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.

15383 lines
419KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @anchor{aformat}
  588. @section aformat
  589. Set output format constraints for the input audio. The framework will
  590. negotiate the most appropriate format to minimize conversions.
  591. It accepts the following parameters:
  592. @table @option
  593. @item sample_fmts
  594. A '|'-separated list of requested sample formats.
  595. @item sample_rates
  596. A '|'-separated list of requested sample rates.
  597. @item channel_layouts
  598. A '|'-separated list of requested channel layouts.
  599. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  600. for the required syntax.
  601. @end table
  602. If a parameter is omitted, all values are allowed.
  603. Force the output to either unsigned 8-bit or signed 16-bit stereo
  604. @example
  605. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  606. @end example
  607. @section agate
  608. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  609. processing reduces disturbing noise between useful signals.
  610. Gating is done by detecting the volume below a chosen level @var{threshold}
  611. and divide it by the factor set with @var{ratio}. The bottom of the noise
  612. floor is set via @var{range}. Because an exact manipulation of the signal
  613. would cause distortion of the waveform the reduction can be levelled over
  614. time. This is done by setting @var{attack} and @var{release}.
  615. @var{attack} determines how long the signal has to fall below the threshold
  616. before any reduction will occur and @var{release} sets the time the signal
  617. has to raise above the threshold to reduce the reduction again.
  618. Shorter signals than the chosen attack time will be left untouched.
  619. @table @option
  620. @item level_in
  621. Set input level before filtering.
  622. Default is 1. Allowed range is from 0.015625 to 64.
  623. @item range
  624. Set the level of gain reduction when the signal is below the threshold.
  625. Default is 0.06125. Allowed range is from 0 to 1.
  626. @item threshold
  627. If a signal rises above this level the gain reduction is released.
  628. Default is 0.125. Allowed range is from 0 to 1.
  629. @item ratio
  630. Set a ratio about which the signal is reduced.
  631. Default is 2. Allowed range is from 1 to 9000.
  632. @item attack
  633. Amount of milliseconds the signal has to rise above the threshold before gain
  634. reduction stops.
  635. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  636. @item release
  637. Amount of milliseconds the signal has to fall below the threshold before the
  638. reduction is increased again. Default is 250 milliseconds.
  639. Allowed range is from 0.01 to 9000.
  640. @item makeup
  641. Set amount of amplification of signal after processing.
  642. Default is 1. Allowed range is from 1 to 64.
  643. @item knee
  644. Curve the sharp knee around the threshold to enter gain reduction more softly.
  645. Default is 2.828427125. Allowed range is from 1 to 8.
  646. @item detection
  647. Choose if exact signal should be taken for detection or an RMS like one.
  648. Default is rms. Can be peak or rms.
  649. @item link
  650. Choose if the average level between all channels or the louder channel affects
  651. the reduction.
  652. Default is average. Can be average or maximum.
  653. @end table
  654. @section alimiter
  655. The limiter prevents input signal from raising over a desired threshold.
  656. This limiter uses lookahead technology to prevent your signal from distorting.
  657. It means that there is a small delay after signal is processed. Keep in mind
  658. that the delay it produces is the attack time you set.
  659. The filter accepts the following options:
  660. @table @option
  661. @item level_in
  662. Set input gain. Default is 1.
  663. @item level_out
  664. Set output gain. Default is 1.
  665. @item limit
  666. Don't let signals above this level pass the limiter. Default is 1.
  667. @item attack
  668. The limiter will reach its attenuation level in this amount of time in
  669. milliseconds. Default is 5 milliseconds.
  670. @item release
  671. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  672. Default is 50 milliseconds.
  673. @item asc
  674. When gain reduction is always needed ASC takes care of releasing to an
  675. average reduction level rather than reaching a reduction of 0 in the release
  676. time.
  677. @item asc_level
  678. Select how much the release time is affected by ASC, 0 means nearly no changes
  679. in release time while 1 produces higher release times.
  680. @item level
  681. Auto level output signal. Default is enabled.
  682. This normalizes audio back to 0dB if enabled.
  683. @end table
  684. Depending on picked setting it is recommended to upsample input 2x or 4x times
  685. with @ref{aresample} before applying this filter.
  686. @section allpass
  687. Apply a two-pole all-pass filter with central frequency (in Hz)
  688. @var{frequency}, and filter-width @var{width}.
  689. An all-pass filter changes the audio's frequency to phase relationship
  690. without changing its frequency to amplitude relationship.
  691. The filter accepts the following options:
  692. @table @option
  693. @item frequency, f
  694. Set frequency in Hz.
  695. @item width_type
  696. Set method to specify band-width of filter.
  697. @table @option
  698. @item h
  699. Hz
  700. @item q
  701. Q-Factor
  702. @item o
  703. octave
  704. @item s
  705. slope
  706. @end table
  707. @item width, w
  708. Specify the band-width of a filter in width_type units.
  709. @end table
  710. @anchor{amerge}
  711. @section amerge
  712. Merge two or more audio streams into a single multi-channel stream.
  713. The filter accepts the following options:
  714. @table @option
  715. @item inputs
  716. Set the number of inputs. Default is 2.
  717. @end table
  718. If the channel layouts of the inputs are disjoint, and therefore compatible,
  719. the channel layout of the output will be set accordingly and the channels
  720. will be reordered as necessary. If the channel layouts of the inputs are not
  721. disjoint, the output will have all the channels of the first input then all
  722. the channels of the second input, in that order, and the channel layout of
  723. the output will be the default value corresponding to the total number of
  724. channels.
  725. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  726. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  727. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  728. first input, b1 is the first channel of the second input).
  729. On the other hand, if both input are in stereo, the output channels will be
  730. in the default order: a1, a2, b1, b2, and the channel layout will be
  731. arbitrarily set to 4.0, which may or may not be the expected value.
  732. All inputs must have the same sample rate, and format.
  733. If inputs do not have the same duration, the output will stop with the
  734. shortest.
  735. @subsection Examples
  736. @itemize
  737. @item
  738. Merge two mono files into a stereo stream:
  739. @example
  740. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  741. @end example
  742. @item
  743. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  744. @example
  745. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  746. @end example
  747. @end itemize
  748. @section amix
  749. Mixes multiple audio inputs into a single output.
  750. Note that this filter only supports float samples (the @var{amerge}
  751. and @var{pan} audio filters support many formats). If the @var{amix}
  752. input has integer samples then @ref{aresample} will be automatically
  753. inserted to perform the conversion to float samples.
  754. For example
  755. @example
  756. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  757. @end example
  758. will mix 3 input audio streams to a single output with the same duration as the
  759. first input and a dropout transition time of 3 seconds.
  760. It accepts the following parameters:
  761. @table @option
  762. @item inputs
  763. The number of inputs. If unspecified, it defaults to 2.
  764. @item duration
  765. How to determine the end-of-stream.
  766. @table @option
  767. @item longest
  768. The duration of the longest input. (default)
  769. @item shortest
  770. The duration of the shortest input.
  771. @item first
  772. The duration of the first input.
  773. @end table
  774. @item dropout_transition
  775. The transition time, in seconds, for volume renormalization when an input
  776. stream ends. The default value is 2 seconds.
  777. @end table
  778. @section anequalizer
  779. High-order parametric multiband equalizer for each channel.
  780. It accepts the following parameters:
  781. @table @option
  782. @item params
  783. This option string is in format:
  784. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  785. Each equalizer band is separated by '|'.
  786. @table @option
  787. @item chn
  788. Set channel number to which equalization will be applied.
  789. If input doesn't have that channel the entry is ignored.
  790. @item cf
  791. Set central frequency for band.
  792. If input doesn't have that frequency the entry is ignored.
  793. @item w
  794. Set band width in hertz.
  795. @item g
  796. Set band gain in dB.
  797. @item f
  798. Set filter type for band, optional, can be:
  799. @table @samp
  800. @item 0
  801. Butterworth, this is default.
  802. @item 1
  803. Chebyshev type 1.
  804. @item 2
  805. Chebyshev type 2.
  806. @end table
  807. @end table
  808. @item curves
  809. With this option activated frequency response of anequalizer is displayed
  810. in video stream.
  811. @item size
  812. Set video stream size. Only useful if curves option is activated.
  813. @item mgain
  814. Set max gain that will be displayed. Only useful if curves option is activated.
  815. Setting this to reasonable value allows to display gain which is derived from
  816. neighbour bands which are too close to each other and thus produce higher gain
  817. when both are activated.
  818. @item fscale
  819. Set frequency scale used to draw frequency response in video output.
  820. Can be linear or logarithmic. Default is logarithmic.
  821. @item colors
  822. Set color for each channel curve which is going to be displayed in video stream.
  823. This is list of color names separated by space or by '|'.
  824. Unrecognised or missing colors will be replaced by white color.
  825. @end table
  826. @subsection Examples
  827. @itemize
  828. @item
  829. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  830. for first 2 channels using Chebyshev type 1 filter:
  831. @example
  832. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  833. @end example
  834. @end itemize
  835. @subsection Commands
  836. This filter supports the following commands:
  837. @table @option
  838. @item change
  839. Alter existing filter parameters.
  840. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  841. @var{fN} is existing filter number, starting from 0, if no such filter is available
  842. error is returned.
  843. @var{freq} set new frequency parameter.
  844. @var{width} set new width parameter in herz.
  845. @var{gain} set new gain parameter in dB.
  846. Full filter invocation with asendcmd may look like this:
  847. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  848. @end table
  849. @section anull
  850. Pass the audio source unchanged to the output.
  851. @section apad
  852. Pad the end of an audio stream with silence.
  853. This can be used together with @command{ffmpeg} @option{-shortest} to
  854. extend audio streams to the same length as the video stream.
  855. A description of the accepted options follows.
  856. @table @option
  857. @item packet_size
  858. Set silence packet size. Default value is 4096.
  859. @item pad_len
  860. Set the number of samples of silence to add to the end. After the
  861. value is reached, the stream is terminated. This option is mutually
  862. exclusive with @option{whole_len}.
  863. @item whole_len
  864. Set the minimum total number of samples in the output audio stream. If
  865. the value is longer than the input audio length, silence is added to
  866. the end, until the value is reached. This option is mutually exclusive
  867. with @option{pad_len}.
  868. @end table
  869. If neither the @option{pad_len} nor the @option{whole_len} option is
  870. set, the filter will add silence to the end of the input stream
  871. indefinitely.
  872. @subsection Examples
  873. @itemize
  874. @item
  875. Add 1024 samples of silence to the end of the input:
  876. @example
  877. apad=pad_len=1024
  878. @end example
  879. @item
  880. Make sure the audio output will contain at least 10000 samples, pad
  881. the input with silence if required:
  882. @example
  883. apad=whole_len=10000
  884. @end example
  885. @item
  886. Use @command{ffmpeg} to pad the audio input with silence, so that the
  887. video stream will always result the shortest and will be converted
  888. until the end in the output file when using the @option{shortest}
  889. option:
  890. @example
  891. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  892. @end example
  893. @end itemize
  894. @section aphaser
  895. Add a phasing effect to the input audio.
  896. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  897. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  898. A description of the accepted parameters follows.
  899. @table @option
  900. @item in_gain
  901. Set input gain. Default is 0.4.
  902. @item out_gain
  903. Set output gain. Default is 0.74
  904. @item delay
  905. Set delay in milliseconds. Default is 3.0.
  906. @item decay
  907. Set decay. Default is 0.4.
  908. @item speed
  909. Set modulation speed in Hz. Default is 0.5.
  910. @item type
  911. Set modulation type. Default is triangular.
  912. It accepts the following values:
  913. @table @samp
  914. @item triangular, t
  915. @item sinusoidal, s
  916. @end table
  917. @end table
  918. @section apulsator
  919. Audio pulsator is something between an autopanner and a tremolo.
  920. But it can produce funny stereo effects as well. Pulsator changes the volume
  921. of the left and right channel based on a LFO (low frequency oscillator) with
  922. different waveforms and shifted phases.
  923. This filter have the ability to define an offset between left and right
  924. channel. An offset of 0 means that both LFO shapes match each other.
  925. The left and right channel are altered equally - a conventional tremolo.
  926. An offset of 50% means that the shape of the right channel is exactly shifted
  927. in phase (or moved backwards about half of the frequency) - pulsator acts as
  928. an autopanner. At 1 both curves match again. Every setting in between moves the
  929. phase shift gapless between all stages and produces some "bypassing" sounds with
  930. sine and triangle waveforms. The more you set the offset near 1 (starting from
  931. the 0.5) the faster the signal passes from the left to the right speaker.
  932. The filter accepts the following options:
  933. @table @option
  934. @item level_in
  935. Set input gain. By default it is 1. Range is [0.015625 - 64].
  936. @item level_out
  937. Set output gain. By default it is 1. Range is [0.015625 - 64].
  938. @item mode
  939. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  940. sawup or sawdown. Default is sine.
  941. @item amount
  942. Set modulation. Define how much of original signal is affected by the LFO.
  943. @item offset_l
  944. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  945. @item offset_r
  946. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  947. @item width
  948. Set pulse width. Default is 1. Allowed range is [0 - 2].
  949. @item timing
  950. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  951. @item bpm
  952. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  953. is set to bpm.
  954. @item ms
  955. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  956. is set to ms.
  957. @item hz
  958. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  959. if timing is set to hz.
  960. @end table
  961. @anchor{aresample}
  962. @section aresample
  963. Resample the input audio to the specified parameters, using the
  964. libswresample library. If none are specified then the filter will
  965. automatically convert between its input and output.
  966. This filter is also able to stretch/squeeze the audio data to make it match
  967. the timestamps or to inject silence / cut out audio to make it match the
  968. timestamps, do a combination of both or do neither.
  969. The filter accepts the syntax
  970. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  971. expresses a sample rate and @var{resampler_options} is a list of
  972. @var{key}=@var{value} pairs, separated by ":". See the
  973. ffmpeg-resampler manual for the complete list of supported options.
  974. @subsection Examples
  975. @itemize
  976. @item
  977. Resample the input audio to 44100Hz:
  978. @example
  979. aresample=44100
  980. @end example
  981. @item
  982. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  983. samples per second compensation:
  984. @example
  985. aresample=async=1000
  986. @end example
  987. @end itemize
  988. @section asetnsamples
  989. Set the number of samples per each output audio frame.
  990. The last output packet may contain a different number of samples, as
  991. the filter will flush all the remaining samples when the input audio
  992. signal its end.
  993. The filter accepts the following options:
  994. @table @option
  995. @item nb_out_samples, n
  996. Set the number of frames per each output audio frame. The number is
  997. intended as the number of samples @emph{per each channel}.
  998. Default value is 1024.
  999. @item pad, p
  1000. If set to 1, the filter will pad the last audio frame with zeroes, so
  1001. that the last frame will contain the same number of samples as the
  1002. previous ones. Default value is 1.
  1003. @end table
  1004. For example, to set the number of per-frame samples to 1234 and
  1005. disable padding for the last frame, use:
  1006. @example
  1007. asetnsamples=n=1234:p=0
  1008. @end example
  1009. @section asetrate
  1010. Set the sample rate without altering the PCM data.
  1011. This will result in a change of speed and pitch.
  1012. The filter accepts the following options:
  1013. @table @option
  1014. @item sample_rate, r
  1015. Set the output sample rate. Default is 44100 Hz.
  1016. @end table
  1017. @section ashowinfo
  1018. Show a line containing various information for each input audio frame.
  1019. The input audio is not modified.
  1020. The shown line contains a sequence of key/value pairs of the form
  1021. @var{key}:@var{value}.
  1022. The following values are shown in the output:
  1023. @table @option
  1024. @item n
  1025. The (sequential) number of the input frame, starting from 0.
  1026. @item pts
  1027. The presentation timestamp of the input frame, in time base units; the time base
  1028. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1029. @item pts_time
  1030. The presentation timestamp of the input frame in seconds.
  1031. @item pos
  1032. position of the frame in the input stream, -1 if this information in
  1033. unavailable and/or meaningless (for example in case of synthetic audio)
  1034. @item fmt
  1035. The sample format.
  1036. @item chlayout
  1037. The channel layout.
  1038. @item rate
  1039. The sample rate for the audio frame.
  1040. @item nb_samples
  1041. The number of samples (per channel) in the frame.
  1042. @item checksum
  1043. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1044. audio, the data is treated as if all the planes were concatenated.
  1045. @item plane_checksums
  1046. A list of Adler-32 checksums for each data plane.
  1047. @end table
  1048. @anchor{astats}
  1049. @section astats
  1050. Display time domain statistical information about the audio channels.
  1051. Statistics are calculated and displayed for each audio channel and,
  1052. where applicable, an overall figure is also given.
  1053. It accepts the following option:
  1054. @table @option
  1055. @item length
  1056. Short window length in seconds, used for peak and trough RMS measurement.
  1057. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1058. @item metadata
  1059. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1060. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1061. disabled.
  1062. Available keys for each channel are:
  1063. DC_offset
  1064. Min_level
  1065. Max_level
  1066. Min_difference
  1067. Max_difference
  1068. Mean_difference
  1069. Peak_level
  1070. RMS_peak
  1071. RMS_trough
  1072. Crest_factor
  1073. Flat_factor
  1074. Peak_count
  1075. Bit_depth
  1076. and for Overall:
  1077. DC_offset
  1078. Min_level
  1079. Max_level
  1080. Min_difference
  1081. Max_difference
  1082. Mean_difference
  1083. Peak_level
  1084. RMS_level
  1085. RMS_peak
  1086. RMS_trough
  1087. Flat_factor
  1088. Peak_count
  1089. Bit_depth
  1090. Number_of_samples
  1091. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1092. this @code{lavfi.astats.Overall.Peak_count}.
  1093. For description what each key means read below.
  1094. @item reset
  1095. Set number of frame after which stats are going to be recalculated.
  1096. Default is disabled.
  1097. @end table
  1098. A description of each shown parameter follows:
  1099. @table @option
  1100. @item DC offset
  1101. Mean amplitude displacement from zero.
  1102. @item Min level
  1103. Minimal sample level.
  1104. @item Max level
  1105. Maximal sample level.
  1106. @item Min difference
  1107. Minimal difference between two consecutive samples.
  1108. @item Max difference
  1109. Maximal difference between two consecutive samples.
  1110. @item Mean difference
  1111. Mean difference between two consecutive samples.
  1112. The average of each difference between two consecutive samples.
  1113. @item Peak level dB
  1114. @item RMS level dB
  1115. Standard peak and RMS level measured in dBFS.
  1116. @item RMS peak dB
  1117. @item RMS trough dB
  1118. Peak and trough values for RMS level measured over a short window.
  1119. @item Crest factor
  1120. Standard ratio of peak to RMS level (note: not in dB).
  1121. @item Flat factor
  1122. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1123. (i.e. either @var{Min level} or @var{Max level}).
  1124. @item Peak count
  1125. Number of occasions (not the number of samples) that the signal attained either
  1126. @var{Min level} or @var{Max level}.
  1127. @item Bit depth
  1128. Overall bit depth of audio. Number of bits used for each sample.
  1129. @end table
  1130. @section asyncts
  1131. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1132. dropping samples/adding silence when needed.
  1133. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1134. It accepts the following parameters:
  1135. @table @option
  1136. @item compensate
  1137. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1138. by default. When disabled, time gaps are covered with silence.
  1139. @item min_delta
  1140. The minimum difference between timestamps and audio data (in seconds) to trigger
  1141. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1142. sync with this filter, try setting this parameter to 0.
  1143. @item max_comp
  1144. The maximum compensation in samples per second. Only relevant with compensate=1.
  1145. The default value is 500.
  1146. @item first_pts
  1147. Assume that the first PTS should be this value. The time base is 1 / sample
  1148. rate. This allows for padding/trimming at the start of the stream. By default,
  1149. no assumption is made about the first frame's expected PTS, so no padding or
  1150. trimming is done. For example, this could be set to 0 to pad the beginning with
  1151. silence if an audio stream starts after the video stream or to trim any samples
  1152. with a negative PTS due to encoder delay.
  1153. @end table
  1154. @section atempo
  1155. Adjust audio tempo.
  1156. The filter accepts exactly one parameter, the audio tempo. If not
  1157. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1158. be in the [0.5, 2.0] range.
  1159. @subsection Examples
  1160. @itemize
  1161. @item
  1162. Slow down audio to 80% tempo:
  1163. @example
  1164. atempo=0.8
  1165. @end example
  1166. @item
  1167. To speed up audio to 125% tempo:
  1168. @example
  1169. atempo=1.25
  1170. @end example
  1171. @end itemize
  1172. @section atrim
  1173. Trim the input so that the output contains one continuous subpart of the input.
  1174. It accepts the following parameters:
  1175. @table @option
  1176. @item start
  1177. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1178. sample with the timestamp @var{start} will be the first sample in the output.
  1179. @item end
  1180. Specify time of the first audio sample that will be dropped, i.e. the
  1181. audio sample immediately preceding the one with the timestamp @var{end} will be
  1182. the last sample in the output.
  1183. @item start_pts
  1184. Same as @var{start}, except this option sets the start timestamp in samples
  1185. instead of seconds.
  1186. @item end_pts
  1187. Same as @var{end}, except this option sets the end timestamp in samples instead
  1188. of seconds.
  1189. @item duration
  1190. The maximum duration of the output in seconds.
  1191. @item start_sample
  1192. The number of the first sample that should be output.
  1193. @item end_sample
  1194. The number of the first sample that should be dropped.
  1195. @end table
  1196. @option{start}, @option{end}, and @option{duration} are expressed as time
  1197. duration specifications; see
  1198. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1199. Note that the first two sets of the start/end options and the @option{duration}
  1200. option look at the frame timestamp, while the _sample options simply count the
  1201. samples that pass through the filter. So start/end_pts and start/end_sample will
  1202. give different results when the timestamps are wrong, inexact or do not start at
  1203. zero. Also note that this filter does not modify the timestamps. If you wish
  1204. to have the output timestamps start at zero, insert the asetpts filter after the
  1205. atrim filter.
  1206. If multiple start or end options are set, this filter tries to be greedy and
  1207. keep all samples that match at least one of the specified constraints. To keep
  1208. only the part that matches all the constraints at once, chain multiple atrim
  1209. filters.
  1210. The defaults are such that all the input is kept. So it is possible to set e.g.
  1211. just the end values to keep everything before the specified time.
  1212. Examples:
  1213. @itemize
  1214. @item
  1215. Drop everything except the second minute of input:
  1216. @example
  1217. ffmpeg -i INPUT -af atrim=60:120
  1218. @end example
  1219. @item
  1220. Keep only the first 1000 samples:
  1221. @example
  1222. ffmpeg -i INPUT -af atrim=end_sample=1000
  1223. @end example
  1224. @end itemize
  1225. @section bandpass
  1226. Apply a two-pole Butterworth band-pass filter with central
  1227. frequency @var{frequency}, and (3dB-point) band-width width.
  1228. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1229. instead of the default: constant 0dB peak gain.
  1230. The filter roll off at 6dB per octave (20dB per decade).
  1231. The filter accepts the following options:
  1232. @table @option
  1233. @item frequency, f
  1234. Set the filter's central frequency. Default is @code{3000}.
  1235. @item csg
  1236. Constant skirt gain if set to 1. Defaults to 0.
  1237. @item width_type
  1238. Set method to specify band-width of filter.
  1239. @table @option
  1240. @item h
  1241. Hz
  1242. @item q
  1243. Q-Factor
  1244. @item o
  1245. octave
  1246. @item s
  1247. slope
  1248. @end table
  1249. @item width, w
  1250. Specify the band-width of a filter in width_type units.
  1251. @end table
  1252. @section bandreject
  1253. Apply a two-pole Butterworth band-reject filter with central
  1254. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1255. The filter roll off at 6dB per octave (20dB per decade).
  1256. The filter accepts the following options:
  1257. @table @option
  1258. @item frequency, f
  1259. Set the filter's central frequency. Default is @code{3000}.
  1260. @item width_type
  1261. Set method to specify band-width of filter.
  1262. @table @option
  1263. @item h
  1264. Hz
  1265. @item q
  1266. Q-Factor
  1267. @item o
  1268. octave
  1269. @item s
  1270. slope
  1271. @end table
  1272. @item width, w
  1273. Specify the band-width of a filter in width_type units.
  1274. @end table
  1275. @section bass
  1276. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1277. shelving filter with a response similar to that of a standard
  1278. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1279. The filter accepts the following options:
  1280. @table @option
  1281. @item gain, g
  1282. Give the gain at 0 Hz. Its useful range is about -20
  1283. (for a large cut) to +20 (for a large boost).
  1284. Beware of clipping when using a positive gain.
  1285. @item frequency, f
  1286. Set the filter's central frequency and so can be used
  1287. to extend or reduce the frequency range to be boosted or cut.
  1288. The default value is @code{100} Hz.
  1289. @item width_type
  1290. Set method to specify band-width of filter.
  1291. @table @option
  1292. @item h
  1293. Hz
  1294. @item q
  1295. Q-Factor
  1296. @item o
  1297. octave
  1298. @item s
  1299. slope
  1300. @end table
  1301. @item width, w
  1302. Determine how steep is the filter's shelf transition.
  1303. @end table
  1304. @section biquad
  1305. Apply a biquad IIR filter with the given coefficients.
  1306. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1307. are the numerator and denominator coefficients respectively.
  1308. @section bs2b
  1309. Bauer stereo to binaural transformation, which improves headphone listening of
  1310. stereo audio records.
  1311. It accepts the following parameters:
  1312. @table @option
  1313. @item profile
  1314. Pre-defined crossfeed level.
  1315. @table @option
  1316. @item default
  1317. Default level (fcut=700, feed=50).
  1318. @item cmoy
  1319. Chu Moy circuit (fcut=700, feed=60).
  1320. @item jmeier
  1321. Jan Meier circuit (fcut=650, feed=95).
  1322. @end table
  1323. @item fcut
  1324. Cut frequency (in Hz).
  1325. @item feed
  1326. Feed level (in Hz).
  1327. @end table
  1328. @section channelmap
  1329. Remap input channels to new locations.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item channel_layout
  1333. The channel layout of the output stream.
  1334. @item map
  1335. Map channels from input to output. The argument is a '|'-separated list of
  1336. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1337. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1338. channel (e.g. FL for front left) or its index in the input channel layout.
  1339. @var{out_channel} is the name of the output channel or its index in the output
  1340. channel layout. If @var{out_channel} is not given then it is implicitly an
  1341. index, starting with zero and increasing by one for each mapping.
  1342. @end table
  1343. If no mapping is present, the filter will implicitly map input channels to
  1344. output channels, preserving indices.
  1345. For example, assuming a 5.1+downmix input MOV file,
  1346. @example
  1347. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1348. @end example
  1349. will create an output WAV file tagged as stereo from the downmix channels of
  1350. the input.
  1351. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1352. @example
  1353. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1354. @end example
  1355. @section channelsplit
  1356. Split each channel from an input audio stream into a separate output stream.
  1357. It accepts the following parameters:
  1358. @table @option
  1359. @item channel_layout
  1360. The channel layout of the input stream. The default is "stereo".
  1361. @end table
  1362. For example, assuming a stereo input MP3 file,
  1363. @example
  1364. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1365. @end example
  1366. will create an output Matroska file with two audio streams, one containing only
  1367. the left channel and the other the right channel.
  1368. Split a 5.1 WAV file into per-channel files:
  1369. @example
  1370. ffmpeg -i in.wav -filter_complex
  1371. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1372. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1373. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1374. side_right.wav
  1375. @end example
  1376. @section chorus
  1377. Add a chorus effect to the audio.
  1378. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1379. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1380. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1381. The modulation depth defines the range the modulated delay is played before or after
  1382. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1383. sound tuned around the original one, like in a chorus where some vocals are slightly
  1384. off key.
  1385. It accepts the following parameters:
  1386. @table @option
  1387. @item in_gain
  1388. Set input gain. Default is 0.4.
  1389. @item out_gain
  1390. Set output gain. Default is 0.4.
  1391. @item delays
  1392. Set delays. A typical delay is around 40ms to 60ms.
  1393. @item decays
  1394. Set decays.
  1395. @item speeds
  1396. Set speeds.
  1397. @item depths
  1398. Set depths.
  1399. @end table
  1400. @subsection Examples
  1401. @itemize
  1402. @item
  1403. A single delay:
  1404. @example
  1405. chorus=0.7:0.9:55:0.4:0.25:2
  1406. @end example
  1407. @item
  1408. Two delays:
  1409. @example
  1410. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1411. @end example
  1412. @item
  1413. Fuller sounding chorus with three delays:
  1414. @example
  1415. 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
  1416. @end example
  1417. @end itemize
  1418. @section compand
  1419. Compress or expand the audio's dynamic range.
  1420. It accepts the following parameters:
  1421. @table @option
  1422. @item attacks
  1423. @item decays
  1424. A list of times in seconds for each channel over which the instantaneous level
  1425. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1426. increase of volume and @var{decays} refers to decrease of volume. For most
  1427. situations, the attack time (response to the audio getting louder) should be
  1428. shorter than the decay time, because the human ear is more sensitive to sudden
  1429. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1430. a typical value for decay is 0.8 seconds.
  1431. If specified number of attacks & decays is lower than number of channels, the last
  1432. set attack/decay will be used for all remaining channels.
  1433. @item points
  1434. A list of points for the transfer function, specified in dB relative to the
  1435. maximum possible signal amplitude. Each key points list must be defined using
  1436. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1437. @code{x0/y0 x1/y1 x2/y2 ....}
  1438. The input values must be in strictly increasing order but the transfer function
  1439. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1440. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1441. function are @code{-70/-70|-60/-20}.
  1442. @item soft-knee
  1443. Set the curve radius in dB for all joints. It defaults to 0.01.
  1444. @item gain
  1445. Set the additional gain in dB to be applied at all points on the transfer
  1446. function. This allows for easy adjustment of the overall gain.
  1447. It defaults to 0.
  1448. @item volume
  1449. Set an initial volume, in dB, to be assumed for each channel when filtering
  1450. starts. This permits the user to supply a nominal level initially, so that, for
  1451. example, a very large gain is not applied to initial signal levels before the
  1452. companding has begun to operate. A typical value for audio which is initially
  1453. quiet is -90 dB. It defaults to 0.
  1454. @item delay
  1455. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1456. delayed before being fed to the volume adjuster. Specifying a delay
  1457. approximately equal to the attack/decay times allows the filter to effectively
  1458. operate in predictive rather than reactive mode. It defaults to 0.
  1459. @end table
  1460. @subsection Examples
  1461. @itemize
  1462. @item
  1463. Make music with both quiet and loud passages suitable for listening to in a
  1464. noisy environment:
  1465. @example
  1466. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1467. @end example
  1468. Another example for audio with whisper and explosion parts:
  1469. @example
  1470. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1471. @end example
  1472. @item
  1473. A noise gate for when the noise is at a lower level than the signal:
  1474. @example
  1475. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1476. @end example
  1477. @item
  1478. Here is another noise gate, this time for when the noise is at a higher level
  1479. than the signal (making it, in some ways, similar to squelch):
  1480. @example
  1481. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1482. @end example
  1483. @item
  1484. 2:1 compression starting at -6dB:
  1485. @example
  1486. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1487. @end example
  1488. @item
  1489. 2:1 compression starting at -9dB:
  1490. @example
  1491. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1492. @end example
  1493. @item
  1494. 2:1 compression starting at -12dB:
  1495. @example
  1496. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1497. @end example
  1498. @item
  1499. 2:1 compression starting at -18dB:
  1500. @example
  1501. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1502. @end example
  1503. @item
  1504. 3:1 compression starting at -15dB:
  1505. @example
  1506. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1507. @end example
  1508. @item
  1509. Compressor/Gate:
  1510. @example
  1511. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1512. @end example
  1513. @item
  1514. Expander:
  1515. @example
  1516. 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
  1517. @end example
  1518. @item
  1519. Hard limiter at -6dB:
  1520. @example
  1521. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1522. @end example
  1523. @item
  1524. Hard limiter at -12dB:
  1525. @example
  1526. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1527. @end example
  1528. @item
  1529. Hard noise gate at -35 dB:
  1530. @example
  1531. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1532. @end example
  1533. @item
  1534. Soft limiter:
  1535. @example
  1536. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1537. @end example
  1538. @end itemize
  1539. @section compensationdelay
  1540. Compensation Delay Line is a metric based delay to compensate differing
  1541. positions of microphones or speakers.
  1542. For example, you have recorded guitar with two microphones placed in
  1543. different location. Because the front of sound wave has fixed speed in
  1544. normal conditions, the phasing of microphones can vary and depends on
  1545. their location and interposition. The best sound mix can be achieved when
  1546. these microphones are in phase (synchronized). Note that distance of
  1547. ~30 cm between microphones makes one microphone to capture signal in
  1548. antiphase to another microphone. That makes the final mix sounding moody.
  1549. This filter helps to solve phasing problems by adding different delays
  1550. to each microphone track and make them synchronized.
  1551. The best result can be reached when you take one track as base and
  1552. synchronize other tracks one by one with it.
  1553. Remember that synchronization/delay tolerance depends on sample rate, too.
  1554. Higher sample rates will give more tolerance.
  1555. It accepts the following parameters:
  1556. @table @option
  1557. @item mm
  1558. Set millimeters distance. This is compensation distance for fine tuning.
  1559. Default is 0.
  1560. @item cm
  1561. Set cm distance. This is compensation distance for tightening distance setup.
  1562. Default is 0.
  1563. @item m
  1564. Set meters distance. This is compensation distance for hard distance setup.
  1565. Default is 0.
  1566. @item dry
  1567. Set dry amount. Amount of unprocessed (dry) signal.
  1568. Default is 0.
  1569. @item wet
  1570. Set wet amount. Amount of processed (wet) signal.
  1571. Default is 1.
  1572. @item temp
  1573. Set temperature degree in Celsius. This is the temperature of the environment.
  1574. Default is 20.
  1575. @end table
  1576. @section dcshift
  1577. Apply a DC shift to the audio.
  1578. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1579. in the recording chain) from the audio. The effect of a DC offset is reduced
  1580. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1581. a signal has a DC offset.
  1582. @table @option
  1583. @item shift
  1584. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1585. the audio.
  1586. @item limitergain
  1587. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1588. used to prevent clipping.
  1589. @end table
  1590. @section dynaudnorm
  1591. Dynamic Audio Normalizer.
  1592. This filter applies a certain amount of gain to the input audio in order
  1593. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1594. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1595. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1596. This allows for applying extra gain to the "quiet" sections of the audio
  1597. while avoiding distortions or clipping the "loud" sections. In other words:
  1598. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1599. sections, in the sense that the volume of each section is brought to the
  1600. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1601. this goal *without* applying "dynamic range compressing". It will retain 100%
  1602. of the dynamic range *within* each section of the audio file.
  1603. @table @option
  1604. @item f
  1605. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1606. Default is 500 milliseconds.
  1607. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1608. referred to as frames. This is required, because a peak magnitude has no
  1609. meaning for just a single sample value. Instead, we need to determine the
  1610. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1611. normalizer would simply use the peak magnitude of the complete file, the
  1612. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1613. frame. The length of a frame is specified in milliseconds. By default, the
  1614. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1615. been found to give good results with most files.
  1616. Note that the exact frame length, in number of samples, will be determined
  1617. automatically, based on the sampling rate of the individual input audio file.
  1618. @item g
  1619. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1620. number. Default is 31.
  1621. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1622. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1623. is specified in frames, centered around the current frame. For the sake of
  1624. simplicity, this must be an odd number. Consequently, the default value of 31
  1625. takes into account the current frame, as well as the 15 preceding frames and
  1626. the 15 subsequent frames. Using a larger window results in a stronger
  1627. smoothing effect and thus in less gain variation, i.e. slower gain
  1628. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1629. effect and thus in more gain variation, i.e. faster gain adaptation.
  1630. In other words, the more you increase this value, the more the Dynamic Audio
  1631. Normalizer will behave like a "traditional" normalization filter. On the
  1632. contrary, the more you decrease this value, the more the Dynamic Audio
  1633. Normalizer will behave like a dynamic range compressor.
  1634. @item p
  1635. Set the target peak value. This specifies the highest permissible magnitude
  1636. level for the normalized audio input. This filter will try to approach the
  1637. target peak magnitude as closely as possible, but at the same time it also
  1638. makes sure that the normalized signal will never exceed the peak magnitude.
  1639. A frame's maximum local gain factor is imposed directly by the target peak
  1640. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1641. It is not recommended to go above this value.
  1642. @item m
  1643. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1644. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1645. factor for each input frame, i.e. the maximum gain factor that does not
  1646. result in clipping or distortion. The maximum gain factor is determined by
  1647. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1648. additionally bounds the frame's maximum gain factor by a predetermined
  1649. (global) maximum gain factor. This is done in order to avoid excessive gain
  1650. factors in "silent" or almost silent frames. By default, the maximum gain
  1651. factor is 10.0, For most inputs the default value should be sufficient and
  1652. it usually is not recommended to increase this value. Though, for input
  1653. with an extremely low overall volume level, it may be necessary to allow even
  1654. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1655. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1656. Instead, a "sigmoid" threshold function will be applied. This way, the
  1657. gain factors will smoothly approach the threshold value, but never exceed that
  1658. value.
  1659. @item r
  1660. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1661. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1662. This means that the maximum local gain factor for each frame is defined
  1663. (only) by the frame's highest magnitude sample. This way, the samples can
  1664. be amplified as much as possible without exceeding the maximum signal
  1665. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1666. Normalizer can also take into account the frame's root mean square,
  1667. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1668. determine the power of a time-varying signal. It is therefore considered
  1669. that the RMS is a better approximation of the "perceived loudness" than
  1670. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1671. frames to a constant RMS value, a uniform "perceived loudness" can be
  1672. established. If a target RMS value has been specified, a frame's local gain
  1673. factor is defined as the factor that would result in exactly that RMS value.
  1674. Note, however, that the maximum local gain factor is still restricted by the
  1675. frame's highest magnitude sample, in order to prevent clipping.
  1676. @item n
  1677. Enable channels coupling. By default is enabled.
  1678. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1679. amount. This means the same gain factor will be applied to all channels, i.e.
  1680. the maximum possible gain factor is determined by the "loudest" channel.
  1681. However, in some recordings, it may happen that the volume of the different
  1682. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1683. In this case, this option can be used to disable the channel coupling. This way,
  1684. the gain factor will be determined independently for each channel, depending
  1685. only on the individual channel's highest magnitude sample. This allows for
  1686. harmonizing the volume of the different channels.
  1687. @item c
  1688. Enable DC bias correction. By default is disabled.
  1689. An audio signal (in the time domain) is a sequence of sample values.
  1690. In the Dynamic Audio Normalizer these sample values are represented in the
  1691. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1692. audio signal, or "waveform", should be centered around the zero point.
  1693. That means if we calculate the mean value of all samples in a file, or in a
  1694. single frame, then the result should be 0.0 or at least very close to that
  1695. value. If, however, there is a significant deviation of the mean value from
  1696. 0.0, in either positive or negative direction, this is referred to as a
  1697. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1698. Audio Normalizer provides optional DC bias correction.
  1699. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1700. the mean value, or "DC correction" offset, of each input frame and subtract
  1701. that value from all of the frame's sample values which ensures those samples
  1702. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1703. boundaries, the DC correction offset values will be interpolated smoothly
  1704. between neighbouring frames.
  1705. @item b
  1706. Enable alternative boundary mode. By default is disabled.
  1707. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1708. around each frame. This includes the preceding frames as well as the
  1709. subsequent frames. However, for the "boundary" frames, located at the very
  1710. beginning and at the very end of the audio file, not all neighbouring
  1711. frames are available. In particular, for the first few frames in the audio
  1712. file, the preceding frames are not known. And, similarly, for the last few
  1713. frames in the audio file, the subsequent frames are not known. Thus, the
  1714. question arises which gain factors should be assumed for the missing frames
  1715. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1716. to deal with this situation. The default boundary mode assumes a gain factor
  1717. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1718. "fade out" at the beginning and at the end of the input, respectively.
  1719. @item s
  1720. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1721. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1722. compression. This means that signal peaks will not be pruned and thus the
  1723. full dynamic range will be retained within each local neighbourhood. However,
  1724. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1725. normalization algorithm with a more "traditional" compression.
  1726. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1727. (thresholding) function. If (and only if) the compression feature is enabled,
  1728. all input frames will be processed by a soft knee thresholding function prior
  1729. to the actual normalization process. Put simply, the thresholding function is
  1730. going to prune all samples whose magnitude exceeds a certain threshold value.
  1731. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1732. value. Instead, the threshold value will be adjusted for each individual
  1733. frame.
  1734. In general, smaller parameters result in stronger compression, and vice versa.
  1735. Values below 3.0 are not recommended, because audible distortion may appear.
  1736. @end table
  1737. @section earwax
  1738. Make audio easier to listen to on headphones.
  1739. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1740. so that when listened to on headphones the stereo image is moved from
  1741. inside your head (standard for headphones) to outside and in front of
  1742. the listener (standard for speakers).
  1743. Ported from SoX.
  1744. @section equalizer
  1745. Apply a two-pole peaking equalisation (EQ) filter. With this
  1746. filter, the signal-level at and around a selected frequency can
  1747. be increased or decreased, whilst (unlike bandpass and bandreject
  1748. filters) that at all other frequencies is unchanged.
  1749. In order to produce complex equalisation curves, this filter can
  1750. be given several times, each with a different central frequency.
  1751. The filter accepts the following options:
  1752. @table @option
  1753. @item frequency, f
  1754. Set the filter's central frequency in Hz.
  1755. @item width_type
  1756. Set method to specify band-width of filter.
  1757. @table @option
  1758. @item h
  1759. Hz
  1760. @item q
  1761. Q-Factor
  1762. @item o
  1763. octave
  1764. @item s
  1765. slope
  1766. @end table
  1767. @item width, w
  1768. Specify the band-width of a filter in width_type units.
  1769. @item gain, g
  1770. Set the required gain or attenuation in dB.
  1771. Beware of clipping when using a positive gain.
  1772. @end table
  1773. @subsection Examples
  1774. @itemize
  1775. @item
  1776. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1777. @example
  1778. equalizer=f=1000:width_type=h:width=200:g=-10
  1779. @end example
  1780. @item
  1781. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1782. @example
  1783. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1784. @end example
  1785. @end itemize
  1786. @section extrastereo
  1787. Linearly increases the difference between left and right channels which
  1788. adds some sort of "live" effect to playback.
  1789. The filter accepts the following option:
  1790. @table @option
  1791. @item m
  1792. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1793. (average of both channels), with 1.0 sound will be unchanged, with
  1794. -1.0 left and right channels will be swapped.
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section flanger
  1799. Apply a flanging effect to the audio.
  1800. The filter accepts the following options:
  1801. @table @option
  1802. @item delay
  1803. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1804. @item depth
  1805. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1806. @item regen
  1807. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1808. Default value is 0.
  1809. @item width
  1810. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1811. Default value is 71.
  1812. @item speed
  1813. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1814. @item shape
  1815. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1816. Default value is @var{sinusoidal}.
  1817. @item phase
  1818. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1819. Default value is 25.
  1820. @item interp
  1821. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1822. Default is @var{linear}.
  1823. @end table
  1824. @section highpass
  1825. Apply a high-pass filter with 3dB point frequency.
  1826. The filter can be either single-pole, or double-pole (the default).
  1827. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1828. The filter accepts the following options:
  1829. @table @option
  1830. @item frequency, f
  1831. Set frequency in Hz. Default is 3000.
  1832. @item poles, p
  1833. Set number of poles. Default is 2.
  1834. @item width_type
  1835. Set method to specify band-width of filter.
  1836. @table @option
  1837. @item h
  1838. Hz
  1839. @item q
  1840. Q-Factor
  1841. @item o
  1842. octave
  1843. @item s
  1844. slope
  1845. @end table
  1846. @item width, w
  1847. Specify the band-width of a filter in width_type units.
  1848. Applies only to double-pole filter.
  1849. The default is 0.707q and gives a Butterworth response.
  1850. @end table
  1851. @section join
  1852. Join multiple input streams into one multi-channel stream.
  1853. It accepts the following parameters:
  1854. @table @option
  1855. @item inputs
  1856. The number of input streams. It defaults to 2.
  1857. @item channel_layout
  1858. The desired output channel layout. It defaults to stereo.
  1859. @item map
  1860. Map channels from inputs to output. The argument is a '|'-separated list of
  1861. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1862. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1863. can be either the name of the input channel (e.g. FL for front left) or its
  1864. index in the specified input stream. @var{out_channel} is the name of the output
  1865. channel.
  1866. @end table
  1867. The filter will attempt to guess the mappings when they are not specified
  1868. explicitly. It does so by first trying to find an unused matching input channel
  1869. and if that fails it picks the first unused input channel.
  1870. Join 3 inputs (with properly set channel layouts):
  1871. @example
  1872. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1873. @end example
  1874. Build a 5.1 output from 6 single-channel streams:
  1875. @example
  1876. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1877. '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'
  1878. out
  1879. @end example
  1880. @section ladspa
  1881. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1882. To enable compilation of this filter you need to configure FFmpeg with
  1883. @code{--enable-ladspa}.
  1884. @table @option
  1885. @item file, f
  1886. Specifies the name of LADSPA plugin library to load. If the environment
  1887. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1888. each one of the directories specified by the colon separated list in
  1889. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1890. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1891. @file{/usr/lib/ladspa/}.
  1892. @item plugin, p
  1893. Specifies the plugin within the library. Some libraries contain only
  1894. one plugin, but others contain many of them. If this is not set filter
  1895. will list all available plugins within the specified library.
  1896. @item controls, c
  1897. Set the '|' separated list of controls which are zero or more floating point
  1898. values that determine the behavior of the loaded plugin (for example delay,
  1899. threshold or gain).
  1900. Controls need to be defined using the following syntax:
  1901. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1902. @var{valuei} is the value set on the @var{i}-th control.
  1903. Alternatively they can be also defined using the following syntax:
  1904. @var{value0}|@var{value1}|@var{value2}|..., where
  1905. @var{valuei} is the value set on the @var{i}-th control.
  1906. If @option{controls} is set to @code{help}, all available controls and
  1907. their valid ranges are printed.
  1908. @item sample_rate, s
  1909. Specify the sample rate, default to 44100. Only used if plugin have
  1910. zero inputs.
  1911. @item nb_samples, n
  1912. Set the number of samples per channel per each output frame, default
  1913. is 1024. Only used if plugin have zero inputs.
  1914. @item duration, d
  1915. Set the minimum duration of the sourced audio. See
  1916. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1917. for the accepted syntax.
  1918. Note that the resulting duration may be greater than the specified duration,
  1919. as the generated audio is always cut at the end of a complete frame.
  1920. If not specified, or the expressed duration is negative, the audio is
  1921. supposed to be generated forever.
  1922. Only used if plugin have zero inputs.
  1923. @end table
  1924. @subsection Examples
  1925. @itemize
  1926. @item
  1927. List all available plugins within amp (LADSPA example plugin) library:
  1928. @example
  1929. ladspa=file=amp
  1930. @end example
  1931. @item
  1932. List all available controls and their valid ranges for @code{vcf_notch}
  1933. plugin from @code{VCF} library:
  1934. @example
  1935. ladspa=f=vcf:p=vcf_notch:c=help
  1936. @end example
  1937. @item
  1938. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1939. plugin library:
  1940. @example
  1941. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1942. @end example
  1943. @item
  1944. Add reverberation to the audio using TAP-plugins
  1945. (Tom's Audio Processing plugins):
  1946. @example
  1947. ladspa=file=tap_reverb:tap_reverb
  1948. @end example
  1949. @item
  1950. Generate white noise, with 0.2 amplitude:
  1951. @example
  1952. ladspa=file=cmt:noise_source_white:c=c0=.2
  1953. @end example
  1954. @item
  1955. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1956. @code{C* Audio Plugin Suite} (CAPS) library:
  1957. @example
  1958. ladspa=file=caps:Click:c=c1=20'
  1959. @end example
  1960. @item
  1961. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1962. @example
  1963. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1964. @end example
  1965. @item
  1966. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1967. @code{SWH Plugins} collection:
  1968. @example
  1969. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1970. @end example
  1971. @item
  1972. Attenuate low frequencies using Multiband EQ from Steve Harris
  1973. @code{SWH Plugins} collection:
  1974. @example
  1975. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1976. @end example
  1977. @end itemize
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item cN
  1982. Modify the @var{N}-th control value.
  1983. If the specified value is not valid, it is ignored and prior one is kept.
  1984. @end table
  1985. @section lowpass
  1986. Apply a low-pass filter with 3dB point frequency.
  1987. The filter can be either single-pole or double-pole (the default).
  1988. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1989. The filter accepts the following options:
  1990. @table @option
  1991. @item frequency, f
  1992. Set frequency in Hz. Default is 500.
  1993. @item poles, p
  1994. Set number of poles. Default is 2.
  1995. @item width_type
  1996. Set method to specify band-width of filter.
  1997. @table @option
  1998. @item h
  1999. Hz
  2000. @item q
  2001. Q-Factor
  2002. @item o
  2003. octave
  2004. @item s
  2005. slope
  2006. @end table
  2007. @item width, w
  2008. Specify the band-width of a filter in width_type units.
  2009. Applies only to double-pole filter.
  2010. The default is 0.707q and gives a Butterworth response.
  2011. @end table
  2012. @anchor{pan}
  2013. @section pan
  2014. Mix channels with specific gain levels. The filter accepts the output
  2015. channel layout followed by a set of channels definitions.
  2016. This filter is also designed to efficiently remap the channels of an audio
  2017. stream.
  2018. The filter accepts parameters of the form:
  2019. "@var{l}|@var{outdef}|@var{outdef}|..."
  2020. @table @option
  2021. @item l
  2022. output channel layout or number of channels
  2023. @item outdef
  2024. output channel specification, of the form:
  2025. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2026. @item out_name
  2027. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2028. number (c0, c1, etc.)
  2029. @item gain
  2030. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2031. @item in_name
  2032. input channel to use, see out_name for details; it is not possible to mix
  2033. named and numbered input channels
  2034. @end table
  2035. If the `=' in a channel specification is replaced by `<', then the gains for
  2036. that specification will be renormalized so that the total is 1, thus
  2037. avoiding clipping noise.
  2038. @subsection Mixing examples
  2039. For example, if you want to down-mix from stereo to mono, but with a bigger
  2040. factor for the left channel:
  2041. @example
  2042. pan=1c|c0=0.9*c0+0.1*c1
  2043. @end example
  2044. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2045. 7-channels surround:
  2046. @example
  2047. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2048. @end example
  2049. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2050. that should be preferred (see "-ac" option) unless you have very specific
  2051. needs.
  2052. @subsection Remapping examples
  2053. The channel remapping will be effective if, and only if:
  2054. @itemize
  2055. @item gain coefficients are zeroes or ones,
  2056. @item only one input per channel output,
  2057. @end itemize
  2058. If all these conditions are satisfied, the filter will notify the user ("Pure
  2059. channel mapping detected"), and use an optimized and lossless method to do the
  2060. remapping.
  2061. For example, if you have a 5.1 source and want a stereo audio stream by
  2062. dropping the extra channels:
  2063. @example
  2064. pan="stereo| c0=FL | c1=FR"
  2065. @end example
  2066. Given the same source, you can also switch front left and front right channels
  2067. and keep the input channel layout:
  2068. @example
  2069. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2070. @end example
  2071. If the input is a stereo audio stream, you can mute the front left channel (and
  2072. still keep the stereo channel layout) with:
  2073. @example
  2074. pan="stereo|c1=c1"
  2075. @end example
  2076. Still with a stereo audio stream input, you can copy the right channel in both
  2077. front left and right:
  2078. @example
  2079. pan="stereo| c0=FR | c1=FR"
  2080. @end example
  2081. @section replaygain
  2082. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2083. outputs it unchanged.
  2084. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2085. @section resample
  2086. Convert the audio sample format, sample rate and channel layout. It is
  2087. not meant to be used directly.
  2088. @section rubberband
  2089. Apply time-stretching and pitch-shifting with librubberband.
  2090. The filter accepts the following options:
  2091. @table @option
  2092. @item tempo
  2093. Set tempo scale factor.
  2094. @item pitch
  2095. Set pitch scale factor.
  2096. @item transients
  2097. Set transients detector.
  2098. Possible values are:
  2099. @table @var
  2100. @item crisp
  2101. @item mixed
  2102. @item smooth
  2103. @end table
  2104. @item detector
  2105. Set detector.
  2106. Possible values are:
  2107. @table @var
  2108. @item compound
  2109. @item percussive
  2110. @item soft
  2111. @end table
  2112. @item phase
  2113. Set phase.
  2114. Possible values are:
  2115. @table @var
  2116. @item laminar
  2117. @item independent
  2118. @end table
  2119. @item window
  2120. Set processing window size.
  2121. Possible values are:
  2122. @table @var
  2123. @item standard
  2124. @item short
  2125. @item long
  2126. @end table
  2127. @item smoothing
  2128. Set smoothing.
  2129. Possible values are:
  2130. @table @var
  2131. @item off
  2132. @item on
  2133. @end table
  2134. @item formant
  2135. Enable formant preservation when shift pitching.
  2136. Possible values are:
  2137. @table @var
  2138. @item shifted
  2139. @item preserved
  2140. @end table
  2141. @item pitchq
  2142. Set pitch quality.
  2143. Possible values are:
  2144. @table @var
  2145. @item quality
  2146. @item speed
  2147. @item consistency
  2148. @end table
  2149. @item channels
  2150. Set channels.
  2151. Possible values are:
  2152. @table @var
  2153. @item apart
  2154. @item together
  2155. @end table
  2156. @end table
  2157. @section sidechaincompress
  2158. This filter acts like normal compressor but has the ability to compress
  2159. detected signal using second input signal.
  2160. It needs two input streams and returns one output stream.
  2161. First input stream will be processed depending on second stream signal.
  2162. The filtered signal then can be filtered with other filters in later stages of
  2163. processing. See @ref{pan} and @ref{amerge} filter.
  2164. The filter accepts the following options:
  2165. @table @option
  2166. @item level_in
  2167. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2168. @item threshold
  2169. If a signal of second stream raises above this level it will affect the gain
  2170. reduction of first stream.
  2171. By default is 0.125. Range is between 0.00097563 and 1.
  2172. @item ratio
  2173. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2174. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2175. Default is 2. Range is between 1 and 20.
  2176. @item attack
  2177. Amount of milliseconds the signal has to rise above the threshold before gain
  2178. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2179. @item release
  2180. Amount of milliseconds the signal has to fall below the threshold before
  2181. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2182. @item makeup
  2183. Set the amount by how much signal will be amplified after processing.
  2184. Default is 2. Range is from 1 and 64.
  2185. @item knee
  2186. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2187. Default is 2.82843. Range is between 1 and 8.
  2188. @item link
  2189. Choose if the @code{average} level between all channels of side-chain stream
  2190. or the louder(@code{maximum}) channel of side-chain stream affects the
  2191. reduction. Default is @code{average}.
  2192. @item detection
  2193. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2194. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2195. @item level_sc
  2196. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2197. @item mix
  2198. How much to use compressed signal in output. Default is 1.
  2199. Range is between 0 and 1.
  2200. @end table
  2201. @subsection Examples
  2202. @itemize
  2203. @item
  2204. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2205. depending on the signal of 2nd input and later compressed signal to be
  2206. merged with 2nd input:
  2207. @example
  2208. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2209. @end example
  2210. @end itemize
  2211. @section sidechaingate
  2212. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2213. filter the detected signal before sending it to the gain reduction stage.
  2214. Normally a gate uses the full range signal to detect a level above the
  2215. threshold.
  2216. For example: If you cut all lower frequencies from your sidechain signal
  2217. the gate will decrease the volume of your track only if not enough highs
  2218. appear. With this technique you are able to reduce the resonation of a
  2219. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2220. guitar.
  2221. It needs two input streams and returns one output stream.
  2222. First input stream will be processed depending on second stream signal.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item level_in
  2226. Set input level before filtering.
  2227. Default is 1. Allowed range is from 0.015625 to 64.
  2228. @item range
  2229. Set the level of gain reduction when the signal is below the threshold.
  2230. Default is 0.06125. Allowed range is from 0 to 1.
  2231. @item threshold
  2232. If a signal rises above this level the gain reduction is released.
  2233. Default is 0.125. Allowed range is from 0 to 1.
  2234. @item ratio
  2235. Set a ratio about which the signal is reduced.
  2236. Default is 2. Allowed range is from 1 to 9000.
  2237. @item attack
  2238. Amount of milliseconds the signal has to rise above the threshold before gain
  2239. reduction stops.
  2240. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2241. @item release
  2242. Amount of milliseconds the signal has to fall below the threshold before the
  2243. reduction is increased again. Default is 250 milliseconds.
  2244. Allowed range is from 0.01 to 9000.
  2245. @item makeup
  2246. Set amount of amplification of signal after processing.
  2247. Default is 1. Allowed range is from 1 to 64.
  2248. @item knee
  2249. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2250. Default is 2.828427125. Allowed range is from 1 to 8.
  2251. @item detection
  2252. Choose if exact signal should be taken for detection or an RMS like one.
  2253. Default is rms. Can be peak or rms.
  2254. @item link
  2255. Choose if the average level between all channels or the louder channel affects
  2256. the reduction.
  2257. Default is average. Can be average or maximum.
  2258. @item level_sc
  2259. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2260. @end table
  2261. @section silencedetect
  2262. Detect silence in an audio stream.
  2263. This filter logs a message when it detects that the input audio volume is less
  2264. or equal to a noise tolerance value for a duration greater or equal to the
  2265. minimum detected noise duration.
  2266. The printed times and duration are expressed in seconds.
  2267. The filter accepts the following options:
  2268. @table @option
  2269. @item duration, d
  2270. Set silence duration until notification (default is 2 seconds).
  2271. @item noise, n
  2272. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2273. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2274. @end table
  2275. @subsection Examples
  2276. @itemize
  2277. @item
  2278. Detect 5 seconds of silence with -50dB noise tolerance:
  2279. @example
  2280. silencedetect=n=-50dB:d=5
  2281. @end example
  2282. @item
  2283. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2284. tolerance in @file{silence.mp3}:
  2285. @example
  2286. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2287. @end example
  2288. @end itemize
  2289. @section silenceremove
  2290. Remove silence from the beginning, middle or end of the audio.
  2291. The filter accepts the following options:
  2292. @table @option
  2293. @item start_periods
  2294. This value is used to indicate if audio should be trimmed at beginning of
  2295. the audio. A value of zero indicates no silence should be trimmed from the
  2296. beginning. When specifying a non-zero value, it trims audio up until it
  2297. finds non-silence. Normally, when trimming silence from beginning of audio
  2298. the @var{start_periods} will be @code{1} but it can be increased to higher
  2299. values to trim all audio up to specific count of non-silence periods.
  2300. Default value is @code{0}.
  2301. @item start_duration
  2302. Specify the amount of time that non-silence must be detected before it stops
  2303. trimming audio. By increasing the duration, bursts of noises can be treated
  2304. as silence and trimmed off. Default value is @code{0}.
  2305. @item start_threshold
  2306. This indicates what sample value should be treated as silence. For digital
  2307. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2308. you may wish to increase the value to account for background noise.
  2309. Can be specified in dB (in case "dB" is appended to the specified value)
  2310. or amplitude ratio. Default value is @code{0}.
  2311. @item stop_periods
  2312. Set the count for trimming silence from the end of audio.
  2313. To remove silence from the middle of a file, specify a @var{stop_periods}
  2314. that is negative. This value is then treated as a positive value and is
  2315. used to indicate the effect should restart processing as specified by
  2316. @var{start_periods}, making it suitable for removing periods of silence
  2317. in the middle of the audio.
  2318. Default value is @code{0}.
  2319. @item stop_duration
  2320. Specify a duration of silence that must exist before audio is not copied any
  2321. more. By specifying a higher duration, silence that is wanted can be left in
  2322. the audio.
  2323. Default value is @code{0}.
  2324. @item stop_threshold
  2325. This is the same as @option{start_threshold} but for trimming silence from
  2326. the end of audio.
  2327. Can be specified in dB (in case "dB" is appended to the specified value)
  2328. or amplitude ratio. Default value is @code{0}.
  2329. @item leave_silence
  2330. This indicate that @var{stop_duration} length of audio should be left intact
  2331. at the beginning of each period of silence.
  2332. For example, if you want to remove long pauses between words but do not want
  2333. to remove the pauses completely. Default value is @code{0}.
  2334. @item detection
  2335. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2336. and works better with digital silence which is exactly 0.
  2337. Default value is @code{rms}.
  2338. @item window
  2339. Set ratio used to calculate size of window for detecting silence.
  2340. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2341. @end table
  2342. @subsection Examples
  2343. @itemize
  2344. @item
  2345. The following example shows how this filter can be used to start a recording
  2346. that does not contain the delay at the start which usually occurs between
  2347. pressing the record button and the start of the performance:
  2348. @example
  2349. silenceremove=1:5:0.02
  2350. @end example
  2351. @item
  2352. Trim all silence encountered from begining to end where there is more than 1
  2353. second of silence in audio:
  2354. @example
  2355. silenceremove=0:0:0:-1:1:-90dB
  2356. @end example
  2357. @end itemize
  2358. @section sofalizer
  2359. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2360. loudspeakers around the user for binaural listening via headphones (audio
  2361. formats up to 9 channels supported).
  2362. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2363. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2364. Austrian Academy of Sciences.
  2365. To enable compilation of this filter you need to configure FFmpeg with
  2366. @code{--enable-netcdf}.
  2367. The filter accepts the following options:
  2368. @table @option
  2369. @item sofa
  2370. Set the SOFA file used for rendering.
  2371. @item gain
  2372. Set gain applied to audio. Value is in dB. Default is 0.
  2373. @item rotation
  2374. Set rotation of virtual loudspeakers in deg. Default is 0.
  2375. @item elevation
  2376. Set elevation of virtual speakers in deg. Default is 0.
  2377. @item radius
  2378. Set distance in meters between loudspeakers and the listener with near-field
  2379. HRTFs. Default is 1.
  2380. @item type
  2381. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2382. processing audio in time domain which is slow but gives high quality output.
  2383. @var{freq} is processing audio in frequency domain which is fast but gives
  2384. mediocre output. Default is @var{freq}.
  2385. @end table
  2386. @section stereotools
  2387. This filter has some handy utilities to manage stereo signals, for converting
  2388. M/S stereo recordings to L/R signal while having control over the parameters
  2389. or spreading the stereo image of master track.
  2390. The filter accepts the following options:
  2391. @table @option
  2392. @item level_in
  2393. Set input level before filtering for both channels. Defaults is 1.
  2394. Allowed range is from 0.015625 to 64.
  2395. @item level_out
  2396. Set output level after filtering for both channels. Defaults is 1.
  2397. Allowed range is from 0.015625 to 64.
  2398. @item balance_in
  2399. Set input balance between both channels. Default is 0.
  2400. Allowed range is from -1 to 1.
  2401. @item balance_out
  2402. Set output balance between both channels. Default is 0.
  2403. Allowed range is from -1 to 1.
  2404. @item softclip
  2405. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2406. clipping. Disabled by default.
  2407. @item mutel
  2408. Mute the left channel. Disabled by default.
  2409. @item muter
  2410. Mute the right channel. Disabled by default.
  2411. @item phasel
  2412. Change the phase of the left channel. Disabled by default.
  2413. @item phaser
  2414. Change the phase of the right channel. Disabled by default.
  2415. @item mode
  2416. Set stereo mode. Available values are:
  2417. @table @samp
  2418. @item lr>lr
  2419. Left/Right to Left/Right, this is default.
  2420. @item lr>ms
  2421. Left/Right to Mid/Side.
  2422. @item ms>lr
  2423. Mid/Side to Left/Right.
  2424. @item lr>ll
  2425. Left/Right to Left/Left.
  2426. @item lr>rr
  2427. Left/Right to Right/Right.
  2428. @item lr>l+r
  2429. Left/Right to Left + Right.
  2430. @item lr>rl
  2431. Left/Right to Right/Left.
  2432. @end table
  2433. @item slev
  2434. Set level of side signal. Default is 1.
  2435. Allowed range is from 0.015625 to 64.
  2436. @item sbal
  2437. Set balance of side signal. Default is 0.
  2438. Allowed range is from -1 to 1.
  2439. @item mlev
  2440. Set level of the middle signal. Default is 1.
  2441. Allowed range is from 0.015625 to 64.
  2442. @item mpan
  2443. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2444. @item base
  2445. Set stereo base between mono and inversed channels. Default is 0.
  2446. Allowed range is from -1 to 1.
  2447. @item delay
  2448. Set delay in milliseconds how much to delay left from right channel and
  2449. vice versa. Default is 0. Allowed range is from -20 to 20.
  2450. @item sclevel
  2451. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2452. @item phase
  2453. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2454. @end table
  2455. @section stereowiden
  2456. This filter enhance the stereo effect by suppressing signal common to both
  2457. channels and by delaying the signal of left into right and vice versa,
  2458. thereby widening the stereo effect.
  2459. The filter accepts the following options:
  2460. @table @option
  2461. @item delay
  2462. Time in milliseconds of the delay of left signal into right and vice versa.
  2463. Default is 20 milliseconds.
  2464. @item feedback
  2465. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2466. effect of left signal in right output and vice versa which gives widening
  2467. effect. Default is 0.3.
  2468. @item crossfeed
  2469. Cross feed of left into right with inverted phase. This helps in suppressing
  2470. the mono. If the value is 1 it will cancel all the signal common to both
  2471. channels. Default is 0.3.
  2472. @item drymix
  2473. Set level of input signal of original channel. Default is 0.8.
  2474. @end table
  2475. @section treble
  2476. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2477. shelving filter with a response similar to that of a standard
  2478. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2479. The filter accepts the following options:
  2480. @table @option
  2481. @item gain, g
  2482. Give the gain at whichever is the lower of ~22 kHz and the
  2483. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2484. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2485. @item frequency, f
  2486. Set the filter's central frequency and so can be used
  2487. to extend or reduce the frequency range to be boosted or cut.
  2488. The default value is @code{3000} Hz.
  2489. @item width_type
  2490. Set method to specify band-width of filter.
  2491. @table @option
  2492. @item h
  2493. Hz
  2494. @item q
  2495. Q-Factor
  2496. @item o
  2497. octave
  2498. @item s
  2499. slope
  2500. @end table
  2501. @item width, w
  2502. Determine how steep is the filter's shelf transition.
  2503. @end table
  2504. @section tremolo
  2505. Sinusoidal amplitude modulation.
  2506. The filter accepts the following options:
  2507. @table @option
  2508. @item f
  2509. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2510. (20 Hz or lower) will result in a tremolo effect.
  2511. This filter may also be used as a ring modulator by specifying
  2512. a modulation frequency higher than 20 Hz.
  2513. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2514. @item d
  2515. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2516. Default value is 0.5.
  2517. @end table
  2518. @section vibrato
  2519. Sinusoidal phase modulation.
  2520. The filter accepts the following options:
  2521. @table @option
  2522. @item f
  2523. Modulation frequency in Hertz.
  2524. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2525. @item d
  2526. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2527. Default value is 0.5.
  2528. @end table
  2529. @section volume
  2530. Adjust the input audio volume.
  2531. It accepts the following parameters:
  2532. @table @option
  2533. @item volume
  2534. Set audio volume expression.
  2535. Output values are clipped to the maximum value.
  2536. The output audio volume is given by the relation:
  2537. @example
  2538. @var{output_volume} = @var{volume} * @var{input_volume}
  2539. @end example
  2540. The default value for @var{volume} is "1.0".
  2541. @item precision
  2542. This parameter represents the mathematical precision.
  2543. It determines which input sample formats will be allowed, which affects the
  2544. precision of the volume scaling.
  2545. @table @option
  2546. @item fixed
  2547. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2548. @item float
  2549. 32-bit floating-point; this limits input sample format to FLT. (default)
  2550. @item double
  2551. 64-bit floating-point; this limits input sample format to DBL.
  2552. @end table
  2553. @item replaygain
  2554. Choose the behaviour on encountering ReplayGain side data in input frames.
  2555. @table @option
  2556. @item drop
  2557. Remove ReplayGain side data, ignoring its contents (the default).
  2558. @item ignore
  2559. Ignore ReplayGain side data, but leave it in the frame.
  2560. @item track
  2561. Prefer the track gain, if present.
  2562. @item album
  2563. Prefer the album gain, if present.
  2564. @end table
  2565. @item replaygain_preamp
  2566. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2567. Default value for @var{replaygain_preamp} is 0.0.
  2568. @item eval
  2569. Set when the volume expression is evaluated.
  2570. It accepts the following values:
  2571. @table @samp
  2572. @item once
  2573. only evaluate expression once during the filter initialization, or
  2574. when the @samp{volume} command is sent
  2575. @item frame
  2576. evaluate expression for each incoming frame
  2577. @end table
  2578. Default value is @samp{once}.
  2579. @end table
  2580. The volume expression can contain the following parameters.
  2581. @table @option
  2582. @item n
  2583. frame number (starting at zero)
  2584. @item nb_channels
  2585. number of channels
  2586. @item nb_consumed_samples
  2587. number of samples consumed by the filter
  2588. @item nb_samples
  2589. number of samples in the current frame
  2590. @item pos
  2591. original frame position in the file
  2592. @item pts
  2593. frame PTS
  2594. @item sample_rate
  2595. sample rate
  2596. @item startpts
  2597. PTS at start of stream
  2598. @item startt
  2599. time at start of stream
  2600. @item t
  2601. frame time
  2602. @item tb
  2603. timestamp timebase
  2604. @item volume
  2605. last set volume value
  2606. @end table
  2607. Note that when @option{eval} is set to @samp{once} only the
  2608. @var{sample_rate} and @var{tb} variables are available, all other
  2609. variables will evaluate to NAN.
  2610. @subsection Commands
  2611. This filter supports the following commands:
  2612. @table @option
  2613. @item volume
  2614. Modify the volume expression.
  2615. The command accepts the same syntax of the corresponding option.
  2616. If the specified expression is not valid, it is kept at its current
  2617. value.
  2618. @item replaygain_noclip
  2619. Prevent clipping by limiting the gain applied.
  2620. Default value for @var{replaygain_noclip} is 1.
  2621. @end table
  2622. @subsection Examples
  2623. @itemize
  2624. @item
  2625. Halve the input audio volume:
  2626. @example
  2627. volume=volume=0.5
  2628. volume=volume=1/2
  2629. volume=volume=-6.0206dB
  2630. @end example
  2631. In all the above example the named key for @option{volume} can be
  2632. omitted, for example like in:
  2633. @example
  2634. volume=0.5
  2635. @end example
  2636. @item
  2637. Increase input audio power by 6 decibels using fixed-point precision:
  2638. @example
  2639. volume=volume=6dB:precision=fixed
  2640. @end example
  2641. @item
  2642. Fade volume after time 10 with an annihilation period of 5 seconds:
  2643. @example
  2644. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2645. @end example
  2646. @end itemize
  2647. @section volumedetect
  2648. Detect the volume of the input video.
  2649. The filter has no parameters. The input is not modified. Statistics about
  2650. the volume will be printed in the log when the input stream end is reached.
  2651. In particular it will show the mean volume (root mean square), maximum
  2652. volume (on a per-sample basis), and the beginning of a histogram of the
  2653. registered volume values (from the maximum value to a cumulated 1/1000 of
  2654. the samples).
  2655. All volumes are in decibels relative to the maximum PCM value.
  2656. @subsection Examples
  2657. Here is an excerpt of the output:
  2658. @example
  2659. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2660. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2661. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2662. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2663. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2664. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2665. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2666. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2667. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2668. @end example
  2669. It means that:
  2670. @itemize
  2671. @item
  2672. The mean square energy is approximately -27 dB, or 10^-2.7.
  2673. @item
  2674. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2675. @item
  2676. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2677. @end itemize
  2678. In other words, raising the volume by +4 dB does not cause any clipping,
  2679. raising it by +5 dB causes clipping for 6 samples, etc.
  2680. @c man end AUDIO FILTERS
  2681. @chapter Audio Sources
  2682. @c man begin AUDIO SOURCES
  2683. Below is a description of the currently available audio sources.
  2684. @section abuffer
  2685. Buffer audio frames, and make them available to the filter chain.
  2686. This source is mainly intended for a programmatic use, in particular
  2687. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2688. It accepts the following parameters:
  2689. @table @option
  2690. @item time_base
  2691. The timebase which will be used for timestamps of submitted frames. It must be
  2692. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2693. @item sample_rate
  2694. The sample rate of the incoming audio buffers.
  2695. @item sample_fmt
  2696. The sample format of the incoming audio buffers.
  2697. Either a sample format name or its corresponding integer representation from
  2698. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2699. @item channel_layout
  2700. The channel layout of the incoming audio buffers.
  2701. Either a channel layout name from channel_layout_map in
  2702. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2703. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2704. @item channels
  2705. The number of channels of the incoming audio buffers.
  2706. If both @var{channels} and @var{channel_layout} are specified, then they
  2707. must be consistent.
  2708. @end table
  2709. @subsection Examples
  2710. @example
  2711. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2712. @end example
  2713. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2714. Since the sample format with name "s16p" corresponds to the number
  2715. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2716. equivalent to:
  2717. @example
  2718. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2719. @end example
  2720. @section aevalsrc
  2721. Generate an audio signal specified by an expression.
  2722. This source accepts in input one or more expressions (one for each
  2723. channel), which are evaluated and used to generate a corresponding
  2724. audio signal.
  2725. This source accepts the following options:
  2726. @table @option
  2727. @item exprs
  2728. Set the '|'-separated expressions list for each separate channel. In case the
  2729. @option{channel_layout} option is not specified, the selected channel layout
  2730. depends on the number of provided expressions. Otherwise the last
  2731. specified expression is applied to the remaining output channels.
  2732. @item channel_layout, c
  2733. Set the channel layout. The number of channels in the specified layout
  2734. must be equal to the number of specified expressions.
  2735. @item duration, d
  2736. Set the minimum duration of the sourced audio. See
  2737. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2738. for the accepted syntax.
  2739. Note that the resulting duration may be greater than the specified
  2740. duration, as the generated audio is always cut at the end of a
  2741. complete frame.
  2742. If not specified, or the expressed duration is negative, the audio is
  2743. supposed to be generated forever.
  2744. @item nb_samples, n
  2745. Set the number of samples per channel per each output frame,
  2746. default to 1024.
  2747. @item sample_rate, s
  2748. Specify the sample rate, default to 44100.
  2749. @end table
  2750. Each expression in @var{exprs} can contain the following constants:
  2751. @table @option
  2752. @item n
  2753. number of the evaluated sample, starting from 0
  2754. @item t
  2755. time of the evaluated sample expressed in seconds, starting from 0
  2756. @item s
  2757. sample rate
  2758. @end table
  2759. @subsection Examples
  2760. @itemize
  2761. @item
  2762. Generate silence:
  2763. @example
  2764. aevalsrc=0
  2765. @end example
  2766. @item
  2767. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2768. 8000 Hz:
  2769. @example
  2770. aevalsrc="sin(440*2*PI*t):s=8000"
  2771. @end example
  2772. @item
  2773. Generate a two channels signal, specify the channel layout (Front
  2774. Center + Back Center) explicitly:
  2775. @example
  2776. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2777. @end example
  2778. @item
  2779. Generate white noise:
  2780. @example
  2781. aevalsrc="-2+random(0)"
  2782. @end example
  2783. @item
  2784. Generate an amplitude modulated signal:
  2785. @example
  2786. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2787. @end example
  2788. @item
  2789. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2790. @example
  2791. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2792. @end example
  2793. @end itemize
  2794. @section anullsrc
  2795. The null audio source, return unprocessed audio frames. It is mainly useful
  2796. as a template and to be employed in analysis / debugging tools, or as
  2797. the source for filters which ignore the input data (for example the sox
  2798. synth filter).
  2799. This source accepts the following options:
  2800. @table @option
  2801. @item channel_layout, cl
  2802. Specifies the channel layout, and can be either an integer or a string
  2803. representing a channel layout. The default value of @var{channel_layout}
  2804. is "stereo".
  2805. Check the channel_layout_map definition in
  2806. @file{libavutil/channel_layout.c} for the mapping between strings and
  2807. channel layout values.
  2808. @item sample_rate, r
  2809. Specifies the sample rate, and defaults to 44100.
  2810. @item nb_samples, n
  2811. Set the number of samples per requested frames.
  2812. @end table
  2813. @subsection Examples
  2814. @itemize
  2815. @item
  2816. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2817. @example
  2818. anullsrc=r=48000:cl=4
  2819. @end example
  2820. @item
  2821. Do the same operation with a more obvious syntax:
  2822. @example
  2823. anullsrc=r=48000:cl=mono
  2824. @end example
  2825. @end itemize
  2826. All the parameters need to be explicitly defined.
  2827. @section flite
  2828. Synthesize a voice utterance using the libflite library.
  2829. To enable compilation of this filter you need to configure FFmpeg with
  2830. @code{--enable-libflite}.
  2831. Note that the flite library is not thread-safe.
  2832. The filter accepts the following options:
  2833. @table @option
  2834. @item list_voices
  2835. If set to 1, list the names of the available voices and exit
  2836. immediately. Default value is 0.
  2837. @item nb_samples, n
  2838. Set the maximum number of samples per frame. Default value is 512.
  2839. @item textfile
  2840. Set the filename containing the text to speak.
  2841. @item text
  2842. Set the text to speak.
  2843. @item voice, v
  2844. Set the voice to use for the speech synthesis. Default value is
  2845. @code{kal}. See also the @var{list_voices} option.
  2846. @end table
  2847. @subsection Examples
  2848. @itemize
  2849. @item
  2850. Read from file @file{speech.txt}, and synthesize the text using the
  2851. standard flite voice:
  2852. @example
  2853. flite=textfile=speech.txt
  2854. @end example
  2855. @item
  2856. Read the specified text selecting the @code{slt} voice:
  2857. @example
  2858. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2859. @end example
  2860. @item
  2861. Input text to ffmpeg:
  2862. @example
  2863. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2864. @end example
  2865. @item
  2866. Make @file{ffplay} speak the specified text, using @code{flite} and
  2867. the @code{lavfi} device:
  2868. @example
  2869. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2870. @end example
  2871. @end itemize
  2872. For more information about libflite, check:
  2873. @url{http://www.speech.cs.cmu.edu/flite/}
  2874. @section anoisesrc
  2875. Generate a noise audio signal.
  2876. The filter accepts the following options:
  2877. @table @option
  2878. @item sample_rate, r
  2879. Specify the sample rate. Default value is 48000 Hz.
  2880. @item amplitude, a
  2881. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2882. is 1.0.
  2883. @item duration, d
  2884. Specify the duration of the generated audio stream. Not specifying this option
  2885. results in noise with an infinite length.
  2886. @item color, colour, c
  2887. Specify the color of noise. Available noise colors are white, pink, and brown.
  2888. Default color is white.
  2889. @item seed, s
  2890. Specify a value used to seed the PRNG.
  2891. @item nb_samples, n
  2892. Set the number of samples per each output frame, default is 1024.
  2893. @end table
  2894. @subsection Examples
  2895. @itemize
  2896. @item
  2897. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2898. @example
  2899. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2900. @end example
  2901. @end itemize
  2902. @section sine
  2903. Generate an audio signal made of a sine wave with amplitude 1/8.
  2904. The audio signal is bit-exact.
  2905. The filter accepts the following options:
  2906. @table @option
  2907. @item frequency, f
  2908. Set the carrier frequency. Default is 440 Hz.
  2909. @item beep_factor, b
  2910. Enable a periodic beep every second with frequency @var{beep_factor} times
  2911. the carrier frequency. Default is 0, meaning the beep is disabled.
  2912. @item sample_rate, r
  2913. Specify the sample rate, default is 44100.
  2914. @item duration, d
  2915. Specify the duration of the generated audio stream.
  2916. @item samples_per_frame
  2917. Set the number of samples per output frame.
  2918. The expression can contain the following constants:
  2919. @table @option
  2920. @item n
  2921. The (sequential) number of the output audio frame, starting from 0.
  2922. @item pts
  2923. The PTS (Presentation TimeStamp) of the output audio frame,
  2924. expressed in @var{TB} units.
  2925. @item t
  2926. The PTS of the output audio frame, expressed in seconds.
  2927. @item TB
  2928. The timebase of the output audio frames.
  2929. @end table
  2930. Default is @code{1024}.
  2931. @end table
  2932. @subsection Examples
  2933. @itemize
  2934. @item
  2935. Generate a simple 440 Hz sine wave:
  2936. @example
  2937. sine
  2938. @end example
  2939. @item
  2940. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2941. @example
  2942. sine=220:4:d=5
  2943. sine=f=220:b=4:d=5
  2944. sine=frequency=220:beep_factor=4:duration=5
  2945. @end example
  2946. @item
  2947. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2948. pattern:
  2949. @example
  2950. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2951. @end example
  2952. @end itemize
  2953. @c man end AUDIO SOURCES
  2954. @chapter Audio Sinks
  2955. @c man begin AUDIO SINKS
  2956. Below is a description of the currently available audio sinks.
  2957. @section abuffersink
  2958. Buffer audio frames, and make them available to the end of filter chain.
  2959. This sink is mainly intended for programmatic use, in particular
  2960. through the interface defined in @file{libavfilter/buffersink.h}
  2961. or the options system.
  2962. It accepts a pointer to an AVABufferSinkContext structure, which
  2963. defines the incoming buffers' formats, to be passed as the opaque
  2964. parameter to @code{avfilter_init_filter} for initialization.
  2965. @section anullsink
  2966. Null audio sink; do absolutely nothing with the input audio. It is
  2967. mainly useful as a template and for use in analysis / debugging
  2968. tools.
  2969. @c man end AUDIO SINKS
  2970. @chapter Video Filters
  2971. @c man begin VIDEO FILTERS
  2972. When you configure your FFmpeg build, you can disable any of the
  2973. existing filters using @code{--disable-filters}.
  2974. The configure output will show the video filters included in your
  2975. build.
  2976. Below is a description of the currently available video filters.
  2977. @section alphaextract
  2978. Extract the alpha component from the input as a grayscale video. This
  2979. is especially useful with the @var{alphamerge} filter.
  2980. @section alphamerge
  2981. Add or replace the alpha component of the primary input with the
  2982. grayscale value of a second input. This is intended for use with
  2983. @var{alphaextract} to allow the transmission or storage of frame
  2984. sequences that have alpha in a format that doesn't support an alpha
  2985. channel.
  2986. For example, to reconstruct full frames from a normal YUV-encoded video
  2987. and a separate video created with @var{alphaextract}, you might use:
  2988. @example
  2989. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2990. @end example
  2991. Since this filter is designed for reconstruction, it operates on frame
  2992. sequences without considering timestamps, and terminates when either
  2993. input reaches end of stream. This will cause problems if your encoding
  2994. pipeline drops frames. If you're trying to apply an image as an
  2995. overlay to a video stream, consider the @var{overlay} filter instead.
  2996. @section ass
  2997. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2998. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2999. Substation Alpha) subtitles files.
  3000. This filter accepts the following option in addition to the common options from
  3001. the @ref{subtitles} filter:
  3002. @table @option
  3003. @item shaping
  3004. Set the shaping engine
  3005. Available values are:
  3006. @table @samp
  3007. @item auto
  3008. The default libass shaping engine, which is the best available.
  3009. @item simple
  3010. Fast, font-agnostic shaper that can do only substitutions
  3011. @item complex
  3012. Slower shaper using OpenType for substitutions and positioning
  3013. @end table
  3014. The default is @code{auto}.
  3015. @end table
  3016. @section atadenoise
  3017. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3018. The filter accepts the following options:
  3019. @table @option
  3020. @item 0a
  3021. Set threshold A for 1st plane. Default is 0.02.
  3022. Valid range is 0 to 0.3.
  3023. @item 0b
  3024. Set threshold B for 1st plane. Default is 0.04.
  3025. Valid range is 0 to 5.
  3026. @item 1a
  3027. Set threshold A for 2nd plane. Default is 0.02.
  3028. Valid range is 0 to 0.3.
  3029. @item 1b
  3030. Set threshold B for 2nd plane. Default is 0.04.
  3031. Valid range is 0 to 5.
  3032. @item 2a
  3033. Set threshold A for 3rd plane. Default is 0.02.
  3034. Valid range is 0 to 0.3.
  3035. @item 2b
  3036. Set threshold B for 3rd plane. Default is 0.04.
  3037. Valid range is 0 to 5.
  3038. Threshold A is designed to react on abrupt changes in the input signal and
  3039. threshold B is designed to react on continuous changes in the input signal.
  3040. @item s
  3041. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3042. number in range [5, 129].
  3043. @end table
  3044. @section bbox
  3045. Compute the bounding box for the non-black pixels in the input frame
  3046. luminance plane.
  3047. This filter computes the bounding box containing all the pixels with a
  3048. luminance value greater than the minimum allowed value.
  3049. The parameters describing the bounding box are printed on the filter
  3050. log.
  3051. The filter accepts the following option:
  3052. @table @option
  3053. @item min_val
  3054. Set the minimal luminance value. Default is @code{16}.
  3055. @end table
  3056. @section blackdetect
  3057. Detect video intervals that are (almost) completely black. Can be
  3058. useful to detect chapter transitions, commercials, or invalid
  3059. recordings. Output lines contains the time for the start, end and
  3060. duration of the detected black interval expressed in seconds.
  3061. In order to display the output lines, you need to set the loglevel at
  3062. least to the AV_LOG_INFO value.
  3063. The filter accepts the following options:
  3064. @table @option
  3065. @item black_min_duration, d
  3066. Set the minimum detected black duration expressed in seconds. It must
  3067. be a non-negative floating point number.
  3068. Default value is 2.0.
  3069. @item picture_black_ratio_th, pic_th
  3070. Set the threshold for considering a picture "black".
  3071. Express the minimum value for the ratio:
  3072. @example
  3073. @var{nb_black_pixels} / @var{nb_pixels}
  3074. @end example
  3075. for which a picture is considered black.
  3076. Default value is 0.98.
  3077. @item pixel_black_th, pix_th
  3078. Set the threshold for considering a pixel "black".
  3079. The threshold expresses the maximum pixel luminance value for which a
  3080. pixel is considered "black". The provided value is scaled according to
  3081. the following equation:
  3082. @example
  3083. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3084. @end example
  3085. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3086. the input video format, the range is [0-255] for YUV full-range
  3087. formats and [16-235] for YUV non full-range formats.
  3088. Default value is 0.10.
  3089. @end table
  3090. The following example sets the maximum pixel threshold to the minimum
  3091. value, and detects only black intervals of 2 or more seconds:
  3092. @example
  3093. blackdetect=d=2:pix_th=0.00
  3094. @end example
  3095. @section blackframe
  3096. Detect frames that are (almost) completely black. Can be useful to
  3097. detect chapter transitions or commercials. Output lines consist of
  3098. the frame number of the detected frame, the percentage of blackness,
  3099. the position in the file if known or -1 and the timestamp in seconds.
  3100. In order to display the output lines, you need to set the loglevel at
  3101. least to the AV_LOG_INFO value.
  3102. It accepts the following parameters:
  3103. @table @option
  3104. @item amount
  3105. The percentage of the pixels that have to be below the threshold; it defaults to
  3106. @code{98}.
  3107. @item threshold, thresh
  3108. The threshold below which a pixel value is considered black; it defaults to
  3109. @code{32}.
  3110. @end table
  3111. @section blend, tblend
  3112. Blend two video frames into each other.
  3113. The @code{blend} filter takes two input streams and outputs one
  3114. stream, the first input is the "top" layer and second input is
  3115. "bottom" layer. Output terminates when shortest input terminates.
  3116. The @code{tblend} (time blend) filter takes two consecutive frames
  3117. from one single stream, and outputs the result obtained by blending
  3118. the new frame on top of the old frame.
  3119. A description of the accepted options follows.
  3120. @table @option
  3121. @item c0_mode
  3122. @item c1_mode
  3123. @item c2_mode
  3124. @item c3_mode
  3125. @item all_mode
  3126. Set blend mode for specific pixel component or all pixel components in case
  3127. of @var{all_mode}. Default value is @code{normal}.
  3128. Available values for component modes are:
  3129. @table @samp
  3130. @item addition
  3131. @item addition128
  3132. @item and
  3133. @item average
  3134. @item burn
  3135. @item darken
  3136. @item difference
  3137. @item difference128
  3138. @item divide
  3139. @item dodge
  3140. @item exclusion
  3141. @item glow
  3142. @item hardlight
  3143. @item hardmix
  3144. @item lighten
  3145. @item linearlight
  3146. @item multiply
  3147. @item negation
  3148. @item normal
  3149. @item or
  3150. @item overlay
  3151. @item phoenix
  3152. @item pinlight
  3153. @item reflect
  3154. @item screen
  3155. @item softlight
  3156. @item subtract
  3157. @item vividlight
  3158. @item xor
  3159. @end table
  3160. @item c0_opacity
  3161. @item c1_opacity
  3162. @item c2_opacity
  3163. @item c3_opacity
  3164. @item all_opacity
  3165. Set blend opacity for specific pixel component or all pixel components in case
  3166. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3167. @item c0_expr
  3168. @item c1_expr
  3169. @item c2_expr
  3170. @item c3_expr
  3171. @item all_expr
  3172. Set blend expression for specific pixel component or all pixel components in case
  3173. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3174. The expressions can use the following variables:
  3175. @table @option
  3176. @item N
  3177. The sequential number of the filtered frame, starting from @code{0}.
  3178. @item X
  3179. @item Y
  3180. the coordinates of the current sample
  3181. @item W
  3182. @item H
  3183. the width and height of currently filtered plane
  3184. @item SW
  3185. @item SH
  3186. Width and height scale depending on the currently filtered plane. It is the
  3187. ratio between the corresponding luma plane number of pixels and the current
  3188. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3189. @code{0.5,0.5} for chroma planes.
  3190. @item T
  3191. Time of the current frame, expressed in seconds.
  3192. @item TOP, A
  3193. Value of pixel component at current location for first video frame (top layer).
  3194. @item BOTTOM, B
  3195. Value of pixel component at current location for second video frame (bottom layer).
  3196. @end table
  3197. @item shortest
  3198. Force termination when the shortest input terminates. Default is
  3199. @code{0}. This option is only defined for the @code{blend} filter.
  3200. @item repeatlast
  3201. Continue applying the last bottom frame after the end of the stream. A value of
  3202. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3203. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3204. @end table
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. Apply transition from bottom layer to top layer in first 10 seconds:
  3209. @example
  3210. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3211. @end example
  3212. @item
  3213. Apply 1x1 checkerboard effect:
  3214. @example
  3215. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3216. @end example
  3217. @item
  3218. Apply uncover left effect:
  3219. @example
  3220. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3221. @end example
  3222. @item
  3223. Apply uncover down effect:
  3224. @example
  3225. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3226. @end example
  3227. @item
  3228. Apply uncover up-left effect:
  3229. @example
  3230. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3231. @end example
  3232. @item
  3233. Display differences between the current and the previous frame:
  3234. @example
  3235. tblend=all_mode=difference128
  3236. @end example
  3237. @end itemize
  3238. @section boxblur
  3239. Apply a boxblur algorithm to the input video.
  3240. It accepts the following parameters:
  3241. @table @option
  3242. @item luma_radius, lr
  3243. @item luma_power, lp
  3244. @item chroma_radius, cr
  3245. @item chroma_power, cp
  3246. @item alpha_radius, ar
  3247. @item alpha_power, ap
  3248. @end table
  3249. A description of the accepted options follows.
  3250. @table @option
  3251. @item luma_radius, lr
  3252. @item chroma_radius, cr
  3253. @item alpha_radius, ar
  3254. Set an expression for the box radius in pixels used for blurring the
  3255. corresponding input plane.
  3256. The radius value must be a non-negative number, and must not be
  3257. greater than the value of the expression @code{min(w,h)/2} for the
  3258. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3259. planes.
  3260. Default value for @option{luma_radius} is "2". If not specified,
  3261. @option{chroma_radius} and @option{alpha_radius} default to the
  3262. corresponding value set for @option{luma_radius}.
  3263. The expressions can contain the following constants:
  3264. @table @option
  3265. @item w
  3266. @item h
  3267. The input width and height in pixels.
  3268. @item cw
  3269. @item ch
  3270. The input chroma image width and height in pixels.
  3271. @item hsub
  3272. @item vsub
  3273. The horizontal and vertical chroma subsample values. For example, for the
  3274. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3275. @end table
  3276. @item luma_power, lp
  3277. @item chroma_power, cp
  3278. @item alpha_power, ap
  3279. Specify how many times the boxblur filter is applied to the
  3280. corresponding plane.
  3281. Default value for @option{luma_power} is 2. If not specified,
  3282. @option{chroma_power} and @option{alpha_power} default to the
  3283. corresponding value set for @option{luma_power}.
  3284. A value of 0 will disable the effect.
  3285. @end table
  3286. @subsection Examples
  3287. @itemize
  3288. @item
  3289. Apply a boxblur filter with the luma, chroma, and alpha radii
  3290. set to 2:
  3291. @example
  3292. boxblur=luma_radius=2:luma_power=1
  3293. boxblur=2:1
  3294. @end example
  3295. @item
  3296. Set the luma radius to 2, and alpha and chroma radius to 0:
  3297. @example
  3298. boxblur=2:1:cr=0:ar=0
  3299. @end example
  3300. @item
  3301. Set the luma and chroma radii to a fraction of the video dimension:
  3302. @example
  3303. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3304. @end example
  3305. @end itemize
  3306. @section chromakey
  3307. YUV colorspace color/chroma keying.
  3308. The filter accepts the following options:
  3309. @table @option
  3310. @item color
  3311. The color which will be replaced with transparency.
  3312. @item similarity
  3313. Similarity percentage with the key color.
  3314. 0.01 matches only the exact key color, while 1.0 matches everything.
  3315. @item blend
  3316. Blend percentage.
  3317. 0.0 makes pixels either fully transparent, or not transparent at all.
  3318. Higher values result in semi-transparent pixels, with a higher transparency
  3319. the more similar the pixels color is to the key color.
  3320. @item yuv
  3321. Signals that the color passed is already in YUV instead of RGB.
  3322. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3323. This can be used to pass exact YUV values as hexadecimal numbers.
  3324. @end table
  3325. @subsection Examples
  3326. @itemize
  3327. @item
  3328. Make every green pixel in the input image transparent:
  3329. @example
  3330. ffmpeg -i input.png -vf chromakey=green out.png
  3331. @end example
  3332. @item
  3333. Overlay a greenscreen-video on top of a static black background.
  3334. @example
  3335. 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
  3336. @end example
  3337. @end itemize
  3338. @section codecview
  3339. Visualize information exported by some codecs.
  3340. Some codecs can export information through frames using side-data or other
  3341. means. For example, some MPEG based codecs export motion vectors through the
  3342. @var{export_mvs} flag in the codec @option{flags2} option.
  3343. The filter accepts the following option:
  3344. @table @option
  3345. @item mv
  3346. Set motion vectors to visualize.
  3347. Available flags for @var{mv} are:
  3348. @table @samp
  3349. @item pf
  3350. forward predicted MVs of P-frames
  3351. @item bf
  3352. forward predicted MVs of B-frames
  3353. @item bb
  3354. backward predicted MVs of B-frames
  3355. @end table
  3356. @item qp
  3357. Display quantization parameters using the chroma planes
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3363. @example
  3364. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3365. @end example
  3366. @end itemize
  3367. @section colorbalance
  3368. Modify intensity of primary colors (red, green and blue) of input frames.
  3369. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3370. regions for the red-cyan, green-magenta or blue-yellow balance.
  3371. A positive adjustment value shifts the balance towards the primary color, a negative
  3372. value towards the complementary color.
  3373. The filter accepts the following options:
  3374. @table @option
  3375. @item rs
  3376. @item gs
  3377. @item bs
  3378. Adjust red, green and blue shadows (darkest pixels).
  3379. @item rm
  3380. @item gm
  3381. @item bm
  3382. Adjust red, green and blue midtones (medium pixels).
  3383. @item rh
  3384. @item gh
  3385. @item bh
  3386. Adjust red, green and blue highlights (brightest pixels).
  3387. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3388. @end table
  3389. @subsection Examples
  3390. @itemize
  3391. @item
  3392. Add red color cast to shadows:
  3393. @example
  3394. colorbalance=rs=.3
  3395. @end example
  3396. @end itemize
  3397. @section colorkey
  3398. RGB colorspace color keying.
  3399. The filter accepts the following options:
  3400. @table @option
  3401. @item color
  3402. The color which will be replaced with transparency.
  3403. @item similarity
  3404. Similarity percentage with the key color.
  3405. 0.01 matches only the exact key color, while 1.0 matches everything.
  3406. @item blend
  3407. Blend percentage.
  3408. 0.0 makes pixels either fully transparent, or not transparent at all.
  3409. Higher values result in semi-transparent pixels, with a higher transparency
  3410. the more similar the pixels color is to the key color.
  3411. @end table
  3412. @subsection Examples
  3413. @itemize
  3414. @item
  3415. Make every green pixel in the input image transparent:
  3416. @example
  3417. ffmpeg -i input.png -vf colorkey=green out.png
  3418. @end example
  3419. @item
  3420. Overlay a greenscreen-video on top of a static background image.
  3421. @example
  3422. 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
  3423. @end example
  3424. @end itemize
  3425. @section colorlevels
  3426. Adjust video input frames using levels.
  3427. The filter accepts the following options:
  3428. @table @option
  3429. @item rimin
  3430. @item gimin
  3431. @item bimin
  3432. @item aimin
  3433. Adjust red, green, blue and alpha input black point.
  3434. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3435. @item rimax
  3436. @item gimax
  3437. @item bimax
  3438. @item aimax
  3439. Adjust red, green, blue and alpha input white point.
  3440. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3441. Input levels are used to lighten highlights (bright tones), darken shadows
  3442. (dark tones), change the balance of bright and dark tones.
  3443. @item romin
  3444. @item gomin
  3445. @item bomin
  3446. @item aomin
  3447. Adjust red, green, blue and alpha output black point.
  3448. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3449. @item romax
  3450. @item gomax
  3451. @item bomax
  3452. @item aomax
  3453. Adjust red, green, blue and alpha output white point.
  3454. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3455. Output levels allows manual selection of a constrained output level range.
  3456. @end table
  3457. @subsection Examples
  3458. @itemize
  3459. @item
  3460. Make video output darker:
  3461. @example
  3462. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3463. @end example
  3464. @item
  3465. Increase contrast:
  3466. @example
  3467. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3468. @end example
  3469. @item
  3470. Make video output lighter:
  3471. @example
  3472. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3473. @end example
  3474. @item
  3475. Increase brightness:
  3476. @example
  3477. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3478. @end example
  3479. @end itemize
  3480. @section colorchannelmixer
  3481. Adjust video input frames by re-mixing color channels.
  3482. This filter modifies a color channel by adding the values associated to
  3483. the other channels of the same pixels. For example if the value to
  3484. modify is red, the output value will be:
  3485. @example
  3486. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3487. @end example
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item rr
  3491. @item rg
  3492. @item rb
  3493. @item ra
  3494. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3495. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3496. @item gr
  3497. @item gg
  3498. @item gb
  3499. @item ga
  3500. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3501. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3502. @item br
  3503. @item bg
  3504. @item bb
  3505. @item ba
  3506. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3507. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3508. @item ar
  3509. @item ag
  3510. @item ab
  3511. @item aa
  3512. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3513. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3514. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3515. @end table
  3516. @subsection Examples
  3517. @itemize
  3518. @item
  3519. Convert source to grayscale:
  3520. @example
  3521. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3522. @end example
  3523. @item
  3524. Simulate sepia tones:
  3525. @example
  3526. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3527. @end example
  3528. @end itemize
  3529. @section colormatrix
  3530. Convert color matrix.
  3531. The filter accepts the following options:
  3532. @table @option
  3533. @item src
  3534. @item dst
  3535. Specify the source and destination color matrix. Both values must be
  3536. specified.
  3537. The accepted values are:
  3538. @table @samp
  3539. @item bt709
  3540. BT.709
  3541. @item bt601
  3542. BT.601
  3543. @item smpte240m
  3544. SMPTE-240M
  3545. @item fcc
  3546. FCC
  3547. @end table
  3548. @end table
  3549. For example to convert from BT.601 to SMPTE-240M, use the command:
  3550. @example
  3551. colormatrix=bt601:smpte240m
  3552. @end example
  3553. @section copy
  3554. Copy the input source unchanged to the output. This is mainly useful for
  3555. testing purposes.
  3556. @section crop
  3557. Crop the input video to given dimensions.
  3558. It accepts the following parameters:
  3559. @table @option
  3560. @item w, out_w
  3561. The width of the output video. It defaults to @code{iw}.
  3562. This expression is evaluated only once during the filter
  3563. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3564. @item h, out_h
  3565. The height of the output video. It defaults to @code{ih}.
  3566. This expression is evaluated only once during the filter
  3567. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3568. @item x
  3569. The horizontal position, in the input video, of the left edge of the output
  3570. video. It defaults to @code{(in_w-out_w)/2}.
  3571. This expression is evaluated per-frame.
  3572. @item y
  3573. The vertical position, in the input video, of the top edge of the output video.
  3574. It defaults to @code{(in_h-out_h)/2}.
  3575. This expression is evaluated per-frame.
  3576. @item keep_aspect
  3577. If set to 1 will force the output display aspect ratio
  3578. to be the same of the input, by changing the output sample aspect
  3579. ratio. It defaults to 0.
  3580. @end table
  3581. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3582. expressions containing the following constants:
  3583. @table @option
  3584. @item x
  3585. @item y
  3586. The computed values for @var{x} and @var{y}. They are evaluated for
  3587. each new frame.
  3588. @item in_w
  3589. @item in_h
  3590. The input width and height.
  3591. @item iw
  3592. @item ih
  3593. These are the same as @var{in_w} and @var{in_h}.
  3594. @item out_w
  3595. @item out_h
  3596. The output (cropped) width and height.
  3597. @item ow
  3598. @item oh
  3599. These are the same as @var{out_w} and @var{out_h}.
  3600. @item a
  3601. same as @var{iw} / @var{ih}
  3602. @item sar
  3603. input sample aspect ratio
  3604. @item dar
  3605. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3606. @item hsub
  3607. @item vsub
  3608. horizontal and vertical chroma subsample values. For example for the
  3609. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3610. @item n
  3611. The number of the input frame, starting from 0.
  3612. @item pos
  3613. the position in the file of the input frame, NAN if unknown
  3614. @item t
  3615. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3616. @end table
  3617. The expression for @var{out_w} may depend on the value of @var{out_h},
  3618. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3619. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3620. evaluated after @var{out_w} and @var{out_h}.
  3621. The @var{x} and @var{y} parameters specify the expressions for the
  3622. position of the top-left corner of the output (non-cropped) area. They
  3623. are evaluated for each frame. If the evaluated value is not valid, it
  3624. is approximated to the nearest valid value.
  3625. The expression for @var{x} may depend on @var{y}, and the expression
  3626. for @var{y} may depend on @var{x}.
  3627. @subsection Examples
  3628. @itemize
  3629. @item
  3630. Crop area with size 100x100 at position (12,34).
  3631. @example
  3632. crop=100:100:12:34
  3633. @end example
  3634. Using named options, the example above becomes:
  3635. @example
  3636. crop=w=100:h=100:x=12:y=34
  3637. @end example
  3638. @item
  3639. Crop the central input area with size 100x100:
  3640. @example
  3641. crop=100:100
  3642. @end example
  3643. @item
  3644. Crop the central input area with size 2/3 of the input video:
  3645. @example
  3646. crop=2/3*in_w:2/3*in_h
  3647. @end example
  3648. @item
  3649. Crop the input video central square:
  3650. @example
  3651. crop=out_w=in_h
  3652. crop=in_h
  3653. @end example
  3654. @item
  3655. Delimit the rectangle with the top-left corner placed at position
  3656. 100:100 and the right-bottom corner corresponding to the right-bottom
  3657. corner of the input image.
  3658. @example
  3659. crop=in_w-100:in_h-100:100:100
  3660. @end example
  3661. @item
  3662. Crop 10 pixels from the left and right borders, and 20 pixels from
  3663. the top and bottom borders
  3664. @example
  3665. crop=in_w-2*10:in_h-2*20
  3666. @end example
  3667. @item
  3668. Keep only the bottom right quarter of the input image:
  3669. @example
  3670. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3671. @end example
  3672. @item
  3673. Crop height for getting Greek harmony:
  3674. @example
  3675. crop=in_w:1/PHI*in_w
  3676. @end example
  3677. @item
  3678. Apply trembling effect:
  3679. @example
  3680. 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)
  3681. @end example
  3682. @item
  3683. Apply erratic camera effect depending on timestamp:
  3684. @example
  3685. 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)"
  3686. @end example
  3687. @item
  3688. Set x depending on the value of y:
  3689. @example
  3690. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3691. @end example
  3692. @end itemize
  3693. @subsection Commands
  3694. This filter supports the following commands:
  3695. @table @option
  3696. @item w, out_w
  3697. @item h, out_h
  3698. @item x
  3699. @item y
  3700. Set width/height of the output video and the horizontal/vertical position
  3701. in the input video.
  3702. The command accepts the same syntax of the corresponding option.
  3703. If the specified expression is not valid, it is kept at its current
  3704. value.
  3705. @end table
  3706. @section cropdetect
  3707. Auto-detect the crop size.
  3708. It calculates the necessary cropping parameters and prints the
  3709. recommended parameters via the logging system. The detected dimensions
  3710. correspond to the non-black area of the input video.
  3711. It accepts the following parameters:
  3712. @table @option
  3713. @item limit
  3714. Set higher black value threshold, which can be optionally specified
  3715. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3716. value greater to the set value is considered non-black. It defaults to 24.
  3717. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3718. on the bitdepth of the pixel format.
  3719. @item round
  3720. The value which the width/height should be divisible by. It defaults to
  3721. 16. The offset is automatically adjusted to center the video. Use 2 to
  3722. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3723. encoding to most video codecs.
  3724. @item reset_count, reset
  3725. Set the counter that determines after how many frames cropdetect will
  3726. reset the previously detected largest video area and start over to
  3727. detect the current optimal crop area. Default value is 0.
  3728. This can be useful when channel logos distort the video area. 0
  3729. indicates 'never reset', and returns the largest area encountered during
  3730. playback.
  3731. @end table
  3732. @anchor{curves}
  3733. @section curves
  3734. Apply color adjustments using curves.
  3735. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3736. component (red, green and blue) has its values defined by @var{N} key points
  3737. tied from each other using a smooth curve. The x-axis represents the pixel
  3738. values from the input frame, and the y-axis the new pixel values to be set for
  3739. the output frame.
  3740. By default, a component curve is defined by the two points @var{(0;0)} and
  3741. @var{(1;1)}. This creates a straight line where each original pixel value is
  3742. "adjusted" to its own value, which means no change to the image.
  3743. The filter allows you to redefine these two points and add some more. A new
  3744. curve (using a natural cubic spline interpolation) will be define to pass
  3745. smoothly through all these new coordinates. The new defined points needs to be
  3746. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3747. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3748. the vector spaces, the values will be clipped accordingly.
  3749. If there is no key point defined in @code{x=0}, the filter will automatically
  3750. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3751. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3752. The filter accepts the following options:
  3753. @table @option
  3754. @item preset
  3755. Select one of the available color presets. This option can be used in addition
  3756. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3757. options takes priority on the preset values.
  3758. Available presets are:
  3759. @table @samp
  3760. @item none
  3761. @item color_negative
  3762. @item cross_process
  3763. @item darker
  3764. @item increase_contrast
  3765. @item lighter
  3766. @item linear_contrast
  3767. @item medium_contrast
  3768. @item negative
  3769. @item strong_contrast
  3770. @item vintage
  3771. @end table
  3772. Default is @code{none}.
  3773. @item master, m
  3774. Set the master key points. These points will define a second pass mapping. It
  3775. is sometimes called a "luminance" or "value" mapping. It can be used with
  3776. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3777. post-processing LUT.
  3778. @item red, r
  3779. Set the key points for the red component.
  3780. @item green, g
  3781. Set the key points for the green component.
  3782. @item blue, b
  3783. Set the key points for the blue component.
  3784. @item all
  3785. Set the key points for all components (not including master).
  3786. Can be used in addition to the other key points component
  3787. options. In this case, the unset component(s) will fallback on this
  3788. @option{all} setting.
  3789. @item psfile
  3790. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3791. @end table
  3792. To avoid some filtergraph syntax conflicts, each key points list need to be
  3793. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3794. @subsection Examples
  3795. @itemize
  3796. @item
  3797. Increase slightly the middle level of blue:
  3798. @example
  3799. curves=blue='0.5/0.58'
  3800. @end example
  3801. @item
  3802. Vintage effect:
  3803. @example
  3804. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3805. @end example
  3806. Here we obtain the following coordinates for each components:
  3807. @table @var
  3808. @item red
  3809. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3810. @item green
  3811. @code{(0;0) (0.50;0.48) (1;1)}
  3812. @item blue
  3813. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3814. @end table
  3815. @item
  3816. The previous example can also be achieved with the associated built-in preset:
  3817. @example
  3818. curves=preset=vintage
  3819. @end example
  3820. @item
  3821. Or simply:
  3822. @example
  3823. curves=vintage
  3824. @end example
  3825. @item
  3826. Use a Photoshop preset and redefine the points of the green component:
  3827. @example
  3828. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3829. @end example
  3830. @end itemize
  3831. @section dctdnoiz
  3832. Denoise frames using 2D DCT (frequency domain filtering).
  3833. This filter is not designed for real time.
  3834. The filter accepts the following options:
  3835. @table @option
  3836. @item sigma, s
  3837. Set the noise sigma constant.
  3838. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3839. coefficient (absolute value) below this threshold with be dropped.
  3840. If you need a more advanced filtering, see @option{expr}.
  3841. Default is @code{0}.
  3842. @item overlap
  3843. Set number overlapping pixels for each block. Since the filter can be slow, you
  3844. may want to reduce this value, at the cost of a less effective filter and the
  3845. risk of various artefacts.
  3846. If the overlapping value doesn't permit processing the whole input width or
  3847. height, a warning will be displayed and according borders won't be denoised.
  3848. Default value is @var{blocksize}-1, which is the best possible setting.
  3849. @item expr, e
  3850. Set the coefficient factor expression.
  3851. For each coefficient of a DCT block, this expression will be evaluated as a
  3852. multiplier value for the coefficient.
  3853. If this is option is set, the @option{sigma} option will be ignored.
  3854. The absolute value of the coefficient can be accessed through the @var{c}
  3855. variable.
  3856. @item n
  3857. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3858. @var{blocksize}, which is the width and height of the processed blocks.
  3859. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3860. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3861. on the speed processing. Also, a larger block size does not necessarily means a
  3862. better de-noising.
  3863. @end table
  3864. @subsection Examples
  3865. Apply a denoise with a @option{sigma} of @code{4.5}:
  3866. @example
  3867. dctdnoiz=4.5
  3868. @end example
  3869. The same operation can be achieved using the expression system:
  3870. @example
  3871. dctdnoiz=e='gte(c, 4.5*3)'
  3872. @end example
  3873. Violent denoise using a block size of @code{16x16}:
  3874. @example
  3875. dctdnoiz=15:n=4
  3876. @end example
  3877. @section deband
  3878. Remove banding artifacts from input video.
  3879. It works by replacing banded pixels with average value of referenced pixels.
  3880. The filter accepts the following options:
  3881. @table @option
  3882. @item 1thr
  3883. @item 2thr
  3884. @item 3thr
  3885. @item 4thr
  3886. Set banding detection threshold for each plane. Default is 0.02.
  3887. Valid range is 0.00003 to 0.5.
  3888. If difference between current pixel and reference pixel is less than threshold,
  3889. it will be considered as banded.
  3890. @item range, r
  3891. Banding detection range in pixels. Default is 16. If positive, random number
  3892. in range 0 to set value will be used. If negative, exact absolute value
  3893. will be used.
  3894. The range defines square of four pixels around current pixel.
  3895. @item direction, d
  3896. Set direction in radians from which four pixel will be compared. If positive,
  3897. random direction from 0 to set direction will be picked. If negative, exact of
  3898. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3899. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3900. column.
  3901. @item blur
  3902. If enabled, current pixel is compared with average value of all four
  3903. surrounding pixels. The default is enabled. If disabled current pixel is
  3904. compared with all four surrounding pixels. The pixel is considered banded
  3905. if only all four differences with surrounding pixels are less than threshold.
  3906. @end table
  3907. @anchor{decimate}
  3908. @section decimate
  3909. Drop duplicated frames at regular intervals.
  3910. The filter accepts the following options:
  3911. @table @option
  3912. @item cycle
  3913. Set the number of frames from which one will be dropped. Setting this to
  3914. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3915. Default is @code{5}.
  3916. @item dupthresh
  3917. Set the threshold for duplicate detection. If the difference metric for a frame
  3918. is less than or equal to this value, then it is declared as duplicate. Default
  3919. is @code{1.1}
  3920. @item scthresh
  3921. Set scene change threshold. Default is @code{15}.
  3922. @item blockx
  3923. @item blocky
  3924. Set the size of the x and y-axis blocks used during metric calculations.
  3925. Larger blocks give better noise suppression, but also give worse detection of
  3926. small movements. Must be a power of two. Default is @code{32}.
  3927. @item ppsrc
  3928. Mark main input as a pre-processed input and activate clean source input
  3929. stream. This allows the input to be pre-processed with various filters to help
  3930. the metrics calculation while keeping the frame selection lossless. When set to
  3931. @code{1}, the first stream is for the pre-processed input, and the second
  3932. stream is the clean source from where the kept frames are chosen. Default is
  3933. @code{0}.
  3934. @item chroma
  3935. Set whether or not chroma is considered in the metric calculations. Default is
  3936. @code{1}.
  3937. @end table
  3938. @section deflate
  3939. Apply deflate effect to the video.
  3940. This filter replaces the pixel by the local(3x3) average by taking into account
  3941. only values lower than the pixel.
  3942. It accepts the following options:
  3943. @table @option
  3944. @item threshold0
  3945. @item threshold1
  3946. @item threshold2
  3947. @item threshold3
  3948. Limit the maximum change for each plane, default is 65535.
  3949. If 0, plane will remain unchanged.
  3950. @end table
  3951. @section dejudder
  3952. Remove judder produced by partially interlaced telecined content.
  3953. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3954. source was partially telecined content then the output of @code{pullup,dejudder}
  3955. will have a variable frame rate. May change the recorded frame rate of the
  3956. container. Aside from that change, this filter will not affect constant frame
  3957. rate video.
  3958. The option available in this filter is:
  3959. @table @option
  3960. @item cycle
  3961. Specify the length of the window over which the judder repeats.
  3962. Accepts any integer greater than 1. Useful values are:
  3963. @table @samp
  3964. @item 4
  3965. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3966. @item 5
  3967. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3968. @item 20
  3969. If a mixture of the two.
  3970. @end table
  3971. The default is @samp{4}.
  3972. @end table
  3973. @section delogo
  3974. Suppress a TV station logo by a simple interpolation of the surrounding
  3975. pixels. Just set a rectangle covering the logo and watch it disappear
  3976. (and sometimes something even uglier appear - your mileage may vary).
  3977. It accepts the following parameters:
  3978. @table @option
  3979. @item x
  3980. @item y
  3981. Specify the top left corner coordinates of the logo. They must be
  3982. specified.
  3983. @item w
  3984. @item h
  3985. Specify the width and height of the logo to clear. They must be
  3986. specified.
  3987. @item band, t
  3988. Specify the thickness of the fuzzy edge of the rectangle (added to
  3989. @var{w} and @var{h}). The default value is 1. This option is
  3990. deprecated, setting higher values should no longer be necessary and
  3991. is not recommended.
  3992. @item show
  3993. When set to 1, a green rectangle is drawn on the screen to simplify
  3994. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3995. The default value is 0.
  3996. The rectangle is drawn on the outermost pixels which will be (partly)
  3997. replaced with interpolated values. The values of the next pixels
  3998. immediately outside this rectangle in each direction will be used to
  3999. compute the interpolated pixel values inside the rectangle.
  4000. @end table
  4001. @subsection Examples
  4002. @itemize
  4003. @item
  4004. Set a rectangle covering the area with top left corner coordinates 0,0
  4005. and size 100x77, and a band of size 10:
  4006. @example
  4007. delogo=x=0:y=0:w=100:h=77:band=10
  4008. @end example
  4009. @end itemize
  4010. @section deshake
  4011. Attempt to fix small changes in horizontal and/or vertical shift. This
  4012. filter helps remove camera shake from hand-holding a camera, bumping a
  4013. tripod, moving on a vehicle, etc.
  4014. The filter accepts the following options:
  4015. @table @option
  4016. @item x
  4017. @item y
  4018. @item w
  4019. @item h
  4020. Specify a rectangular area where to limit the search for motion
  4021. vectors.
  4022. If desired the search for motion vectors can be limited to a
  4023. rectangular area of the frame defined by its top left corner, width
  4024. and height. These parameters have the same meaning as the drawbox
  4025. filter which can be used to visualise the position of the bounding
  4026. box.
  4027. This is useful when simultaneous movement of subjects within the frame
  4028. might be confused for camera motion by the motion vector search.
  4029. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4030. then the full frame is used. This allows later options to be set
  4031. without specifying the bounding box for the motion vector search.
  4032. Default - search the whole frame.
  4033. @item rx
  4034. @item ry
  4035. Specify the maximum extent of movement in x and y directions in the
  4036. range 0-64 pixels. Default 16.
  4037. @item edge
  4038. Specify how to generate pixels to fill blanks at the edge of the
  4039. frame. Available values are:
  4040. @table @samp
  4041. @item blank, 0
  4042. Fill zeroes at blank locations
  4043. @item original, 1
  4044. Original image at blank locations
  4045. @item clamp, 2
  4046. Extruded edge value at blank locations
  4047. @item mirror, 3
  4048. Mirrored edge at blank locations
  4049. @end table
  4050. Default value is @samp{mirror}.
  4051. @item blocksize
  4052. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4053. default 8.
  4054. @item contrast
  4055. Specify the contrast threshold for blocks. Only blocks with more than
  4056. the specified contrast (difference between darkest and lightest
  4057. pixels) will be considered. Range 1-255, default 125.
  4058. @item search
  4059. Specify the search strategy. Available values are:
  4060. @table @samp
  4061. @item exhaustive, 0
  4062. Set exhaustive search
  4063. @item less, 1
  4064. Set less exhaustive search.
  4065. @end table
  4066. Default value is @samp{exhaustive}.
  4067. @item filename
  4068. If set then a detailed log of the motion search is written to the
  4069. specified file.
  4070. @item opencl
  4071. If set to 1, specify using OpenCL capabilities, only available if
  4072. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4073. @end table
  4074. @section detelecine
  4075. Apply an exact inverse of the telecine operation. It requires a predefined
  4076. pattern specified using the pattern option which must be the same as that passed
  4077. to the telecine filter.
  4078. This filter accepts the following options:
  4079. @table @option
  4080. @item first_field
  4081. @table @samp
  4082. @item top, t
  4083. top field first
  4084. @item bottom, b
  4085. bottom field first
  4086. The default value is @code{top}.
  4087. @end table
  4088. @item pattern
  4089. A string of numbers representing the pulldown pattern you wish to apply.
  4090. The default value is @code{23}.
  4091. @item start_frame
  4092. A number representing position of the first frame with respect to the telecine
  4093. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4094. @end table
  4095. @section dilation
  4096. Apply dilation effect to the video.
  4097. This filter replaces the pixel by the local(3x3) maximum.
  4098. It accepts the following options:
  4099. @table @option
  4100. @item threshold0
  4101. @item threshold1
  4102. @item threshold2
  4103. @item threshold3
  4104. Limit the maximum change for each plane, default is 65535.
  4105. If 0, plane will remain unchanged.
  4106. @item coordinates
  4107. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4108. pixels are used.
  4109. Flags to local 3x3 coordinates maps like this:
  4110. 1 2 3
  4111. 4 5
  4112. 6 7 8
  4113. @end table
  4114. @section displace
  4115. Displace pixels as indicated by second and third input stream.
  4116. It takes three input streams and outputs one stream, the first input is the
  4117. source, and second and third input are displacement maps.
  4118. The second input specifies how much to displace pixels along the
  4119. x-axis, while the third input specifies how much to displace pixels
  4120. along the y-axis.
  4121. If one of displacement map streams terminates, last frame from that
  4122. displacement map will be used.
  4123. Note that once generated, displacements maps can be reused over and over again.
  4124. A description of the accepted options follows.
  4125. @table @option
  4126. @item edge
  4127. Set displace behavior for pixels that are out of range.
  4128. Available values are:
  4129. @table @samp
  4130. @item blank
  4131. Missing pixels are replaced by black pixels.
  4132. @item smear
  4133. Adjacent pixels will spread out to replace missing pixels.
  4134. @item wrap
  4135. Out of range pixels are wrapped so they point to pixels of other side.
  4136. @end table
  4137. Default is @samp{smear}.
  4138. @end table
  4139. @subsection Examples
  4140. @itemize
  4141. @item
  4142. Add ripple effect to rgb input of video size hd720:
  4143. @example
  4144. 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
  4145. @end example
  4146. @item
  4147. Add wave effect to rgb input of video size hd720:
  4148. @example
  4149. 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
  4150. @end example
  4151. @end itemize
  4152. @section drawbox
  4153. Draw a colored box on the input image.
  4154. It accepts the following parameters:
  4155. @table @option
  4156. @item x
  4157. @item y
  4158. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4159. @item width, w
  4160. @item height, h
  4161. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4162. the input width and height. It defaults to 0.
  4163. @item color, c
  4164. Specify the color of the box to write. For the general syntax of this option,
  4165. check the "Color" section in the ffmpeg-utils manual. If the special
  4166. value @code{invert} is used, the box edge color is the same as the
  4167. video with inverted luma.
  4168. @item thickness, t
  4169. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4170. See below for the list of accepted constants.
  4171. @end table
  4172. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4173. following constants:
  4174. @table @option
  4175. @item dar
  4176. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4177. @item hsub
  4178. @item vsub
  4179. horizontal and vertical chroma subsample values. For example for the
  4180. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4181. @item in_h, ih
  4182. @item in_w, iw
  4183. The input width and height.
  4184. @item sar
  4185. The input sample aspect ratio.
  4186. @item x
  4187. @item y
  4188. The x and y offset coordinates where the box is drawn.
  4189. @item w
  4190. @item h
  4191. The width and height of the drawn box.
  4192. @item t
  4193. The thickness of the drawn box.
  4194. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4195. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4196. @end table
  4197. @subsection Examples
  4198. @itemize
  4199. @item
  4200. Draw a black box around the edge of the input image:
  4201. @example
  4202. drawbox
  4203. @end example
  4204. @item
  4205. Draw a box with color red and an opacity of 50%:
  4206. @example
  4207. drawbox=10:20:200:60:red@@0.5
  4208. @end example
  4209. The previous example can be specified as:
  4210. @example
  4211. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4212. @end example
  4213. @item
  4214. Fill the box with pink color:
  4215. @example
  4216. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4217. @end example
  4218. @item
  4219. Draw a 2-pixel red 2.40:1 mask:
  4220. @example
  4221. 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
  4222. @end example
  4223. @end itemize
  4224. @section drawgraph, adrawgraph
  4225. Draw a graph using input video or audio metadata.
  4226. It accepts the following parameters:
  4227. @table @option
  4228. @item m1
  4229. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4230. @item fg1
  4231. Set 1st foreground color expression.
  4232. @item m2
  4233. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4234. @item fg2
  4235. Set 2nd foreground color expression.
  4236. @item m3
  4237. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4238. @item fg3
  4239. Set 3rd foreground color expression.
  4240. @item m4
  4241. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4242. @item fg4
  4243. Set 4th foreground color expression.
  4244. @item min
  4245. Set minimal value of metadata value.
  4246. @item max
  4247. Set maximal value of metadata value.
  4248. @item bg
  4249. Set graph background color. Default is white.
  4250. @item mode
  4251. Set graph mode.
  4252. Available values for mode is:
  4253. @table @samp
  4254. @item bar
  4255. @item dot
  4256. @item line
  4257. @end table
  4258. Default is @code{line}.
  4259. @item slide
  4260. Set slide mode.
  4261. Available values for slide is:
  4262. @table @samp
  4263. @item frame
  4264. Draw new frame when right border is reached.
  4265. @item replace
  4266. Replace old columns with new ones.
  4267. @item scroll
  4268. Scroll from right to left.
  4269. @item rscroll
  4270. Scroll from left to right.
  4271. @end table
  4272. Default is @code{frame}.
  4273. @item size
  4274. Set size of graph video. For the syntax of this option, check the
  4275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4276. The default value is @code{900x256}.
  4277. The foreground color expressions can use the following variables:
  4278. @table @option
  4279. @item MIN
  4280. Minimal value of metadata value.
  4281. @item MAX
  4282. Maximal value of metadata value.
  4283. @item VAL
  4284. Current metadata key value.
  4285. @end table
  4286. The color is defined as 0xAABBGGRR.
  4287. @end table
  4288. Example using metadata from @ref{signalstats} filter:
  4289. @example
  4290. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4291. @end example
  4292. Example using metadata from @ref{ebur128} filter:
  4293. @example
  4294. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4295. @end example
  4296. @section drawgrid
  4297. Draw a grid on the input image.
  4298. It accepts the following parameters:
  4299. @table @option
  4300. @item x
  4301. @item y
  4302. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4303. @item width, w
  4304. @item height, h
  4305. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4306. input width and height, respectively, minus @code{thickness}, so image gets
  4307. framed. Default to 0.
  4308. @item color, c
  4309. Specify the color of the grid. For the general syntax of this option,
  4310. check the "Color" section in the ffmpeg-utils manual. If the special
  4311. value @code{invert} is used, the grid color is the same as the
  4312. video with inverted luma.
  4313. @item thickness, t
  4314. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4315. See below for the list of accepted constants.
  4316. @end table
  4317. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4318. following constants:
  4319. @table @option
  4320. @item dar
  4321. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4322. @item hsub
  4323. @item vsub
  4324. horizontal and vertical chroma subsample values. For example for the
  4325. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4326. @item in_h, ih
  4327. @item in_w, iw
  4328. The input grid cell width and height.
  4329. @item sar
  4330. The input sample aspect ratio.
  4331. @item x
  4332. @item y
  4333. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4334. @item w
  4335. @item h
  4336. The width and height of the drawn cell.
  4337. @item t
  4338. The thickness of the drawn cell.
  4339. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4340. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4341. @end table
  4342. @subsection Examples
  4343. @itemize
  4344. @item
  4345. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4346. @example
  4347. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4348. @end example
  4349. @item
  4350. Draw a white 3x3 grid with an opacity of 50%:
  4351. @example
  4352. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4353. @end example
  4354. @end itemize
  4355. @anchor{drawtext}
  4356. @section drawtext
  4357. Draw a text string or text from a specified file on top of a video, using the
  4358. libfreetype library.
  4359. To enable compilation of this filter, you need to configure FFmpeg with
  4360. @code{--enable-libfreetype}.
  4361. To enable default font fallback and the @var{font} option you need to
  4362. configure FFmpeg with @code{--enable-libfontconfig}.
  4363. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4364. @code{--enable-libfribidi}.
  4365. @subsection Syntax
  4366. It accepts the following parameters:
  4367. @table @option
  4368. @item box
  4369. Used to draw a box around text using the background color.
  4370. The value must be either 1 (enable) or 0 (disable).
  4371. The default value of @var{box} is 0.
  4372. @item boxborderw
  4373. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4374. The default value of @var{boxborderw} is 0.
  4375. @item boxcolor
  4376. The color to be used for drawing box around text. For the syntax of this
  4377. option, check the "Color" section in the ffmpeg-utils manual.
  4378. The default value of @var{boxcolor} is "white".
  4379. @item borderw
  4380. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4381. The default value of @var{borderw} is 0.
  4382. @item bordercolor
  4383. Set the color to be used for drawing border around text. For the syntax of this
  4384. option, check the "Color" section in the ffmpeg-utils manual.
  4385. The default value of @var{bordercolor} is "black".
  4386. @item expansion
  4387. Select how the @var{text} is expanded. Can be either @code{none},
  4388. @code{strftime} (deprecated) or
  4389. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4390. below for details.
  4391. @item fix_bounds
  4392. If true, check and fix text coords to avoid clipping.
  4393. @item fontcolor
  4394. The color to be used for drawing fonts. For the syntax of this option, check
  4395. the "Color" section in the ffmpeg-utils manual.
  4396. The default value of @var{fontcolor} is "black".
  4397. @item fontcolor_expr
  4398. String which is expanded the same way as @var{text} to obtain dynamic
  4399. @var{fontcolor} value. By default this option has empty value and is not
  4400. processed. When this option is set, it overrides @var{fontcolor} option.
  4401. @item font
  4402. The font family to be used for drawing text. By default Sans.
  4403. @item fontfile
  4404. The font file to be used for drawing text. The path must be included.
  4405. This parameter is mandatory if the fontconfig support is disabled.
  4406. @item draw
  4407. This option does not exist, please see the timeline system
  4408. @item alpha
  4409. Draw the text applying alpha blending. The value can
  4410. be either a number between 0.0 and 1.0
  4411. The expression accepts the same variables @var{x, y} do.
  4412. The default value is 1.
  4413. Please see fontcolor_expr
  4414. @item fontsize
  4415. The font size to be used for drawing text.
  4416. The default value of @var{fontsize} is 16.
  4417. @item text_shaping
  4418. If set to 1, attempt to shape the text (for example, reverse the order of
  4419. right-to-left text and join Arabic characters) before drawing it.
  4420. Otherwise, just draw the text exactly as given.
  4421. By default 1 (if supported).
  4422. @item ft_load_flags
  4423. The flags to be used for loading the fonts.
  4424. The flags map the corresponding flags supported by libfreetype, and are
  4425. a combination of the following values:
  4426. @table @var
  4427. @item default
  4428. @item no_scale
  4429. @item no_hinting
  4430. @item render
  4431. @item no_bitmap
  4432. @item vertical_layout
  4433. @item force_autohint
  4434. @item crop_bitmap
  4435. @item pedantic
  4436. @item ignore_global_advance_width
  4437. @item no_recurse
  4438. @item ignore_transform
  4439. @item monochrome
  4440. @item linear_design
  4441. @item no_autohint
  4442. @end table
  4443. Default value is "default".
  4444. For more information consult the documentation for the FT_LOAD_*
  4445. libfreetype flags.
  4446. @item shadowcolor
  4447. The color to be used for drawing a shadow behind the drawn text. For the
  4448. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4449. The default value of @var{shadowcolor} is "black".
  4450. @item shadowx
  4451. @item shadowy
  4452. The x and y offsets for the text shadow position with respect to the
  4453. position of the text. They can be either positive or negative
  4454. values. The default value for both is "0".
  4455. @item start_number
  4456. The starting frame number for the n/frame_num variable. The default value
  4457. is "0".
  4458. @item tabsize
  4459. The size in number of spaces to use for rendering the tab.
  4460. Default value is 4.
  4461. @item timecode
  4462. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4463. format. It can be used with or without text parameter. @var{timecode_rate}
  4464. option must be specified.
  4465. @item timecode_rate, rate, r
  4466. Set the timecode frame rate (timecode only).
  4467. @item text
  4468. The text string to be drawn. The text must be a sequence of UTF-8
  4469. encoded characters.
  4470. This parameter is mandatory if no file is specified with the parameter
  4471. @var{textfile}.
  4472. @item textfile
  4473. A text file containing text to be drawn. The text must be a sequence
  4474. of UTF-8 encoded characters.
  4475. This parameter is mandatory if no text string is specified with the
  4476. parameter @var{text}.
  4477. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4478. @item reload
  4479. If set to 1, the @var{textfile} will be reloaded before each frame.
  4480. Be sure to update it atomically, or it may be read partially, or even fail.
  4481. @item x
  4482. @item y
  4483. The expressions which specify the offsets where text will be drawn
  4484. within the video frame. They are relative to the top/left border of the
  4485. output image.
  4486. The default value of @var{x} and @var{y} is "0".
  4487. See below for the list of accepted constants and functions.
  4488. @end table
  4489. The parameters for @var{x} and @var{y} are expressions containing the
  4490. following constants and functions:
  4491. @table @option
  4492. @item dar
  4493. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4494. @item hsub
  4495. @item vsub
  4496. horizontal and vertical chroma subsample values. For example for the
  4497. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4498. @item line_h, lh
  4499. the height of each text line
  4500. @item main_h, h, H
  4501. the input height
  4502. @item main_w, w, W
  4503. the input width
  4504. @item max_glyph_a, ascent
  4505. the maximum distance from the baseline to the highest/upper grid
  4506. coordinate used to place a glyph outline point, for all the rendered
  4507. glyphs.
  4508. It is a positive value, due to the grid's orientation with the Y axis
  4509. upwards.
  4510. @item max_glyph_d, descent
  4511. the maximum distance from the baseline to the lowest grid coordinate
  4512. used to place a glyph outline point, for all the rendered glyphs.
  4513. This is a negative value, due to the grid's orientation, with the Y axis
  4514. upwards.
  4515. @item max_glyph_h
  4516. maximum glyph height, that is the maximum height for all the glyphs
  4517. contained in the rendered text, it is equivalent to @var{ascent} -
  4518. @var{descent}.
  4519. @item max_glyph_w
  4520. maximum glyph width, that is the maximum width for all the glyphs
  4521. contained in the rendered text
  4522. @item n
  4523. the number of input frame, starting from 0
  4524. @item rand(min, max)
  4525. return a random number included between @var{min} and @var{max}
  4526. @item sar
  4527. The input sample aspect ratio.
  4528. @item t
  4529. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4530. @item text_h, th
  4531. the height of the rendered text
  4532. @item text_w, tw
  4533. the width of the rendered text
  4534. @item x
  4535. @item y
  4536. the x and y offset coordinates where the text is drawn.
  4537. These parameters allow the @var{x} and @var{y} expressions to refer
  4538. each other, so you can for example specify @code{y=x/dar}.
  4539. @end table
  4540. @anchor{drawtext_expansion}
  4541. @subsection Text expansion
  4542. If @option{expansion} is set to @code{strftime},
  4543. the filter recognizes strftime() sequences in the provided text and
  4544. expands them accordingly. Check the documentation of strftime(). This
  4545. feature is deprecated.
  4546. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4547. If @option{expansion} is set to @code{normal} (which is the default),
  4548. the following expansion mechanism is used.
  4549. The backslash character @samp{\}, followed by any character, always expands to
  4550. the second character.
  4551. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4552. braces is a function name, possibly followed by arguments separated by ':'.
  4553. If the arguments contain special characters or delimiters (':' or '@}'),
  4554. they should be escaped.
  4555. Note that they probably must also be escaped as the value for the
  4556. @option{text} option in the filter argument string and as the filter
  4557. argument in the filtergraph description, and possibly also for the shell,
  4558. that makes up to four levels of escaping; using a text file avoids these
  4559. problems.
  4560. The following functions are available:
  4561. @table @command
  4562. @item expr, e
  4563. The expression evaluation result.
  4564. It must take one argument specifying the expression to be evaluated,
  4565. which accepts the same constants and functions as the @var{x} and
  4566. @var{y} values. Note that not all constants should be used, for
  4567. example the text size is not known when evaluating the expression, so
  4568. the constants @var{text_w} and @var{text_h} will have an undefined
  4569. value.
  4570. @item expr_int_format, eif
  4571. Evaluate the expression's value and output as formatted integer.
  4572. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4573. The second argument specifies the output format. Allowed values are @samp{x},
  4574. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4575. @code{printf} function.
  4576. The third parameter is optional and sets the number of positions taken by the output.
  4577. It can be used to add padding with zeros from the left.
  4578. @item gmtime
  4579. The time at which the filter is running, expressed in UTC.
  4580. It can accept an argument: a strftime() format string.
  4581. @item localtime
  4582. The time at which the filter is running, expressed in the local time zone.
  4583. It can accept an argument: a strftime() format string.
  4584. @item metadata
  4585. Frame metadata. It must take one argument specifying metadata key.
  4586. @item n, frame_num
  4587. The frame number, starting from 0.
  4588. @item pict_type
  4589. A 1 character description of the current picture type.
  4590. @item pts
  4591. The timestamp of the current frame.
  4592. It can take up to three arguments.
  4593. The first argument is the format of the timestamp; it defaults to @code{flt}
  4594. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4595. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4596. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4597. @code{localtime} stands for the timestamp of the frame formatted as
  4598. local time zone time.
  4599. The second argument is an offset added to the timestamp.
  4600. If the format is set to @code{localtime} or @code{gmtime},
  4601. a third argument may be supplied: a strftime() format string.
  4602. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4603. @end table
  4604. @subsection Examples
  4605. @itemize
  4606. @item
  4607. Draw "Test Text" with font FreeSerif, using the default values for the
  4608. optional parameters.
  4609. @example
  4610. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4611. @end example
  4612. @item
  4613. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4614. and y=50 (counting from the top-left corner of the screen), text is
  4615. yellow with a red box around it. Both the text and the box have an
  4616. opacity of 20%.
  4617. @example
  4618. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4619. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4620. @end example
  4621. Note that the double quotes are not necessary if spaces are not used
  4622. within the parameter list.
  4623. @item
  4624. Show the text at the center of the video frame:
  4625. @example
  4626. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4627. @end example
  4628. @item
  4629. Show a text line sliding from right to left in the last row of the video
  4630. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4631. with no newlines.
  4632. @example
  4633. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4634. @end example
  4635. @item
  4636. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4637. @example
  4638. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4639. @end example
  4640. @item
  4641. Draw a single green letter "g", at the center of the input video.
  4642. The glyph baseline is placed at half screen height.
  4643. @example
  4644. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4645. @end example
  4646. @item
  4647. Show text for 1 second every 3 seconds:
  4648. @example
  4649. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4650. @end example
  4651. @item
  4652. Use fontconfig to set the font. Note that the colons need to be escaped.
  4653. @example
  4654. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4655. @end example
  4656. @item
  4657. Print the date of a real-time encoding (see strftime(3)):
  4658. @example
  4659. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4660. @end example
  4661. @item
  4662. Show text fading in and out (appearing/disappearing):
  4663. @example
  4664. #!/bin/sh
  4665. DS=1.0 # display start
  4666. DE=10.0 # display end
  4667. FID=1.5 # fade in duration
  4668. FOD=5 # fade out duration
  4669. 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 @}"
  4670. @end example
  4671. @end itemize
  4672. For more information about libfreetype, check:
  4673. @url{http://www.freetype.org/}.
  4674. For more information about fontconfig, check:
  4675. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4676. For more information about libfribidi, check:
  4677. @url{http://fribidi.org/}.
  4678. @section edgedetect
  4679. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4680. The filter accepts the following options:
  4681. @table @option
  4682. @item low
  4683. @item high
  4684. Set low and high threshold values used by the Canny thresholding
  4685. algorithm.
  4686. The high threshold selects the "strong" edge pixels, which are then
  4687. connected through 8-connectivity with the "weak" edge pixels selected
  4688. by the low threshold.
  4689. @var{low} and @var{high} threshold values must be chosen in the range
  4690. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4691. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4692. is @code{50/255}.
  4693. @item mode
  4694. Define the drawing mode.
  4695. @table @samp
  4696. @item wires
  4697. Draw white/gray wires on black background.
  4698. @item colormix
  4699. Mix the colors to create a paint/cartoon effect.
  4700. @end table
  4701. Default value is @var{wires}.
  4702. @end table
  4703. @subsection Examples
  4704. @itemize
  4705. @item
  4706. Standard edge detection with custom values for the hysteresis thresholding:
  4707. @example
  4708. edgedetect=low=0.1:high=0.4
  4709. @end example
  4710. @item
  4711. Painting effect without thresholding:
  4712. @example
  4713. edgedetect=mode=colormix:high=0
  4714. @end example
  4715. @end itemize
  4716. @section eq
  4717. Set brightness, contrast, saturation and approximate gamma adjustment.
  4718. The filter accepts the following options:
  4719. @table @option
  4720. @item contrast
  4721. Set the contrast expression. The value must be a float value in range
  4722. @code{-2.0} to @code{2.0}. The default value is "1".
  4723. @item brightness
  4724. Set the brightness expression. The value must be a float value in
  4725. range @code{-1.0} to @code{1.0}. The default value is "0".
  4726. @item saturation
  4727. Set the saturation expression. The value must be a float in
  4728. range @code{0.0} to @code{3.0}. The default value is "1".
  4729. @item gamma
  4730. Set the gamma expression. The value must be a float in range
  4731. @code{0.1} to @code{10.0}. The default value is "1".
  4732. @item gamma_r
  4733. Set the gamma expression for red. The value must be a float in
  4734. range @code{0.1} to @code{10.0}. The default value is "1".
  4735. @item gamma_g
  4736. Set the gamma expression for green. The value must be a float in range
  4737. @code{0.1} to @code{10.0}. The default value is "1".
  4738. @item gamma_b
  4739. Set the gamma expression for blue. The value must be a float in range
  4740. @code{0.1} to @code{10.0}. The default value is "1".
  4741. @item gamma_weight
  4742. Set the gamma weight expression. It can be used to reduce the effect
  4743. of a high gamma value on bright image areas, e.g. keep them from
  4744. getting overamplified and just plain white. The value must be a float
  4745. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4746. gamma correction all the way down while @code{1.0} leaves it at its
  4747. full strength. Default is "1".
  4748. @item eval
  4749. Set when the expressions for brightness, contrast, saturation and
  4750. gamma expressions are evaluated.
  4751. It accepts the following values:
  4752. @table @samp
  4753. @item init
  4754. only evaluate expressions once during the filter initialization or
  4755. when a command is processed
  4756. @item frame
  4757. evaluate expressions for each incoming frame
  4758. @end table
  4759. Default value is @samp{init}.
  4760. @end table
  4761. The expressions accept the following parameters:
  4762. @table @option
  4763. @item n
  4764. frame count of the input frame starting from 0
  4765. @item pos
  4766. byte position of the corresponding packet in the input file, NAN if
  4767. unspecified
  4768. @item r
  4769. frame rate of the input video, NAN if the input frame rate is unknown
  4770. @item t
  4771. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4772. @end table
  4773. @subsection Commands
  4774. The filter supports the following commands:
  4775. @table @option
  4776. @item contrast
  4777. Set the contrast expression.
  4778. @item brightness
  4779. Set the brightness expression.
  4780. @item saturation
  4781. Set the saturation expression.
  4782. @item gamma
  4783. Set the gamma expression.
  4784. @item gamma_r
  4785. Set the gamma_r expression.
  4786. @item gamma_g
  4787. Set gamma_g expression.
  4788. @item gamma_b
  4789. Set gamma_b expression.
  4790. @item gamma_weight
  4791. Set gamma_weight expression.
  4792. The command accepts the same syntax of the corresponding option.
  4793. If the specified expression is not valid, it is kept at its current
  4794. value.
  4795. @end table
  4796. @section erosion
  4797. Apply erosion effect to the video.
  4798. This filter replaces the pixel by the local(3x3) minimum.
  4799. It accepts the following options:
  4800. @table @option
  4801. @item threshold0
  4802. @item threshold1
  4803. @item threshold2
  4804. @item threshold3
  4805. Limit the maximum change for each plane, default is 65535.
  4806. If 0, plane will remain unchanged.
  4807. @item coordinates
  4808. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4809. pixels are used.
  4810. Flags to local 3x3 coordinates maps like this:
  4811. 1 2 3
  4812. 4 5
  4813. 6 7 8
  4814. @end table
  4815. @section extractplanes
  4816. Extract color channel components from input video stream into
  4817. separate grayscale video streams.
  4818. The filter accepts the following option:
  4819. @table @option
  4820. @item planes
  4821. Set plane(s) to extract.
  4822. Available values for planes are:
  4823. @table @samp
  4824. @item y
  4825. @item u
  4826. @item v
  4827. @item a
  4828. @item r
  4829. @item g
  4830. @item b
  4831. @end table
  4832. Choosing planes not available in the input will result in an error.
  4833. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4834. with @code{y}, @code{u}, @code{v} planes at same time.
  4835. @end table
  4836. @subsection Examples
  4837. @itemize
  4838. @item
  4839. Extract luma, u and v color channel component from input video frame
  4840. into 3 grayscale outputs:
  4841. @example
  4842. 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
  4843. @end example
  4844. @end itemize
  4845. @section elbg
  4846. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4847. For each input image, the filter will compute the optimal mapping from
  4848. the input to the output given the codebook length, that is the number
  4849. of distinct output colors.
  4850. This filter accepts the following options.
  4851. @table @option
  4852. @item codebook_length, l
  4853. Set codebook length. The value must be a positive integer, and
  4854. represents the number of distinct output colors. Default value is 256.
  4855. @item nb_steps, n
  4856. Set the maximum number of iterations to apply for computing the optimal
  4857. mapping. The higher the value the better the result and the higher the
  4858. computation time. Default value is 1.
  4859. @item seed, s
  4860. Set a random seed, must be an integer included between 0 and
  4861. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4862. will try to use a good random seed on a best effort basis.
  4863. @item pal8
  4864. Set pal8 output pixel format. This option does not work with codebook
  4865. length greater than 256.
  4866. @end table
  4867. @section fade
  4868. Apply a fade-in/out effect to the input video.
  4869. It accepts the following parameters:
  4870. @table @option
  4871. @item type, t
  4872. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4873. effect.
  4874. Default is @code{in}.
  4875. @item start_frame, s
  4876. Specify the number of the frame to start applying the fade
  4877. effect at. Default is 0.
  4878. @item nb_frames, n
  4879. The number of frames that the fade effect lasts. At the end of the
  4880. fade-in effect, the output video will have the same intensity as the input video.
  4881. At the end of the fade-out transition, the output video will be filled with the
  4882. selected @option{color}.
  4883. Default is 25.
  4884. @item alpha
  4885. If set to 1, fade only alpha channel, if one exists on the input.
  4886. Default value is 0.
  4887. @item start_time, st
  4888. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4889. effect. If both start_frame and start_time are specified, the fade will start at
  4890. whichever comes last. Default is 0.
  4891. @item duration, d
  4892. The number of seconds for which the fade effect has to last. At the end of the
  4893. fade-in effect the output video will have the same intensity as the input video,
  4894. at the end of the fade-out transition the output video will be filled with the
  4895. selected @option{color}.
  4896. If both duration and nb_frames are specified, duration is used. Default is 0
  4897. (nb_frames is used by default).
  4898. @item color, c
  4899. Specify the color of the fade. Default is "black".
  4900. @end table
  4901. @subsection Examples
  4902. @itemize
  4903. @item
  4904. Fade in the first 30 frames of video:
  4905. @example
  4906. fade=in:0:30
  4907. @end example
  4908. The command above is equivalent to:
  4909. @example
  4910. fade=t=in:s=0:n=30
  4911. @end example
  4912. @item
  4913. Fade out the last 45 frames of a 200-frame video:
  4914. @example
  4915. fade=out:155:45
  4916. fade=type=out:start_frame=155:nb_frames=45
  4917. @end example
  4918. @item
  4919. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4920. @example
  4921. fade=in:0:25, fade=out:975:25
  4922. @end example
  4923. @item
  4924. Make the first 5 frames yellow, then fade in from frame 5-24:
  4925. @example
  4926. fade=in:5:20:color=yellow
  4927. @end example
  4928. @item
  4929. Fade in alpha over first 25 frames of video:
  4930. @example
  4931. fade=in:0:25:alpha=1
  4932. @end example
  4933. @item
  4934. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4935. @example
  4936. fade=t=in:st=5.5:d=0.5
  4937. @end example
  4938. @end itemize
  4939. @section fftfilt
  4940. Apply arbitrary expressions to samples in frequency domain
  4941. @table @option
  4942. @item dc_Y
  4943. Adjust the dc value (gain) of the luma plane of the image. The filter
  4944. accepts an integer value in range @code{0} to @code{1000}. The default
  4945. value is set to @code{0}.
  4946. @item dc_U
  4947. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4948. filter accepts an integer value in range @code{0} to @code{1000}. The
  4949. default value is set to @code{0}.
  4950. @item dc_V
  4951. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4952. filter accepts an integer value in range @code{0} to @code{1000}. The
  4953. default value is set to @code{0}.
  4954. @item weight_Y
  4955. Set the frequency domain weight expression for the luma plane.
  4956. @item weight_U
  4957. Set the frequency domain weight expression for the 1st chroma plane.
  4958. @item weight_V
  4959. Set the frequency domain weight expression for the 2nd chroma plane.
  4960. The filter accepts the following variables:
  4961. @item X
  4962. @item Y
  4963. The coordinates of the current sample.
  4964. @item W
  4965. @item H
  4966. The width and height of the image.
  4967. @end table
  4968. @subsection Examples
  4969. @itemize
  4970. @item
  4971. High-pass:
  4972. @example
  4973. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4974. @end example
  4975. @item
  4976. Low-pass:
  4977. @example
  4978. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4979. @end example
  4980. @item
  4981. Sharpen:
  4982. @example
  4983. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4984. @end example
  4985. @item
  4986. Blur:
  4987. @example
  4988. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  4989. @end example
  4990. @end itemize
  4991. @section field
  4992. Extract a single field from an interlaced image using stride
  4993. arithmetic to avoid wasting CPU time. The output frames are marked as
  4994. non-interlaced.
  4995. The filter accepts the following options:
  4996. @table @option
  4997. @item type
  4998. Specify whether to extract the top (if the value is @code{0} or
  4999. @code{top}) or the bottom field (if the value is @code{1} or
  5000. @code{bottom}).
  5001. @end table
  5002. @section fieldmatch
  5003. Field matching filter for inverse telecine. It is meant to reconstruct the
  5004. progressive frames from a telecined stream. The filter does not drop duplicated
  5005. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5006. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5007. The separation of the field matching and the decimation is notably motivated by
  5008. the possibility of inserting a de-interlacing filter fallback between the two.
  5009. If the source has mixed telecined and real interlaced content,
  5010. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5011. But these remaining combed frames will be marked as interlaced, and thus can be
  5012. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5013. In addition to the various configuration options, @code{fieldmatch} can take an
  5014. optional second stream, activated through the @option{ppsrc} option. If
  5015. enabled, the frames reconstruction will be based on the fields and frames from
  5016. this second stream. This allows the first input to be pre-processed in order to
  5017. help the various algorithms of the filter, while keeping the output lossless
  5018. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5019. or brightness/contrast adjustments can help.
  5020. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5021. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5022. which @code{fieldmatch} is based on. While the semantic and usage are very
  5023. close, some behaviour and options names can differ.
  5024. The @ref{decimate} filter currently only works for constant frame rate input.
  5025. If your input has mixed telecined (30fps) and progressive content with a lower
  5026. framerate like 24fps use the following filterchain to produce the necessary cfr
  5027. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5028. The filter accepts the following options:
  5029. @table @option
  5030. @item order
  5031. Specify the assumed field order of the input stream. Available values are:
  5032. @table @samp
  5033. @item auto
  5034. Auto detect parity (use FFmpeg's internal parity value).
  5035. @item bff
  5036. Assume bottom field first.
  5037. @item tff
  5038. Assume top field first.
  5039. @end table
  5040. Note that it is sometimes recommended not to trust the parity announced by the
  5041. stream.
  5042. Default value is @var{auto}.
  5043. @item mode
  5044. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5045. sense that it won't risk creating jerkiness due to duplicate frames when
  5046. possible, but if there are bad edits or blended fields it will end up
  5047. outputting combed frames when a good match might actually exist. On the other
  5048. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5049. but will almost always find a good frame if there is one. The other values are
  5050. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5051. jerkiness and creating duplicate frames versus finding good matches in sections
  5052. with bad edits, orphaned fields, blended fields, etc.
  5053. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5054. Available values are:
  5055. @table @samp
  5056. @item pc
  5057. 2-way matching (p/c)
  5058. @item pc_n
  5059. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5060. @item pc_u
  5061. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5062. @item pc_n_ub
  5063. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5064. still combed (p/c + n + u/b)
  5065. @item pcn
  5066. 3-way matching (p/c/n)
  5067. @item pcn_ub
  5068. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5069. detected as combed (p/c/n + u/b)
  5070. @end table
  5071. The parenthesis at the end indicate the matches that would be used for that
  5072. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5073. @var{top}).
  5074. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5075. the slowest.
  5076. Default value is @var{pc_n}.
  5077. @item ppsrc
  5078. Mark the main input stream as a pre-processed input, and enable the secondary
  5079. input stream as the clean source to pick the fields from. See the filter
  5080. introduction for more details. It is similar to the @option{clip2} feature from
  5081. VFM/TFM.
  5082. Default value is @code{0} (disabled).
  5083. @item field
  5084. Set the field to match from. It is recommended to set this to the same value as
  5085. @option{order} unless you experience matching failures with that setting. In
  5086. certain circumstances changing the field that is used to match from can have a
  5087. large impact on matching performance. Available values are:
  5088. @table @samp
  5089. @item auto
  5090. Automatic (same value as @option{order}).
  5091. @item bottom
  5092. Match from the bottom field.
  5093. @item top
  5094. Match from the top field.
  5095. @end table
  5096. Default value is @var{auto}.
  5097. @item mchroma
  5098. Set whether or not chroma is included during the match comparisons. In most
  5099. cases it is recommended to leave this enabled. You should set this to @code{0}
  5100. only if your clip has bad chroma problems such as heavy rainbowing or other
  5101. artifacts. Setting this to @code{0} could also be used to speed things up at
  5102. the cost of some accuracy.
  5103. Default value is @code{1}.
  5104. @item y0
  5105. @item y1
  5106. These define an exclusion band which excludes the lines between @option{y0} and
  5107. @option{y1} from being included in the field matching decision. An exclusion
  5108. band can be used to ignore subtitles, a logo, or other things that may
  5109. interfere with the matching. @option{y0} sets the starting scan line and
  5110. @option{y1} sets the ending line; all lines in between @option{y0} and
  5111. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5112. @option{y0} and @option{y1} to the same value will disable the feature.
  5113. @option{y0} and @option{y1} defaults to @code{0}.
  5114. @item scthresh
  5115. Set the scene change detection threshold as a percentage of maximum change on
  5116. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5117. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5118. @option{scthresh} is @code{[0.0, 100.0]}.
  5119. Default value is @code{12.0}.
  5120. @item combmatch
  5121. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5122. account the combed scores of matches when deciding what match to use as the
  5123. final match. Available values are:
  5124. @table @samp
  5125. @item none
  5126. No final matching based on combed scores.
  5127. @item sc
  5128. Combed scores are only used when a scene change is detected.
  5129. @item full
  5130. Use combed scores all the time.
  5131. @end table
  5132. Default is @var{sc}.
  5133. @item combdbg
  5134. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5135. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5136. Available values are:
  5137. @table @samp
  5138. @item none
  5139. No forced calculation.
  5140. @item pcn
  5141. Force p/c/n calculations.
  5142. @item pcnub
  5143. Force p/c/n/u/b calculations.
  5144. @end table
  5145. Default value is @var{none}.
  5146. @item cthresh
  5147. This is the area combing threshold used for combed frame detection. This
  5148. essentially controls how "strong" or "visible" combing must be to be detected.
  5149. Larger values mean combing must be more visible and smaller values mean combing
  5150. can be less visible or strong and still be detected. Valid settings are from
  5151. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5152. be detected as combed). This is basically a pixel difference value. A good
  5153. range is @code{[8, 12]}.
  5154. Default value is @code{9}.
  5155. @item chroma
  5156. Sets whether or not chroma is considered in the combed frame decision. Only
  5157. disable this if your source has chroma problems (rainbowing, etc.) that are
  5158. causing problems for the combed frame detection with chroma enabled. Actually,
  5159. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5160. where there is chroma only combing in the source.
  5161. Default value is @code{0}.
  5162. @item blockx
  5163. @item blocky
  5164. Respectively set the x-axis and y-axis size of the window used during combed
  5165. frame detection. This has to do with the size of the area in which
  5166. @option{combpel} pixels are required to be detected as combed for a frame to be
  5167. declared combed. See the @option{combpel} parameter description for more info.
  5168. Possible values are any number that is a power of 2 starting at 4 and going up
  5169. to 512.
  5170. Default value is @code{16}.
  5171. @item combpel
  5172. The number of combed pixels inside any of the @option{blocky} by
  5173. @option{blockx} size blocks on the frame for the frame to be detected as
  5174. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5175. setting controls "how much" combing there must be in any localized area (a
  5176. window defined by the @option{blockx} and @option{blocky} settings) on the
  5177. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5178. which point no frames will ever be detected as combed). This setting is known
  5179. as @option{MI} in TFM/VFM vocabulary.
  5180. Default value is @code{80}.
  5181. @end table
  5182. @anchor{p/c/n/u/b meaning}
  5183. @subsection p/c/n/u/b meaning
  5184. @subsubsection p/c/n
  5185. We assume the following telecined stream:
  5186. @example
  5187. Top fields: 1 2 2 3 4
  5188. Bottom fields: 1 2 3 4 4
  5189. @end example
  5190. The numbers correspond to the progressive frame the fields relate to. Here, the
  5191. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5192. When @code{fieldmatch} is configured to run a matching from bottom
  5193. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5194. @example
  5195. Input stream:
  5196. T 1 2 2 3 4
  5197. B 1 2 3 4 4 <-- matching reference
  5198. Matches: c c n n c
  5199. Output stream:
  5200. T 1 2 3 4 4
  5201. B 1 2 3 4 4
  5202. @end example
  5203. As a result of the field matching, we can see that some frames get duplicated.
  5204. To perform a complete inverse telecine, you need to rely on a decimation filter
  5205. after this operation. See for instance the @ref{decimate} filter.
  5206. The same operation now matching from top fields (@option{field}=@var{top})
  5207. looks like this:
  5208. @example
  5209. Input stream:
  5210. T 1 2 2 3 4 <-- matching reference
  5211. B 1 2 3 4 4
  5212. Matches: c c p p c
  5213. Output stream:
  5214. T 1 2 2 3 4
  5215. B 1 2 2 3 4
  5216. @end example
  5217. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5218. basically, they refer to the frame and field of the opposite parity:
  5219. @itemize
  5220. @item @var{p} matches the field of the opposite parity in the previous frame
  5221. @item @var{c} matches the field of the opposite parity in the current frame
  5222. @item @var{n} matches the field of the opposite parity in the next frame
  5223. @end itemize
  5224. @subsubsection u/b
  5225. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5226. from the opposite parity flag. In the following examples, we assume that we are
  5227. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5228. 'x' is placed above and below each matched fields.
  5229. With bottom matching (@option{field}=@var{bottom}):
  5230. @example
  5231. Match: c p n b u
  5232. x x x x x
  5233. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5234. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5235. x x x x x
  5236. Output frames:
  5237. 2 1 2 2 2
  5238. 2 2 2 1 3
  5239. @end example
  5240. With top matching (@option{field}=@var{top}):
  5241. @example
  5242. Match: c p n b u
  5243. x x x x x
  5244. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5245. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5246. x x x x x
  5247. Output frames:
  5248. 2 2 2 1 2
  5249. 2 1 3 2 2
  5250. @end example
  5251. @subsection Examples
  5252. Simple IVTC of a top field first telecined stream:
  5253. @example
  5254. fieldmatch=order=tff:combmatch=none, decimate
  5255. @end example
  5256. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5257. @example
  5258. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5259. @end example
  5260. @section fieldorder
  5261. Transform the field order of the input video.
  5262. It accepts the following parameters:
  5263. @table @option
  5264. @item order
  5265. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5266. for bottom field first.
  5267. @end table
  5268. The default value is @samp{tff}.
  5269. The transformation is done by shifting the picture content up or down
  5270. by one line, and filling the remaining line with appropriate picture content.
  5271. This method is consistent with most broadcast field order converters.
  5272. If the input video is not flagged as being interlaced, or it is already
  5273. flagged as being of the required output field order, then this filter does
  5274. not alter the incoming video.
  5275. It is very useful when converting to or from PAL DV material,
  5276. which is bottom field first.
  5277. For example:
  5278. @example
  5279. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5280. @end example
  5281. @section fifo, afifo
  5282. Buffer input images and send them when they are requested.
  5283. It is mainly useful when auto-inserted by the libavfilter
  5284. framework.
  5285. It does not take parameters.
  5286. @section find_rect
  5287. Find a rectangular object
  5288. It accepts the following options:
  5289. @table @option
  5290. @item object
  5291. Filepath of the object image, needs to be in gray8.
  5292. @item threshold
  5293. Detection threshold, default is 0.5.
  5294. @item mipmaps
  5295. Number of mipmaps, default is 3.
  5296. @item xmin, ymin, xmax, ymax
  5297. Specifies the rectangle in which to search.
  5298. @end table
  5299. @subsection Examples
  5300. @itemize
  5301. @item
  5302. Generate a representative palette of a given video using @command{ffmpeg}:
  5303. @example
  5304. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5305. @end example
  5306. @end itemize
  5307. @section cover_rect
  5308. Cover a rectangular object
  5309. It accepts the following options:
  5310. @table @option
  5311. @item cover
  5312. Filepath of the optional cover image, needs to be in yuv420.
  5313. @item mode
  5314. Set covering mode.
  5315. It accepts the following values:
  5316. @table @samp
  5317. @item cover
  5318. cover it by the supplied image
  5319. @item blur
  5320. cover it by interpolating the surrounding pixels
  5321. @end table
  5322. Default value is @var{blur}.
  5323. @end table
  5324. @subsection Examples
  5325. @itemize
  5326. @item
  5327. Generate a representative palette of a given video using @command{ffmpeg}:
  5328. @example
  5329. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5330. @end example
  5331. @end itemize
  5332. @anchor{format}
  5333. @section format
  5334. Convert the input video to one of the specified pixel formats.
  5335. Libavfilter will try to pick one that is suitable as input to
  5336. the next filter.
  5337. It accepts the following parameters:
  5338. @table @option
  5339. @item pix_fmts
  5340. A '|'-separated list of pixel format names, such as
  5341. "pix_fmts=yuv420p|monow|rgb24".
  5342. @end table
  5343. @subsection Examples
  5344. @itemize
  5345. @item
  5346. Convert the input video to the @var{yuv420p} format
  5347. @example
  5348. format=pix_fmts=yuv420p
  5349. @end example
  5350. Convert the input video to any of the formats in the list
  5351. @example
  5352. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5353. @end example
  5354. @end itemize
  5355. @anchor{fps}
  5356. @section fps
  5357. Convert the video to specified constant frame rate by duplicating or dropping
  5358. frames as necessary.
  5359. It accepts the following parameters:
  5360. @table @option
  5361. @item fps
  5362. The desired output frame rate. The default is @code{25}.
  5363. @item round
  5364. Rounding method.
  5365. Possible values are:
  5366. @table @option
  5367. @item zero
  5368. zero round towards 0
  5369. @item inf
  5370. round away from 0
  5371. @item down
  5372. round towards -infinity
  5373. @item up
  5374. round towards +infinity
  5375. @item near
  5376. round to nearest
  5377. @end table
  5378. The default is @code{near}.
  5379. @item start_time
  5380. Assume the first PTS should be the given value, in seconds. This allows for
  5381. padding/trimming at the start of stream. By default, no assumption is made
  5382. about the first frame's expected PTS, so no padding or trimming is done.
  5383. For example, this could be set to 0 to pad the beginning with duplicates of
  5384. the first frame if a video stream starts after the audio stream or to trim any
  5385. frames with a negative PTS.
  5386. @end table
  5387. Alternatively, the options can be specified as a flat string:
  5388. @var{fps}[:@var{round}].
  5389. See also the @ref{setpts} filter.
  5390. @subsection Examples
  5391. @itemize
  5392. @item
  5393. A typical usage in order to set the fps to 25:
  5394. @example
  5395. fps=fps=25
  5396. @end example
  5397. @item
  5398. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5399. @example
  5400. fps=fps=film:round=near
  5401. @end example
  5402. @end itemize
  5403. @section framepack
  5404. Pack two different video streams into a stereoscopic video, setting proper
  5405. metadata on supported codecs. The two views should have the same size and
  5406. framerate and processing will stop when the shorter video ends. Please note
  5407. that you may conveniently adjust view properties with the @ref{scale} and
  5408. @ref{fps} filters.
  5409. It accepts the following parameters:
  5410. @table @option
  5411. @item format
  5412. The desired packing format. Supported values are:
  5413. @table @option
  5414. @item sbs
  5415. The views are next to each other (default).
  5416. @item tab
  5417. The views are on top of each other.
  5418. @item lines
  5419. The views are packed by line.
  5420. @item columns
  5421. The views are packed by column.
  5422. @item frameseq
  5423. The views are temporally interleaved.
  5424. @end table
  5425. @end table
  5426. Some examples:
  5427. @example
  5428. # Convert left and right views into a frame-sequential video
  5429. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5430. # Convert views into a side-by-side video with the same output resolution as the input
  5431. 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
  5432. @end example
  5433. @section framerate
  5434. Change the frame rate by interpolating new video output frames from the source
  5435. frames.
  5436. This filter is not designed to function correctly with interlaced media. If
  5437. you wish to change the frame rate of interlaced media then you are required
  5438. to deinterlace before this filter and re-interlace after this filter.
  5439. A description of the accepted options follows.
  5440. @table @option
  5441. @item fps
  5442. Specify the output frames per second. This option can also be specified
  5443. as a value alone. The default is @code{50}.
  5444. @item interp_start
  5445. Specify the start of a range where the output frame will be created as a
  5446. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5447. the default is @code{15}.
  5448. @item interp_end
  5449. Specify the end of a range where the output frame will be created as a
  5450. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5451. the default is @code{240}.
  5452. @item scene
  5453. Specify the level at which a scene change is detected as a value between
  5454. 0 and 100 to indicate a new scene; a low value reflects a low
  5455. probability for the current frame to introduce a new scene, while a higher
  5456. value means the current frame is more likely to be one.
  5457. The default is @code{7}.
  5458. @item flags
  5459. Specify flags influencing the filter process.
  5460. Available value for @var{flags} is:
  5461. @table @option
  5462. @item scene_change_detect, scd
  5463. Enable scene change detection using the value of the option @var{scene}.
  5464. This flag is enabled by default.
  5465. @end table
  5466. @end table
  5467. @section framestep
  5468. Select one frame every N-th frame.
  5469. This filter accepts the following option:
  5470. @table @option
  5471. @item step
  5472. Select frame after every @code{step} frames.
  5473. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5474. @end table
  5475. @anchor{frei0r}
  5476. @section frei0r
  5477. Apply a frei0r effect to the input video.
  5478. To enable the compilation of this filter, you need to install the frei0r
  5479. header and configure FFmpeg with @code{--enable-frei0r}.
  5480. It accepts the following parameters:
  5481. @table @option
  5482. @item filter_name
  5483. The name of the frei0r effect to load. If the environment variable
  5484. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5485. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5486. Otherwise, the standard frei0r paths are searched, in this order:
  5487. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5488. @file{/usr/lib/frei0r-1/}.
  5489. @item filter_params
  5490. A '|'-separated list of parameters to pass to the frei0r effect.
  5491. @end table
  5492. A frei0r effect parameter can be a boolean (its value is either
  5493. "y" or "n"), a double, a color (specified as
  5494. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5495. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5496. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5497. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5498. The number and types of parameters depend on the loaded effect. If an
  5499. effect parameter is not specified, the default value is set.
  5500. @subsection Examples
  5501. @itemize
  5502. @item
  5503. Apply the distort0r effect, setting the first two double parameters:
  5504. @example
  5505. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5506. @end example
  5507. @item
  5508. Apply the colordistance effect, taking a color as the first parameter:
  5509. @example
  5510. frei0r=colordistance:0.2/0.3/0.4
  5511. frei0r=colordistance:violet
  5512. frei0r=colordistance:0x112233
  5513. @end example
  5514. @item
  5515. Apply the perspective effect, specifying the top left and top right image
  5516. positions:
  5517. @example
  5518. frei0r=perspective:0.2/0.2|0.8/0.2
  5519. @end example
  5520. @end itemize
  5521. For more information, see
  5522. @url{http://frei0r.dyne.org}
  5523. @section fspp
  5524. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5525. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5526. processing filter, one of them is performed once per block, not per pixel.
  5527. This allows for much higher speed.
  5528. The filter accepts the following options:
  5529. @table @option
  5530. @item quality
  5531. Set quality. This option defines the number of levels for averaging. It accepts
  5532. an integer in the range 4-5. Default value is @code{4}.
  5533. @item qp
  5534. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5535. If not set, the filter will use the QP from the video stream (if available).
  5536. @item strength
  5537. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5538. more details but also more artifacts, while higher values make the image smoother
  5539. but also blurrier. Default value is @code{0} − PSNR optimal.
  5540. @item use_bframe_qp
  5541. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5542. option may cause flicker since the B-Frames have often larger QP. Default is
  5543. @code{0} (not enabled).
  5544. @end table
  5545. @section geq
  5546. The filter accepts the following options:
  5547. @table @option
  5548. @item lum_expr, lum
  5549. Set the luminance expression.
  5550. @item cb_expr, cb
  5551. Set the chrominance blue expression.
  5552. @item cr_expr, cr
  5553. Set the chrominance red expression.
  5554. @item alpha_expr, a
  5555. Set the alpha expression.
  5556. @item red_expr, r
  5557. Set the red expression.
  5558. @item green_expr, g
  5559. Set the green expression.
  5560. @item blue_expr, b
  5561. Set the blue expression.
  5562. @end table
  5563. The colorspace is selected according to the specified options. If one
  5564. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5565. options is specified, the filter will automatically select a YCbCr
  5566. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5567. @option{blue_expr} options is specified, it will select an RGB
  5568. colorspace.
  5569. If one of the chrominance expression is not defined, it falls back on the other
  5570. one. If no alpha expression is specified it will evaluate to opaque value.
  5571. If none of chrominance expressions are specified, they will evaluate
  5572. to the luminance expression.
  5573. The expressions can use the following variables and functions:
  5574. @table @option
  5575. @item N
  5576. The sequential number of the filtered frame, starting from @code{0}.
  5577. @item X
  5578. @item Y
  5579. The coordinates of the current sample.
  5580. @item W
  5581. @item H
  5582. The width and height of the image.
  5583. @item SW
  5584. @item SH
  5585. Width and height scale depending on the currently filtered plane. It is the
  5586. ratio between the corresponding luma plane number of pixels and the current
  5587. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5588. @code{0.5,0.5} for chroma planes.
  5589. @item T
  5590. Time of the current frame, expressed in seconds.
  5591. @item p(x, y)
  5592. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5593. plane.
  5594. @item lum(x, y)
  5595. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5596. plane.
  5597. @item cb(x, y)
  5598. Return the value of the pixel at location (@var{x},@var{y}) of the
  5599. blue-difference chroma plane. Return 0 if there is no such plane.
  5600. @item cr(x, y)
  5601. Return the value of the pixel at location (@var{x},@var{y}) of the
  5602. red-difference chroma plane. Return 0 if there is no such plane.
  5603. @item r(x, y)
  5604. @item g(x, y)
  5605. @item b(x, y)
  5606. Return the value of the pixel at location (@var{x},@var{y}) of the
  5607. red/green/blue component. Return 0 if there is no such component.
  5608. @item alpha(x, y)
  5609. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5610. plane. Return 0 if there is no such plane.
  5611. @end table
  5612. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5613. automatically clipped to the closer edge.
  5614. @subsection Examples
  5615. @itemize
  5616. @item
  5617. Flip the image horizontally:
  5618. @example
  5619. geq=p(W-X\,Y)
  5620. @end example
  5621. @item
  5622. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5623. wavelength of 100 pixels:
  5624. @example
  5625. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5626. @end example
  5627. @item
  5628. Generate a fancy enigmatic moving light:
  5629. @example
  5630. 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
  5631. @end example
  5632. @item
  5633. Generate a quick emboss effect:
  5634. @example
  5635. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5636. @end example
  5637. @item
  5638. Modify RGB components depending on pixel position:
  5639. @example
  5640. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5641. @end example
  5642. @item
  5643. Create a radial gradient that is the same size as the input (also see
  5644. the @ref{vignette} filter):
  5645. @example
  5646. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5647. @end example
  5648. @item
  5649. Create a linear gradient to use as a mask for another filter, then
  5650. compose with @ref{overlay}. In this example the video will gradually
  5651. become more blurry from the top to the bottom of the y-axis as defined
  5652. by the linear gradient:
  5653. @example
  5654. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5655. @end example
  5656. @end itemize
  5657. @section gradfun
  5658. Fix the banding artifacts that are sometimes introduced into nearly flat
  5659. regions by truncation to 8bit color depth.
  5660. Interpolate the gradients that should go where the bands are, and
  5661. dither them.
  5662. It is designed for playback only. Do not use it prior to
  5663. lossy compression, because compression tends to lose the dither and
  5664. bring back the bands.
  5665. It accepts the following parameters:
  5666. @table @option
  5667. @item strength
  5668. The maximum amount by which the filter will change any one pixel. This is also
  5669. the threshold for detecting nearly flat regions. Acceptable values range from
  5670. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5671. valid range.
  5672. @item radius
  5673. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5674. gradients, but also prevents the filter from modifying the pixels near detailed
  5675. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5676. values will be clipped to the valid range.
  5677. @end table
  5678. Alternatively, the options can be specified as a flat string:
  5679. @var{strength}[:@var{radius}]
  5680. @subsection Examples
  5681. @itemize
  5682. @item
  5683. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5684. @example
  5685. gradfun=3.5:8
  5686. @end example
  5687. @item
  5688. Specify radius, omitting the strength (which will fall-back to the default
  5689. value):
  5690. @example
  5691. gradfun=radius=8
  5692. @end example
  5693. @end itemize
  5694. @anchor{haldclut}
  5695. @section haldclut
  5696. Apply a Hald CLUT to a video stream.
  5697. First input is the video stream to process, and second one is the Hald CLUT.
  5698. The Hald CLUT input can be a simple picture or a complete video stream.
  5699. The filter accepts the following options:
  5700. @table @option
  5701. @item shortest
  5702. Force termination when the shortest input terminates. Default is @code{0}.
  5703. @item repeatlast
  5704. Continue applying the last CLUT after the end of the stream. A value of
  5705. @code{0} disable the filter after the last frame of the CLUT is reached.
  5706. Default is @code{1}.
  5707. @end table
  5708. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5709. filters share the same internals).
  5710. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5711. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5712. @subsection Workflow examples
  5713. @subsubsection Hald CLUT video stream
  5714. Generate an identity Hald CLUT stream altered with various effects:
  5715. @example
  5716. 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
  5717. @end example
  5718. Note: make sure you use a lossless codec.
  5719. Then use it with @code{haldclut} to apply it on some random stream:
  5720. @example
  5721. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5722. @end example
  5723. The Hald CLUT will be applied to the 10 first seconds (duration of
  5724. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5725. to the remaining frames of the @code{mandelbrot} stream.
  5726. @subsubsection Hald CLUT with preview
  5727. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5728. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5729. biggest possible square starting at the top left of the picture. The remaining
  5730. padding pixels (bottom or right) will be ignored. This area can be used to add
  5731. a preview of the Hald CLUT.
  5732. Typically, the following generated Hald CLUT will be supported by the
  5733. @code{haldclut} filter:
  5734. @example
  5735. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5736. pad=iw+320 [padded_clut];
  5737. smptebars=s=320x256, split [a][b];
  5738. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5739. [main][b] overlay=W-320" -frames:v 1 clut.png
  5740. @end example
  5741. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5742. bars are displayed on the right-top, and below the same color bars processed by
  5743. the color changes.
  5744. Then, the effect of this Hald CLUT can be visualized with:
  5745. @example
  5746. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5747. @end example
  5748. @section hflip
  5749. Flip the input video horizontally.
  5750. For example, to horizontally flip the input video with @command{ffmpeg}:
  5751. @example
  5752. ffmpeg -i in.avi -vf "hflip" out.avi
  5753. @end example
  5754. @section histeq
  5755. This filter applies a global color histogram equalization on a
  5756. per-frame basis.
  5757. It can be used to correct video that has a compressed range of pixel
  5758. intensities. The filter redistributes the pixel intensities to
  5759. equalize their distribution across the intensity range. It may be
  5760. viewed as an "automatically adjusting contrast filter". This filter is
  5761. useful only for correcting degraded or poorly captured source
  5762. video.
  5763. The filter accepts the following options:
  5764. @table @option
  5765. @item strength
  5766. Determine the amount of equalization to be applied. As the strength
  5767. is reduced, the distribution of pixel intensities more-and-more
  5768. approaches that of the input frame. The value must be a float number
  5769. in the range [0,1] and defaults to 0.200.
  5770. @item intensity
  5771. Set the maximum intensity that can generated and scale the output
  5772. values appropriately. The strength should be set as desired and then
  5773. the intensity can be limited if needed to avoid washing-out. The value
  5774. must be a float number in the range [0,1] and defaults to 0.210.
  5775. @item antibanding
  5776. Set the antibanding level. If enabled the filter will randomly vary
  5777. the luminance of output pixels by a small amount to avoid banding of
  5778. the histogram. Possible values are @code{none}, @code{weak} or
  5779. @code{strong}. It defaults to @code{none}.
  5780. @end table
  5781. @section histogram
  5782. Compute and draw a color distribution histogram for the input video.
  5783. The computed histogram is a representation of the color component
  5784. distribution in an image.
  5785. Standard histogram displays the color components distribution in an image.
  5786. Displays color graph for each color component. Shows distribution of
  5787. the Y, U, V, A or R, G, B components, depending on input format, in the
  5788. current frame. Below each graph a color component scale meter is shown.
  5789. The filter accepts the following options:
  5790. @table @option
  5791. @item level_height
  5792. Set height of level. Default value is @code{200}.
  5793. Allowed range is [50, 2048].
  5794. @item scale_height
  5795. Set height of color scale. Default value is @code{12}.
  5796. Allowed range is [0, 40].
  5797. @item display_mode
  5798. Set display mode.
  5799. It accepts the following values:
  5800. @table @samp
  5801. @item parade
  5802. Per color component graphs are placed below each other.
  5803. @item overlay
  5804. Presents information identical to that in the @code{parade}, except
  5805. that the graphs representing color components are superimposed directly
  5806. over one another.
  5807. @end table
  5808. Default is @code{parade}.
  5809. @item levels_mode
  5810. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5811. Default is @code{linear}.
  5812. @item components
  5813. Set what color components to display.
  5814. Default is @code{7}.
  5815. @end table
  5816. @subsection Examples
  5817. @itemize
  5818. @item
  5819. Calculate and draw histogram:
  5820. @example
  5821. ffplay -i input -vf histogram
  5822. @end example
  5823. @end itemize
  5824. @anchor{hqdn3d}
  5825. @section hqdn3d
  5826. This is a high precision/quality 3d denoise filter. It aims to reduce
  5827. image noise, producing smooth images and making still images really
  5828. still. It should enhance compressibility.
  5829. It accepts the following optional parameters:
  5830. @table @option
  5831. @item luma_spatial
  5832. A non-negative floating point number which specifies spatial luma strength.
  5833. It defaults to 4.0.
  5834. @item chroma_spatial
  5835. A non-negative floating point number which specifies spatial chroma strength.
  5836. It defaults to 3.0*@var{luma_spatial}/4.0.
  5837. @item luma_tmp
  5838. A floating point number which specifies luma temporal strength. It defaults to
  5839. 6.0*@var{luma_spatial}/4.0.
  5840. @item chroma_tmp
  5841. A floating point number which specifies chroma temporal strength. It defaults to
  5842. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5843. @end table
  5844. @section hqx
  5845. Apply a high-quality magnification filter designed for pixel art. This filter
  5846. was originally created by Maxim Stepin.
  5847. It accepts the following option:
  5848. @table @option
  5849. @item n
  5850. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5851. @code{hq3x} and @code{4} for @code{hq4x}.
  5852. Default is @code{3}.
  5853. @end table
  5854. @section hstack
  5855. Stack input videos horizontally.
  5856. All streams must be of same pixel format and of same height.
  5857. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5858. to create same output.
  5859. The filter accept the following option:
  5860. @table @option
  5861. @item inputs
  5862. Set number of input streams. Default is 2.
  5863. @item shortest
  5864. If set to 1, force the output to terminate when the shortest input
  5865. terminates. Default value is 0.
  5866. @end table
  5867. @section hue
  5868. Modify the hue and/or the saturation of the input.
  5869. It accepts the following parameters:
  5870. @table @option
  5871. @item h
  5872. Specify the hue angle as a number of degrees. It accepts an expression,
  5873. and defaults to "0".
  5874. @item s
  5875. Specify the saturation in the [-10,10] range. It accepts an expression and
  5876. defaults to "1".
  5877. @item H
  5878. Specify the hue angle as a number of radians. It accepts an
  5879. expression, and defaults to "0".
  5880. @item b
  5881. Specify the brightness in the [-10,10] range. It accepts an expression and
  5882. defaults to "0".
  5883. @end table
  5884. @option{h} and @option{H} are mutually exclusive, and can't be
  5885. specified at the same time.
  5886. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5887. expressions containing the following constants:
  5888. @table @option
  5889. @item n
  5890. frame count of the input frame starting from 0
  5891. @item pts
  5892. presentation timestamp of the input frame expressed in time base units
  5893. @item r
  5894. frame rate of the input video, NAN if the input frame rate is unknown
  5895. @item t
  5896. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5897. @item tb
  5898. time base of the input video
  5899. @end table
  5900. @subsection Examples
  5901. @itemize
  5902. @item
  5903. Set the hue to 90 degrees and the saturation to 1.0:
  5904. @example
  5905. hue=h=90:s=1
  5906. @end example
  5907. @item
  5908. Same command but expressing the hue in radians:
  5909. @example
  5910. hue=H=PI/2:s=1
  5911. @end example
  5912. @item
  5913. Rotate hue and make the saturation swing between 0
  5914. and 2 over a period of 1 second:
  5915. @example
  5916. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5917. @end example
  5918. @item
  5919. Apply a 3 seconds saturation fade-in effect starting at 0:
  5920. @example
  5921. hue="s=min(t/3\,1)"
  5922. @end example
  5923. The general fade-in expression can be written as:
  5924. @example
  5925. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5926. @end example
  5927. @item
  5928. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5929. @example
  5930. hue="s=max(0\, min(1\, (8-t)/3))"
  5931. @end example
  5932. The general fade-out expression can be written as:
  5933. @example
  5934. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5935. @end example
  5936. @end itemize
  5937. @subsection Commands
  5938. This filter supports the following commands:
  5939. @table @option
  5940. @item b
  5941. @item s
  5942. @item h
  5943. @item H
  5944. Modify the hue and/or the saturation and/or brightness of the input video.
  5945. The command accepts the same syntax of the corresponding option.
  5946. If the specified expression is not valid, it is kept at its current
  5947. value.
  5948. @end table
  5949. @section idet
  5950. Detect video interlacing type.
  5951. This filter tries to detect if the input frames as interlaced, progressive,
  5952. top or bottom field first. It will also try and detect fields that are
  5953. repeated between adjacent frames (a sign of telecine).
  5954. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5955. Multiple frame detection incorporates the classification history of previous frames.
  5956. The filter will log these metadata values:
  5957. @table @option
  5958. @item single.current_frame
  5959. Detected type of current frame using single-frame detection. One of:
  5960. ``tff'' (top field first), ``bff'' (bottom field first),
  5961. ``progressive'', or ``undetermined''
  5962. @item single.tff
  5963. Cumulative number of frames detected as top field first using single-frame detection.
  5964. @item multiple.tff
  5965. Cumulative number of frames detected as top field first using multiple-frame detection.
  5966. @item single.bff
  5967. Cumulative number of frames detected as bottom field first using single-frame detection.
  5968. @item multiple.current_frame
  5969. Detected type of current frame using multiple-frame detection. One of:
  5970. ``tff'' (top field first), ``bff'' (bottom field first),
  5971. ``progressive'', or ``undetermined''
  5972. @item multiple.bff
  5973. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5974. @item single.progressive
  5975. Cumulative number of frames detected as progressive using single-frame detection.
  5976. @item multiple.progressive
  5977. Cumulative number of frames detected as progressive using multiple-frame detection.
  5978. @item single.undetermined
  5979. Cumulative number of frames that could not be classified using single-frame detection.
  5980. @item multiple.undetermined
  5981. Cumulative number of frames that could not be classified using multiple-frame detection.
  5982. @item repeated.current_frame
  5983. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5984. @item repeated.neither
  5985. Cumulative number of frames with no repeated field.
  5986. @item repeated.top
  5987. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5988. @item repeated.bottom
  5989. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5990. @end table
  5991. The filter accepts the following options:
  5992. @table @option
  5993. @item intl_thres
  5994. Set interlacing threshold.
  5995. @item prog_thres
  5996. Set progressive threshold.
  5997. @item repeat_thres
  5998. Threshold for repeated field detection.
  5999. @item half_life
  6000. Number of frames after which a given frame's contribution to the
  6001. statistics is halved (i.e., it contributes only 0.5 to it's
  6002. classification). The default of 0 means that all frames seen are given
  6003. full weight of 1.0 forever.
  6004. @item analyze_interlaced_flag
  6005. When this is not 0 then idet will use the specified number of frames to determine
  6006. if the interlaced flag is accurate, it will not count undetermined frames.
  6007. If the flag is found to be accurate it will be used without any further
  6008. computations, if it is found to be inaccurate it will be cleared without any
  6009. further computations. This allows inserting the idet filter as a low computational
  6010. method to clean up the interlaced flag
  6011. @end table
  6012. @section il
  6013. Deinterleave or interleave fields.
  6014. This filter allows one to process interlaced images fields without
  6015. deinterlacing them. Deinterleaving splits the input frame into 2
  6016. fields (so called half pictures). Odd lines are moved to the top
  6017. half of the output image, even lines to the bottom half.
  6018. You can process (filter) them independently and then re-interleave them.
  6019. The filter accepts the following options:
  6020. @table @option
  6021. @item luma_mode, l
  6022. @item chroma_mode, c
  6023. @item alpha_mode, a
  6024. Available values for @var{luma_mode}, @var{chroma_mode} and
  6025. @var{alpha_mode} are:
  6026. @table @samp
  6027. @item none
  6028. Do nothing.
  6029. @item deinterleave, d
  6030. Deinterleave fields, placing one above the other.
  6031. @item interleave, i
  6032. Interleave fields. Reverse the effect of deinterleaving.
  6033. @end table
  6034. Default value is @code{none}.
  6035. @item luma_swap, ls
  6036. @item chroma_swap, cs
  6037. @item alpha_swap, as
  6038. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6039. @end table
  6040. @section inflate
  6041. Apply inflate effect to the video.
  6042. This filter replaces the pixel by the local(3x3) average by taking into account
  6043. only values higher than the pixel.
  6044. It accepts the following options:
  6045. @table @option
  6046. @item threshold0
  6047. @item threshold1
  6048. @item threshold2
  6049. @item threshold3
  6050. Limit the maximum change for each plane, default is 65535.
  6051. If 0, plane will remain unchanged.
  6052. @end table
  6053. @section interlace
  6054. Simple interlacing filter from progressive contents. This interleaves upper (or
  6055. lower) lines from odd frames with lower (or upper) lines from even frames,
  6056. halving the frame rate and preserving image height.
  6057. @example
  6058. Original Original New Frame
  6059. Frame 'j' Frame 'j+1' (tff)
  6060. ========== =========== ==================
  6061. Line 0 --------------------> Frame 'j' Line 0
  6062. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6063. Line 2 ---------------------> Frame 'j' Line 2
  6064. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6065. ... ... ...
  6066. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6067. @end example
  6068. It accepts the following optional parameters:
  6069. @table @option
  6070. @item scan
  6071. This determines whether the interlaced frame is taken from the even
  6072. (tff - default) or odd (bff) lines of the progressive frame.
  6073. @item lowpass
  6074. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6075. interlacing and reduce moire patterns.
  6076. @end table
  6077. @section kerndeint
  6078. Deinterlace input video by applying Donald Graft's adaptive kernel
  6079. deinterling. Work on interlaced parts of a video to produce
  6080. progressive frames.
  6081. The description of the accepted parameters follows.
  6082. @table @option
  6083. @item thresh
  6084. Set the threshold which affects the filter's tolerance when
  6085. determining if a pixel line must be processed. It must be an integer
  6086. in the range [0,255] and defaults to 10. A value of 0 will result in
  6087. applying the process on every pixels.
  6088. @item map
  6089. Paint pixels exceeding the threshold value to white if set to 1.
  6090. Default is 0.
  6091. @item order
  6092. Set the fields order. Swap fields if set to 1, leave fields alone if
  6093. 0. Default is 0.
  6094. @item sharp
  6095. Enable additional sharpening if set to 1. Default is 0.
  6096. @item twoway
  6097. Enable twoway sharpening if set to 1. Default is 0.
  6098. @end table
  6099. @subsection Examples
  6100. @itemize
  6101. @item
  6102. Apply default values:
  6103. @example
  6104. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6105. @end example
  6106. @item
  6107. Enable additional sharpening:
  6108. @example
  6109. kerndeint=sharp=1
  6110. @end example
  6111. @item
  6112. Paint processed pixels in white:
  6113. @example
  6114. kerndeint=map=1
  6115. @end example
  6116. @end itemize
  6117. @section lenscorrection
  6118. Correct radial lens distortion
  6119. This filter can be used to correct for radial distortion as can result from the use
  6120. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6121. one can use tools available for example as part of opencv or simply trial-and-error.
  6122. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6123. and extract the k1 and k2 coefficients from the resulting matrix.
  6124. Note that effectively the same filter is available in the open-source tools Krita and
  6125. Digikam from the KDE project.
  6126. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6127. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6128. brightness distribution, so you may want to use both filters together in certain
  6129. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6130. be applied before or after lens correction.
  6131. @subsection Options
  6132. The filter accepts the following options:
  6133. @table @option
  6134. @item cx
  6135. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6136. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6137. width.
  6138. @item cy
  6139. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6140. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6141. height.
  6142. @item k1
  6143. Coefficient of the quadratic correction term. 0.5 means no correction.
  6144. @item k2
  6145. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6146. @end table
  6147. The formula that generates the correction is:
  6148. @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)
  6149. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6150. distances from the focal point in the source and target images, respectively.
  6151. @anchor{lut3d}
  6152. @section lut3d
  6153. Apply a 3D LUT to an input video.
  6154. The filter accepts the following options:
  6155. @table @option
  6156. @item file
  6157. Set the 3D LUT file name.
  6158. Currently supported formats:
  6159. @table @samp
  6160. @item 3dl
  6161. AfterEffects
  6162. @item cube
  6163. Iridas
  6164. @item dat
  6165. DaVinci
  6166. @item m3d
  6167. Pandora
  6168. @end table
  6169. @item interp
  6170. Select interpolation mode.
  6171. Available values are:
  6172. @table @samp
  6173. @item nearest
  6174. Use values from the nearest defined point.
  6175. @item trilinear
  6176. Interpolate values using the 8 points defining a cube.
  6177. @item tetrahedral
  6178. Interpolate values using a tetrahedron.
  6179. @end table
  6180. @end table
  6181. @section lut, lutrgb, lutyuv
  6182. Compute a look-up table for binding each pixel component input value
  6183. to an output value, and apply it to the input video.
  6184. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6185. to an RGB input video.
  6186. These filters accept the following parameters:
  6187. @table @option
  6188. @item c0
  6189. set first pixel component expression
  6190. @item c1
  6191. set second pixel component expression
  6192. @item c2
  6193. set third pixel component expression
  6194. @item c3
  6195. set fourth pixel component expression, corresponds to the alpha component
  6196. @item r
  6197. set red component expression
  6198. @item g
  6199. set green component expression
  6200. @item b
  6201. set blue component expression
  6202. @item a
  6203. alpha component expression
  6204. @item y
  6205. set Y/luminance component expression
  6206. @item u
  6207. set U/Cb component expression
  6208. @item v
  6209. set V/Cr component expression
  6210. @end table
  6211. Each of them specifies the expression to use for computing the lookup table for
  6212. the corresponding pixel component values.
  6213. The exact component associated to each of the @var{c*} options depends on the
  6214. format in input.
  6215. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6216. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6217. The expressions can contain the following constants and functions:
  6218. @table @option
  6219. @item w
  6220. @item h
  6221. The input width and height.
  6222. @item val
  6223. The input value for the pixel component.
  6224. @item clipval
  6225. The input value, clipped to the @var{minval}-@var{maxval} range.
  6226. @item maxval
  6227. The maximum value for the pixel component.
  6228. @item minval
  6229. The minimum value for the pixel component.
  6230. @item negval
  6231. The negated value for the pixel component value, clipped to the
  6232. @var{minval}-@var{maxval} range; it corresponds to the expression
  6233. "maxval-clipval+minval".
  6234. @item clip(val)
  6235. The computed value in @var{val}, clipped to the
  6236. @var{minval}-@var{maxval} range.
  6237. @item gammaval(gamma)
  6238. The computed gamma correction value of the pixel component value,
  6239. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6240. expression
  6241. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6242. @end table
  6243. All expressions default to "val".
  6244. @subsection Examples
  6245. @itemize
  6246. @item
  6247. Negate input video:
  6248. @example
  6249. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6250. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6251. @end example
  6252. The above is the same as:
  6253. @example
  6254. lutrgb="r=negval:g=negval:b=negval"
  6255. lutyuv="y=negval:u=negval:v=negval"
  6256. @end example
  6257. @item
  6258. Negate luminance:
  6259. @example
  6260. lutyuv=y=negval
  6261. @end example
  6262. @item
  6263. Remove chroma components, turning the video into a graytone image:
  6264. @example
  6265. lutyuv="u=128:v=128"
  6266. @end example
  6267. @item
  6268. Apply a luma burning effect:
  6269. @example
  6270. lutyuv="y=2*val"
  6271. @end example
  6272. @item
  6273. Remove green and blue components:
  6274. @example
  6275. lutrgb="g=0:b=0"
  6276. @end example
  6277. @item
  6278. Set a constant alpha channel value on input:
  6279. @example
  6280. format=rgba,lutrgb=a="maxval-minval/2"
  6281. @end example
  6282. @item
  6283. Correct luminance gamma by a factor of 0.5:
  6284. @example
  6285. lutyuv=y=gammaval(0.5)
  6286. @end example
  6287. @item
  6288. Discard least significant bits of luma:
  6289. @example
  6290. lutyuv=y='bitand(val, 128+64+32)'
  6291. @end example
  6292. @end itemize
  6293. @section maskedmerge
  6294. Merge the first input stream with the second input stream using per pixel
  6295. weights in the third input stream.
  6296. A value of 0 in the third stream pixel component means that pixel component
  6297. from first stream is returned unchanged, while maximum value (eg. 255 for
  6298. 8-bit videos) means that pixel component from second stream is returned
  6299. unchanged. Intermediate values define the amount of merging between both
  6300. input stream's pixel components.
  6301. This filter accepts the following options:
  6302. @table @option
  6303. @item planes
  6304. Set which planes will be processed as bitmap, unprocessed planes will be
  6305. copied from first stream.
  6306. By default value 0xf, all planes will be processed.
  6307. @end table
  6308. @section mcdeint
  6309. Apply motion-compensation deinterlacing.
  6310. It needs one field per frame as input and must thus be used together
  6311. with yadif=1/3 or equivalent.
  6312. This filter accepts the following options:
  6313. @table @option
  6314. @item mode
  6315. Set the deinterlacing mode.
  6316. It accepts one of the following values:
  6317. @table @samp
  6318. @item fast
  6319. @item medium
  6320. @item slow
  6321. use iterative motion estimation
  6322. @item extra_slow
  6323. like @samp{slow}, but use multiple reference frames.
  6324. @end table
  6325. Default value is @samp{fast}.
  6326. @item parity
  6327. Set the picture field parity assumed for the input video. It must be
  6328. one of the following values:
  6329. @table @samp
  6330. @item 0, tff
  6331. assume top field first
  6332. @item 1, bff
  6333. assume bottom field first
  6334. @end table
  6335. Default value is @samp{bff}.
  6336. @item qp
  6337. Set per-block quantization parameter (QP) used by the internal
  6338. encoder.
  6339. Higher values should result in a smoother motion vector field but less
  6340. optimal individual vectors. Default value is 1.
  6341. @end table
  6342. @section mergeplanes
  6343. Merge color channel components from several video streams.
  6344. The filter accepts up to 4 input streams, and merge selected input
  6345. planes to the output video.
  6346. This filter accepts the following options:
  6347. @table @option
  6348. @item mapping
  6349. Set input to output plane mapping. Default is @code{0}.
  6350. The mappings is specified as a bitmap. It should be specified as a
  6351. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6352. mapping for the first plane of the output stream. 'A' sets the number of
  6353. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6354. corresponding input to use (from 0 to 3). The rest of the mappings is
  6355. similar, 'Bb' describes the mapping for the output stream second
  6356. plane, 'Cc' describes the mapping for the output stream third plane and
  6357. 'Dd' describes the mapping for the output stream fourth plane.
  6358. @item format
  6359. Set output pixel format. Default is @code{yuva444p}.
  6360. @end table
  6361. @subsection Examples
  6362. @itemize
  6363. @item
  6364. Merge three gray video streams of same width and height into single video stream:
  6365. @example
  6366. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6367. @end example
  6368. @item
  6369. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6370. @example
  6371. [a0][a1]mergeplanes=0x00010210:yuva444p
  6372. @end example
  6373. @item
  6374. Swap Y and A plane in yuva444p stream:
  6375. @example
  6376. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6377. @end example
  6378. @item
  6379. Swap U and V plane in yuv420p stream:
  6380. @example
  6381. format=yuv420p,mergeplanes=0x000201:yuv420p
  6382. @end example
  6383. @item
  6384. Cast a rgb24 clip to yuv444p:
  6385. @example
  6386. format=rgb24,mergeplanes=0x000102:yuv444p
  6387. @end example
  6388. @end itemize
  6389. @section mpdecimate
  6390. Drop frames that do not differ greatly from the previous frame in
  6391. order to reduce frame rate.
  6392. The main use of this filter is for very-low-bitrate encoding
  6393. (e.g. streaming over dialup modem), but it could in theory be used for
  6394. fixing movies that were inverse-telecined incorrectly.
  6395. A description of the accepted options follows.
  6396. @table @option
  6397. @item max
  6398. Set the maximum number of consecutive frames which can be dropped (if
  6399. positive), or the minimum interval between dropped frames (if
  6400. negative). If the value is 0, the frame is dropped unregarding the
  6401. number of previous sequentially dropped frames.
  6402. Default value is 0.
  6403. @item hi
  6404. @item lo
  6405. @item frac
  6406. Set the dropping threshold values.
  6407. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6408. represent actual pixel value differences, so a threshold of 64
  6409. corresponds to 1 unit of difference for each pixel, or the same spread
  6410. out differently over the block.
  6411. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6412. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6413. meaning the whole image) differ by more than a threshold of @option{lo}.
  6414. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6415. 64*5, and default value for @option{frac} is 0.33.
  6416. @end table
  6417. @section negate
  6418. Negate input video.
  6419. It accepts an integer in input; if non-zero it negates the
  6420. alpha component (if available). The default value in input is 0.
  6421. @section noformat
  6422. Force libavfilter not to use any of the specified pixel formats for the
  6423. input to the next filter.
  6424. It accepts the following parameters:
  6425. @table @option
  6426. @item pix_fmts
  6427. A '|'-separated list of pixel format names, such as
  6428. apix_fmts=yuv420p|monow|rgb24".
  6429. @end table
  6430. @subsection Examples
  6431. @itemize
  6432. @item
  6433. Force libavfilter to use a format different from @var{yuv420p} for the
  6434. input to the vflip filter:
  6435. @example
  6436. noformat=pix_fmts=yuv420p,vflip
  6437. @end example
  6438. @item
  6439. Convert the input video to any of the formats not contained in the list:
  6440. @example
  6441. noformat=yuv420p|yuv444p|yuv410p
  6442. @end example
  6443. @end itemize
  6444. @section noise
  6445. Add noise on video input frame.
  6446. The filter accepts the following options:
  6447. @table @option
  6448. @item all_seed
  6449. @item c0_seed
  6450. @item c1_seed
  6451. @item c2_seed
  6452. @item c3_seed
  6453. Set noise seed for specific pixel component or all pixel components in case
  6454. of @var{all_seed}. Default value is @code{123457}.
  6455. @item all_strength, alls
  6456. @item c0_strength, c0s
  6457. @item c1_strength, c1s
  6458. @item c2_strength, c2s
  6459. @item c3_strength, c3s
  6460. Set noise strength for specific pixel component or all pixel components in case
  6461. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6462. @item all_flags, allf
  6463. @item c0_flags, c0f
  6464. @item c1_flags, c1f
  6465. @item c2_flags, c2f
  6466. @item c3_flags, c3f
  6467. Set pixel component flags or set flags for all components if @var{all_flags}.
  6468. Available values for component flags are:
  6469. @table @samp
  6470. @item a
  6471. averaged temporal noise (smoother)
  6472. @item p
  6473. mix random noise with a (semi)regular pattern
  6474. @item t
  6475. temporal noise (noise pattern changes between frames)
  6476. @item u
  6477. uniform noise (gaussian otherwise)
  6478. @end table
  6479. @end table
  6480. @subsection Examples
  6481. Add temporal and uniform noise to input video:
  6482. @example
  6483. noise=alls=20:allf=t+u
  6484. @end example
  6485. @section null
  6486. Pass the video source unchanged to the output.
  6487. @section ocr
  6488. Optical Character Recognition
  6489. This filter uses Tesseract for optical character recognition.
  6490. It accepts the following options:
  6491. @table @option
  6492. @item datapath
  6493. Set datapath to tesseract data. Default is to use whatever was
  6494. set at installation.
  6495. @item language
  6496. Set language, default is "eng".
  6497. @item whitelist
  6498. Set character whitelist.
  6499. @item blacklist
  6500. Set character blacklist.
  6501. @end table
  6502. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6503. @section ocv
  6504. Apply a video transform using libopencv.
  6505. To enable this filter, install the libopencv library and headers and
  6506. configure FFmpeg with @code{--enable-libopencv}.
  6507. It accepts the following parameters:
  6508. @table @option
  6509. @item filter_name
  6510. The name of the libopencv filter to apply.
  6511. @item filter_params
  6512. The parameters to pass to the libopencv filter. If not specified, the default
  6513. values are assumed.
  6514. @end table
  6515. Refer to the official libopencv documentation for more precise
  6516. information:
  6517. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6518. Several libopencv filters are supported; see the following subsections.
  6519. @anchor{dilate}
  6520. @subsection dilate
  6521. Dilate an image by using a specific structuring element.
  6522. It corresponds to the libopencv function @code{cvDilate}.
  6523. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6524. @var{struct_el} represents a structuring element, and has the syntax:
  6525. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6526. @var{cols} and @var{rows} represent the number of columns and rows of
  6527. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6528. point, and @var{shape} the shape for the structuring element. @var{shape}
  6529. must be "rect", "cross", "ellipse", or "custom".
  6530. If the value for @var{shape} is "custom", it must be followed by a
  6531. string of the form "=@var{filename}". The file with name
  6532. @var{filename} is assumed to represent a binary image, with each
  6533. printable character corresponding to a bright pixel. When a custom
  6534. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6535. or columns and rows of the read file are assumed instead.
  6536. The default value for @var{struct_el} is "3x3+0x0/rect".
  6537. @var{nb_iterations} specifies the number of times the transform is
  6538. applied to the image, and defaults to 1.
  6539. Some examples:
  6540. @example
  6541. # Use the default values
  6542. ocv=dilate
  6543. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6544. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6545. # Read the shape from the file diamond.shape, iterating two times.
  6546. # The file diamond.shape may contain a pattern of characters like this
  6547. # *
  6548. # ***
  6549. # *****
  6550. # ***
  6551. # *
  6552. # The specified columns and rows are ignored
  6553. # but the anchor point coordinates are not
  6554. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6555. @end example
  6556. @subsection erode
  6557. Erode an image by using a specific structuring element.
  6558. It corresponds to the libopencv function @code{cvErode}.
  6559. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6560. with the same syntax and semantics as the @ref{dilate} filter.
  6561. @subsection smooth
  6562. Smooth the input video.
  6563. The filter takes the following parameters:
  6564. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6565. @var{type} is the type of smooth filter to apply, and must be one of
  6566. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6567. or "bilateral". The default value is "gaussian".
  6568. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6569. depend on the smooth type. @var{param1} and
  6570. @var{param2} accept integer positive values or 0. @var{param3} and
  6571. @var{param4} accept floating point values.
  6572. The default value for @var{param1} is 3. The default value for the
  6573. other parameters is 0.
  6574. These parameters correspond to the parameters assigned to the
  6575. libopencv function @code{cvSmooth}.
  6576. @anchor{overlay}
  6577. @section overlay
  6578. Overlay one video on top of another.
  6579. It takes two inputs and has one output. The first input is the "main"
  6580. video on which the second input is overlaid.
  6581. It accepts the following parameters:
  6582. A description of the accepted options follows.
  6583. @table @option
  6584. @item x
  6585. @item y
  6586. Set the expression for the x and y coordinates of the overlaid video
  6587. on the main video. Default value is "0" for both expressions. In case
  6588. the expression is invalid, it is set to a huge value (meaning that the
  6589. overlay will not be displayed within the output visible area).
  6590. @item eof_action
  6591. The action to take when EOF is encountered on the secondary input; it accepts
  6592. one of the following values:
  6593. @table @option
  6594. @item repeat
  6595. Repeat the last frame (the default).
  6596. @item endall
  6597. End both streams.
  6598. @item pass
  6599. Pass the main input through.
  6600. @end table
  6601. @item eval
  6602. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6603. It accepts the following values:
  6604. @table @samp
  6605. @item init
  6606. only evaluate expressions once during the filter initialization or
  6607. when a command is processed
  6608. @item frame
  6609. evaluate expressions for each incoming frame
  6610. @end table
  6611. Default value is @samp{frame}.
  6612. @item shortest
  6613. If set to 1, force the output to terminate when the shortest input
  6614. terminates. Default value is 0.
  6615. @item format
  6616. Set the format for the output video.
  6617. It accepts the following values:
  6618. @table @samp
  6619. @item yuv420
  6620. force YUV420 output
  6621. @item yuv422
  6622. force YUV422 output
  6623. @item yuv444
  6624. force YUV444 output
  6625. @item rgb
  6626. force RGB output
  6627. @end table
  6628. Default value is @samp{yuv420}.
  6629. @item rgb @emph{(deprecated)}
  6630. If set to 1, force the filter to accept inputs in the RGB
  6631. color space. Default value is 0. This option is deprecated, use
  6632. @option{format} instead.
  6633. @item repeatlast
  6634. If set to 1, force the filter to draw the last overlay frame over the
  6635. main input until the end of the stream. A value of 0 disables this
  6636. behavior. Default value is 1.
  6637. @end table
  6638. The @option{x}, and @option{y} expressions can contain the following
  6639. parameters.
  6640. @table @option
  6641. @item main_w, W
  6642. @item main_h, H
  6643. The main input width and height.
  6644. @item overlay_w, w
  6645. @item overlay_h, h
  6646. The overlay input width and height.
  6647. @item x
  6648. @item y
  6649. The computed values for @var{x} and @var{y}. They are evaluated for
  6650. each new frame.
  6651. @item hsub
  6652. @item vsub
  6653. horizontal and vertical chroma subsample values of the output
  6654. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6655. @var{vsub} is 1.
  6656. @item n
  6657. the number of input frame, starting from 0
  6658. @item pos
  6659. the position in the file of the input frame, NAN if unknown
  6660. @item t
  6661. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6662. @end table
  6663. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6664. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6665. when @option{eval} is set to @samp{init}.
  6666. Be aware that frames are taken from each input video in timestamp
  6667. order, hence, if their initial timestamps differ, it is a good idea
  6668. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6669. have them begin in the same zero timestamp, as the example for
  6670. the @var{movie} filter does.
  6671. You can chain together more overlays but you should test the
  6672. efficiency of such approach.
  6673. @subsection Commands
  6674. This filter supports the following commands:
  6675. @table @option
  6676. @item x
  6677. @item y
  6678. Modify the x and y of the overlay input.
  6679. The command accepts the same syntax of the corresponding option.
  6680. If the specified expression is not valid, it is kept at its current
  6681. value.
  6682. @end table
  6683. @subsection Examples
  6684. @itemize
  6685. @item
  6686. Draw the overlay at 10 pixels from the bottom right corner of the main
  6687. video:
  6688. @example
  6689. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6690. @end example
  6691. Using named options the example above becomes:
  6692. @example
  6693. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6694. @end example
  6695. @item
  6696. Insert a transparent PNG logo in the bottom left corner of the input,
  6697. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6698. @example
  6699. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6700. @end example
  6701. @item
  6702. Insert 2 different transparent PNG logos (second logo on bottom
  6703. right corner) using the @command{ffmpeg} tool:
  6704. @example
  6705. 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
  6706. @end example
  6707. @item
  6708. Add a transparent color layer on top of the main video; @code{WxH}
  6709. must specify the size of the main input to the overlay filter:
  6710. @example
  6711. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6712. @end example
  6713. @item
  6714. Play an original video and a filtered version (here with the deshake
  6715. filter) side by side using the @command{ffplay} tool:
  6716. @example
  6717. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6718. @end example
  6719. The above command is the same as:
  6720. @example
  6721. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6722. @end example
  6723. @item
  6724. Make a sliding overlay appearing from the left to the right top part of the
  6725. screen starting since time 2:
  6726. @example
  6727. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6728. @end example
  6729. @item
  6730. Compose output by putting two input videos side to side:
  6731. @example
  6732. ffmpeg -i left.avi -i right.avi -filter_complex "
  6733. nullsrc=size=200x100 [background];
  6734. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6735. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6736. [background][left] overlay=shortest=1 [background+left];
  6737. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6738. "
  6739. @end example
  6740. @item
  6741. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6742. @example
  6743. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6744. -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]'
  6745. masked.avi
  6746. @end example
  6747. @item
  6748. Chain several overlays in cascade:
  6749. @example
  6750. nullsrc=s=200x200 [bg];
  6751. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6752. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6753. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6754. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6755. [in3] null, [mid2] overlay=100:100 [out0]
  6756. @end example
  6757. @end itemize
  6758. @section owdenoise
  6759. Apply Overcomplete Wavelet denoiser.
  6760. The filter accepts the following options:
  6761. @table @option
  6762. @item depth
  6763. Set depth.
  6764. Larger depth values will denoise lower frequency components more, but
  6765. slow down filtering.
  6766. Must be an int in the range 8-16, default is @code{8}.
  6767. @item luma_strength, ls
  6768. Set luma strength.
  6769. Must be a double value in the range 0-1000, default is @code{1.0}.
  6770. @item chroma_strength, cs
  6771. Set chroma strength.
  6772. Must be a double value in the range 0-1000, default is @code{1.0}.
  6773. @end table
  6774. @anchor{pad}
  6775. @section pad
  6776. Add paddings to the input image, and place the original input at the
  6777. provided @var{x}, @var{y} coordinates.
  6778. It accepts the following parameters:
  6779. @table @option
  6780. @item width, w
  6781. @item height, h
  6782. Specify an expression for the size of the output image with the
  6783. paddings added. If the value for @var{width} or @var{height} is 0, the
  6784. corresponding input size is used for the output.
  6785. The @var{width} expression can reference the value set by the
  6786. @var{height} expression, and vice versa.
  6787. The default value of @var{width} and @var{height} is 0.
  6788. @item x
  6789. @item y
  6790. Specify the offsets to place the input image at within the padded area,
  6791. with respect to the top/left border of the output image.
  6792. The @var{x} expression can reference the value set by the @var{y}
  6793. expression, and vice versa.
  6794. The default value of @var{x} and @var{y} is 0.
  6795. @item color
  6796. Specify the color of the padded area. For the syntax of this option,
  6797. check the "Color" section in the ffmpeg-utils manual.
  6798. The default value of @var{color} is "black".
  6799. @end table
  6800. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6801. options are expressions containing the following constants:
  6802. @table @option
  6803. @item in_w
  6804. @item in_h
  6805. The input video width and height.
  6806. @item iw
  6807. @item ih
  6808. These are the same as @var{in_w} and @var{in_h}.
  6809. @item out_w
  6810. @item out_h
  6811. The output width and height (the size of the padded area), as
  6812. specified by the @var{width} and @var{height} expressions.
  6813. @item ow
  6814. @item oh
  6815. These are the same as @var{out_w} and @var{out_h}.
  6816. @item x
  6817. @item y
  6818. The x and y offsets as specified by the @var{x} and @var{y}
  6819. expressions, or NAN if not yet specified.
  6820. @item a
  6821. same as @var{iw} / @var{ih}
  6822. @item sar
  6823. input sample aspect ratio
  6824. @item dar
  6825. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6826. @item hsub
  6827. @item vsub
  6828. The horizontal and vertical chroma subsample values. For example for the
  6829. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6830. @end table
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Add paddings with the color "violet" to the input video. The output video
  6835. size is 640x480, and the top-left corner of the input video is placed at
  6836. column 0, row 40
  6837. @example
  6838. pad=640:480:0:40:violet
  6839. @end example
  6840. The example above is equivalent to the following command:
  6841. @example
  6842. pad=width=640:height=480:x=0:y=40:color=violet
  6843. @end example
  6844. @item
  6845. Pad the input to get an output with dimensions increased by 3/2,
  6846. and put the input video at the center of the padded area:
  6847. @example
  6848. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6849. @end example
  6850. @item
  6851. Pad the input to get a squared output with size equal to the maximum
  6852. value between the input width and height, and put the input video at
  6853. the center of the padded area:
  6854. @example
  6855. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6856. @end example
  6857. @item
  6858. Pad the input to get a final w/h ratio of 16:9:
  6859. @example
  6860. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6861. @end example
  6862. @item
  6863. In case of anamorphic video, in order to set the output display aspect
  6864. correctly, it is necessary to use @var{sar} in the expression,
  6865. according to the relation:
  6866. @example
  6867. (ih * X / ih) * sar = output_dar
  6868. X = output_dar / sar
  6869. @end example
  6870. Thus the previous example needs to be modified to:
  6871. @example
  6872. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6873. @end example
  6874. @item
  6875. Double the output size and put the input video in the bottom-right
  6876. corner of the output padded area:
  6877. @example
  6878. pad="2*iw:2*ih:ow-iw:oh-ih"
  6879. @end example
  6880. @end itemize
  6881. @anchor{palettegen}
  6882. @section palettegen
  6883. Generate one palette for a whole video stream.
  6884. It accepts the following options:
  6885. @table @option
  6886. @item max_colors
  6887. Set the maximum number of colors to quantize in the palette.
  6888. Note: the palette will still contain 256 colors; the unused palette entries
  6889. will be black.
  6890. @item reserve_transparent
  6891. Create a palette of 255 colors maximum and reserve the last one for
  6892. transparency. Reserving the transparency color is useful for GIF optimization.
  6893. If not set, the maximum of colors in the palette will be 256. You probably want
  6894. to disable this option for a standalone image.
  6895. Set by default.
  6896. @item stats_mode
  6897. Set statistics mode.
  6898. It accepts the following values:
  6899. @table @samp
  6900. @item full
  6901. Compute full frame histograms.
  6902. @item diff
  6903. Compute histograms only for the part that differs from previous frame. This
  6904. might be relevant to give more importance to the moving part of your input if
  6905. the background is static.
  6906. @end table
  6907. Default value is @var{full}.
  6908. @end table
  6909. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6910. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6911. color quantization of the palette. This information is also visible at
  6912. @var{info} logging level.
  6913. @subsection Examples
  6914. @itemize
  6915. @item
  6916. Generate a representative palette of a given video using @command{ffmpeg}:
  6917. @example
  6918. ffmpeg -i input.mkv -vf palettegen palette.png
  6919. @end example
  6920. @end itemize
  6921. @section paletteuse
  6922. Use a palette to downsample an input video stream.
  6923. The filter takes two inputs: one video stream and a palette. The palette must
  6924. be a 256 pixels image.
  6925. It accepts the following options:
  6926. @table @option
  6927. @item dither
  6928. Select dithering mode. Available algorithms are:
  6929. @table @samp
  6930. @item bayer
  6931. Ordered 8x8 bayer dithering (deterministic)
  6932. @item heckbert
  6933. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6934. Note: this dithering is sometimes considered "wrong" and is included as a
  6935. reference.
  6936. @item floyd_steinberg
  6937. Floyd and Steingberg dithering (error diffusion)
  6938. @item sierra2
  6939. Frankie Sierra dithering v2 (error diffusion)
  6940. @item sierra2_4a
  6941. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6942. @end table
  6943. Default is @var{sierra2_4a}.
  6944. @item bayer_scale
  6945. When @var{bayer} dithering is selected, this option defines the scale of the
  6946. pattern (how much the crosshatch pattern is visible). A low value means more
  6947. visible pattern for less banding, and higher value means less visible pattern
  6948. at the cost of more banding.
  6949. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6950. @item diff_mode
  6951. If set, define the zone to process
  6952. @table @samp
  6953. @item rectangle
  6954. Only the changing rectangle will be reprocessed. This is similar to GIF
  6955. cropping/offsetting compression mechanism. This option can be useful for speed
  6956. if only a part of the image is changing, and has use cases such as limiting the
  6957. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6958. moving scene (it leads to more deterministic output if the scene doesn't change
  6959. much, and as a result less moving noise and better GIF compression).
  6960. @end table
  6961. Default is @var{none}.
  6962. @end table
  6963. @subsection Examples
  6964. @itemize
  6965. @item
  6966. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6967. using @command{ffmpeg}:
  6968. @example
  6969. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6970. @end example
  6971. @end itemize
  6972. @section perspective
  6973. Correct perspective of video not recorded perpendicular to the screen.
  6974. A description of the accepted parameters follows.
  6975. @table @option
  6976. @item x0
  6977. @item y0
  6978. @item x1
  6979. @item y1
  6980. @item x2
  6981. @item y2
  6982. @item x3
  6983. @item y3
  6984. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6985. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6986. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6987. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6988. then the corners of the source will be sent to the specified coordinates.
  6989. The expressions can use the following variables:
  6990. @table @option
  6991. @item W
  6992. @item H
  6993. the width and height of video frame.
  6994. @end table
  6995. @item interpolation
  6996. Set interpolation for perspective correction.
  6997. It accepts the following values:
  6998. @table @samp
  6999. @item linear
  7000. @item cubic
  7001. @end table
  7002. Default value is @samp{linear}.
  7003. @item sense
  7004. Set interpretation of coordinate options.
  7005. It accepts the following values:
  7006. @table @samp
  7007. @item 0, source
  7008. Send point in the source specified by the given coordinates to
  7009. the corners of the destination.
  7010. @item 1, destination
  7011. Send the corners of the source to the point in the destination specified
  7012. by the given coordinates.
  7013. Default value is @samp{source}.
  7014. @end table
  7015. @end table
  7016. @section phase
  7017. Delay interlaced video by one field time so that the field order changes.
  7018. The intended use is to fix PAL movies that have been captured with the
  7019. opposite field order to the film-to-video transfer.
  7020. A description of the accepted parameters follows.
  7021. @table @option
  7022. @item mode
  7023. Set phase mode.
  7024. It accepts the following values:
  7025. @table @samp
  7026. @item t
  7027. Capture field order top-first, transfer bottom-first.
  7028. Filter will delay the bottom field.
  7029. @item b
  7030. Capture field order bottom-first, transfer top-first.
  7031. Filter will delay the top field.
  7032. @item p
  7033. Capture and transfer with the same field order. This mode only exists
  7034. for the documentation of the other options to refer to, but if you
  7035. actually select it, the filter will faithfully do nothing.
  7036. @item a
  7037. Capture field order determined automatically by field flags, transfer
  7038. opposite.
  7039. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7040. basis using field flags. If no field information is available,
  7041. then this works just like @samp{u}.
  7042. @item u
  7043. Capture unknown or varying, transfer opposite.
  7044. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7045. analyzing the images and selecting the alternative that produces best
  7046. match between the fields.
  7047. @item T
  7048. Capture top-first, transfer unknown or varying.
  7049. Filter selects among @samp{t} and @samp{p} using image analysis.
  7050. @item B
  7051. Capture bottom-first, transfer unknown or varying.
  7052. Filter selects among @samp{b} and @samp{p} using image analysis.
  7053. @item A
  7054. Capture determined by field flags, transfer unknown or varying.
  7055. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7056. image analysis. If no field information is available, then this works just
  7057. like @samp{U}. This is the default mode.
  7058. @item U
  7059. Both capture and transfer unknown or varying.
  7060. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7061. @end table
  7062. @end table
  7063. @section pixdesctest
  7064. Pixel format descriptor test filter, mainly useful for internal
  7065. testing. The output video should be equal to the input video.
  7066. For example:
  7067. @example
  7068. format=monow, pixdesctest
  7069. @end example
  7070. can be used to test the monowhite pixel format descriptor definition.
  7071. @section pp
  7072. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7073. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7074. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7075. Each subfilter and some options have a short and a long name that can be used
  7076. interchangeably, i.e. dr/dering are the same.
  7077. The filters accept the following options:
  7078. @table @option
  7079. @item subfilters
  7080. Set postprocessing subfilters string.
  7081. @end table
  7082. All subfilters share common options to determine their scope:
  7083. @table @option
  7084. @item a/autoq
  7085. Honor the quality commands for this subfilter.
  7086. @item c/chrom
  7087. Do chrominance filtering, too (default).
  7088. @item y/nochrom
  7089. Do luminance filtering only (no chrominance).
  7090. @item n/noluma
  7091. Do chrominance filtering only (no luminance).
  7092. @end table
  7093. These options can be appended after the subfilter name, separated by a '|'.
  7094. Available subfilters are:
  7095. @table @option
  7096. @item hb/hdeblock[|difference[|flatness]]
  7097. Horizontal deblocking filter
  7098. @table @option
  7099. @item difference
  7100. Difference factor where higher values mean more deblocking (default: @code{32}).
  7101. @item flatness
  7102. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7103. @end table
  7104. @item vb/vdeblock[|difference[|flatness]]
  7105. Vertical deblocking filter
  7106. @table @option
  7107. @item difference
  7108. Difference factor where higher values mean more deblocking (default: @code{32}).
  7109. @item flatness
  7110. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7111. @end table
  7112. @item ha/hadeblock[|difference[|flatness]]
  7113. Accurate horizontal deblocking filter
  7114. @table @option
  7115. @item difference
  7116. Difference factor where higher values mean more deblocking (default: @code{32}).
  7117. @item flatness
  7118. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7119. @end table
  7120. @item va/vadeblock[|difference[|flatness]]
  7121. Accurate vertical deblocking filter
  7122. @table @option
  7123. @item difference
  7124. Difference factor where higher values mean more deblocking (default: @code{32}).
  7125. @item flatness
  7126. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7127. @end table
  7128. @end table
  7129. The horizontal and vertical deblocking filters share the difference and
  7130. flatness values so you cannot set different horizontal and vertical
  7131. thresholds.
  7132. @table @option
  7133. @item h1/x1hdeblock
  7134. Experimental horizontal deblocking filter
  7135. @item v1/x1vdeblock
  7136. Experimental vertical deblocking filter
  7137. @item dr/dering
  7138. Deringing filter
  7139. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7140. @table @option
  7141. @item threshold1
  7142. larger -> stronger filtering
  7143. @item threshold2
  7144. larger -> stronger filtering
  7145. @item threshold3
  7146. larger -> stronger filtering
  7147. @end table
  7148. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7149. @table @option
  7150. @item f/fullyrange
  7151. Stretch luminance to @code{0-255}.
  7152. @end table
  7153. @item lb/linblenddeint
  7154. Linear blend deinterlacing filter that deinterlaces the given block by
  7155. filtering all lines with a @code{(1 2 1)} filter.
  7156. @item li/linipoldeint
  7157. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7158. linearly interpolating every second line.
  7159. @item ci/cubicipoldeint
  7160. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7161. cubically interpolating every second line.
  7162. @item md/mediandeint
  7163. Median deinterlacing filter that deinterlaces the given block by applying a
  7164. median filter to every second line.
  7165. @item fd/ffmpegdeint
  7166. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7167. second line with a @code{(-1 4 2 4 -1)} filter.
  7168. @item l5/lowpass5
  7169. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7170. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7171. @item fq/forceQuant[|quantizer]
  7172. Overrides the quantizer table from the input with the constant quantizer you
  7173. specify.
  7174. @table @option
  7175. @item quantizer
  7176. Quantizer to use
  7177. @end table
  7178. @item de/default
  7179. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7180. @item fa/fast
  7181. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7182. @item ac
  7183. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7184. @end table
  7185. @subsection Examples
  7186. @itemize
  7187. @item
  7188. Apply horizontal and vertical deblocking, deringing and automatic
  7189. brightness/contrast:
  7190. @example
  7191. pp=hb/vb/dr/al
  7192. @end example
  7193. @item
  7194. Apply default filters without brightness/contrast correction:
  7195. @example
  7196. pp=de/-al
  7197. @end example
  7198. @item
  7199. Apply default filters and temporal denoiser:
  7200. @example
  7201. pp=default/tmpnoise|1|2|3
  7202. @end example
  7203. @item
  7204. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7205. automatically depending on available CPU time:
  7206. @example
  7207. pp=hb|y/vb|a
  7208. @end example
  7209. @end itemize
  7210. @section pp7
  7211. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7212. similar to spp = 6 with 7 point DCT, where only the center sample is
  7213. used after IDCT.
  7214. The filter accepts the following options:
  7215. @table @option
  7216. @item qp
  7217. Force a constant quantization parameter. It accepts an integer in range
  7218. 0 to 63. If not set, the filter will use the QP from the video stream
  7219. (if available).
  7220. @item mode
  7221. Set thresholding mode. Available modes are:
  7222. @table @samp
  7223. @item hard
  7224. Set hard thresholding.
  7225. @item soft
  7226. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7227. @item medium
  7228. Set medium thresholding (good results, default).
  7229. @end table
  7230. @end table
  7231. @section psnr
  7232. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7233. Ratio) between two input videos.
  7234. This filter takes in input two input videos, the first input is
  7235. considered the "main" source and is passed unchanged to the
  7236. output. The second input is used as a "reference" video for computing
  7237. the PSNR.
  7238. Both video inputs must have the same resolution and pixel format for
  7239. this filter to work correctly. Also it assumes that both inputs
  7240. have the same number of frames, which are compared one by one.
  7241. The obtained average PSNR is printed through the logging system.
  7242. The filter stores the accumulated MSE (mean squared error) of each
  7243. frame, and at the end of the processing it is averaged across all frames
  7244. equally, and the following formula is applied to obtain the PSNR:
  7245. @example
  7246. PSNR = 10*log10(MAX^2/MSE)
  7247. @end example
  7248. Where MAX is the average of the maximum values of each component of the
  7249. image.
  7250. The description of the accepted parameters follows.
  7251. @table @option
  7252. @item stats_file, f
  7253. If specified the filter will use the named file to save the PSNR of
  7254. each individual frame. When filename equals "-" the data is sent to
  7255. standard output.
  7256. @end table
  7257. The file printed if @var{stats_file} is selected, contains a sequence of
  7258. key/value pairs of the form @var{key}:@var{value} for each compared
  7259. couple of frames.
  7260. A description of each shown parameter follows:
  7261. @table @option
  7262. @item n
  7263. sequential number of the input frame, starting from 1
  7264. @item mse_avg
  7265. Mean Square Error pixel-by-pixel average difference of the compared
  7266. frames, averaged over all the image components.
  7267. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7268. Mean Square Error pixel-by-pixel average difference of the compared
  7269. frames for the component specified by the suffix.
  7270. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7271. Peak Signal to Noise ratio of the compared frames for the component
  7272. specified by the suffix.
  7273. @end table
  7274. For example:
  7275. @example
  7276. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7277. [main][ref] psnr="stats_file=stats.log" [out]
  7278. @end example
  7279. On this example the input file being processed is compared with the
  7280. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7281. is stored in @file{stats.log}.
  7282. @anchor{pullup}
  7283. @section pullup
  7284. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7285. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7286. content.
  7287. The pullup filter is designed to take advantage of future context in making
  7288. its decisions. This filter is stateless in the sense that it does not lock
  7289. onto a pattern to follow, but it instead looks forward to the following
  7290. fields in order to identify matches and rebuild progressive frames.
  7291. To produce content with an even framerate, insert the fps filter after
  7292. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7293. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7294. The filter accepts the following options:
  7295. @table @option
  7296. @item jl
  7297. @item jr
  7298. @item jt
  7299. @item jb
  7300. These options set the amount of "junk" to ignore at the left, right, top, and
  7301. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7302. while top and bottom are in units of 2 lines.
  7303. The default is 8 pixels on each side.
  7304. @item sb
  7305. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7306. filter generating an occasional mismatched frame, but it may also cause an
  7307. excessive number of frames to be dropped during high motion sequences.
  7308. Conversely, setting it to -1 will make filter match fields more easily.
  7309. This may help processing of video where there is slight blurring between
  7310. the fields, but may also cause there to be interlaced frames in the output.
  7311. Default value is @code{0}.
  7312. @item mp
  7313. Set the metric plane to use. It accepts the following values:
  7314. @table @samp
  7315. @item l
  7316. Use luma plane.
  7317. @item u
  7318. Use chroma blue plane.
  7319. @item v
  7320. Use chroma red plane.
  7321. @end table
  7322. This option may be set to use chroma plane instead of the default luma plane
  7323. for doing filter's computations. This may improve accuracy on very clean
  7324. source material, but more likely will decrease accuracy, especially if there
  7325. is chroma noise (rainbow effect) or any grayscale video.
  7326. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7327. load and make pullup usable in realtime on slow machines.
  7328. @end table
  7329. For best results (without duplicated frames in the output file) it is
  7330. necessary to change the output frame rate. For example, to inverse
  7331. telecine NTSC input:
  7332. @example
  7333. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7334. @end example
  7335. @section qp
  7336. Change video quantization parameters (QP).
  7337. The filter accepts the following option:
  7338. @table @option
  7339. @item qp
  7340. Set expression for quantization parameter.
  7341. @end table
  7342. The expression is evaluated through the eval API and can contain, among others,
  7343. the following constants:
  7344. @table @var
  7345. @item known
  7346. 1 if index is not 129, 0 otherwise.
  7347. @item qp
  7348. Sequentional index starting from -129 to 128.
  7349. @end table
  7350. @subsection Examples
  7351. @itemize
  7352. @item
  7353. Some equation like:
  7354. @example
  7355. qp=2+2*sin(PI*qp)
  7356. @end example
  7357. @end itemize
  7358. @section random
  7359. Flush video frames from internal cache of frames into a random order.
  7360. No frame is discarded.
  7361. Inspired by @ref{frei0r} nervous filter.
  7362. @table @option
  7363. @item frames
  7364. Set size in number of frames of internal cache, in range from @code{2} to
  7365. @code{512}. Default is @code{30}.
  7366. @item seed
  7367. Set seed for random number generator, must be an integer included between
  7368. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7369. less than @code{0}, the filter will try to use a good random seed on a
  7370. best effort basis.
  7371. @end table
  7372. @section removegrain
  7373. The removegrain filter is a spatial denoiser for progressive video.
  7374. @table @option
  7375. @item m0
  7376. Set mode for the first plane.
  7377. @item m1
  7378. Set mode for the second plane.
  7379. @item m2
  7380. Set mode for the third plane.
  7381. @item m3
  7382. Set mode for the fourth plane.
  7383. @end table
  7384. Range of mode is from 0 to 24. Description of each mode follows:
  7385. @table @var
  7386. @item 0
  7387. Leave input plane unchanged. Default.
  7388. @item 1
  7389. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7390. @item 2
  7391. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7392. @item 3
  7393. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7394. @item 4
  7395. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7396. This is equivalent to a median filter.
  7397. @item 5
  7398. Line-sensitive clipping giving the minimal change.
  7399. @item 6
  7400. Line-sensitive clipping, intermediate.
  7401. @item 7
  7402. Line-sensitive clipping, intermediate.
  7403. @item 8
  7404. Line-sensitive clipping, intermediate.
  7405. @item 9
  7406. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7407. @item 10
  7408. Replaces the target pixel with the closest neighbour.
  7409. @item 11
  7410. [1 2 1] horizontal and vertical kernel blur.
  7411. @item 12
  7412. Same as mode 11.
  7413. @item 13
  7414. Bob mode, interpolates top field from the line where the neighbours
  7415. pixels are the closest.
  7416. @item 14
  7417. Bob mode, interpolates bottom field from the line where the neighbours
  7418. pixels are the closest.
  7419. @item 15
  7420. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7421. interpolation formula.
  7422. @item 16
  7423. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7424. interpolation formula.
  7425. @item 17
  7426. Clips the pixel with the minimum and maximum of respectively the maximum and
  7427. minimum of each pair of opposite neighbour pixels.
  7428. @item 18
  7429. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7430. the current pixel is minimal.
  7431. @item 19
  7432. Replaces the pixel with the average of its 8 neighbours.
  7433. @item 20
  7434. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7435. @item 21
  7436. Clips pixels using the averages of opposite neighbour.
  7437. @item 22
  7438. Same as mode 21 but simpler and faster.
  7439. @item 23
  7440. Small edge and halo removal, but reputed useless.
  7441. @item 24
  7442. Similar as 23.
  7443. @end table
  7444. @section removelogo
  7445. Suppress a TV station logo, using an image file to determine which
  7446. pixels comprise the logo. It works by filling in the pixels that
  7447. comprise the logo with neighboring pixels.
  7448. The filter accepts the following options:
  7449. @table @option
  7450. @item filename, f
  7451. Set the filter bitmap file, which can be any image format supported by
  7452. libavformat. The width and height of the image file must match those of the
  7453. video stream being processed.
  7454. @end table
  7455. Pixels in the provided bitmap image with a value of zero are not
  7456. considered part of the logo, non-zero pixels are considered part of
  7457. the logo. If you use white (255) for the logo and black (0) for the
  7458. rest, you will be safe. For making the filter bitmap, it is
  7459. recommended to take a screen capture of a black frame with the logo
  7460. visible, and then using a threshold filter followed by the erode
  7461. filter once or twice.
  7462. If needed, little splotches can be fixed manually. Remember that if
  7463. logo pixels are not covered, the filter quality will be much
  7464. reduced. Marking too many pixels as part of the logo does not hurt as
  7465. much, but it will increase the amount of blurring needed to cover over
  7466. the image and will destroy more information than necessary, and extra
  7467. pixels will slow things down on a large logo.
  7468. @section repeatfields
  7469. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7470. fields based on its value.
  7471. @section reverse, areverse
  7472. Reverse a clip.
  7473. Warning: This filter requires memory to buffer the entire clip, so trimming
  7474. is suggested.
  7475. @subsection Examples
  7476. @itemize
  7477. @item
  7478. Take the first 5 seconds of a clip, and reverse it.
  7479. @example
  7480. trim=end=5,reverse
  7481. @end example
  7482. @end itemize
  7483. @section rotate
  7484. Rotate video by an arbitrary angle expressed in radians.
  7485. The filter accepts the following options:
  7486. A description of the optional parameters follows.
  7487. @table @option
  7488. @item angle, a
  7489. Set an expression for the angle by which to rotate the input video
  7490. clockwise, expressed as a number of radians. A negative value will
  7491. result in a counter-clockwise rotation. By default it is set to "0".
  7492. This expression is evaluated for each frame.
  7493. @item out_w, ow
  7494. Set the output width expression, default value is "iw".
  7495. This expression is evaluated just once during configuration.
  7496. @item out_h, oh
  7497. Set the output height expression, default value is "ih".
  7498. This expression is evaluated just once during configuration.
  7499. @item bilinear
  7500. Enable bilinear interpolation if set to 1, a value of 0 disables
  7501. it. Default value is 1.
  7502. @item fillcolor, c
  7503. Set the color used to fill the output area not covered by the rotated
  7504. image. For the general syntax of this option, check the "Color" section in the
  7505. ffmpeg-utils manual. If the special value "none" is selected then no
  7506. background is printed (useful for example if the background is never shown).
  7507. Default value is "black".
  7508. @end table
  7509. The expressions for the angle and the output size can contain the
  7510. following constants and functions:
  7511. @table @option
  7512. @item n
  7513. sequential number of the input frame, starting from 0. It is always NAN
  7514. before the first frame is filtered.
  7515. @item t
  7516. time in seconds of the input frame, it is set to 0 when the filter is
  7517. configured. It is always NAN before the first frame is filtered.
  7518. @item hsub
  7519. @item vsub
  7520. horizontal and vertical chroma subsample values. For example for the
  7521. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7522. @item in_w, iw
  7523. @item in_h, ih
  7524. the input video width and height
  7525. @item out_w, ow
  7526. @item out_h, oh
  7527. the output width and height, that is the size of the padded area as
  7528. specified by the @var{width} and @var{height} expressions
  7529. @item rotw(a)
  7530. @item roth(a)
  7531. the minimal width/height required for completely containing the input
  7532. video rotated by @var{a} radians.
  7533. These are only available when computing the @option{out_w} and
  7534. @option{out_h} expressions.
  7535. @end table
  7536. @subsection Examples
  7537. @itemize
  7538. @item
  7539. Rotate the input by PI/6 radians clockwise:
  7540. @example
  7541. rotate=PI/6
  7542. @end example
  7543. @item
  7544. Rotate the input by PI/6 radians counter-clockwise:
  7545. @example
  7546. rotate=-PI/6
  7547. @end example
  7548. @item
  7549. Rotate the input by 45 degrees clockwise:
  7550. @example
  7551. rotate=45*PI/180
  7552. @end example
  7553. @item
  7554. Apply a constant rotation with period T, starting from an angle of PI/3:
  7555. @example
  7556. rotate=PI/3+2*PI*t/T
  7557. @end example
  7558. @item
  7559. Make the input video rotation oscillating with a period of T
  7560. seconds and an amplitude of A radians:
  7561. @example
  7562. rotate=A*sin(2*PI/T*t)
  7563. @end example
  7564. @item
  7565. Rotate the video, output size is chosen so that the whole rotating
  7566. input video is always completely contained in the output:
  7567. @example
  7568. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7569. @end example
  7570. @item
  7571. Rotate the video, reduce the output size so that no background is ever
  7572. shown:
  7573. @example
  7574. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7575. @end example
  7576. @end itemize
  7577. @subsection Commands
  7578. The filter supports the following commands:
  7579. @table @option
  7580. @item a, angle
  7581. Set the angle expression.
  7582. The command accepts the same syntax of the corresponding option.
  7583. If the specified expression is not valid, it is kept at its current
  7584. value.
  7585. @end table
  7586. @section sab
  7587. Apply Shape Adaptive Blur.
  7588. The filter accepts the following options:
  7589. @table @option
  7590. @item luma_radius, lr
  7591. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7592. value is 1.0. A greater value will result in a more blurred image, and
  7593. in slower processing.
  7594. @item luma_pre_filter_radius, lpfr
  7595. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7596. value is 1.0.
  7597. @item luma_strength, ls
  7598. Set luma maximum difference between pixels to still be considered, must
  7599. be a value in the 0.1-100.0 range, default value is 1.0.
  7600. @item chroma_radius, cr
  7601. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7602. greater value will result in a more blurred image, and in slower
  7603. processing.
  7604. @item chroma_pre_filter_radius, cpfr
  7605. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7606. @item chroma_strength, cs
  7607. Set chroma maximum difference between pixels to still be considered,
  7608. must be a value in the 0.1-100.0 range.
  7609. @end table
  7610. Each chroma option value, if not explicitly specified, is set to the
  7611. corresponding luma option value.
  7612. @anchor{scale}
  7613. @section scale
  7614. Scale (resize) the input video, using the libswscale library.
  7615. The scale filter forces the output display aspect ratio to be the same
  7616. of the input, by changing the output sample aspect ratio.
  7617. If the input image format is different from the format requested by
  7618. the next filter, the scale filter will convert the input to the
  7619. requested format.
  7620. @subsection Options
  7621. The filter accepts the following options, or any of the options
  7622. supported by the libswscale scaler.
  7623. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7624. the complete list of scaler options.
  7625. @table @option
  7626. @item width, w
  7627. @item height, h
  7628. Set the output video dimension expression. Default value is the input
  7629. dimension.
  7630. If the value is 0, the input width is used for the output.
  7631. If one of the values is -1, the scale filter will use a value that
  7632. maintains the aspect ratio of the input image, calculated from the
  7633. other specified dimension. If both of them are -1, the input size is
  7634. used
  7635. If one of the values is -n with n > 1, the scale filter will also use a value
  7636. that maintains the aspect ratio of the input image, calculated from the other
  7637. specified dimension. After that it will, however, make sure that the calculated
  7638. dimension is divisible by n and adjust the value if necessary.
  7639. See below for the list of accepted constants for use in the dimension
  7640. expression.
  7641. @item eval
  7642. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  7643. @table @samp
  7644. @item init
  7645. Only evaluate expressions once during the filter initialization or when a command is processed.
  7646. @item frame
  7647. Evaluate expressions for each incoming frame.
  7648. @end table
  7649. Default value is @samp{init}.
  7650. @item interl
  7651. Set the interlacing mode. It accepts the following values:
  7652. @table @samp
  7653. @item 1
  7654. Force interlaced aware scaling.
  7655. @item 0
  7656. Do not apply interlaced scaling.
  7657. @item -1
  7658. Select interlaced aware scaling depending on whether the source frames
  7659. are flagged as interlaced or not.
  7660. @end table
  7661. Default value is @samp{0}.
  7662. @item flags
  7663. Set libswscale scaling flags. See
  7664. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7665. complete list of values. If not explicitly specified the filter applies
  7666. the default flags.
  7667. @item param0, param1
  7668. Set libswscale input parameters for scaling algorithms that need them. See
  7669. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7670. complete documentation. If not explicitly specified the filter applies
  7671. empty parameters.
  7672. @item size, s
  7673. Set the video size. For the syntax of this option, check the
  7674. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7675. @item in_color_matrix
  7676. @item out_color_matrix
  7677. Set in/output YCbCr color space type.
  7678. This allows the autodetected value to be overridden as well as allows forcing
  7679. a specific value used for the output and encoder.
  7680. If not specified, the color space type depends on the pixel format.
  7681. Possible values:
  7682. @table @samp
  7683. @item auto
  7684. Choose automatically.
  7685. @item bt709
  7686. Format conforming to International Telecommunication Union (ITU)
  7687. Recommendation BT.709.
  7688. @item fcc
  7689. Set color space conforming to the United States Federal Communications
  7690. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7691. @item bt601
  7692. Set color space conforming to:
  7693. @itemize
  7694. @item
  7695. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7696. @item
  7697. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7698. @item
  7699. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7700. @end itemize
  7701. @item smpte240m
  7702. Set color space conforming to SMPTE ST 240:1999.
  7703. @end table
  7704. @item in_range
  7705. @item out_range
  7706. Set in/output YCbCr sample range.
  7707. This allows the autodetected value to be overridden as well as allows forcing
  7708. a specific value used for the output and encoder. If not specified, the
  7709. range depends on the pixel format. Possible values:
  7710. @table @samp
  7711. @item auto
  7712. Choose automatically.
  7713. @item jpeg/full/pc
  7714. Set full range (0-255 in case of 8-bit luma).
  7715. @item mpeg/tv
  7716. Set "MPEG" range (16-235 in case of 8-bit luma).
  7717. @end table
  7718. @item force_original_aspect_ratio
  7719. Enable decreasing or increasing output video width or height if necessary to
  7720. keep the original aspect ratio. Possible values:
  7721. @table @samp
  7722. @item disable
  7723. Scale the video as specified and disable this feature.
  7724. @item decrease
  7725. The output video dimensions will automatically be decreased if needed.
  7726. @item increase
  7727. The output video dimensions will automatically be increased if needed.
  7728. @end table
  7729. One useful instance of this option is that when you know a specific device's
  7730. maximum allowed resolution, you can use this to limit the output video to
  7731. that, while retaining the aspect ratio. For example, device A allows
  7732. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7733. decrease) and specifying 1280x720 to the command line makes the output
  7734. 1280x533.
  7735. Please note that this is a different thing than specifying -1 for @option{w}
  7736. or @option{h}, you still need to specify the output resolution for this option
  7737. to work.
  7738. @end table
  7739. The values of the @option{w} and @option{h} options are expressions
  7740. containing the following constants:
  7741. @table @var
  7742. @item in_w
  7743. @item in_h
  7744. The input width and height
  7745. @item iw
  7746. @item ih
  7747. These are the same as @var{in_w} and @var{in_h}.
  7748. @item out_w
  7749. @item out_h
  7750. The output (scaled) width and height
  7751. @item ow
  7752. @item oh
  7753. These are the same as @var{out_w} and @var{out_h}
  7754. @item a
  7755. The same as @var{iw} / @var{ih}
  7756. @item sar
  7757. input sample aspect ratio
  7758. @item dar
  7759. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7760. @item hsub
  7761. @item vsub
  7762. horizontal and vertical input chroma subsample values. For example for the
  7763. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7764. @item ohsub
  7765. @item ovsub
  7766. horizontal and vertical output chroma subsample values. For example for the
  7767. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7768. @end table
  7769. @subsection Examples
  7770. @itemize
  7771. @item
  7772. Scale the input video to a size of 200x100
  7773. @example
  7774. scale=w=200:h=100
  7775. @end example
  7776. This is equivalent to:
  7777. @example
  7778. scale=200:100
  7779. @end example
  7780. or:
  7781. @example
  7782. scale=200x100
  7783. @end example
  7784. @item
  7785. Specify a size abbreviation for the output size:
  7786. @example
  7787. scale=qcif
  7788. @end example
  7789. which can also be written as:
  7790. @example
  7791. scale=size=qcif
  7792. @end example
  7793. @item
  7794. Scale the input to 2x:
  7795. @example
  7796. scale=w=2*iw:h=2*ih
  7797. @end example
  7798. @item
  7799. The above is the same as:
  7800. @example
  7801. scale=2*in_w:2*in_h
  7802. @end example
  7803. @item
  7804. Scale the input to 2x with forced interlaced scaling:
  7805. @example
  7806. scale=2*iw:2*ih:interl=1
  7807. @end example
  7808. @item
  7809. Scale the input to half size:
  7810. @example
  7811. scale=w=iw/2:h=ih/2
  7812. @end example
  7813. @item
  7814. Increase the width, and set the height to the same size:
  7815. @example
  7816. scale=3/2*iw:ow
  7817. @end example
  7818. @item
  7819. Seek Greek harmony:
  7820. @example
  7821. scale=iw:1/PHI*iw
  7822. scale=ih*PHI:ih
  7823. @end example
  7824. @item
  7825. Increase the height, and set the width to 3/2 of the height:
  7826. @example
  7827. scale=w=3/2*oh:h=3/5*ih
  7828. @end example
  7829. @item
  7830. Increase the size, making the size a multiple of the chroma
  7831. subsample values:
  7832. @example
  7833. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7834. @end example
  7835. @item
  7836. Increase the width to a maximum of 500 pixels,
  7837. keeping the same aspect ratio as the input:
  7838. @example
  7839. scale=w='min(500\, iw*3/2):h=-1'
  7840. @end example
  7841. @end itemize
  7842. @subsection Commands
  7843. This filter supports the following commands:
  7844. @table @option
  7845. @item width, w
  7846. @item height, h
  7847. Set the output video dimension expression.
  7848. The command accepts the same syntax of the corresponding option.
  7849. If the specified expression is not valid, it is kept at its current
  7850. value.
  7851. @end table
  7852. @section scale2ref
  7853. Scale (resize) the input video, based on a reference video.
  7854. See the scale filter for available options, scale2ref supports the same but
  7855. uses the reference video instead of the main input as basis.
  7856. @subsection Examples
  7857. @itemize
  7858. @item
  7859. Scale a subtitle stream to match the main video in size before overlaying
  7860. @example
  7861. 'scale2ref[b][a];[a][b]overlay'
  7862. @end example
  7863. @end itemize
  7864. @section selectivecolor
  7865. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  7866. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  7867. by the "purity" of the color (that is, how saturated it already is).
  7868. This filter is similar to the Adobe Photoshop Selective Color tool.
  7869. The filter accepts the following options:
  7870. @table @option
  7871. @item correction_method
  7872. Select color correction method.
  7873. Available values are:
  7874. @table @samp
  7875. @item absolute
  7876. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  7877. component value).
  7878. @item relative
  7879. Specified adjustments are relative to the original component value.
  7880. @end table
  7881. Default is @code{absolute}.
  7882. @item reds
  7883. Adjustments for red pixels (pixels where the red component is the maximum)
  7884. @item yellows
  7885. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  7886. @item greens
  7887. Adjustments for green pixels (pixels where the green component is the maximum)
  7888. @item cyans
  7889. Adjustments for cyan pixels (pixels where the red component is the minimum)
  7890. @item blues
  7891. Adjustments for blue pixels (pixels where the blue component is the maximum)
  7892. @item magentas
  7893. Adjustments for magenta pixels (pixels where the green component is the minimum)
  7894. @item whites
  7895. Adjustments for white pixels (pixels where all components are greater than 128)
  7896. @item neutrals
  7897. Adjustments for all pixels except pure black and pure white
  7898. @item blacks
  7899. Adjustments for black pixels (pixels where all components are lesser than 128)
  7900. @item psfile
  7901. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  7902. @end table
  7903. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  7904. 4 space separated floating point adjustment values in the [-1,1] range,
  7905. respectively to adjust the amount of cyan, magenta, yellow and black for the
  7906. pixels of its range.
  7907. @subsection Examples
  7908. @itemize
  7909. @item
  7910. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  7911. increase magenta by 27% in blue areas:
  7912. @example
  7913. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  7914. @end example
  7915. @item
  7916. Use a Photoshop selective color preset:
  7917. @example
  7918. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  7919. @end example
  7920. @end itemize
  7921. @section separatefields
  7922. The @code{separatefields} takes a frame-based video input and splits
  7923. each frame into its components fields, producing a new half height clip
  7924. with twice the frame rate and twice the frame count.
  7925. This filter use field-dominance information in frame to decide which
  7926. of each pair of fields to place first in the output.
  7927. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7928. @section setdar, setsar
  7929. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7930. output video.
  7931. This is done by changing the specified Sample (aka Pixel) Aspect
  7932. Ratio, according to the following equation:
  7933. @example
  7934. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7935. @end example
  7936. Keep in mind that the @code{setdar} filter does not modify the pixel
  7937. dimensions of the video frame. Also, the display aspect ratio set by
  7938. this filter may be changed by later filters in the filterchain,
  7939. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7940. applied.
  7941. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7942. the filter output video.
  7943. Note that as a consequence of the application of this filter, the
  7944. output display aspect ratio will change according to the equation
  7945. above.
  7946. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7947. filter may be changed by later filters in the filterchain, e.g. if
  7948. another "setsar" or a "setdar" filter is applied.
  7949. It accepts the following parameters:
  7950. @table @option
  7951. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7952. Set the aspect ratio used by the filter.
  7953. The parameter can be a floating point number string, an expression, or
  7954. a string of the form @var{num}:@var{den}, where @var{num} and
  7955. @var{den} are the numerator and denominator of the aspect ratio. If
  7956. the parameter is not specified, it is assumed the value "0".
  7957. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7958. should be escaped.
  7959. @item max
  7960. Set the maximum integer value to use for expressing numerator and
  7961. denominator when reducing the expressed aspect ratio to a rational.
  7962. Default value is @code{100}.
  7963. @end table
  7964. The parameter @var{sar} is an expression containing
  7965. the following constants:
  7966. @table @option
  7967. @item E, PI, PHI
  7968. These are approximated values for the mathematical constants e
  7969. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7970. @item w, h
  7971. The input width and height.
  7972. @item a
  7973. These are the same as @var{w} / @var{h}.
  7974. @item sar
  7975. The input sample aspect ratio.
  7976. @item dar
  7977. The input display aspect ratio. It is the same as
  7978. (@var{w} / @var{h}) * @var{sar}.
  7979. @item hsub, vsub
  7980. Horizontal and vertical chroma subsample values. For example, for the
  7981. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7982. @end table
  7983. @subsection Examples
  7984. @itemize
  7985. @item
  7986. To change the display aspect ratio to 16:9, specify one of the following:
  7987. @example
  7988. setdar=dar=1.77777
  7989. setdar=dar=16/9
  7990. setdar=dar=1.77777
  7991. @end example
  7992. @item
  7993. To change the sample aspect ratio to 10:11, specify:
  7994. @example
  7995. setsar=sar=10/11
  7996. @end example
  7997. @item
  7998. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7999. 1000 in the aspect ratio reduction, use the command:
  8000. @example
  8001. setdar=ratio=16/9:max=1000
  8002. @end example
  8003. @end itemize
  8004. @anchor{setfield}
  8005. @section setfield
  8006. Force field for the output video frame.
  8007. The @code{setfield} filter marks the interlace type field for the
  8008. output frames. It does not change the input frame, but only sets the
  8009. corresponding property, which affects how the frame is treated by
  8010. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8011. The filter accepts the following options:
  8012. @table @option
  8013. @item mode
  8014. Available values are:
  8015. @table @samp
  8016. @item auto
  8017. Keep the same field property.
  8018. @item bff
  8019. Mark the frame as bottom-field-first.
  8020. @item tff
  8021. Mark the frame as top-field-first.
  8022. @item prog
  8023. Mark the frame as progressive.
  8024. @end table
  8025. @end table
  8026. @section showinfo
  8027. Show a line containing various information for each input video frame.
  8028. The input video is not modified.
  8029. The shown line contains a sequence of key/value pairs of the form
  8030. @var{key}:@var{value}.
  8031. The following values are shown in the output:
  8032. @table @option
  8033. @item n
  8034. The (sequential) number of the input frame, starting from 0.
  8035. @item pts
  8036. The Presentation TimeStamp of the input frame, expressed as a number of
  8037. time base units. The time base unit depends on the filter input pad.
  8038. @item pts_time
  8039. The Presentation TimeStamp of the input frame, expressed as a number of
  8040. seconds.
  8041. @item pos
  8042. The position of the frame in the input stream, or -1 if this information is
  8043. unavailable and/or meaningless (for example in case of synthetic video).
  8044. @item fmt
  8045. The pixel format name.
  8046. @item sar
  8047. The sample aspect ratio of the input frame, expressed in the form
  8048. @var{num}/@var{den}.
  8049. @item s
  8050. The size of the input frame. For the syntax of this option, check the
  8051. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8052. @item i
  8053. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8054. for bottom field first).
  8055. @item iskey
  8056. This is 1 if the frame is a key frame, 0 otherwise.
  8057. @item type
  8058. The picture type of the input frame ("I" for an I-frame, "P" for a
  8059. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8060. Also refer to the documentation of the @code{AVPictureType} enum and of
  8061. the @code{av_get_picture_type_char} function defined in
  8062. @file{libavutil/avutil.h}.
  8063. @item checksum
  8064. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8065. @item plane_checksum
  8066. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8067. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8068. @end table
  8069. @section showpalette
  8070. Displays the 256 colors palette of each frame. This filter is only relevant for
  8071. @var{pal8} pixel format frames.
  8072. It accepts the following option:
  8073. @table @option
  8074. @item s
  8075. Set the size of the box used to represent one palette color entry. Default is
  8076. @code{30} (for a @code{30x30} pixel box).
  8077. @end table
  8078. @section shuffleframes
  8079. Reorder and/or duplicate video frames.
  8080. It accepts the following parameters:
  8081. @table @option
  8082. @item mapping
  8083. Set the destination indexes of input frames.
  8084. This is space or '|' separated list of indexes that maps input frames to output
  8085. frames. Number of indexes also sets maximal value that each index may have.
  8086. @end table
  8087. The first frame has the index 0. The default is to keep the input unchanged.
  8088. Swap second and third frame of every three frames of the input:
  8089. @example
  8090. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8091. @end example
  8092. @section shuffleplanes
  8093. Reorder and/or duplicate video planes.
  8094. It accepts the following parameters:
  8095. @table @option
  8096. @item map0
  8097. The index of the input plane to be used as the first output plane.
  8098. @item map1
  8099. The index of the input plane to be used as the second output plane.
  8100. @item map2
  8101. The index of the input plane to be used as the third output plane.
  8102. @item map3
  8103. The index of the input plane to be used as the fourth output plane.
  8104. @end table
  8105. The first plane has the index 0. The default is to keep the input unchanged.
  8106. Swap the second and third planes of the input:
  8107. @example
  8108. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8109. @end example
  8110. @anchor{signalstats}
  8111. @section signalstats
  8112. Evaluate various visual metrics that assist in determining issues associated
  8113. with the digitization of analog video media.
  8114. By default the filter will log these metadata values:
  8115. @table @option
  8116. @item YMIN
  8117. Display the minimal Y value contained within the input frame. Expressed in
  8118. range of [0-255].
  8119. @item YLOW
  8120. Display the Y value at the 10% percentile within the input frame. Expressed in
  8121. range of [0-255].
  8122. @item YAVG
  8123. Display the average Y value within the input frame. Expressed in range of
  8124. [0-255].
  8125. @item YHIGH
  8126. Display the Y value at the 90% percentile within the input frame. Expressed in
  8127. range of [0-255].
  8128. @item YMAX
  8129. Display the maximum Y value contained within the input frame. Expressed in
  8130. range of [0-255].
  8131. @item UMIN
  8132. Display the minimal U value contained within the input frame. Expressed in
  8133. range of [0-255].
  8134. @item ULOW
  8135. Display the U value at the 10% percentile within the input frame. Expressed in
  8136. range of [0-255].
  8137. @item UAVG
  8138. Display the average U value within the input frame. Expressed in range of
  8139. [0-255].
  8140. @item UHIGH
  8141. Display the U value at the 90% percentile within the input frame. Expressed in
  8142. range of [0-255].
  8143. @item UMAX
  8144. Display the maximum U value contained within the input frame. Expressed in
  8145. range of [0-255].
  8146. @item VMIN
  8147. Display the minimal V value contained within the input frame. Expressed in
  8148. range of [0-255].
  8149. @item VLOW
  8150. Display the V value at the 10% percentile within the input frame. Expressed in
  8151. range of [0-255].
  8152. @item VAVG
  8153. Display the average V value within the input frame. Expressed in range of
  8154. [0-255].
  8155. @item VHIGH
  8156. Display the V value at the 90% percentile within the input frame. Expressed in
  8157. range of [0-255].
  8158. @item VMAX
  8159. Display the maximum V value contained within the input frame. Expressed in
  8160. range of [0-255].
  8161. @item SATMIN
  8162. Display the minimal saturation value contained within the input frame.
  8163. Expressed in range of [0-~181.02].
  8164. @item SATLOW
  8165. Display the saturation value at the 10% percentile within the input frame.
  8166. Expressed in range of [0-~181.02].
  8167. @item SATAVG
  8168. Display the average saturation value within the input frame. Expressed in range
  8169. of [0-~181.02].
  8170. @item SATHIGH
  8171. Display the saturation value at the 90% percentile within the input frame.
  8172. Expressed in range of [0-~181.02].
  8173. @item SATMAX
  8174. Display the maximum saturation value contained within the input frame.
  8175. Expressed in range of [0-~181.02].
  8176. @item HUEMED
  8177. Display the median value for hue within the input frame. Expressed in range of
  8178. [0-360].
  8179. @item HUEAVG
  8180. Display the average value for hue within the input frame. Expressed in range of
  8181. [0-360].
  8182. @item YDIF
  8183. Display the average of sample value difference between all values of the Y
  8184. plane in the current frame and corresponding values of the previous input frame.
  8185. Expressed in range of [0-255].
  8186. @item UDIF
  8187. Display the average of sample value difference between all values of the U
  8188. plane in the current frame and corresponding values of the previous input frame.
  8189. Expressed in range of [0-255].
  8190. @item VDIF
  8191. Display the average of sample value difference between all values of the V
  8192. plane in the current frame and corresponding values of the previous input frame.
  8193. Expressed in range of [0-255].
  8194. @end table
  8195. The filter accepts the following options:
  8196. @table @option
  8197. @item stat
  8198. @item out
  8199. @option{stat} specify an additional form of image analysis.
  8200. @option{out} output video with the specified type of pixel highlighted.
  8201. Both options accept the following values:
  8202. @table @samp
  8203. @item tout
  8204. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8205. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8206. include the results of video dropouts, head clogs, or tape tracking issues.
  8207. @item vrep
  8208. Identify @var{vertical line repetition}. Vertical line repetition includes
  8209. similar rows of pixels within a frame. In born-digital video vertical line
  8210. repetition is common, but this pattern is uncommon in video digitized from an
  8211. analog source. When it occurs in video that results from the digitization of an
  8212. analog source it can indicate concealment from a dropout compensator.
  8213. @item brng
  8214. Identify pixels that fall outside of legal broadcast range.
  8215. @end table
  8216. @item color, c
  8217. Set the highlight color for the @option{out} option. The default color is
  8218. yellow.
  8219. @end table
  8220. @subsection Examples
  8221. @itemize
  8222. @item
  8223. Output data of various video metrics:
  8224. @example
  8225. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8226. @end example
  8227. @item
  8228. Output specific data about the minimum and maximum values of the Y plane per frame:
  8229. @example
  8230. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8231. @end example
  8232. @item
  8233. Playback video while highlighting pixels that are outside of broadcast range in red.
  8234. @example
  8235. ffplay example.mov -vf signalstats="out=brng:color=red"
  8236. @end example
  8237. @item
  8238. Playback video with signalstats metadata drawn over the frame.
  8239. @example
  8240. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8241. @end example
  8242. The contents of signalstat_drawtext.txt used in the command are:
  8243. @example
  8244. time %@{pts:hms@}
  8245. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8246. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8247. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8248. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8249. @end example
  8250. @end itemize
  8251. @anchor{smartblur}
  8252. @section smartblur
  8253. Blur the input video without impacting the outlines.
  8254. It accepts the following options:
  8255. @table @option
  8256. @item luma_radius, lr
  8257. Set the luma radius. The option value must be a float number in
  8258. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8259. used to blur the image (slower if larger). Default value is 1.0.
  8260. @item luma_strength, ls
  8261. Set the luma strength. The option value must be a float number
  8262. in the range [-1.0,1.0] that configures the blurring. A value included
  8263. in [0.0,1.0] will blur the image whereas a value included in
  8264. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8265. @item luma_threshold, lt
  8266. Set the luma threshold used as a coefficient to determine
  8267. whether a pixel should be blurred or not. The option value must be an
  8268. integer in the range [-30,30]. A value of 0 will filter all the image,
  8269. a value included in [0,30] will filter flat areas and a value included
  8270. in [-30,0] will filter edges. Default value is 0.
  8271. @item chroma_radius, cr
  8272. Set the chroma radius. The option value must be a float number in
  8273. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8274. used to blur the image (slower if larger). Default value is 1.0.
  8275. @item chroma_strength, cs
  8276. Set the chroma strength. The option value must be a float number
  8277. in the range [-1.0,1.0] that configures the blurring. A value included
  8278. in [0.0,1.0] will blur the image whereas a value included in
  8279. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8280. @item chroma_threshold, ct
  8281. Set the chroma threshold used as a coefficient to determine
  8282. whether a pixel should be blurred or not. The option value must be an
  8283. integer in the range [-30,30]. A value of 0 will filter all the image,
  8284. a value included in [0,30] will filter flat areas and a value included
  8285. in [-30,0] will filter edges. Default value is 0.
  8286. @end table
  8287. If a chroma option is not explicitly set, the corresponding luma value
  8288. is set.
  8289. @section ssim
  8290. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8291. This filter takes in input two input videos, the first input is
  8292. considered the "main" source and is passed unchanged to the
  8293. output. The second input is used as a "reference" video for computing
  8294. the SSIM.
  8295. Both video inputs must have the same resolution and pixel format for
  8296. this filter to work correctly. Also it assumes that both inputs
  8297. have the same number of frames, which are compared one by one.
  8298. The filter stores the calculated SSIM of each frame.
  8299. The description of the accepted parameters follows.
  8300. @table @option
  8301. @item stats_file, f
  8302. If specified the filter will use the named file to save the SSIM of
  8303. each individual frame. When filename equals "-" the data is sent to
  8304. standard output.
  8305. @end table
  8306. The file printed if @var{stats_file} is selected, contains a sequence of
  8307. key/value pairs of the form @var{key}:@var{value} for each compared
  8308. couple of frames.
  8309. A description of each shown parameter follows:
  8310. @table @option
  8311. @item n
  8312. sequential number of the input frame, starting from 1
  8313. @item Y, U, V, R, G, B
  8314. SSIM of the compared frames for the component specified by the suffix.
  8315. @item All
  8316. SSIM of the compared frames for the whole frame.
  8317. @item dB
  8318. Same as above but in dB representation.
  8319. @end table
  8320. For example:
  8321. @example
  8322. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8323. [main][ref] ssim="stats_file=stats.log" [out]
  8324. @end example
  8325. On this example the input file being processed is compared with the
  8326. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8327. is stored in @file{stats.log}.
  8328. Another example with both psnr and ssim at same time:
  8329. @example
  8330. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8331. @end example
  8332. @section stereo3d
  8333. Convert between different stereoscopic image formats.
  8334. The filters accept the following options:
  8335. @table @option
  8336. @item in
  8337. Set stereoscopic image format of input.
  8338. Available values for input image formats are:
  8339. @table @samp
  8340. @item sbsl
  8341. side by side parallel (left eye left, right eye right)
  8342. @item sbsr
  8343. side by side crosseye (right eye left, left eye right)
  8344. @item sbs2l
  8345. side by side parallel with half width resolution
  8346. (left eye left, right eye right)
  8347. @item sbs2r
  8348. side by side crosseye with half width resolution
  8349. (right eye left, left eye right)
  8350. @item abl
  8351. above-below (left eye above, right eye below)
  8352. @item abr
  8353. above-below (right eye above, left eye below)
  8354. @item ab2l
  8355. above-below with half height resolution
  8356. (left eye above, right eye below)
  8357. @item ab2r
  8358. above-below with half height resolution
  8359. (right eye above, left eye below)
  8360. @item al
  8361. alternating frames (left eye first, right eye second)
  8362. @item ar
  8363. alternating frames (right eye first, left eye second)
  8364. @item irl
  8365. interleaved rows (left eye has top row, right eye starts on next row)
  8366. @item irr
  8367. interleaved rows (right eye has top row, left eye starts on next row)
  8368. @item icl
  8369. interleaved columns, left eye first
  8370. @item icr
  8371. interleaved columns, right eye first
  8372. Default value is @samp{sbsl}.
  8373. @end table
  8374. @item out
  8375. Set stereoscopic image format of output.
  8376. @table @samp
  8377. @item sbsl
  8378. side by side parallel (left eye left, right eye right)
  8379. @item sbsr
  8380. side by side crosseye (right eye left, left eye right)
  8381. @item sbs2l
  8382. side by side parallel with half width resolution
  8383. (left eye left, right eye right)
  8384. @item sbs2r
  8385. side by side crosseye with half width resolution
  8386. (right eye left, left eye right)
  8387. @item abl
  8388. above-below (left eye above, right eye below)
  8389. @item abr
  8390. above-below (right eye above, left eye below)
  8391. @item ab2l
  8392. above-below with half height resolution
  8393. (left eye above, right eye below)
  8394. @item ab2r
  8395. above-below with half height resolution
  8396. (right eye above, left eye below)
  8397. @item al
  8398. alternating frames (left eye first, right eye second)
  8399. @item ar
  8400. alternating frames (right eye first, left eye second)
  8401. @item irl
  8402. interleaved rows (left eye has top row, right eye starts on next row)
  8403. @item irr
  8404. interleaved rows (right eye has top row, left eye starts on next row)
  8405. @item arbg
  8406. anaglyph red/blue gray
  8407. (red filter on left eye, blue filter on right eye)
  8408. @item argg
  8409. anaglyph red/green gray
  8410. (red filter on left eye, green filter on right eye)
  8411. @item arcg
  8412. anaglyph red/cyan gray
  8413. (red filter on left eye, cyan filter on right eye)
  8414. @item arch
  8415. anaglyph red/cyan half colored
  8416. (red filter on left eye, cyan filter on right eye)
  8417. @item arcc
  8418. anaglyph red/cyan color
  8419. (red filter on left eye, cyan filter on right eye)
  8420. @item arcd
  8421. anaglyph red/cyan color optimized with the least squares projection of dubois
  8422. (red filter on left eye, cyan filter on right eye)
  8423. @item agmg
  8424. anaglyph green/magenta gray
  8425. (green filter on left eye, magenta filter on right eye)
  8426. @item agmh
  8427. anaglyph green/magenta half colored
  8428. (green filter on left eye, magenta filter on right eye)
  8429. @item agmc
  8430. anaglyph green/magenta colored
  8431. (green filter on left eye, magenta filter on right eye)
  8432. @item agmd
  8433. anaglyph green/magenta color optimized with the least squares projection of dubois
  8434. (green filter on left eye, magenta filter on right eye)
  8435. @item aybg
  8436. anaglyph yellow/blue gray
  8437. (yellow filter on left eye, blue filter on right eye)
  8438. @item aybh
  8439. anaglyph yellow/blue half colored
  8440. (yellow filter on left eye, blue filter on right eye)
  8441. @item aybc
  8442. anaglyph yellow/blue colored
  8443. (yellow filter on left eye, blue filter on right eye)
  8444. @item aybd
  8445. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8446. (yellow filter on left eye, blue filter on right eye)
  8447. @item ml
  8448. mono output (left eye only)
  8449. @item mr
  8450. mono output (right eye only)
  8451. @item chl
  8452. checkerboard, left eye first
  8453. @item chr
  8454. checkerboard, right eye first
  8455. @item icl
  8456. interleaved columns, left eye first
  8457. @item icr
  8458. interleaved columns, right eye first
  8459. @end table
  8460. Default value is @samp{arcd}.
  8461. @end table
  8462. @subsection Examples
  8463. @itemize
  8464. @item
  8465. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8466. @example
  8467. stereo3d=sbsl:aybd
  8468. @end example
  8469. @item
  8470. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8471. @example
  8472. stereo3d=abl:sbsr
  8473. @end example
  8474. @end itemize
  8475. @anchor{spp}
  8476. @section spp
  8477. Apply a simple postprocessing filter that compresses and decompresses the image
  8478. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8479. and average the results.
  8480. The filter accepts the following options:
  8481. @table @option
  8482. @item quality
  8483. Set quality. This option defines the number of levels for averaging. It accepts
  8484. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8485. effect. A value of @code{6} means the higher quality. For each increment of
  8486. that value the speed drops by a factor of approximately 2. Default value is
  8487. @code{3}.
  8488. @item qp
  8489. Force a constant quantization parameter. If not set, the filter will use the QP
  8490. from the video stream (if available).
  8491. @item mode
  8492. Set thresholding mode. Available modes are:
  8493. @table @samp
  8494. @item hard
  8495. Set hard thresholding (default).
  8496. @item soft
  8497. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8498. @end table
  8499. @item use_bframe_qp
  8500. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8501. option may cause flicker since the B-Frames have often larger QP. Default is
  8502. @code{0} (not enabled).
  8503. @end table
  8504. @anchor{subtitles}
  8505. @section subtitles
  8506. Draw subtitles on top of input video using the libass library.
  8507. To enable compilation of this filter you need to configure FFmpeg with
  8508. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8509. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8510. Alpha) subtitles format.
  8511. The filter accepts the following options:
  8512. @table @option
  8513. @item filename, f
  8514. Set the filename of the subtitle file to read. It must be specified.
  8515. @item original_size
  8516. Specify the size of the original video, the video for which the ASS file
  8517. was composed. For the syntax of this option, check the
  8518. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8519. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8520. correctly scale the fonts if the aspect ratio has been changed.
  8521. @item fontsdir
  8522. Set a directory path containing fonts that can be used by the filter.
  8523. These fonts will be used in addition to whatever the font provider uses.
  8524. @item charenc
  8525. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8526. useful if not UTF-8.
  8527. @item stream_index, si
  8528. Set subtitles stream index. @code{subtitles} filter only.
  8529. @item force_style
  8530. Override default style or script info parameters of the subtitles. It accepts a
  8531. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8532. @end table
  8533. If the first key is not specified, it is assumed that the first value
  8534. specifies the @option{filename}.
  8535. For example, to render the file @file{sub.srt} on top of the input
  8536. video, use the command:
  8537. @example
  8538. subtitles=sub.srt
  8539. @end example
  8540. which is equivalent to:
  8541. @example
  8542. subtitles=filename=sub.srt
  8543. @end example
  8544. To render the default subtitles stream from file @file{video.mkv}, use:
  8545. @example
  8546. subtitles=video.mkv
  8547. @end example
  8548. To render the second subtitles stream from that file, use:
  8549. @example
  8550. subtitles=video.mkv:si=1
  8551. @end example
  8552. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8553. @code{DejaVu Serif}, use:
  8554. @example
  8555. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8556. @end example
  8557. @section super2xsai
  8558. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8559. Interpolate) pixel art scaling algorithm.
  8560. Useful for enlarging pixel art images without reducing sharpness.
  8561. @section swapuv
  8562. Swap U & V plane.
  8563. @section telecine
  8564. Apply telecine process to the video.
  8565. This filter accepts the following options:
  8566. @table @option
  8567. @item first_field
  8568. @table @samp
  8569. @item top, t
  8570. top field first
  8571. @item bottom, b
  8572. bottom field first
  8573. The default value is @code{top}.
  8574. @end table
  8575. @item pattern
  8576. A string of numbers representing the pulldown pattern you wish to apply.
  8577. The default value is @code{23}.
  8578. @end table
  8579. @example
  8580. Some typical patterns:
  8581. NTSC output (30i):
  8582. 27.5p: 32222
  8583. 24p: 23 (classic)
  8584. 24p: 2332 (preferred)
  8585. 20p: 33
  8586. 18p: 334
  8587. 16p: 3444
  8588. PAL output (25i):
  8589. 27.5p: 12222
  8590. 24p: 222222222223 ("Euro pulldown")
  8591. 16.67p: 33
  8592. 16p: 33333334
  8593. @end example
  8594. @section thumbnail
  8595. Select the most representative frame in a given sequence of consecutive frames.
  8596. The filter accepts the following options:
  8597. @table @option
  8598. @item n
  8599. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8600. will pick one of them, and then handle the next batch of @var{n} frames until
  8601. the end. Default is @code{100}.
  8602. @end table
  8603. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8604. value will result in a higher memory usage, so a high value is not recommended.
  8605. @subsection Examples
  8606. @itemize
  8607. @item
  8608. Extract one picture each 50 frames:
  8609. @example
  8610. thumbnail=50
  8611. @end example
  8612. @item
  8613. Complete example of a thumbnail creation with @command{ffmpeg}:
  8614. @example
  8615. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8616. @end example
  8617. @end itemize
  8618. @section tile
  8619. Tile several successive frames together.
  8620. The filter accepts the following options:
  8621. @table @option
  8622. @item layout
  8623. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8624. this option, check the
  8625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8626. @item nb_frames
  8627. Set the maximum number of frames to render in the given area. It must be less
  8628. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8629. the area will be used.
  8630. @item margin
  8631. Set the outer border margin in pixels.
  8632. @item padding
  8633. Set the inner border thickness (i.e. the number of pixels between frames). For
  8634. more advanced padding options (such as having different values for the edges),
  8635. refer to the pad video filter.
  8636. @item color
  8637. Specify the color of the unused area. For the syntax of this option, check the
  8638. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8639. is "black".
  8640. @end table
  8641. @subsection Examples
  8642. @itemize
  8643. @item
  8644. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8645. @example
  8646. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8647. @end example
  8648. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8649. duplicating each output frame to accommodate the originally detected frame
  8650. rate.
  8651. @item
  8652. Display @code{5} pictures in an area of @code{3x2} frames,
  8653. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8654. mixed flat and named options:
  8655. @example
  8656. tile=3x2:nb_frames=5:padding=7:margin=2
  8657. @end example
  8658. @end itemize
  8659. @section tinterlace
  8660. Perform various types of temporal field interlacing.
  8661. Frames are counted starting from 1, so the first input frame is
  8662. considered odd.
  8663. The filter accepts the following options:
  8664. @table @option
  8665. @item mode
  8666. Specify the mode of the interlacing. This option can also be specified
  8667. as a value alone. See below for a list of values for this option.
  8668. Available values are:
  8669. @table @samp
  8670. @item merge, 0
  8671. Move odd frames into the upper field, even into the lower field,
  8672. generating a double height frame at half frame rate.
  8673. @example
  8674. ------> time
  8675. Input:
  8676. Frame 1 Frame 2 Frame 3 Frame 4
  8677. 11111 22222 33333 44444
  8678. 11111 22222 33333 44444
  8679. 11111 22222 33333 44444
  8680. 11111 22222 33333 44444
  8681. Output:
  8682. 11111 33333
  8683. 22222 44444
  8684. 11111 33333
  8685. 22222 44444
  8686. 11111 33333
  8687. 22222 44444
  8688. 11111 33333
  8689. 22222 44444
  8690. @end example
  8691. @item drop_odd, 1
  8692. Only output even frames, odd frames are dropped, generating a frame with
  8693. unchanged height at half frame rate.
  8694. @example
  8695. ------> time
  8696. Input:
  8697. Frame 1 Frame 2 Frame 3 Frame 4
  8698. 11111 22222 33333 44444
  8699. 11111 22222 33333 44444
  8700. 11111 22222 33333 44444
  8701. 11111 22222 33333 44444
  8702. Output:
  8703. 22222 44444
  8704. 22222 44444
  8705. 22222 44444
  8706. 22222 44444
  8707. @end example
  8708. @item drop_even, 2
  8709. Only output odd frames, even frames are dropped, generating a frame with
  8710. unchanged height at half frame rate.
  8711. @example
  8712. ------> time
  8713. Input:
  8714. Frame 1 Frame 2 Frame 3 Frame 4
  8715. 11111 22222 33333 44444
  8716. 11111 22222 33333 44444
  8717. 11111 22222 33333 44444
  8718. 11111 22222 33333 44444
  8719. Output:
  8720. 11111 33333
  8721. 11111 33333
  8722. 11111 33333
  8723. 11111 33333
  8724. @end example
  8725. @item pad, 3
  8726. Expand each frame to full height, but pad alternate lines with black,
  8727. generating a frame with double height at the same input frame rate.
  8728. @example
  8729. ------> time
  8730. Input:
  8731. Frame 1 Frame 2 Frame 3 Frame 4
  8732. 11111 22222 33333 44444
  8733. 11111 22222 33333 44444
  8734. 11111 22222 33333 44444
  8735. 11111 22222 33333 44444
  8736. Output:
  8737. 11111 ..... 33333 .....
  8738. ..... 22222 ..... 44444
  8739. 11111 ..... 33333 .....
  8740. ..... 22222 ..... 44444
  8741. 11111 ..... 33333 .....
  8742. ..... 22222 ..... 44444
  8743. 11111 ..... 33333 .....
  8744. ..... 22222 ..... 44444
  8745. @end example
  8746. @item interleave_top, 4
  8747. Interleave the upper field from odd frames with the lower field from
  8748. even frames, generating a frame with unchanged height at half frame rate.
  8749. @example
  8750. ------> time
  8751. Input:
  8752. Frame 1 Frame 2 Frame 3 Frame 4
  8753. 11111<- 22222 33333<- 44444
  8754. 11111 22222<- 33333 44444<-
  8755. 11111<- 22222 33333<- 44444
  8756. 11111 22222<- 33333 44444<-
  8757. Output:
  8758. 11111 33333
  8759. 22222 44444
  8760. 11111 33333
  8761. 22222 44444
  8762. @end example
  8763. @item interleave_bottom, 5
  8764. Interleave the lower field from odd frames with the upper field from
  8765. even frames, generating a frame with unchanged height at half frame rate.
  8766. @example
  8767. ------> time
  8768. Input:
  8769. Frame 1 Frame 2 Frame 3 Frame 4
  8770. 11111 22222<- 33333 44444<-
  8771. 11111<- 22222 33333<- 44444
  8772. 11111 22222<- 33333 44444<-
  8773. 11111<- 22222 33333<- 44444
  8774. Output:
  8775. 22222 44444
  8776. 11111 33333
  8777. 22222 44444
  8778. 11111 33333
  8779. @end example
  8780. @item interlacex2, 6
  8781. Double frame rate with unchanged height. Frames are inserted each
  8782. containing the second temporal field from the previous input frame and
  8783. the first temporal field from the next input frame. This mode relies on
  8784. the top_field_first flag. Useful for interlaced video displays with no
  8785. field synchronisation.
  8786. @example
  8787. ------> time
  8788. Input:
  8789. Frame 1 Frame 2 Frame 3 Frame 4
  8790. 11111 22222 33333 44444
  8791. 11111 22222 33333 44444
  8792. 11111 22222 33333 44444
  8793. 11111 22222 33333 44444
  8794. Output:
  8795. 11111 22222 22222 33333 33333 44444 44444
  8796. 11111 11111 22222 22222 33333 33333 44444
  8797. 11111 22222 22222 33333 33333 44444 44444
  8798. 11111 11111 22222 22222 33333 33333 44444
  8799. @end example
  8800. @item mergex2, 7
  8801. Move odd frames into the upper field, even into the lower field,
  8802. generating a double height frame at same frame rate.
  8803. @example
  8804. ------> time
  8805. Input:
  8806. Frame 1 Frame 2 Frame 3 Frame 4
  8807. 11111 22222 33333 44444
  8808. 11111 22222 33333 44444
  8809. 11111 22222 33333 44444
  8810. 11111 22222 33333 44444
  8811. Output:
  8812. 11111 33333 33333 55555
  8813. 22222 22222 44444 44444
  8814. 11111 33333 33333 55555
  8815. 22222 22222 44444 44444
  8816. 11111 33333 33333 55555
  8817. 22222 22222 44444 44444
  8818. 11111 33333 33333 55555
  8819. 22222 22222 44444 44444
  8820. @end example
  8821. @end table
  8822. Numeric values are deprecated but are accepted for backward
  8823. compatibility reasons.
  8824. Default mode is @code{merge}.
  8825. @item flags
  8826. Specify flags influencing the filter process.
  8827. Available value for @var{flags} is:
  8828. @table @option
  8829. @item low_pass_filter, vlfp
  8830. Enable vertical low-pass filtering in the filter.
  8831. Vertical low-pass filtering is required when creating an interlaced
  8832. destination from a progressive source which contains high-frequency
  8833. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8834. patterning.
  8835. Vertical low-pass filtering can only be enabled for @option{mode}
  8836. @var{interleave_top} and @var{interleave_bottom}.
  8837. @end table
  8838. @end table
  8839. @section transpose
  8840. Transpose rows with columns in the input video and optionally flip it.
  8841. It accepts the following parameters:
  8842. @table @option
  8843. @item dir
  8844. Specify the transposition direction.
  8845. Can assume the following values:
  8846. @table @samp
  8847. @item 0, 4, cclock_flip
  8848. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8849. @example
  8850. L.R L.l
  8851. . . -> . .
  8852. l.r R.r
  8853. @end example
  8854. @item 1, 5, clock
  8855. Rotate by 90 degrees clockwise, that is:
  8856. @example
  8857. L.R l.L
  8858. . . -> . .
  8859. l.r r.R
  8860. @end example
  8861. @item 2, 6, cclock
  8862. Rotate by 90 degrees counterclockwise, that is:
  8863. @example
  8864. L.R R.r
  8865. . . -> . .
  8866. l.r L.l
  8867. @end example
  8868. @item 3, 7, clock_flip
  8869. Rotate by 90 degrees clockwise and vertically flip, that is:
  8870. @example
  8871. L.R r.R
  8872. . . -> . .
  8873. l.r l.L
  8874. @end example
  8875. @end table
  8876. For values between 4-7, the transposition is only done if the input
  8877. video geometry is portrait and not landscape. These values are
  8878. deprecated, the @code{passthrough} option should be used instead.
  8879. Numerical values are deprecated, and should be dropped in favor of
  8880. symbolic constants.
  8881. @item passthrough
  8882. Do not apply the transposition if the input geometry matches the one
  8883. specified by the specified value. It accepts the following values:
  8884. @table @samp
  8885. @item none
  8886. Always apply transposition.
  8887. @item portrait
  8888. Preserve portrait geometry (when @var{height} >= @var{width}).
  8889. @item landscape
  8890. Preserve landscape geometry (when @var{width} >= @var{height}).
  8891. @end table
  8892. Default value is @code{none}.
  8893. @end table
  8894. For example to rotate by 90 degrees clockwise and preserve portrait
  8895. layout:
  8896. @example
  8897. transpose=dir=1:passthrough=portrait
  8898. @end example
  8899. The command above can also be specified as:
  8900. @example
  8901. transpose=1:portrait
  8902. @end example
  8903. @section trim
  8904. Trim the input so that the output contains one continuous subpart of the input.
  8905. It accepts the following parameters:
  8906. @table @option
  8907. @item start
  8908. Specify the time of the start of the kept section, i.e. the frame with the
  8909. timestamp @var{start} will be the first frame in the output.
  8910. @item end
  8911. Specify the time of the first frame that will be dropped, i.e. the frame
  8912. immediately preceding the one with the timestamp @var{end} will be the last
  8913. frame in the output.
  8914. @item start_pts
  8915. This is the same as @var{start}, except this option sets the start timestamp
  8916. in timebase units instead of seconds.
  8917. @item end_pts
  8918. This is the same as @var{end}, except this option sets the end timestamp
  8919. in timebase units instead of seconds.
  8920. @item duration
  8921. The maximum duration of the output in seconds.
  8922. @item start_frame
  8923. The number of the first frame that should be passed to the output.
  8924. @item end_frame
  8925. The number of the first frame that should be dropped.
  8926. @end table
  8927. @option{start}, @option{end}, and @option{duration} are expressed as time
  8928. duration specifications; see
  8929. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8930. for the accepted syntax.
  8931. Note that the first two sets of the start/end options and the @option{duration}
  8932. option look at the frame timestamp, while the _frame variants simply count the
  8933. frames that pass through the filter. Also note that this filter does not modify
  8934. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8935. setpts filter after the trim filter.
  8936. If multiple start or end options are set, this filter tries to be greedy and
  8937. keep all the frames that match at least one of the specified constraints. To keep
  8938. only the part that matches all the constraints at once, chain multiple trim
  8939. filters.
  8940. The defaults are such that all the input is kept. So it is possible to set e.g.
  8941. just the end values to keep everything before the specified time.
  8942. Examples:
  8943. @itemize
  8944. @item
  8945. Drop everything except the second minute of input:
  8946. @example
  8947. ffmpeg -i INPUT -vf trim=60:120
  8948. @end example
  8949. @item
  8950. Keep only the first second:
  8951. @example
  8952. ffmpeg -i INPUT -vf trim=duration=1
  8953. @end example
  8954. @end itemize
  8955. @anchor{unsharp}
  8956. @section unsharp
  8957. Sharpen or blur the input video.
  8958. It accepts the following parameters:
  8959. @table @option
  8960. @item luma_msize_x, lx
  8961. Set the luma matrix horizontal size. It must be an odd integer between
  8962. 3 and 63. The default value is 5.
  8963. @item luma_msize_y, ly
  8964. Set the luma matrix vertical size. It must be an odd integer between 3
  8965. and 63. The default value is 5.
  8966. @item luma_amount, la
  8967. Set the luma effect strength. It must be a floating point number, reasonable
  8968. values lay between -1.5 and 1.5.
  8969. Negative values will blur the input video, while positive values will
  8970. sharpen it, a value of zero will disable the effect.
  8971. Default value is 1.0.
  8972. @item chroma_msize_x, cx
  8973. Set the chroma matrix horizontal size. It must be an odd integer
  8974. between 3 and 63. The default value is 5.
  8975. @item chroma_msize_y, cy
  8976. Set the chroma matrix vertical size. It must be an odd integer
  8977. between 3 and 63. The default value is 5.
  8978. @item chroma_amount, ca
  8979. Set the chroma effect strength. It must be a floating point number, reasonable
  8980. values lay between -1.5 and 1.5.
  8981. Negative values will blur the input video, while positive values will
  8982. sharpen it, a value of zero will disable the effect.
  8983. Default value is 0.0.
  8984. @item opencl
  8985. If set to 1, specify using OpenCL capabilities, only available if
  8986. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8987. @end table
  8988. All parameters are optional and default to the equivalent of the
  8989. string '5:5:1.0:5:5:0.0'.
  8990. @subsection Examples
  8991. @itemize
  8992. @item
  8993. Apply strong luma sharpen effect:
  8994. @example
  8995. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8996. @end example
  8997. @item
  8998. Apply a strong blur of both luma and chroma parameters:
  8999. @example
  9000. unsharp=7:7:-2:7:7:-2
  9001. @end example
  9002. @end itemize
  9003. @section uspp
  9004. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9005. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9006. shifts and average the results.
  9007. The way this differs from the behavior of spp is that uspp actually encodes &
  9008. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9009. DCT similar to MJPEG.
  9010. The filter accepts the following options:
  9011. @table @option
  9012. @item quality
  9013. Set quality. This option defines the number of levels for averaging. It accepts
  9014. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9015. effect. A value of @code{8} means the higher quality. For each increment of
  9016. that value the speed drops by a factor of approximately 2. Default value is
  9017. @code{3}.
  9018. @item qp
  9019. Force a constant quantization parameter. If not set, the filter will use the QP
  9020. from the video stream (if available).
  9021. @end table
  9022. @section vectorscope
  9023. Display 2 color component values in the two dimensional graph (which is called
  9024. a vectorscope).
  9025. This filter accepts the following options:
  9026. @table @option
  9027. @item mode, m
  9028. Set vectorscope mode.
  9029. It accepts the following values:
  9030. @table @samp
  9031. @item gray
  9032. Gray values are displayed on graph, higher brightness means more pixels have
  9033. same component color value on location in graph. This is the default mode.
  9034. @item color
  9035. Gray values are displayed on graph. Surrounding pixels values which are not
  9036. present in video frame are drawn in gradient of 2 color components which are
  9037. set by option @code{x} and @code{y}.
  9038. @item color2
  9039. Actual color components values present in video frame are displayed on graph.
  9040. @item color3
  9041. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9042. on graph increases value of another color component, which is luminance by
  9043. default values of @code{x} and @code{y}.
  9044. @item color4
  9045. Actual colors present in video frame are displayed on graph. If two different
  9046. colors map to same position on graph then color with higher value of component
  9047. not present in graph is picked.
  9048. @end table
  9049. @item x
  9050. Set which color component will be represented on X-axis. Default is @code{1}.
  9051. @item y
  9052. Set which color component will be represented on Y-axis. Default is @code{2}.
  9053. @item intensity, i
  9054. Set intensity, used by modes: gray, color and color3 for increasing brightness
  9055. of color component which represents frequency of (X, Y) location in graph.
  9056. @item envelope, e
  9057. @table @samp
  9058. @item none
  9059. No envelope, this is default.
  9060. @item instant
  9061. Instant envelope, even darkest single pixel will be clearly highlighted.
  9062. @item peak
  9063. Hold maximum and minimum values presented in graph over time. This way you
  9064. can still spot out of range values without constantly looking at vectorscope.
  9065. @item peak+instant
  9066. Peak and instant envelope combined together.
  9067. @end table
  9068. @end table
  9069. @anchor{vidstabdetect}
  9070. @section vidstabdetect
  9071. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9072. @ref{vidstabtransform} for pass 2.
  9073. This filter generates a file with relative translation and rotation
  9074. transform information about subsequent frames, which is then used by
  9075. the @ref{vidstabtransform} filter.
  9076. To enable compilation of this filter you need to configure FFmpeg with
  9077. @code{--enable-libvidstab}.
  9078. This filter accepts the following options:
  9079. @table @option
  9080. @item result
  9081. Set the path to the file used to write the transforms information.
  9082. Default value is @file{transforms.trf}.
  9083. @item shakiness
  9084. Set how shaky the video is and how quick the camera is. It accepts an
  9085. integer in the range 1-10, a value of 1 means little shakiness, a
  9086. value of 10 means strong shakiness. Default value is 5.
  9087. @item accuracy
  9088. Set the accuracy of the detection process. It must be a value in the
  9089. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9090. accuracy. Default value is 15.
  9091. @item stepsize
  9092. Set stepsize of the search process. The region around minimum is
  9093. scanned with 1 pixel resolution. Default value is 6.
  9094. @item mincontrast
  9095. Set minimum contrast. Below this value a local measurement field is
  9096. discarded. Must be a floating point value in the range 0-1. Default
  9097. value is 0.3.
  9098. @item tripod
  9099. Set reference frame number for tripod mode.
  9100. If enabled, the motion of the frames is compared to a reference frame
  9101. in the filtered stream, identified by the specified number. The idea
  9102. is to compensate all movements in a more-or-less static scene and keep
  9103. the camera view absolutely still.
  9104. If set to 0, it is disabled. The frames are counted starting from 1.
  9105. @item show
  9106. Show fields and transforms in the resulting frames. It accepts an
  9107. integer in the range 0-2. Default value is 0, which disables any
  9108. visualization.
  9109. @end table
  9110. @subsection Examples
  9111. @itemize
  9112. @item
  9113. Use default values:
  9114. @example
  9115. vidstabdetect
  9116. @end example
  9117. @item
  9118. Analyze strongly shaky movie and put the results in file
  9119. @file{mytransforms.trf}:
  9120. @example
  9121. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9122. @end example
  9123. @item
  9124. Visualize the result of internal transformations in the resulting
  9125. video:
  9126. @example
  9127. vidstabdetect=show=1
  9128. @end example
  9129. @item
  9130. Analyze a video with medium shakiness using @command{ffmpeg}:
  9131. @example
  9132. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9133. @end example
  9134. @end itemize
  9135. @anchor{vidstabtransform}
  9136. @section vidstabtransform
  9137. Video stabilization/deshaking: pass 2 of 2,
  9138. see @ref{vidstabdetect} for pass 1.
  9139. Read a file with transform information for each frame and
  9140. apply/compensate them. Together with the @ref{vidstabdetect}
  9141. filter this can be used to deshake videos. See also
  9142. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9143. the @ref{unsharp} filter, see below.
  9144. To enable compilation of this filter you need to configure FFmpeg with
  9145. @code{--enable-libvidstab}.
  9146. @subsection Options
  9147. @table @option
  9148. @item input
  9149. Set path to the file used to read the transforms. Default value is
  9150. @file{transforms.trf}.
  9151. @item smoothing
  9152. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9153. camera movements. Default value is 10.
  9154. For example a number of 10 means that 21 frames are used (10 in the
  9155. past and 10 in the future) to smoothen the motion in the video. A
  9156. larger value leads to a smoother video, but limits the acceleration of
  9157. the camera (pan/tilt movements). 0 is a special case where a static
  9158. camera is simulated.
  9159. @item optalgo
  9160. Set the camera path optimization algorithm.
  9161. Accepted values are:
  9162. @table @samp
  9163. @item gauss
  9164. gaussian kernel low-pass filter on camera motion (default)
  9165. @item avg
  9166. averaging on transformations
  9167. @end table
  9168. @item maxshift
  9169. Set maximal number of pixels to translate frames. Default value is -1,
  9170. meaning no limit.
  9171. @item maxangle
  9172. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9173. value is -1, meaning no limit.
  9174. @item crop
  9175. Specify how to deal with borders that may be visible due to movement
  9176. compensation.
  9177. Available values are:
  9178. @table @samp
  9179. @item keep
  9180. keep image information from previous frame (default)
  9181. @item black
  9182. fill the border black
  9183. @end table
  9184. @item invert
  9185. Invert transforms if set to 1. Default value is 0.
  9186. @item relative
  9187. Consider transforms as relative to previous frame if set to 1,
  9188. absolute if set to 0. Default value is 0.
  9189. @item zoom
  9190. Set percentage to zoom. A positive value will result in a zoom-in
  9191. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9192. zoom).
  9193. @item optzoom
  9194. Set optimal zooming to avoid borders.
  9195. Accepted values are:
  9196. @table @samp
  9197. @item 0
  9198. disabled
  9199. @item 1
  9200. optimal static zoom value is determined (only very strong movements
  9201. will lead to visible borders) (default)
  9202. @item 2
  9203. optimal adaptive zoom value is determined (no borders will be
  9204. visible), see @option{zoomspeed}
  9205. @end table
  9206. Note that the value given at zoom is added to the one calculated here.
  9207. @item zoomspeed
  9208. Set percent to zoom maximally each frame (enabled when
  9209. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9210. 0.25.
  9211. @item interpol
  9212. Specify type of interpolation.
  9213. Available values are:
  9214. @table @samp
  9215. @item no
  9216. no interpolation
  9217. @item linear
  9218. linear only horizontal
  9219. @item bilinear
  9220. linear in both directions (default)
  9221. @item bicubic
  9222. cubic in both directions (slow)
  9223. @end table
  9224. @item tripod
  9225. Enable virtual tripod mode if set to 1, which is equivalent to
  9226. @code{relative=0:smoothing=0}. Default value is 0.
  9227. Use also @code{tripod} option of @ref{vidstabdetect}.
  9228. @item debug
  9229. Increase log verbosity if set to 1. Also the detected global motions
  9230. are written to the temporary file @file{global_motions.trf}. Default
  9231. value is 0.
  9232. @end table
  9233. @subsection Examples
  9234. @itemize
  9235. @item
  9236. Use @command{ffmpeg} for a typical stabilization with default values:
  9237. @example
  9238. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9239. @end example
  9240. Note the use of the @ref{unsharp} filter which is always recommended.
  9241. @item
  9242. Zoom in a bit more and load transform data from a given file:
  9243. @example
  9244. vidstabtransform=zoom=5:input="mytransforms.trf"
  9245. @end example
  9246. @item
  9247. Smoothen the video even more:
  9248. @example
  9249. vidstabtransform=smoothing=30
  9250. @end example
  9251. @end itemize
  9252. @section vflip
  9253. Flip the input video vertically.
  9254. For example, to vertically flip a video with @command{ffmpeg}:
  9255. @example
  9256. ffmpeg -i in.avi -vf "vflip" out.avi
  9257. @end example
  9258. @anchor{vignette}
  9259. @section vignette
  9260. Make or reverse a natural vignetting effect.
  9261. The filter accepts the following options:
  9262. @table @option
  9263. @item angle, a
  9264. Set lens angle expression as a number of radians.
  9265. The value is clipped in the @code{[0,PI/2]} range.
  9266. Default value: @code{"PI/5"}
  9267. @item x0
  9268. @item y0
  9269. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9270. by default.
  9271. @item mode
  9272. Set forward/backward mode.
  9273. Available modes are:
  9274. @table @samp
  9275. @item forward
  9276. The larger the distance from the central point, the darker the image becomes.
  9277. @item backward
  9278. The larger the distance from the central point, the brighter the image becomes.
  9279. This can be used to reverse a vignette effect, though there is no automatic
  9280. detection to extract the lens @option{angle} and other settings (yet). It can
  9281. also be used to create a burning effect.
  9282. @end table
  9283. Default value is @samp{forward}.
  9284. @item eval
  9285. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9286. It accepts the following values:
  9287. @table @samp
  9288. @item init
  9289. Evaluate expressions only once during the filter initialization.
  9290. @item frame
  9291. Evaluate expressions for each incoming frame. This is way slower than the
  9292. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9293. allows advanced dynamic expressions.
  9294. @end table
  9295. Default value is @samp{init}.
  9296. @item dither
  9297. Set dithering to reduce the circular banding effects. Default is @code{1}
  9298. (enabled).
  9299. @item aspect
  9300. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9301. Setting this value to the SAR of the input will make a rectangular vignetting
  9302. following the dimensions of the video.
  9303. Default is @code{1/1}.
  9304. @end table
  9305. @subsection Expressions
  9306. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9307. following parameters.
  9308. @table @option
  9309. @item w
  9310. @item h
  9311. input width and height
  9312. @item n
  9313. the number of input frame, starting from 0
  9314. @item pts
  9315. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9316. @var{TB} units, NAN if undefined
  9317. @item r
  9318. frame rate of the input video, NAN if the input frame rate is unknown
  9319. @item t
  9320. the PTS (Presentation TimeStamp) of the filtered video frame,
  9321. expressed in seconds, NAN if undefined
  9322. @item tb
  9323. time base of the input video
  9324. @end table
  9325. @subsection Examples
  9326. @itemize
  9327. @item
  9328. Apply simple strong vignetting effect:
  9329. @example
  9330. vignette=PI/4
  9331. @end example
  9332. @item
  9333. Make a flickering vignetting:
  9334. @example
  9335. vignette='PI/4+random(1)*PI/50':eval=frame
  9336. @end example
  9337. @end itemize
  9338. @section vstack
  9339. Stack input videos vertically.
  9340. All streams must be of same pixel format and of same width.
  9341. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9342. to create same output.
  9343. The filter accept the following option:
  9344. @table @option
  9345. @item inputs
  9346. Set number of input streams. Default is 2.
  9347. @item shortest
  9348. If set to 1, force the output to terminate when the shortest input
  9349. terminates. Default value is 0.
  9350. @end table
  9351. @section w3fdif
  9352. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9353. Deinterlacing Filter").
  9354. Based on the process described by Martin Weston for BBC R&D, and
  9355. implemented based on the de-interlace algorithm written by Jim
  9356. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9357. uses filter coefficients calculated by BBC R&D.
  9358. There are two sets of filter coefficients, so called "simple":
  9359. and "complex". Which set of filter coefficients is used can
  9360. be set by passing an optional parameter:
  9361. @table @option
  9362. @item filter
  9363. Set the interlacing filter coefficients. Accepts one of the following values:
  9364. @table @samp
  9365. @item simple
  9366. Simple filter coefficient set.
  9367. @item complex
  9368. More-complex filter coefficient set.
  9369. @end table
  9370. Default value is @samp{complex}.
  9371. @item deint
  9372. Specify which frames to deinterlace. Accept one of the following values:
  9373. @table @samp
  9374. @item all
  9375. Deinterlace all frames,
  9376. @item interlaced
  9377. Only deinterlace frames marked as interlaced.
  9378. @end table
  9379. Default value is @samp{all}.
  9380. @end table
  9381. @section waveform
  9382. Video waveform monitor.
  9383. The waveform monitor plots color component intensity. By default luminance
  9384. only. Each column of the waveform corresponds to a column of pixels in the
  9385. source video.
  9386. It accepts the following options:
  9387. @table @option
  9388. @item mode, m
  9389. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9390. In row mode, the graph on the left side represents color component value 0 and
  9391. the right side represents value = 255. In column mode, the top side represents
  9392. color component value = 0 and bottom side represents value = 255.
  9393. @item intensity, i
  9394. Set intensity. Smaller values are useful to find out how many values of the same
  9395. luminance are distributed across input rows/columns.
  9396. Default value is @code{0.04}. Allowed range is [0, 1].
  9397. @item mirror, r
  9398. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9399. In mirrored mode, higher values will be represented on the left
  9400. side for @code{row} mode and at the top for @code{column} mode. Default is
  9401. @code{1} (mirrored).
  9402. @item display, d
  9403. Set display mode.
  9404. It accepts the following values:
  9405. @table @samp
  9406. @item overlay
  9407. Presents information identical to that in the @code{parade}, except
  9408. that the graphs representing color components are superimposed directly
  9409. over one another.
  9410. This display mode makes it easier to spot relative differences or similarities
  9411. in overlapping areas of the color components that are supposed to be identical,
  9412. such as neutral whites, grays, or blacks.
  9413. @item parade
  9414. Display separate graph for the color components side by side in
  9415. @code{row} mode or one below the other in @code{column} mode.
  9416. Using this display mode makes it easy to spot color casts in the highlights
  9417. and shadows of an image, by comparing the contours of the top and the bottom
  9418. graphs of each waveform. Since whites, grays, and blacks are characterized
  9419. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9420. should display three waveforms of roughly equal width/height. If not, the
  9421. correction is easy to perform by making level adjustments the three waveforms.
  9422. @end table
  9423. Default is @code{parade}.
  9424. @item components, c
  9425. Set which color components to display. Default is 1, which means only luminance
  9426. or red color component if input is in RGB colorspace. If is set for example to
  9427. 7 it will display all 3 (if) available color components.
  9428. @item envelope, e
  9429. @table @samp
  9430. @item none
  9431. No envelope, this is default.
  9432. @item instant
  9433. Instant envelope, minimum and maximum values presented in graph will be easily
  9434. visible even with small @code{step} value.
  9435. @item peak
  9436. Hold minimum and maximum values presented in graph across time. This way you
  9437. can still spot out of range values without constantly looking at waveforms.
  9438. @item peak+instant
  9439. Peak and instant envelope combined together.
  9440. @end table
  9441. @item filter, f
  9442. @table @samp
  9443. @item lowpass
  9444. No filtering, this is default.
  9445. @item flat
  9446. Luma and chroma combined together.
  9447. @item aflat
  9448. Similar as above, but shows difference between blue and red chroma.
  9449. @item chroma
  9450. Displays only chroma.
  9451. @item achroma
  9452. Similar as above, but shows difference between blue and red chroma.
  9453. @item color
  9454. Displays actual color value on waveform.
  9455. @end table
  9456. @end table
  9457. @section xbr
  9458. Apply the xBR high-quality magnification filter which is designed for pixel
  9459. art. It follows a set of edge-detection rules, see
  9460. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9461. It accepts the following option:
  9462. @table @option
  9463. @item n
  9464. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9465. @code{3xBR} and @code{4} for @code{4xBR}.
  9466. Default is @code{3}.
  9467. @end table
  9468. @anchor{yadif}
  9469. @section yadif
  9470. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9471. filter").
  9472. It accepts the following parameters:
  9473. @table @option
  9474. @item mode
  9475. The interlacing mode to adopt. It accepts one of the following values:
  9476. @table @option
  9477. @item 0, send_frame
  9478. Output one frame for each frame.
  9479. @item 1, send_field
  9480. Output one frame for each field.
  9481. @item 2, send_frame_nospatial
  9482. Like @code{send_frame}, but it skips the spatial interlacing check.
  9483. @item 3, send_field_nospatial
  9484. Like @code{send_field}, but it skips the spatial interlacing check.
  9485. @end table
  9486. The default value is @code{send_frame}.
  9487. @item parity
  9488. The picture field parity assumed for the input interlaced video. It accepts one
  9489. of the following values:
  9490. @table @option
  9491. @item 0, tff
  9492. Assume the top field is first.
  9493. @item 1, bff
  9494. Assume the bottom field is first.
  9495. @item -1, auto
  9496. Enable automatic detection of field parity.
  9497. @end table
  9498. The default value is @code{auto}.
  9499. If the interlacing is unknown or the decoder does not export this information,
  9500. top field first will be assumed.
  9501. @item deint
  9502. Specify which frames to deinterlace. Accept one of the following
  9503. values:
  9504. @table @option
  9505. @item 0, all
  9506. Deinterlace all frames.
  9507. @item 1, interlaced
  9508. Only deinterlace frames marked as interlaced.
  9509. @end table
  9510. The default value is @code{all}.
  9511. @end table
  9512. @section zoompan
  9513. Apply Zoom & Pan effect.
  9514. This filter accepts the following options:
  9515. @table @option
  9516. @item zoom, z
  9517. Set the zoom expression. Default is 1.
  9518. @item x
  9519. @item y
  9520. Set the x and y expression. Default is 0.
  9521. @item d
  9522. Set the duration expression in number of frames.
  9523. This sets for how many number of frames effect will last for
  9524. single input image.
  9525. @item s
  9526. Set the output image size, default is 'hd720'.
  9527. @end table
  9528. Each expression can contain the following constants:
  9529. @table @option
  9530. @item in_w, iw
  9531. Input width.
  9532. @item in_h, ih
  9533. Input height.
  9534. @item out_w, ow
  9535. Output width.
  9536. @item out_h, oh
  9537. Output height.
  9538. @item in
  9539. Input frame count.
  9540. @item on
  9541. Output frame count.
  9542. @item x
  9543. @item y
  9544. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9545. for current input frame.
  9546. @item px
  9547. @item py
  9548. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9549. not yet such frame (first input frame).
  9550. @item zoom
  9551. Last calculated zoom from 'z' expression for current input frame.
  9552. @item pzoom
  9553. Last calculated zoom of last output frame of previous input frame.
  9554. @item duration
  9555. Number of output frames for current input frame. Calculated from 'd' expression
  9556. for each input frame.
  9557. @item pduration
  9558. number of output frames created for previous input frame
  9559. @item a
  9560. Rational number: input width / input height
  9561. @item sar
  9562. sample aspect ratio
  9563. @item dar
  9564. display aspect ratio
  9565. @end table
  9566. @subsection Examples
  9567. @itemize
  9568. @item
  9569. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9570. @example
  9571. 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
  9572. @end example
  9573. @item
  9574. Zoom-in up to 1.5 and pan always at center of picture:
  9575. @example
  9576. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9577. @end example
  9578. @end itemize
  9579. @section zscale
  9580. Scale (resize) the input video, using the z.lib library:
  9581. https://github.com/sekrit-twc/zimg.
  9582. The zscale filter forces the output display aspect ratio to be the same
  9583. as the input, by changing the output sample aspect ratio.
  9584. If the input image format is different from the format requested by
  9585. the next filter, the zscale filter will convert the input to the
  9586. requested format.
  9587. @subsection Options
  9588. The filter accepts the following options.
  9589. @table @option
  9590. @item width, w
  9591. @item height, h
  9592. Set the output video dimension expression. Default value is the input
  9593. dimension.
  9594. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9595. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9596. If one of the values is -1, the zscale filter will use a value that
  9597. maintains the aspect ratio of the input image, calculated from the
  9598. other specified dimension. If both of them are -1, the input size is
  9599. used
  9600. If one of the values is -n with n > 1, the zscale filter will also use a value
  9601. that maintains the aspect ratio of the input image, calculated from the other
  9602. specified dimension. After that it will, however, make sure that the calculated
  9603. dimension is divisible by n and adjust the value if necessary.
  9604. See below for the list of accepted constants for use in the dimension
  9605. expression.
  9606. @item size, s
  9607. Set the video size. For the syntax of this option, check the
  9608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9609. @item dither, d
  9610. Set the dither type.
  9611. Possible values are:
  9612. @table @var
  9613. @item none
  9614. @item ordered
  9615. @item random
  9616. @item error_diffusion
  9617. @end table
  9618. Default is none.
  9619. @item filter, f
  9620. Set the resize filter type.
  9621. Possible values are:
  9622. @table @var
  9623. @item point
  9624. @item bilinear
  9625. @item bicubic
  9626. @item spline16
  9627. @item spline36
  9628. @item lanczos
  9629. @end table
  9630. Default is bilinear.
  9631. @item range, r
  9632. Set the color range.
  9633. Possible values are:
  9634. @table @var
  9635. @item input
  9636. @item limited
  9637. @item full
  9638. @end table
  9639. Default is same as input.
  9640. @item primaries, p
  9641. Set the color primaries.
  9642. Possible values are:
  9643. @table @var
  9644. @item input
  9645. @item 709
  9646. @item unspecified
  9647. @item 170m
  9648. @item 240m
  9649. @item 2020
  9650. @end table
  9651. Default is same as input.
  9652. @item transfer, t
  9653. Set the transfer characteristics.
  9654. Possible values are:
  9655. @table @var
  9656. @item input
  9657. @item 709
  9658. @item unspecified
  9659. @item 601
  9660. @item linear
  9661. @item 2020_10
  9662. @item 2020_12
  9663. @end table
  9664. Default is same as input.
  9665. @item matrix, m
  9666. Set the colorspace matrix.
  9667. Possible value are:
  9668. @table @var
  9669. @item input
  9670. @item 709
  9671. @item unspecified
  9672. @item 470bg
  9673. @item 170m
  9674. @item 2020_ncl
  9675. @item 2020_cl
  9676. @end table
  9677. Default is same as input.
  9678. @end table
  9679. The values of the @option{w} and @option{h} options are expressions
  9680. containing the following constants:
  9681. @table @var
  9682. @item in_w
  9683. @item in_h
  9684. The input width and height
  9685. @item iw
  9686. @item ih
  9687. These are the same as @var{in_w} and @var{in_h}.
  9688. @item out_w
  9689. @item out_h
  9690. The output (scaled) width and height
  9691. @item ow
  9692. @item oh
  9693. These are the same as @var{out_w} and @var{out_h}
  9694. @item a
  9695. The same as @var{iw} / @var{ih}
  9696. @item sar
  9697. input sample aspect ratio
  9698. @item dar
  9699. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9700. @item hsub
  9701. @item vsub
  9702. horizontal and vertical input chroma subsample values. For example for the
  9703. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9704. @item ohsub
  9705. @item ovsub
  9706. horizontal and vertical output chroma subsample values. For example for the
  9707. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9708. @end table
  9709. @table @option
  9710. @end table
  9711. @c man end VIDEO FILTERS
  9712. @chapter Video Sources
  9713. @c man begin VIDEO SOURCES
  9714. Below is a description of the currently available video sources.
  9715. @section buffer
  9716. Buffer video frames, and make them available to the filter chain.
  9717. This source is mainly intended for a programmatic use, in particular
  9718. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9719. It accepts the following parameters:
  9720. @table @option
  9721. @item video_size
  9722. Specify the size (width and height) of the buffered video frames. For the
  9723. syntax of this option, check the
  9724. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9725. @item width
  9726. The input video width.
  9727. @item height
  9728. The input video height.
  9729. @item pix_fmt
  9730. A string representing the pixel format of the buffered video frames.
  9731. It may be a number corresponding to a pixel format, or a pixel format
  9732. name.
  9733. @item time_base
  9734. Specify the timebase assumed by the timestamps of the buffered frames.
  9735. @item frame_rate
  9736. Specify the frame rate expected for the video stream.
  9737. @item pixel_aspect, sar
  9738. The sample (pixel) aspect ratio of the input video.
  9739. @item sws_param
  9740. Specify the optional parameters to be used for the scale filter which
  9741. is automatically inserted when an input change is detected in the
  9742. input size or format.
  9743. @end table
  9744. For example:
  9745. @example
  9746. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9747. @end example
  9748. will instruct the source to accept video frames with size 320x240 and
  9749. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9750. square pixels (1:1 sample aspect ratio).
  9751. Since the pixel format with name "yuv410p" corresponds to the number 6
  9752. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9753. this example corresponds to:
  9754. @example
  9755. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9756. @end example
  9757. Alternatively, the options can be specified as a flat string, but this
  9758. syntax is deprecated:
  9759. @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}]
  9760. @section cellauto
  9761. Create a pattern generated by an elementary cellular automaton.
  9762. The initial state of the cellular automaton can be defined through the
  9763. @option{filename}, and @option{pattern} options. If such options are
  9764. not specified an initial state is created randomly.
  9765. At each new frame a new row in the video is filled with the result of
  9766. the cellular automaton next generation. The behavior when the whole
  9767. frame is filled is defined by the @option{scroll} option.
  9768. This source accepts the following options:
  9769. @table @option
  9770. @item filename, f
  9771. Read the initial cellular automaton state, i.e. the starting row, from
  9772. the specified file.
  9773. In the file, each non-whitespace character is considered an alive
  9774. cell, a newline will terminate the row, and further characters in the
  9775. file will be ignored.
  9776. @item pattern, p
  9777. Read the initial cellular automaton state, i.e. the starting row, from
  9778. the specified string.
  9779. Each non-whitespace character in the string is considered an alive
  9780. cell, a newline will terminate the row, and further characters in the
  9781. string will be ignored.
  9782. @item rate, r
  9783. Set the video rate, that is the number of frames generated per second.
  9784. Default is 25.
  9785. @item random_fill_ratio, ratio
  9786. Set the random fill ratio for the initial cellular automaton row. It
  9787. is a floating point number value ranging from 0 to 1, defaults to
  9788. 1/PHI.
  9789. This option is ignored when a file or a pattern is specified.
  9790. @item random_seed, seed
  9791. Set the seed for filling randomly the initial row, must be an integer
  9792. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9793. set to -1, the filter will try to use a good random seed on a best
  9794. effort basis.
  9795. @item rule
  9796. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9797. Default value is 110.
  9798. @item size, s
  9799. Set the size of the output video. For the syntax of this option, check the
  9800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9801. If @option{filename} or @option{pattern} is specified, the size is set
  9802. by default to the width of the specified initial state row, and the
  9803. height is set to @var{width} * PHI.
  9804. If @option{size} is set, it must contain the width of the specified
  9805. pattern string, and the specified pattern will be centered in the
  9806. larger row.
  9807. If a filename or a pattern string is not specified, the size value
  9808. defaults to "320x518" (used for a randomly generated initial state).
  9809. @item scroll
  9810. If set to 1, scroll the output upward when all the rows in the output
  9811. have been already filled. If set to 0, the new generated row will be
  9812. written over the top row just after the bottom row is filled.
  9813. Defaults to 1.
  9814. @item start_full, full
  9815. If set to 1, completely fill the output with generated rows before
  9816. outputting the first frame.
  9817. This is the default behavior, for disabling set the value to 0.
  9818. @item stitch
  9819. If set to 1, stitch the left and right row edges together.
  9820. This is the default behavior, for disabling set the value to 0.
  9821. @end table
  9822. @subsection Examples
  9823. @itemize
  9824. @item
  9825. Read the initial state from @file{pattern}, and specify an output of
  9826. size 200x400.
  9827. @example
  9828. cellauto=f=pattern:s=200x400
  9829. @end example
  9830. @item
  9831. Generate a random initial row with a width of 200 cells, with a fill
  9832. ratio of 2/3:
  9833. @example
  9834. cellauto=ratio=2/3:s=200x200
  9835. @end example
  9836. @item
  9837. Create a pattern generated by rule 18 starting by a single alive cell
  9838. centered on an initial row with width 100:
  9839. @example
  9840. cellauto=p=@@:s=100x400:full=0:rule=18
  9841. @end example
  9842. @item
  9843. Specify a more elaborated initial pattern:
  9844. @example
  9845. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9846. @end example
  9847. @end itemize
  9848. @section mandelbrot
  9849. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9850. point specified with @var{start_x} and @var{start_y}.
  9851. This source accepts the following options:
  9852. @table @option
  9853. @item end_pts
  9854. Set the terminal pts value. Default value is 400.
  9855. @item end_scale
  9856. Set the terminal scale value.
  9857. Must be a floating point value. Default value is 0.3.
  9858. @item inner
  9859. Set the inner coloring mode, that is the algorithm used to draw the
  9860. Mandelbrot fractal internal region.
  9861. It shall assume one of the following values:
  9862. @table @option
  9863. @item black
  9864. Set black mode.
  9865. @item convergence
  9866. Show time until convergence.
  9867. @item mincol
  9868. Set color based on point closest to the origin of the iterations.
  9869. @item period
  9870. Set period mode.
  9871. @end table
  9872. Default value is @var{mincol}.
  9873. @item bailout
  9874. Set the bailout value. Default value is 10.0.
  9875. @item maxiter
  9876. Set the maximum of iterations performed by the rendering
  9877. algorithm. Default value is 7189.
  9878. @item outer
  9879. Set outer coloring mode.
  9880. It shall assume one of following values:
  9881. @table @option
  9882. @item iteration_count
  9883. Set iteration cound mode.
  9884. @item normalized_iteration_count
  9885. set normalized iteration count mode.
  9886. @end table
  9887. Default value is @var{normalized_iteration_count}.
  9888. @item rate, r
  9889. Set frame rate, expressed as number of frames per second. Default
  9890. value is "25".
  9891. @item size, s
  9892. Set frame size. For the syntax of this option, check the "Video
  9893. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9894. @item start_scale
  9895. Set the initial scale value. Default value is 3.0.
  9896. @item start_x
  9897. Set the initial x position. Must be a floating point value between
  9898. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9899. @item start_y
  9900. Set the initial y position. Must be a floating point value between
  9901. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9902. @end table
  9903. @section mptestsrc
  9904. Generate various test patterns, as generated by the MPlayer test filter.
  9905. The size of the generated video is fixed, and is 256x256.
  9906. This source is useful in particular for testing encoding features.
  9907. This source accepts the following options:
  9908. @table @option
  9909. @item rate, r
  9910. Specify the frame rate of the sourced video, as the number of frames
  9911. generated per second. It has to be a string in the format
  9912. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9913. number or a valid video frame rate abbreviation. The default value is
  9914. "25".
  9915. @item duration, d
  9916. Set the duration of the sourced video. See
  9917. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9918. for the accepted syntax.
  9919. If not specified, or the expressed duration is negative, the video is
  9920. supposed to be generated forever.
  9921. @item test, t
  9922. Set the number or the name of the test to perform. Supported tests are:
  9923. @table @option
  9924. @item dc_luma
  9925. @item dc_chroma
  9926. @item freq_luma
  9927. @item freq_chroma
  9928. @item amp_luma
  9929. @item amp_chroma
  9930. @item cbp
  9931. @item mv
  9932. @item ring1
  9933. @item ring2
  9934. @item all
  9935. @end table
  9936. Default value is "all", which will cycle through the list of all tests.
  9937. @end table
  9938. Some examples:
  9939. @example
  9940. mptestsrc=t=dc_luma
  9941. @end example
  9942. will generate a "dc_luma" test pattern.
  9943. @section frei0r_src
  9944. Provide a frei0r source.
  9945. To enable compilation of this filter you need to install the frei0r
  9946. header and configure FFmpeg with @code{--enable-frei0r}.
  9947. This source accepts the following parameters:
  9948. @table @option
  9949. @item size
  9950. The size of the video to generate. For the syntax of this option, check the
  9951. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9952. @item framerate
  9953. The framerate of the generated video. It may be a string of the form
  9954. @var{num}/@var{den} or a frame rate abbreviation.
  9955. @item filter_name
  9956. The name to the frei0r source to load. For more information regarding frei0r and
  9957. how to set the parameters, read the @ref{frei0r} section in the video filters
  9958. documentation.
  9959. @item filter_params
  9960. A '|'-separated list of parameters to pass to the frei0r source.
  9961. @end table
  9962. For example, to generate a frei0r partik0l source with size 200x200
  9963. and frame rate 10 which is overlaid on the overlay filter main input:
  9964. @example
  9965. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9966. @end example
  9967. @section life
  9968. Generate a life pattern.
  9969. This source is based on a generalization of John Conway's life game.
  9970. The sourced input represents a life grid, each pixel represents a cell
  9971. which can be in one of two possible states, alive or dead. Every cell
  9972. interacts with its eight neighbours, which are the cells that are
  9973. horizontally, vertically, or diagonally adjacent.
  9974. At each interaction the grid evolves according to the adopted rule,
  9975. which specifies the number of neighbor alive cells which will make a
  9976. cell stay alive or born. The @option{rule} option allows one to specify
  9977. the rule to adopt.
  9978. This source accepts the following options:
  9979. @table @option
  9980. @item filename, f
  9981. Set the file from which to read the initial grid state. In the file,
  9982. each non-whitespace character is considered an alive cell, and newline
  9983. is used to delimit the end of each row.
  9984. If this option is not specified, the initial grid is generated
  9985. randomly.
  9986. @item rate, r
  9987. Set the video rate, that is the number of frames generated per second.
  9988. Default is 25.
  9989. @item random_fill_ratio, ratio
  9990. Set the random fill ratio for the initial random grid. It is a
  9991. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9992. It is ignored when a file is specified.
  9993. @item random_seed, seed
  9994. Set the seed for filling the initial random grid, must be an integer
  9995. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9996. set to -1, the filter will try to use a good random seed on a best
  9997. effort basis.
  9998. @item rule
  9999. Set the life rule.
  10000. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10001. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10002. @var{NS} specifies the number of alive neighbor cells which make a
  10003. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10004. which make a dead cell to become alive (i.e. to "born").
  10005. "s" and "b" can be used in place of "S" and "B", respectively.
  10006. Alternatively a rule can be specified by an 18-bits integer. The 9
  10007. high order bits are used to encode the next cell state if it is alive
  10008. for each number of neighbor alive cells, the low order bits specify
  10009. the rule for "borning" new cells. Higher order bits encode for an
  10010. higher number of neighbor cells.
  10011. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10012. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10013. Default value is "S23/B3", which is the original Conway's game of life
  10014. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10015. cells, and will born a new cell if there are three alive cells around
  10016. a dead cell.
  10017. @item size, s
  10018. Set the size of the output video. For the syntax of this option, check the
  10019. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10020. If @option{filename} is specified, the size is set by default to the
  10021. same size of the input file. If @option{size} is set, it must contain
  10022. the size specified in the input file, and the initial grid defined in
  10023. that file is centered in the larger resulting area.
  10024. If a filename is not specified, the size value defaults to "320x240"
  10025. (used for a randomly generated initial grid).
  10026. @item stitch
  10027. If set to 1, stitch the left and right grid edges together, and the
  10028. top and bottom edges also. Defaults to 1.
  10029. @item mold
  10030. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10031. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10032. value from 0 to 255.
  10033. @item life_color
  10034. Set the color of living (or new born) cells.
  10035. @item death_color
  10036. Set the color of dead cells. If @option{mold} is set, this is the first color
  10037. used to represent a dead cell.
  10038. @item mold_color
  10039. Set mold color, for definitely dead and moldy cells.
  10040. For the syntax of these 3 color options, check the "Color" section in the
  10041. ffmpeg-utils manual.
  10042. @end table
  10043. @subsection Examples
  10044. @itemize
  10045. @item
  10046. Read a grid from @file{pattern}, and center it on a grid of size
  10047. 300x300 pixels:
  10048. @example
  10049. life=f=pattern:s=300x300
  10050. @end example
  10051. @item
  10052. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10053. @example
  10054. life=ratio=2/3:s=200x200
  10055. @end example
  10056. @item
  10057. Specify a custom rule for evolving a randomly generated grid:
  10058. @example
  10059. life=rule=S14/B34
  10060. @end example
  10061. @item
  10062. Full example with slow death effect (mold) using @command{ffplay}:
  10063. @example
  10064. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10065. @end example
  10066. @end itemize
  10067. @anchor{allrgb}
  10068. @anchor{allyuv}
  10069. @anchor{color}
  10070. @anchor{haldclutsrc}
  10071. @anchor{nullsrc}
  10072. @anchor{rgbtestsrc}
  10073. @anchor{smptebars}
  10074. @anchor{smptehdbars}
  10075. @anchor{testsrc}
  10076. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10077. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10078. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10079. The @code{color} source provides an uniformly colored input.
  10080. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10081. @ref{haldclut} filter.
  10082. The @code{nullsrc} source returns unprocessed video frames. It is
  10083. mainly useful to be employed in analysis / debugging tools, or as the
  10084. source for filters which ignore the input data.
  10085. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10086. detecting RGB vs BGR issues. You should see a red, green and blue
  10087. stripe from top to bottom.
  10088. The @code{smptebars} source generates a color bars pattern, based on
  10089. the SMPTE Engineering Guideline EG 1-1990.
  10090. The @code{smptehdbars} source generates a color bars pattern, based on
  10091. the SMPTE RP 219-2002.
  10092. The @code{testsrc} source generates a test video pattern, showing a
  10093. color pattern, a scrolling gradient and a timestamp. This is mainly
  10094. intended for testing purposes.
  10095. The sources accept the following parameters:
  10096. @table @option
  10097. @item color, c
  10098. Specify the color of the source, only available in the @code{color}
  10099. source. For the syntax of this option, check the "Color" section in the
  10100. ffmpeg-utils manual.
  10101. @item level
  10102. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10103. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10104. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10105. coded on a @code{1/(N*N)} scale.
  10106. @item size, s
  10107. Specify the size of the sourced video. For the syntax of this option, check the
  10108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10109. The default value is @code{320x240}.
  10110. This option is not available with the @code{haldclutsrc} filter.
  10111. @item rate, r
  10112. Specify the frame rate of the sourced video, as the number of frames
  10113. generated per second. It has to be a string in the format
  10114. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10115. number or a valid video frame rate abbreviation. The default value is
  10116. "25".
  10117. @item sar
  10118. Set the sample aspect ratio of the sourced video.
  10119. @item duration, d
  10120. Set the duration of the sourced video. See
  10121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10122. for the accepted syntax.
  10123. If not specified, or the expressed duration is negative, the video is
  10124. supposed to be generated forever.
  10125. @item decimals, n
  10126. Set the number of decimals to show in the timestamp, only available in the
  10127. @code{testsrc} source.
  10128. The displayed timestamp value will correspond to the original
  10129. timestamp value multiplied by the power of 10 of the specified
  10130. value. Default value is 0.
  10131. @end table
  10132. For example the following:
  10133. @example
  10134. testsrc=duration=5.3:size=qcif:rate=10
  10135. @end example
  10136. will generate a video with a duration of 5.3 seconds, with size
  10137. 176x144 and a frame rate of 10 frames per second.
  10138. The following graph description will generate a red source
  10139. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  10140. frames per second.
  10141. @example
  10142. color=c=red@@0.2:s=qcif:r=10
  10143. @end example
  10144. If the input content is to be ignored, @code{nullsrc} can be used. The
  10145. following command generates noise in the luminance plane by employing
  10146. the @code{geq} filter:
  10147. @example
  10148. nullsrc=s=256x256, geq=random(1)*255:128:128
  10149. @end example
  10150. @subsection Commands
  10151. The @code{color} source supports the following commands:
  10152. @table @option
  10153. @item c, color
  10154. Set the color of the created image. Accepts the same syntax of the
  10155. corresponding @option{color} option.
  10156. @end table
  10157. @c man end VIDEO SOURCES
  10158. @chapter Video Sinks
  10159. @c man begin VIDEO SINKS
  10160. Below is a description of the currently available video sinks.
  10161. @section buffersink
  10162. Buffer video frames, and make them available to the end of the filter
  10163. graph.
  10164. This sink is mainly intended for programmatic use, in particular
  10165. through the interface defined in @file{libavfilter/buffersink.h}
  10166. or the options system.
  10167. It accepts a pointer to an AVBufferSinkContext structure, which
  10168. defines the incoming buffers' formats, to be passed as the opaque
  10169. parameter to @code{avfilter_init_filter} for initialization.
  10170. @section nullsink
  10171. Null video sink: do absolutely nothing with the input video. It is
  10172. mainly useful as a template and for use in analysis / debugging
  10173. tools.
  10174. @c man end VIDEO SINKS
  10175. @chapter Multimedia Filters
  10176. @c man begin MULTIMEDIA FILTERS
  10177. Below is a description of the currently available multimedia filters.
  10178. @section ahistogram
  10179. Convert input audio to a video output, displaying the volume histogram.
  10180. The filter accepts the following options:
  10181. @table @option
  10182. @item dmode
  10183. Specify how histogram is calculated.
  10184. It accepts the following values:
  10185. @table @samp
  10186. @item single
  10187. Use single histogram for all channels.
  10188. @item separate
  10189. Use separate histogram for each channel.
  10190. @end table
  10191. Default is @code{single}.
  10192. @item rate, r
  10193. Set frame rate, expressed as number of frames per second. Default
  10194. value is "25".
  10195. @item size, s
  10196. Specify the video size for the output. For the syntax of this option, check the
  10197. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10198. Default value is @code{hd720}.
  10199. @item scale
  10200. Set display scale.
  10201. It accepts the following values:
  10202. @table @samp
  10203. @item log
  10204. logarithmic
  10205. @item sqrt
  10206. square root
  10207. @item cbrt
  10208. cubic root
  10209. @item lin
  10210. linear
  10211. @item rlog
  10212. reverse logarithmic
  10213. @end table
  10214. Default is @code{log}.
  10215. @item ascale
  10216. Set amplitude scale.
  10217. It accepts the following values:
  10218. @table @samp
  10219. @item log
  10220. logarithmic
  10221. @item lin
  10222. linear
  10223. @end table
  10224. Default is @code{log}.
  10225. @item acount
  10226. Set how much frames to accumulate in histogram.
  10227. Defauls is 1. Setting this to -1 accumulates all frames.
  10228. @item rheight
  10229. Set histogram ratio of window height.
  10230. @item slide
  10231. Set sonogram sliding.
  10232. It accepts the following values:
  10233. @table @samp
  10234. @item replace
  10235. replace old rows with new ones.
  10236. @item scroll
  10237. scroll from top to bottom.
  10238. @end table
  10239. Default is @code{replace}.
  10240. @end table
  10241. @section aphasemeter
  10242. Convert input audio to a video output, displaying the audio phase.
  10243. The filter accepts the following options:
  10244. @table @option
  10245. @item rate, r
  10246. Set the output frame rate. Default value is @code{25}.
  10247. @item size, s
  10248. Set the video size for the output. For the syntax of this option, check the
  10249. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10250. Default value is @code{800x400}.
  10251. @item rc
  10252. @item gc
  10253. @item bc
  10254. Specify the red, green, blue contrast. Default values are @code{2},
  10255. @code{7} and @code{1}.
  10256. Allowed range is @code{[0, 255]}.
  10257. @item mpc
  10258. Set color which will be used for drawing median phase. If color is
  10259. @code{none} which is default, no median phase value will be drawn.
  10260. @end table
  10261. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  10262. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  10263. The @code{-1} means left and right channels are completely out of phase and
  10264. @code{1} means channels are in phase.
  10265. @section avectorscope
  10266. Convert input audio to a video output, representing the audio vector
  10267. scope.
  10268. The filter is used to measure the difference between channels of stereo
  10269. audio stream. A monoaural signal, consisting of identical left and right
  10270. signal, results in straight vertical line. Any stereo separation is visible
  10271. as a deviation from this line, creating a Lissajous figure.
  10272. If the straight (or deviation from it) but horizontal line appears this
  10273. indicates that the left and right channels are out of phase.
  10274. The filter accepts the following options:
  10275. @table @option
  10276. @item mode, m
  10277. Set the vectorscope mode.
  10278. Available values are:
  10279. @table @samp
  10280. @item lissajous
  10281. Lissajous rotated by 45 degrees.
  10282. @item lissajous_xy
  10283. Same as above but not rotated.
  10284. @item polar
  10285. Shape resembling half of circle.
  10286. @end table
  10287. Default value is @samp{lissajous}.
  10288. @item size, s
  10289. Set the video size for the output. For the syntax of this option, check the
  10290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10291. Default value is @code{400x400}.
  10292. @item rate, r
  10293. Set the output frame rate. Default value is @code{25}.
  10294. @item rc
  10295. @item gc
  10296. @item bc
  10297. @item ac
  10298. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10299. @code{160}, @code{80} and @code{255}.
  10300. Allowed range is @code{[0, 255]}.
  10301. @item rf
  10302. @item gf
  10303. @item bf
  10304. @item af
  10305. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10306. @code{10}, @code{5} and @code{5}.
  10307. Allowed range is @code{[0, 255]}.
  10308. @item zoom
  10309. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10310. @item draw
  10311. Set the vectorscope drawing mode.
  10312. Available values are:
  10313. @table @samp
  10314. @item dot
  10315. Draw dot for each sample.
  10316. @item line
  10317. Draw line between previous and current sample.
  10318. @end table
  10319. Default value is @samp{dot}.
  10320. @end table
  10321. @subsection Examples
  10322. @itemize
  10323. @item
  10324. Complete example using @command{ffplay}:
  10325. @example
  10326. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10327. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  10328. @end example
  10329. @end itemize
  10330. @section concat
  10331. Concatenate audio and video streams, joining them together one after the
  10332. other.
  10333. The filter works on segments of synchronized video and audio streams. All
  10334. segments must have the same number of streams of each type, and that will
  10335. also be the number of streams at output.
  10336. The filter accepts the following options:
  10337. @table @option
  10338. @item n
  10339. Set the number of segments. Default is 2.
  10340. @item v
  10341. Set the number of output video streams, that is also the number of video
  10342. streams in each segment. Default is 1.
  10343. @item a
  10344. Set the number of output audio streams, that is also the number of audio
  10345. streams in each segment. Default is 0.
  10346. @item unsafe
  10347. Activate unsafe mode: do not fail if segments have a different format.
  10348. @end table
  10349. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10350. @var{a} audio outputs.
  10351. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10352. segment, in the same order as the outputs, then the inputs for the second
  10353. segment, etc.
  10354. Related streams do not always have exactly the same duration, for various
  10355. reasons including codec frame size or sloppy authoring. For that reason,
  10356. related synchronized streams (e.g. a video and its audio track) should be
  10357. concatenated at once. The concat filter will use the duration of the longest
  10358. stream in each segment (except the last one), and if necessary pad shorter
  10359. audio streams with silence.
  10360. For this filter to work correctly, all segments must start at timestamp 0.
  10361. All corresponding streams must have the same parameters in all segments; the
  10362. filtering system will automatically select a common pixel format for video
  10363. streams, and a common sample format, sample rate and channel layout for
  10364. audio streams, but other settings, such as resolution, must be converted
  10365. explicitly by the user.
  10366. Different frame rates are acceptable but will result in variable frame rate
  10367. at output; be sure to configure the output file to handle it.
  10368. @subsection Examples
  10369. @itemize
  10370. @item
  10371. Concatenate an opening, an episode and an ending, all in bilingual version
  10372. (video in stream 0, audio in streams 1 and 2):
  10373. @example
  10374. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10375. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10376. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10377. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10378. @end example
  10379. @item
  10380. Concatenate two parts, handling audio and video separately, using the
  10381. (a)movie sources, and adjusting the resolution:
  10382. @example
  10383. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10384. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10385. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10386. @end example
  10387. Note that a desync will happen at the stitch if the audio and video streams
  10388. do not have exactly the same duration in the first file.
  10389. @end itemize
  10390. @anchor{ebur128}
  10391. @section ebur128
  10392. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10393. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10394. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10395. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10396. The filter also has a video output (see the @var{video} option) with a real
  10397. time graph to observe the loudness evolution. The graphic contains the logged
  10398. message mentioned above, so it is not printed anymore when this option is set,
  10399. unless the verbose logging is set. The main graphing area contains the
  10400. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10401. the momentary loudness (400 milliseconds).
  10402. More information about the Loudness Recommendation EBU R128 on
  10403. @url{http://tech.ebu.ch/loudness}.
  10404. The filter accepts the following options:
  10405. @table @option
  10406. @item video
  10407. Activate the video output. The audio stream is passed unchanged whether this
  10408. option is set or no. The video stream will be the first output stream if
  10409. activated. Default is @code{0}.
  10410. @item size
  10411. Set the video size. This option is for video only. For the syntax of this
  10412. option, check the
  10413. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10414. Default and minimum resolution is @code{640x480}.
  10415. @item meter
  10416. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10417. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10418. other integer value between this range is allowed.
  10419. @item metadata
  10420. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10421. into 100ms output frames, each of them containing various loudness information
  10422. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10423. Default is @code{0}.
  10424. @item framelog
  10425. Force the frame logging level.
  10426. Available values are:
  10427. @table @samp
  10428. @item info
  10429. information logging level
  10430. @item verbose
  10431. verbose logging level
  10432. @end table
  10433. By default, the logging level is set to @var{info}. If the @option{video} or
  10434. the @option{metadata} options are set, it switches to @var{verbose}.
  10435. @item peak
  10436. Set peak mode(s).
  10437. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10438. values are:
  10439. @table @samp
  10440. @item none
  10441. Disable any peak mode (default).
  10442. @item sample
  10443. Enable sample-peak mode.
  10444. Simple peak mode looking for the higher sample value. It logs a message
  10445. for sample-peak (identified by @code{SPK}).
  10446. @item true
  10447. Enable true-peak mode.
  10448. If enabled, the peak lookup is done on an over-sampled version of the input
  10449. stream for better peak accuracy. It logs a message for true-peak.
  10450. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10451. This mode requires a build with @code{libswresample}.
  10452. @end table
  10453. @item dualmono
  10454. Treat mono input files as "dual mono". If a mono file is intended for playback
  10455. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10456. If set to @code{true}, this option will compensate for this effect.
  10457. Multi-channel input files are not affected by this option.
  10458. @item panlaw
  10459. Set a specific pan law to be used for the measurement of dual mono files.
  10460. This parameter is optional, and has a default value of -3.01dB.
  10461. @end table
  10462. @subsection Examples
  10463. @itemize
  10464. @item
  10465. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10466. @example
  10467. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10468. @end example
  10469. @item
  10470. Run an analysis with @command{ffmpeg}:
  10471. @example
  10472. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10473. @end example
  10474. @end itemize
  10475. @section interleave, ainterleave
  10476. Temporally interleave frames from several inputs.
  10477. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10478. These filters read frames from several inputs and send the oldest
  10479. queued frame to the output.
  10480. Input streams must have a well defined, monotonically increasing frame
  10481. timestamp values.
  10482. In order to submit one frame to output, these filters need to enqueue
  10483. at least one frame for each input, so they cannot work in case one
  10484. input is not yet terminated and will not receive incoming frames.
  10485. For example consider the case when one input is a @code{select} filter
  10486. which always drop input frames. The @code{interleave} filter will keep
  10487. reading from that input, but it will never be able to send new frames
  10488. to output until the input will send an end-of-stream signal.
  10489. Also, depending on inputs synchronization, the filters will drop
  10490. frames in case one input receives more frames than the other ones, and
  10491. the queue is already filled.
  10492. These filters accept the following options:
  10493. @table @option
  10494. @item nb_inputs, n
  10495. Set the number of different inputs, it is 2 by default.
  10496. @end table
  10497. @subsection Examples
  10498. @itemize
  10499. @item
  10500. Interleave frames belonging to different streams using @command{ffmpeg}:
  10501. @example
  10502. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10503. @end example
  10504. @item
  10505. Add flickering blur effect:
  10506. @example
  10507. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10508. @end example
  10509. @end itemize
  10510. @section perms, aperms
  10511. Set read/write permissions for the output frames.
  10512. These filters are mainly aimed at developers to test direct path in the
  10513. following filter in the filtergraph.
  10514. The filters accept the following options:
  10515. @table @option
  10516. @item mode
  10517. Select the permissions mode.
  10518. It accepts the following values:
  10519. @table @samp
  10520. @item none
  10521. Do nothing. This is the default.
  10522. @item ro
  10523. Set all the output frames read-only.
  10524. @item rw
  10525. Set all the output frames directly writable.
  10526. @item toggle
  10527. Make the frame read-only if writable, and writable if read-only.
  10528. @item random
  10529. Set each output frame read-only or writable randomly.
  10530. @end table
  10531. @item seed
  10532. Set the seed for the @var{random} mode, must be an integer included between
  10533. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10534. @code{-1}, the filter will try to use a good random seed on a best effort
  10535. basis.
  10536. @end table
  10537. Note: in case of auto-inserted filter between the permission filter and the
  10538. following one, the permission might not be received as expected in that
  10539. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10540. perms/aperms filter can avoid this problem.
  10541. @section realtime, arealtime
  10542. Slow down filtering to match real time approximatively.
  10543. These filters will pause the filtering for a variable amount of time to
  10544. match the output rate with the input timestamps.
  10545. They are similar to the @option{re} option to @code{ffmpeg}.
  10546. They accept the following options:
  10547. @table @option
  10548. @item limit
  10549. Time limit for the pauses. Any pause longer than that will be considered
  10550. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10551. @end table
  10552. @section select, aselect
  10553. Select frames to pass in output.
  10554. This filter accepts the following options:
  10555. @table @option
  10556. @item expr, e
  10557. Set expression, which is evaluated for each input frame.
  10558. If the expression is evaluated to zero, the frame is discarded.
  10559. If the evaluation result is negative or NaN, the frame is sent to the
  10560. first output; otherwise it is sent to the output with index
  10561. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10562. For example a value of @code{1.2} corresponds to the output with index
  10563. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10564. @item outputs, n
  10565. Set the number of outputs. The output to which to send the selected
  10566. frame is based on the result of the evaluation. Default value is 1.
  10567. @end table
  10568. The expression can contain the following constants:
  10569. @table @option
  10570. @item n
  10571. The (sequential) number of the filtered frame, starting from 0.
  10572. @item selected_n
  10573. The (sequential) number of the selected frame, starting from 0.
  10574. @item prev_selected_n
  10575. The sequential number of the last selected frame. It's NAN if undefined.
  10576. @item TB
  10577. The timebase of the input timestamps.
  10578. @item pts
  10579. The PTS (Presentation TimeStamp) of the filtered video frame,
  10580. expressed in @var{TB} units. It's NAN if undefined.
  10581. @item t
  10582. The PTS of the filtered video frame,
  10583. expressed in seconds. It's NAN if undefined.
  10584. @item prev_pts
  10585. The PTS of the previously filtered video frame. It's NAN if undefined.
  10586. @item prev_selected_pts
  10587. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10588. @item prev_selected_t
  10589. The PTS of the last previously selected video frame. It's NAN if undefined.
  10590. @item start_pts
  10591. The PTS of the first video frame in the video. It's NAN if undefined.
  10592. @item start_t
  10593. The time of the first video frame in the video. It's NAN if undefined.
  10594. @item pict_type @emph{(video only)}
  10595. The type of the filtered frame. It can assume one of the following
  10596. values:
  10597. @table @option
  10598. @item I
  10599. @item P
  10600. @item B
  10601. @item S
  10602. @item SI
  10603. @item SP
  10604. @item BI
  10605. @end table
  10606. @item interlace_type @emph{(video only)}
  10607. The frame interlace type. It can assume one of the following values:
  10608. @table @option
  10609. @item PROGRESSIVE
  10610. The frame is progressive (not interlaced).
  10611. @item TOPFIRST
  10612. The frame is top-field-first.
  10613. @item BOTTOMFIRST
  10614. The frame is bottom-field-first.
  10615. @end table
  10616. @item consumed_sample_n @emph{(audio only)}
  10617. the number of selected samples before the current frame
  10618. @item samples_n @emph{(audio only)}
  10619. the number of samples in the current frame
  10620. @item sample_rate @emph{(audio only)}
  10621. the input sample rate
  10622. @item key
  10623. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10624. @item pos
  10625. the position in the file of the filtered frame, -1 if the information
  10626. is not available (e.g. for synthetic video)
  10627. @item scene @emph{(video only)}
  10628. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10629. probability for the current frame to introduce a new scene, while a higher
  10630. value means the current frame is more likely to be one (see the example below)
  10631. @item concatdec_select
  10632. The concat demuxer can select only part of a concat input file by setting an
  10633. inpoint and an outpoint, but the output packets may not be entirely contained
  10634. in the selected interval. By using this variable, it is possible to skip frames
  10635. generated by the concat demuxer which are not exactly contained in the selected
  10636. interval.
  10637. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10638. and the @var{lavf.concat.duration} packet metadata values which are also
  10639. present in the decoded frames.
  10640. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10641. start_time and either the duration metadata is missing or the frame pts is less
  10642. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10643. missing.
  10644. That basically means that an input frame is selected if its pts is within the
  10645. interval set by the concat demuxer.
  10646. @end table
  10647. The default value of the select expression is "1".
  10648. @subsection Examples
  10649. @itemize
  10650. @item
  10651. Select all frames in input:
  10652. @example
  10653. select
  10654. @end example
  10655. The example above is the same as:
  10656. @example
  10657. select=1
  10658. @end example
  10659. @item
  10660. Skip all frames:
  10661. @example
  10662. select=0
  10663. @end example
  10664. @item
  10665. Select only I-frames:
  10666. @example
  10667. select='eq(pict_type\,I)'
  10668. @end example
  10669. @item
  10670. Select one frame every 100:
  10671. @example
  10672. select='not(mod(n\,100))'
  10673. @end example
  10674. @item
  10675. Select only frames contained in the 10-20 time interval:
  10676. @example
  10677. select=between(t\,10\,20)
  10678. @end example
  10679. @item
  10680. Select only I frames contained in the 10-20 time interval:
  10681. @example
  10682. select=between(t\,10\,20)*eq(pict_type\,I)
  10683. @end example
  10684. @item
  10685. Select frames with a minimum distance of 10 seconds:
  10686. @example
  10687. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10688. @end example
  10689. @item
  10690. Use aselect to select only audio frames with samples number > 100:
  10691. @example
  10692. aselect='gt(samples_n\,100)'
  10693. @end example
  10694. @item
  10695. Create a mosaic of the first scenes:
  10696. @example
  10697. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10698. @end example
  10699. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10700. choice.
  10701. @item
  10702. Send even and odd frames to separate outputs, and compose them:
  10703. @example
  10704. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10705. @end example
  10706. @item
  10707. Select useful frames from an ffconcat file which is using inpoints and
  10708. outpoints but where the source files are not intra frame only.
  10709. @example
  10710. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10711. @end example
  10712. @end itemize
  10713. @section sendcmd, asendcmd
  10714. Send commands to filters in the filtergraph.
  10715. These filters read commands to be sent to other filters in the
  10716. filtergraph.
  10717. @code{sendcmd} must be inserted between two video filters,
  10718. @code{asendcmd} must be inserted between two audio filters, but apart
  10719. from that they act the same way.
  10720. The specification of commands can be provided in the filter arguments
  10721. with the @var{commands} option, or in a file specified by the
  10722. @var{filename} option.
  10723. These filters accept the following options:
  10724. @table @option
  10725. @item commands, c
  10726. Set the commands to be read and sent to the other filters.
  10727. @item filename, f
  10728. Set the filename of the commands to be read and sent to the other
  10729. filters.
  10730. @end table
  10731. @subsection Commands syntax
  10732. A commands description consists of a sequence of interval
  10733. specifications, comprising a list of commands to be executed when a
  10734. particular event related to that interval occurs. The occurring event
  10735. is typically the current frame time entering or leaving a given time
  10736. interval.
  10737. An interval is specified by the following syntax:
  10738. @example
  10739. @var{START}[-@var{END}] @var{COMMANDS};
  10740. @end example
  10741. The time interval is specified by the @var{START} and @var{END} times.
  10742. @var{END} is optional and defaults to the maximum time.
  10743. The current frame time is considered within the specified interval if
  10744. it is included in the interval [@var{START}, @var{END}), that is when
  10745. the time is greater or equal to @var{START} and is lesser than
  10746. @var{END}.
  10747. @var{COMMANDS} consists of a sequence of one or more command
  10748. specifications, separated by ",", relating to that interval. The
  10749. syntax of a command specification is given by:
  10750. @example
  10751. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10752. @end example
  10753. @var{FLAGS} is optional and specifies the type of events relating to
  10754. the time interval which enable sending the specified command, and must
  10755. be a non-null sequence of identifier flags separated by "+" or "|" and
  10756. enclosed between "[" and "]".
  10757. The following flags are recognized:
  10758. @table @option
  10759. @item enter
  10760. The command is sent when the current frame timestamp enters the
  10761. specified interval. In other words, the command is sent when the
  10762. previous frame timestamp was not in the given interval, and the
  10763. current is.
  10764. @item leave
  10765. The command is sent when the current frame timestamp leaves the
  10766. specified interval. In other words, the command is sent when the
  10767. previous frame timestamp was in the given interval, and the
  10768. current is not.
  10769. @end table
  10770. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10771. assumed.
  10772. @var{TARGET} specifies the target of the command, usually the name of
  10773. the filter class or a specific filter instance name.
  10774. @var{COMMAND} specifies the name of the command for the target filter.
  10775. @var{ARG} is optional and specifies the optional list of argument for
  10776. the given @var{COMMAND}.
  10777. Between one interval specification and another, whitespaces, or
  10778. sequences of characters starting with @code{#} until the end of line,
  10779. are ignored and can be used to annotate comments.
  10780. A simplified BNF description of the commands specification syntax
  10781. follows:
  10782. @example
  10783. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10784. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10785. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10786. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10787. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10788. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10789. @end example
  10790. @subsection Examples
  10791. @itemize
  10792. @item
  10793. Specify audio tempo change at second 4:
  10794. @example
  10795. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10796. @end example
  10797. @item
  10798. Specify a list of drawtext and hue commands in a file.
  10799. @example
  10800. # show text in the interval 5-10
  10801. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10802. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10803. # desaturate the image in the interval 15-20
  10804. 15.0-20.0 [enter] hue s 0,
  10805. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10806. [leave] hue s 1,
  10807. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10808. # apply an exponential saturation fade-out effect, starting from time 25
  10809. 25 [enter] hue s exp(25-t)
  10810. @end example
  10811. A filtergraph allowing to read and process the above command list
  10812. stored in a file @file{test.cmd}, can be specified with:
  10813. @example
  10814. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10815. @end example
  10816. @end itemize
  10817. @anchor{setpts}
  10818. @section setpts, asetpts
  10819. Change the PTS (presentation timestamp) of the input frames.
  10820. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10821. This filter accepts the following options:
  10822. @table @option
  10823. @item expr
  10824. The expression which is evaluated for each frame to construct its timestamp.
  10825. @end table
  10826. The expression is evaluated through the eval API and can contain the following
  10827. constants:
  10828. @table @option
  10829. @item FRAME_RATE
  10830. frame rate, only defined for constant frame-rate video
  10831. @item PTS
  10832. The presentation timestamp in input
  10833. @item N
  10834. The count of the input frame for video or the number of consumed samples,
  10835. not including the current frame for audio, starting from 0.
  10836. @item NB_CONSUMED_SAMPLES
  10837. The number of consumed samples, not including the current frame (only
  10838. audio)
  10839. @item NB_SAMPLES, S
  10840. The number of samples in the current frame (only audio)
  10841. @item SAMPLE_RATE, SR
  10842. The audio sample rate.
  10843. @item STARTPTS
  10844. The PTS of the first frame.
  10845. @item STARTT
  10846. the time in seconds of the first frame
  10847. @item INTERLACED
  10848. State whether the current frame is interlaced.
  10849. @item T
  10850. the time in seconds of the current frame
  10851. @item POS
  10852. original position in the file of the frame, or undefined if undefined
  10853. for the current frame
  10854. @item PREV_INPTS
  10855. The previous input PTS.
  10856. @item PREV_INT
  10857. previous input time in seconds
  10858. @item PREV_OUTPTS
  10859. The previous output PTS.
  10860. @item PREV_OUTT
  10861. previous output time in seconds
  10862. @item RTCTIME
  10863. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10864. instead.
  10865. @item RTCSTART
  10866. The wallclock (RTC) time at the start of the movie in microseconds.
  10867. @item TB
  10868. The timebase of the input timestamps.
  10869. @end table
  10870. @subsection Examples
  10871. @itemize
  10872. @item
  10873. Start counting PTS from zero
  10874. @example
  10875. setpts=PTS-STARTPTS
  10876. @end example
  10877. @item
  10878. Apply fast motion effect:
  10879. @example
  10880. setpts=0.5*PTS
  10881. @end example
  10882. @item
  10883. Apply slow motion effect:
  10884. @example
  10885. setpts=2.0*PTS
  10886. @end example
  10887. @item
  10888. Set fixed rate of 25 frames per second:
  10889. @example
  10890. setpts=N/(25*TB)
  10891. @end example
  10892. @item
  10893. Set fixed rate 25 fps with some jitter:
  10894. @example
  10895. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10896. @end example
  10897. @item
  10898. Apply an offset of 10 seconds to the input PTS:
  10899. @example
  10900. setpts=PTS+10/TB
  10901. @end example
  10902. @item
  10903. Generate timestamps from a "live source" and rebase onto the current timebase:
  10904. @example
  10905. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10906. @end example
  10907. @item
  10908. Generate timestamps by counting samples:
  10909. @example
  10910. asetpts=N/SR/TB
  10911. @end example
  10912. @end itemize
  10913. @section settb, asettb
  10914. Set the timebase to use for the output frames timestamps.
  10915. It is mainly useful for testing timebase configuration.
  10916. It accepts the following parameters:
  10917. @table @option
  10918. @item expr, tb
  10919. The expression which is evaluated into the output timebase.
  10920. @end table
  10921. The value for @option{tb} is an arithmetic expression representing a
  10922. rational. The expression can contain the constants "AVTB" (the default
  10923. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10924. audio only). Default value is "intb".
  10925. @subsection Examples
  10926. @itemize
  10927. @item
  10928. Set the timebase to 1/25:
  10929. @example
  10930. settb=expr=1/25
  10931. @end example
  10932. @item
  10933. Set the timebase to 1/10:
  10934. @example
  10935. settb=expr=0.1
  10936. @end example
  10937. @item
  10938. Set the timebase to 1001/1000:
  10939. @example
  10940. settb=1+0.001
  10941. @end example
  10942. @item
  10943. Set the timebase to 2*intb:
  10944. @example
  10945. settb=2*intb
  10946. @end example
  10947. @item
  10948. Set the default timebase value:
  10949. @example
  10950. settb=AVTB
  10951. @end example
  10952. @end itemize
  10953. @section showcqt
  10954. Convert input audio to a video output representing frequency spectrum
  10955. logarithmically using Brown-Puckette constant Q transform algorithm with
  10956. direct frequency domain coefficient calculation (but the transform itself
  10957. is not really constant Q, instead the Q factor is actually variable/clamped),
  10958. with musical tone scale, from E0 to D#10.
  10959. The filter accepts the following options:
  10960. @table @option
  10961. @item size, s
  10962. Specify the video size for the output. It must be even. For the syntax of this option,
  10963. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10964. Default value is @code{1920x1080}.
  10965. @item fps, rate, r
  10966. Set the output frame rate. Default value is @code{25}.
  10967. @item bar_h
  10968. Set the bargraph height. It must be even. Default value is @code{-1} which
  10969. computes the bargraph height automatically.
  10970. @item axis_h
  10971. Set the axis height. It must be even. Default value is @code{-1} which computes
  10972. the axis height automatically.
  10973. @item sono_h
  10974. Set the sonogram height. It must be even. Default value is @code{-1} which
  10975. computes the sonogram height automatically.
  10976. @item fullhd
  10977. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10978. instead. Default value is @code{1}.
  10979. @item sono_v, volume
  10980. Specify the sonogram volume expression. It can contain variables:
  10981. @table @option
  10982. @item bar_v
  10983. the @var{bar_v} evaluated expression
  10984. @item frequency, freq, f
  10985. the frequency where it is evaluated
  10986. @item timeclamp, tc
  10987. the value of @var{timeclamp} option
  10988. @end table
  10989. and functions:
  10990. @table @option
  10991. @item a_weighting(f)
  10992. A-weighting of equal loudness
  10993. @item b_weighting(f)
  10994. B-weighting of equal loudness
  10995. @item c_weighting(f)
  10996. C-weighting of equal loudness.
  10997. @end table
  10998. Default value is @code{16}.
  10999. @item bar_v, volume2
  11000. Specify the bargraph volume expression. It can contain variables:
  11001. @table @option
  11002. @item sono_v
  11003. the @var{sono_v} evaluated expression
  11004. @item frequency, freq, f
  11005. the frequency where it is evaluated
  11006. @item timeclamp, tc
  11007. the value of @var{timeclamp} option
  11008. @end table
  11009. and functions:
  11010. @table @option
  11011. @item a_weighting(f)
  11012. A-weighting of equal loudness
  11013. @item b_weighting(f)
  11014. B-weighting of equal loudness
  11015. @item c_weighting(f)
  11016. C-weighting of equal loudness.
  11017. @end table
  11018. Default value is @code{sono_v}.
  11019. @item sono_g, gamma
  11020. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11021. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11022. Acceptable range is @code{[1, 7]}.
  11023. @item bar_g, gamma2
  11024. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11025. @code{[1, 7]}.
  11026. @item timeclamp, tc
  11027. Specify the transform timeclamp. At low frequency, there is trade-off between
  11028. accuracy in time domain and frequency domain. If timeclamp is lower,
  11029. event in time domain is represented more accurately (such as fast bass drum),
  11030. otherwise event in frequency domain is represented more accurately
  11031. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11032. @item basefreq
  11033. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11034. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11035. @item endfreq
  11036. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11037. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11038. @item coeffclamp
  11039. This option is deprecated and ignored.
  11040. @item tlength
  11041. Specify the transform length in time domain. Use this option to control accuracy
  11042. trade-off between time domain and frequency domain at every frequency sample.
  11043. It can contain variables:
  11044. @table @option
  11045. @item frequency, freq, f
  11046. the frequency where it is evaluated
  11047. @item timeclamp, tc
  11048. the value of @var{timeclamp} option.
  11049. @end table
  11050. Default value is @code{384*tc/(384+tc*f)}.
  11051. @item count
  11052. Specify the transform count for every video frame. Default value is @code{6}.
  11053. Acceptable range is @code{[1, 30]}.
  11054. @item fcount
  11055. Specify the transform count for every single pixel. Default value is @code{0},
  11056. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  11057. @item fontfile
  11058. Specify font file for use with freetype to draw the axis. If not specified,
  11059. use embedded font. Note that drawing with font file or embedded font is not
  11060. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  11061. option instead.
  11062. @item fontcolor
  11063. Specify font color expression. This is arithmetic expression that should return
  11064. integer value 0xRRGGBB. It can contain variables:
  11065. @table @option
  11066. @item frequency, freq, f
  11067. the frequency where it is evaluated
  11068. @item timeclamp, tc
  11069. the value of @var{timeclamp} option
  11070. @end table
  11071. and functions:
  11072. @table @option
  11073. @item midi(f)
  11074. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  11075. @item r(x), g(x), b(x)
  11076. red, green, and blue value of intensity x.
  11077. @end table
  11078. Default value is @code{st(0, (midi(f)-59.5)/12);
  11079. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  11080. r(1-ld(1)) + b(ld(1))}.
  11081. @item axisfile
  11082. Specify image file to draw the axis. This option override @var{fontfile} and
  11083. @var{fontcolor} option.
  11084. @item axis, text
  11085. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  11086. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  11087. Default value is @code{1}.
  11088. @end table
  11089. @subsection Examples
  11090. @itemize
  11091. @item
  11092. Playing audio while showing the spectrum:
  11093. @example
  11094. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11095. @end example
  11096. @item
  11097. Same as above, but with frame rate 30 fps:
  11098. @example
  11099. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11100. @end example
  11101. @item
  11102. Playing at 1280x720:
  11103. @example
  11104. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  11105. @end example
  11106. @item
  11107. Disable sonogram display:
  11108. @example
  11109. sono_h=0
  11110. @end example
  11111. @item
  11112. A1 and its harmonics: A1, A2, (near)E3, A3:
  11113. @example
  11114. 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),
  11115. asplit[a][out1]; [a] showcqt [out0]'
  11116. @end example
  11117. @item
  11118. Same as above, but with more accuracy in frequency domain:
  11119. @example
  11120. 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),
  11121. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  11122. @end example
  11123. @item
  11124. Custom volume:
  11125. @example
  11126. bar_v=10:sono_v=bar_v*a_weighting(f)
  11127. @end example
  11128. @item
  11129. Custom gamma, now spectrum is linear to the amplitude.
  11130. @example
  11131. bar_g=2:sono_g=2
  11132. @end example
  11133. @item
  11134. Custom tlength equation:
  11135. @example
  11136. 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)))'
  11137. @end example
  11138. @item
  11139. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  11140. @example
  11141. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  11142. @end example
  11143. @item
  11144. Custom frequency range with custom axis using image file:
  11145. @example
  11146. axisfile=myaxis.png:basefreq=40:endfreq=10000
  11147. @end example
  11148. @end itemize
  11149. @section showfreqs
  11150. Convert input audio to video output representing the audio power spectrum.
  11151. Audio amplitude is on Y-axis while frequency is on X-axis.
  11152. The filter accepts the following options:
  11153. @table @option
  11154. @item size, s
  11155. Specify size of video. For the syntax of this option, check the
  11156. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11157. Default is @code{1024x512}.
  11158. @item mode
  11159. Set display mode.
  11160. This set how each frequency bin will be represented.
  11161. It accepts the following values:
  11162. @table @samp
  11163. @item line
  11164. @item bar
  11165. @item dot
  11166. @end table
  11167. Default is @code{bar}.
  11168. @item ascale
  11169. Set amplitude scale.
  11170. It accepts the following values:
  11171. @table @samp
  11172. @item lin
  11173. Linear scale.
  11174. @item sqrt
  11175. Square root scale.
  11176. @item cbrt
  11177. Cubic root scale.
  11178. @item log
  11179. Logarithmic scale.
  11180. @end table
  11181. Default is @code{log}.
  11182. @item fscale
  11183. Set frequency scale.
  11184. It accepts the following values:
  11185. @table @samp
  11186. @item lin
  11187. Linear scale.
  11188. @item log
  11189. Logarithmic scale.
  11190. @item rlog
  11191. Reverse logarithmic scale.
  11192. @end table
  11193. Default is @code{lin}.
  11194. @item win_size
  11195. Set window size.
  11196. It accepts the following values:
  11197. @table @samp
  11198. @item w16
  11199. @item w32
  11200. @item w64
  11201. @item w128
  11202. @item w256
  11203. @item w512
  11204. @item w1024
  11205. @item w2048
  11206. @item w4096
  11207. @item w8192
  11208. @item w16384
  11209. @item w32768
  11210. @item w65536
  11211. @end table
  11212. Default is @code{w2048}
  11213. @item win_func
  11214. Set windowing function.
  11215. It accepts the following values:
  11216. @table @samp
  11217. @item rect
  11218. @item bartlett
  11219. @item hanning
  11220. @item hamming
  11221. @item blackman
  11222. @item welch
  11223. @item flattop
  11224. @item bharris
  11225. @item bnuttall
  11226. @item bhann
  11227. @item sine
  11228. @item nuttall
  11229. @item lanczos
  11230. @item gauss
  11231. @item tukey
  11232. @end table
  11233. Default is @code{hanning}.
  11234. @item overlap
  11235. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11236. which means optimal overlap for selected window function will be picked.
  11237. @item averaging
  11238. Set time averaging. Setting this to 0 will display current maximal peaks.
  11239. Default is @code{1}, which means time averaging is disabled.
  11240. @item colors
  11241. Specify list of colors separated by space or by '|' which will be used to
  11242. draw channel frequencies. Unrecognized or missing colors will be replaced
  11243. by white color.
  11244. @item cmode
  11245. Set channel display mode.
  11246. It accepts the following values:
  11247. @table @samp
  11248. @item combined
  11249. @item separate
  11250. @end table
  11251. Default is @code{combined}.
  11252. @end table
  11253. @anchor{showspectrum}
  11254. @section showspectrum
  11255. Convert input audio to a video output, representing the audio frequency
  11256. spectrum.
  11257. The filter accepts the following options:
  11258. @table @option
  11259. @item size, s
  11260. Specify the video size for the output. For the syntax of this option, check the
  11261. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11262. Default value is @code{640x512}.
  11263. @item slide
  11264. Specify how the spectrum should slide along the window.
  11265. It accepts the following values:
  11266. @table @samp
  11267. @item replace
  11268. the samples start again on the left when they reach the right
  11269. @item scroll
  11270. the samples scroll from right to left
  11271. @item rscroll
  11272. the samples scroll from left to right
  11273. @item fullframe
  11274. frames are only produced when the samples reach the right
  11275. @end table
  11276. Default value is @code{replace}.
  11277. @item mode
  11278. Specify display mode.
  11279. It accepts the following values:
  11280. @table @samp
  11281. @item combined
  11282. all channels are displayed in the same row
  11283. @item separate
  11284. all channels are displayed in separate rows
  11285. @end table
  11286. Default value is @samp{combined}.
  11287. @item color
  11288. Specify display color mode.
  11289. It accepts the following values:
  11290. @table @samp
  11291. @item channel
  11292. each channel is displayed in a separate color
  11293. @item intensity
  11294. each channel is displayed using the same color scheme
  11295. @item rainbow
  11296. each channel is displayed using the rainbow color scheme
  11297. @item moreland
  11298. each channel is displayed using the moreland color scheme
  11299. @item nebulae
  11300. each channel is displayed using the nebulae color scheme
  11301. @item fire
  11302. each channel is displayed using the fire color scheme
  11303. @item fiery
  11304. each channel is displayed using the fiery color scheme
  11305. @item fruit
  11306. each channel is displayed using the fruit color scheme
  11307. @item cool
  11308. each channel is displayed using the cool color scheme
  11309. @end table
  11310. Default value is @samp{channel}.
  11311. @item scale
  11312. Specify scale used for calculating intensity color values.
  11313. It accepts the following values:
  11314. @table @samp
  11315. @item lin
  11316. linear
  11317. @item sqrt
  11318. square root, default
  11319. @item cbrt
  11320. cubic root
  11321. @item 4thrt
  11322. 4th root
  11323. @item 5thrt
  11324. 5th root
  11325. @item log
  11326. logarithmic
  11327. @end table
  11328. Default value is @samp{sqrt}.
  11329. @item saturation
  11330. Set saturation modifier for displayed colors. Negative values provide
  11331. alternative color scheme. @code{0} is no saturation at all.
  11332. Saturation must be in [-10.0, 10.0] range.
  11333. Default value is @code{1}.
  11334. @item win_func
  11335. Set window function.
  11336. It accepts the following values:
  11337. @table @samp
  11338. @item rect
  11339. @item bartlett
  11340. @item hann
  11341. @item hanning
  11342. @item hamming
  11343. @item blackman
  11344. @item welch
  11345. @item flattop
  11346. @item bharris
  11347. @item bnuttall
  11348. @item bhann
  11349. @item sine
  11350. @item nuttall
  11351. @item lanczos
  11352. @item gauss
  11353. @item tukey
  11354. @end table
  11355. Default value is @code{hann}.
  11356. @item orientation
  11357. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11358. @code{horizontal}. Default is @code{vertical}.
  11359. @item overlap
  11360. Set ratio of overlap window. Default value is @code{0}.
  11361. When value is @code{1} overlap is set to recommended size for specific
  11362. window function currently used.
  11363. @item gain
  11364. Set scale gain for calculating intensity color values.
  11365. Default value is @code{1}.
  11366. @item data
  11367. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  11368. @end table
  11369. The usage is very similar to the showwaves filter; see the examples in that
  11370. section.
  11371. @subsection Examples
  11372. @itemize
  11373. @item
  11374. Large window with logarithmic color scaling:
  11375. @example
  11376. showspectrum=s=1280x480:scale=log
  11377. @end example
  11378. @item
  11379. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11380. @example
  11381. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11382. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11383. @end example
  11384. @end itemize
  11385. @section showspectrumpic
  11386. Convert input audio to a single video frame, representing the audio frequency
  11387. spectrum.
  11388. The filter accepts the following options:
  11389. @table @option
  11390. @item size, s
  11391. Specify the video size for the output. For the syntax of this option, check the
  11392. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11393. Default value is @code{4096x2048}.
  11394. @item mode
  11395. Specify display mode.
  11396. It accepts the following values:
  11397. @table @samp
  11398. @item combined
  11399. all channels are displayed in the same row
  11400. @item separate
  11401. all channels are displayed in separate rows
  11402. @end table
  11403. Default value is @samp{combined}.
  11404. @item color
  11405. Specify display color mode.
  11406. It accepts the following values:
  11407. @table @samp
  11408. @item channel
  11409. each channel is displayed in a separate color
  11410. @item intensity
  11411. each channel is displayed using the same color scheme
  11412. @item rainbow
  11413. each channel is displayed using the rainbow color scheme
  11414. @item moreland
  11415. each channel is displayed using the moreland color scheme
  11416. @item nebulae
  11417. each channel is displayed using the nebulae color scheme
  11418. @item fire
  11419. each channel is displayed using the fire color scheme
  11420. @item fiery
  11421. each channel is displayed using the fiery color scheme
  11422. @item fruit
  11423. each channel is displayed using the fruit color scheme
  11424. @item cool
  11425. each channel is displayed using the cool color scheme
  11426. @end table
  11427. Default value is @samp{intensity}.
  11428. @item scale
  11429. Specify scale used for calculating intensity color values.
  11430. It accepts the following values:
  11431. @table @samp
  11432. @item lin
  11433. linear
  11434. @item sqrt
  11435. square root, default
  11436. @item cbrt
  11437. cubic root
  11438. @item 4thrt
  11439. 4th root
  11440. @item 5thrt
  11441. 5th root
  11442. @item log
  11443. logarithmic
  11444. @end table
  11445. Default value is @samp{log}.
  11446. @item saturation
  11447. Set saturation modifier for displayed colors. Negative values provide
  11448. alternative color scheme. @code{0} is no saturation at all.
  11449. Saturation must be in [-10.0, 10.0] range.
  11450. Default value is @code{1}.
  11451. @item win_func
  11452. Set window function.
  11453. It accepts the following values:
  11454. @table @samp
  11455. @item rect
  11456. @item bartlett
  11457. @item hann
  11458. @item hanning
  11459. @item hamming
  11460. @item blackman
  11461. @item welch
  11462. @item flattop
  11463. @item bharris
  11464. @item bnuttall
  11465. @item bhann
  11466. @item sine
  11467. @item nuttall
  11468. @item lanczos
  11469. @item gauss
  11470. @item tukey
  11471. @end table
  11472. Default value is @code{hann}.
  11473. @item orientation
  11474. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11475. @code{horizontal}. Default is @code{vertical}.
  11476. @item gain
  11477. Set scale gain for calculating intensity color values.
  11478. Default value is @code{1}.
  11479. @item legend
  11480. Draw time and frequency axes and legends. Default is enabled.
  11481. @end table
  11482. @subsection Examples
  11483. @itemize
  11484. @item
  11485. Extract an audio spectrogram of a whole audio track
  11486. in a 1024x1024 picture using @command{ffmpeg}:
  11487. @example
  11488. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  11489. @end example
  11490. @end itemize
  11491. @section showvolume
  11492. Convert input audio volume to a video output.
  11493. The filter accepts the following options:
  11494. @table @option
  11495. @item rate, r
  11496. Set video rate.
  11497. @item b
  11498. Set border width, allowed range is [0, 5]. Default is 1.
  11499. @item w
  11500. Set channel width, allowed range is [80, 1080]. Default is 400.
  11501. @item h
  11502. Set channel height, allowed range is [1, 100]. Default is 20.
  11503. @item f
  11504. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11505. @item c
  11506. Set volume color expression.
  11507. The expression can use the following variables:
  11508. @table @option
  11509. @item VOLUME
  11510. Current max volume of channel in dB.
  11511. @item CHANNEL
  11512. Current channel number, starting from 0.
  11513. @end table
  11514. @item t
  11515. If set, displays channel names. Default is enabled.
  11516. @item v
  11517. If set, displays volume values. Default is enabled.
  11518. @end table
  11519. @section showwaves
  11520. Convert input audio to a video output, representing the samples waves.
  11521. The filter accepts the following options:
  11522. @table @option
  11523. @item size, s
  11524. Specify the video size for the output. For the syntax of this option, check the
  11525. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11526. Default value is @code{600x240}.
  11527. @item mode
  11528. Set display mode.
  11529. Available values are:
  11530. @table @samp
  11531. @item point
  11532. Draw a point for each sample.
  11533. @item line
  11534. Draw a vertical line for each sample.
  11535. @item p2p
  11536. Draw a point for each sample and a line between them.
  11537. @item cline
  11538. Draw a centered vertical line for each sample.
  11539. @end table
  11540. Default value is @code{point}.
  11541. @item n
  11542. Set the number of samples which are printed on the same column. A
  11543. larger value will decrease the frame rate. Must be a positive
  11544. integer. This option can be set only if the value for @var{rate}
  11545. is not explicitly specified.
  11546. @item rate, r
  11547. Set the (approximate) output frame rate. This is done by setting the
  11548. option @var{n}. Default value is "25".
  11549. @item split_channels
  11550. Set if channels should be drawn separately or overlap. Default value is 0.
  11551. @end table
  11552. @subsection Examples
  11553. @itemize
  11554. @item
  11555. Output the input file audio and the corresponding video representation
  11556. at the same time:
  11557. @example
  11558. amovie=a.mp3,asplit[out0],showwaves[out1]
  11559. @end example
  11560. @item
  11561. Create a synthetic signal and show it with showwaves, forcing a
  11562. frame rate of 30 frames per second:
  11563. @example
  11564. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11565. @end example
  11566. @end itemize
  11567. @section showwavespic
  11568. Convert input audio to a single video frame, representing the samples waves.
  11569. The filter accepts the following options:
  11570. @table @option
  11571. @item size, s
  11572. Specify the video size for the output. For the syntax of this option, check the
  11573. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11574. Default value is @code{600x240}.
  11575. @item split_channels
  11576. Set if channels should be drawn separately or overlap. Default value is 0.
  11577. @end table
  11578. @subsection Examples
  11579. @itemize
  11580. @item
  11581. Extract a channel split representation of the wave form of a whole audio track
  11582. in a 1024x800 picture using @command{ffmpeg}:
  11583. @example
  11584. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11585. @end example
  11586. @item
  11587. Colorize the waveform with colorchannelmixer. This example will make
  11588. the waveform a green color approximately RGB(66,217,150). Additional
  11589. channels will be shades of this color.
  11590. @example
  11591. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  11592. @end example
  11593. @end itemize
  11594. @section spectrumsynth
  11595. Sythesize audio from 2 input video spectrums, first input stream represents
  11596. magnitude across time and second represents phase across time.
  11597. The filter will transform from frequency domain as displayed in videos back
  11598. to time domain as presented in audio output.
  11599. This filter is primarly created for reversing processed @ref{showspectrum}
  11600. filter outputs, but can synthesize sound from other spectrograms too.
  11601. But in such case results are going to be poor if the phase data is not
  11602. available, because in such cases phase data need to be recreated, usually
  11603. its just recreated from random noise.
  11604. For best results use gray only output (@code{channel} color mode in
  11605. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  11606. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  11607. @code{data} option. Inputs videos should generally use @code{fullframe}
  11608. slide mode as that saves resources needed for decoding video.
  11609. The filter accepts the following options:
  11610. @table @option
  11611. @item sample_rate
  11612. Specify sample rate of output audio, the sample rate of audio from which
  11613. spectrum was generated may differ.
  11614. @item channels
  11615. Set number of channels represented in input video spectrums.
  11616. @item scale
  11617. Set scale which was used when generating magnitude input spectrum.
  11618. Can be @code{lin} or @code{log}. Default is @code{log}.
  11619. @item slide
  11620. Set slide which was used when generating inputs spectrums.
  11621. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  11622. Default is @code{fullframe}.
  11623. @item win_func
  11624. Set window function used for resynthesis.
  11625. @item overlap
  11626. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11627. which means optimal overlap for selected window function will be picked.
  11628. @item orientation
  11629. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  11630. Default is @code{vertical}.
  11631. @end table
  11632. @subsection Examples
  11633. @itemize
  11634. @item
  11635. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  11636. then resynthesize videos back to audio with spectrumsynth:
  11637. @example
  11638. 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
  11639. 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
  11640. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_fun=hann:overlap=0.875:slide=fullframe output.flac
  11641. @end example
  11642. @end itemize
  11643. @section split, asplit
  11644. Split input into several identical outputs.
  11645. @code{asplit} works with audio input, @code{split} with video.
  11646. The filter accepts a single parameter which specifies the number of outputs. If
  11647. unspecified, it defaults to 2.
  11648. @subsection Examples
  11649. @itemize
  11650. @item
  11651. Create two separate outputs from the same input:
  11652. @example
  11653. [in] split [out0][out1]
  11654. @end example
  11655. @item
  11656. To create 3 or more outputs, you need to specify the number of
  11657. outputs, like in:
  11658. @example
  11659. [in] asplit=3 [out0][out1][out2]
  11660. @end example
  11661. @item
  11662. Create two separate outputs from the same input, one cropped and
  11663. one padded:
  11664. @example
  11665. [in] split [splitout1][splitout2];
  11666. [splitout1] crop=100:100:0:0 [cropout];
  11667. [splitout2] pad=200:200:100:100 [padout];
  11668. @end example
  11669. @item
  11670. Create 5 copies of the input audio with @command{ffmpeg}:
  11671. @example
  11672. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11673. @end example
  11674. @end itemize
  11675. @section zmq, azmq
  11676. Receive commands sent through a libzmq client, and forward them to
  11677. filters in the filtergraph.
  11678. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11679. must be inserted between two video filters, @code{azmq} between two
  11680. audio filters.
  11681. To enable these filters you need to install the libzmq library and
  11682. headers and configure FFmpeg with @code{--enable-libzmq}.
  11683. For more information about libzmq see:
  11684. @url{http://www.zeromq.org/}
  11685. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11686. receives messages sent through a network interface defined by the
  11687. @option{bind_address} option.
  11688. The received message must be in the form:
  11689. @example
  11690. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11691. @end example
  11692. @var{TARGET} specifies the target of the command, usually the name of
  11693. the filter class or a specific filter instance name.
  11694. @var{COMMAND} specifies the name of the command for the target filter.
  11695. @var{ARG} is optional and specifies the optional argument list for the
  11696. given @var{COMMAND}.
  11697. Upon reception, the message is processed and the corresponding command
  11698. is injected into the filtergraph. Depending on the result, the filter
  11699. will send a reply to the client, adopting the format:
  11700. @example
  11701. @var{ERROR_CODE} @var{ERROR_REASON}
  11702. @var{MESSAGE}
  11703. @end example
  11704. @var{MESSAGE} is optional.
  11705. @subsection Examples
  11706. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11707. be used to send commands processed by these filters.
  11708. Consider the following filtergraph generated by @command{ffplay}
  11709. @example
  11710. ffplay -dumpgraph 1 -f lavfi "
  11711. color=s=100x100:c=red [l];
  11712. color=s=100x100:c=blue [r];
  11713. nullsrc=s=200x100, zmq [bg];
  11714. [bg][l] overlay [bg+l];
  11715. [bg+l][r] overlay=x=100 "
  11716. @end example
  11717. To change the color of the left side of the video, the following
  11718. command can be used:
  11719. @example
  11720. echo Parsed_color_0 c yellow | tools/zmqsend
  11721. @end example
  11722. To change the right side:
  11723. @example
  11724. echo Parsed_color_1 c pink | tools/zmqsend
  11725. @end example
  11726. @c man end MULTIMEDIA FILTERS
  11727. @chapter Multimedia Sources
  11728. @c man begin MULTIMEDIA SOURCES
  11729. Below is a description of the currently available multimedia sources.
  11730. @section amovie
  11731. This is the same as @ref{movie} source, except it selects an audio
  11732. stream by default.
  11733. @anchor{movie}
  11734. @section movie
  11735. Read audio and/or video stream(s) from a movie container.
  11736. It accepts the following parameters:
  11737. @table @option
  11738. @item filename
  11739. The name of the resource to read (not necessarily a file; it can also be a
  11740. device or a stream accessed through some protocol).
  11741. @item format_name, f
  11742. Specifies the format assumed for the movie to read, and can be either
  11743. the name of a container or an input device. If not specified, the
  11744. format is guessed from @var{movie_name} or by probing.
  11745. @item seek_point, sp
  11746. Specifies the seek point in seconds. The frames will be output
  11747. starting from this seek point. The parameter is evaluated with
  11748. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11749. postfix. The default value is "0".
  11750. @item streams, s
  11751. Specifies the streams to read. Several streams can be specified,
  11752. separated by "+". The source will then have as many outputs, in the
  11753. same order. The syntax is explained in the ``Stream specifiers''
  11754. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11755. respectively the default (best suited) video and audio stream. Default
  11756. is "dv", or "da" if the filter is called as "amovie".
  11757. @item stream_index, si
  11758. Specifies the index of the video stream to read. If the value is -1,
  11759. the most suitable video stream will be automatically selected. The default
  11760. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11761. audio instead of video.
  11762. @item loop
  11763. Specifies how many times to read the stream in sequence.
  11764. If the value is less than 1, the stream will be read again and again.
  11765. Default value is "1".
  11766. Note that when the movie is looped the source timestamps are not
  11767. changed, so it will generate non monotonically increasing timestamps.
  11768. @end table
  11769. It allows overlaying a second video on top of the main input of
  11770. a filtergraph, as shown in this graph:
  11771. @example
  11772. input -----------> deltapts0 --> overlay --> output
  11773. ^
  11774. |
  11775. movie --> scale--> deltapts1 -------+
  11776. @end example
  11777. @subsection Examples
  11778. @itemize
  11779. @item
  11780. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11781. on top of the input labelled "in":
  11782. @example
  11783. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11784. [in] setpts=PTS-STARTPTS [main];
  11785. [main][over] overlay=16:16 [out]
  11786. @end example
  11787. @item
  11788. Read from a video4linux2 device, and overlay it on top of the input
  11789. labelled "in":
  11790. @example
  11791. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11792. [in] setpts=PTS-STARTPTS [main];
  11793. [main][over] overlay=16:16 [out]
  11794. @end example
  11795. @item
  11796. Read the first video stream and the audio stream with id 0x81 from
  11797. dvd.vob; the video is connected to the pad named "video" and the audio is
  11798. connected to the pad named "audio":
  11799. @example
  11800. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11801. @end example
  11802. @end itemize
  11803. @c man end MULTIMEDIA SOURCES