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.

17009 lines
457KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @item zero_phase
  1928. Enable zero phase mode by substracting timestamp to compensate delay.
  1929. Default is disabled.
  1930. @end table
  1931. @subsection Examples
  1932. @itemize
  1933. @item
  1934. lowpass at 1000 Hz:
  1935. @example
  1936. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1937. @end example
  1938. @item
  1939. lowpass at 1000 Hz with gain_entry:
  1940. @example
  1941. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1942. @end example
  1943. @item
  1944. custom equalization:
  1945. @example
  1946. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1947. @end example
  1948. @item
  1949. higher delay with zero phase to compensate delay:
  1950. @example
  1951. firequalizer=delay=0.1:fixed=on:zero_phase=on
  1952. @end example
  1953. @item
  1954. lowpass on left channel, highpass on right channel:
  1955. @example
  1956. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1957. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1958. @end example
  1959. @end itemize
  1960. @section flanger
  1961. Apply a flanging effect to the audio.
  1962. The filter accepts the following options:
  1963. @table @option
  1964. @item delay
  1965. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1966. @item depth
  1967. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1968. @item regen
  1969. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1970. Default value is 0.
  1971. @item width
  1972. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1973. Default value is 71.
  1974. @item speed
  1975. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1976. @item shape
  1977. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1978. Default value is @var{sinusoidal}.
  1979. @item phase
  1980. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1981. Default value is 25.
  1982. @item interp
  1983. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1984. Default is @var{linear}.
  1985. @end table
  1986. @section highpass
  1987. Apply a high-pass filter with 3dB point frequency.
  1988. The filter can be either single-pole, or double-pole (the default).
  1989. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1990. The filter accepts the following options:
  1991. @table @option
  1992. @item frequency, f
  1993. Set frequency in Hz. Default is 3000.
  1994. @item poles, p
  1995. Set number of poles. Default is 2.
  1996. @item width_type
  1997. Set method to specify band-width of filter.
  1998. @table @option
  1999. @item h
  2000. Hz
  2001. @item q
  2002. Q-Factor
  2003. @item o
  2004. octave
  2005. @item s
  2006. slope
  2007. @end table
  2008. @item width, w
  2009. Specify the band-width of a filter in width_type units.
  2010. Applies only to double-pole filter.
  2011. The default is 0.707q and gives a Butterworth response.
  2012. @end table
  2013. @section join
  2014. Join multiple input streams into one multi-channel stream.
  2015. It accepts the following parameters:
  2016. @table @option
  2017. @item inputs
  2018. The number of input streams. It defaults to 2.
  2019. @item channel_layout
  2020. The desired output channel layout. It defaults to stereo.
  2021. @item map
  2022. Map channels from inputs to output. The argument is a '|'-separated list of
  2023. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2024. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2025. can be either the name of the input channel (e.g. FL for front left) or its
  2026. index in the specified input stream. @var{out_channel} is the name of the output
  2027. channel.
  2028. @end table
  2029. The filter will attempt to guess the mappings when they are not specified
  2030. explicitly. It does so by first trying to find an unused matching input channel
  2031. and if that fails it picks the first unused input channel.
  2032. Join 3 inputs (with properly set channel layouts):
  2033. @example
  2034. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2035. @end example
  2036. Build a 5.1 output from 6 single-channel streams:
  2037. @example
  2038. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2039. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2040. out
  2041. @end example
  2042. @section ladspa
  2043. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2044. To enable compilation of this filter you need to configure FFmpeg with
  2045. @code{--enable-ladspa}.
  2046. @table @option
  2047. @item file, f
  2048. Specifies the name of LADSPA plugin library to load. If the environment
  2049. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2050. each one of the directories specified by the colon separated list in
  2051. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2052. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2053. @file{/usr/lib/ladspa/}.
  2054. @item plugin, p
  2055. Specifies the plugin within the library. Some libraries contain only
  2056. one plugin, but others contain many of them. If this is not set filter
  2057. will list all available plugins within the specified library.
  2058. @item controls, c
  2059. Set the '|' separated list of controls which are zero or more floating point
  2060. values that determine the behavior of the loaded plugin (for example delay,
  2061. threshold or gain).
  2062. Controls need to be defined using the following syntax:
  2063. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. Alternatively they can be also defined using the following syntax:
  2066. @var{value0}|@var{value1}|@var{value2}|..., where
  2067. @var{valuei} is the value set on the @var{i}-th control.
  2068. If @option{controls} is set to @code{help}, all available controls and
  2069. their valid ranges are printed.
  2070. @item sample_rate, s
  2071. Specify the sample rate, default to 44100. Only used if plugin have
  2072. zero inputs.
  2073. @item nb_samples, n
  2074. Set the number of samples per channel per each output frame, default
  2075. is 1024. Only used if plugin have zero inputs.
  2076. @item duration, d
  2077. Set the minimum duration of the sourced audio. See
  2078. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2079. for the accepted syntax.
  2080. Note that the resulting duration may be greater than the specified duration,
  2081. as the generated audio is always cut at the end of a complete frame.
  2082. If not specified, or the expressed duration is negative, the audio is
  2083. supposed to be generated forever.
  2084. Only used if plugin have zero inputs.
  2085. @end table
  2086. @subsection Examples
  2087. @itemize
  2088. @item
  2089. List all available plugins within amp (LADSPA example plugin) library:
  2090. @example
  2091. ladspa=file=amp
  2092. @end example
  2093. @item
  2094. List all available controls and their valid ranges for @code{vcf_notch}
  2095. plugin from @code{VCF} library:
  2096. @example
  2097. ladspa=f=vcf:p=vcf_notch:c=help
  2098. @end example
  2099. @item
  2100. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2101. plugin library:
  2102. @example
  2103. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2104. @end example
  2105. @item
  2106. Add reverberation to the audio using TAP-plugins
  2107. (Tom's Audio Processing plugins):
  2108. @example
  2109. ladspa=file=tap_reverb:tap_reverb
  2110. @end example
  2111. @item
  2112. Generate white noise, with 0.2 amplitude:
  2113. @example
  2114. ladspa=file=cmt:noise_source_white:c=c0=.2
  2115. @end example
  2116. @item
  2117. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2118. @code{C* Audio Plugin Suite} (CAPS) library:
  2119. @example
  2120. ladspa=file=caps:Click:c=c1=20'
  2121. @end example
  2122. @item
  2123. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2124. @example
  2125. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2126. @end example
  2127. @item
  2128. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2129. @code{SWH Plugins} collection:
  2130. @example
  2131. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2132. @end example
  2133. @item
  2134. Attenuate low frequencies using Multiband EQ from Steve Harris
  2135. @code{SWH Plugins} collection:
  2136. @example
  2137. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2138. @end example
  2139. @end itemize
  2140. @subsection Commands
  2141. This filter supports the following commands:
  2142. @table @option
  2143. @item cN
  2144. Modify the @var{N}-th control value.
  2145. If the specified value is not valid, it is ignored and prior one is kept.
  2146. @end table
  2147. @section loudnorm
  2148. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2149. Support for both single pass (livestreams, files) and double pass (files) modes.
  2150. This algorithm can target IL, LRA, and maximum true peak.
  2151. To enable compilation of this filter you need to configure FFmpeg with
  2152. @code{--enable-libebur128}.
  2153. The filter accepts the following options:
  2154. @table @option
  2155. @item I, i
  2156. Set integrated loudness target.
  2157. Range is -70.0 - -5.0. Default value is -24.0.
  2158. @item LRA, lra
  2159. Set loudness range target.
  2160. Range is 1.0 - 20.0. Default value is 7.0.
  2161. @item TP, tp
  2162. Set maximum true peak.
  2163. Range is -9.0 - +0.0. Default value is -2.0.
  2164. @item measured_I, measured_i
  2165. Measured IL of input file.
  2166. Range is -99.0 - +0.0.
  2167. @item measured_LRA, measured_lra
  2168. Measured LRA of input file.
  2169. Range is 0.0 - 99.0.
  2170. @item measured_TP, measured_tp
  2171. Measured true peak of input file.
  2172. Range is -99.0 - +99.0.
  2173. @item measured_thresh
  2174. Measured threshold of input file.
  2175. Range is -99.0 - +0.0.
  2176. @item offset
  2177. Set offset gain. Gain is applied before the true-peak limiter.
  2178. Range is -99.0 - +99.0. Default is +0.0.
  2179. @item linear
  2180. Normalize linearly if possible.
  2181. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2182. to be specified in order to use this mode.
  2183. Options are true or false. Default is true.
  2184. @item dual_mono
  2185. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2186. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2187. If set to @code{true}, this option will compensate for this effect.
  2188. Multi-channel input files are not affected by this option.
  2189. Options are true or false. Default is false.
  2190. @item print_format
  2191. Set print format for stats. Options are summary, json, or none.
  2192. Default value is none.
  2193. @end table
  2194. @section lowpass
  2195. Apply a low-pass filter with 3dB point frequency.
  2196. The filter can be either single-pole or double-pole (the default).
  2197. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2198. The filter accepts the following options:
  2199. @table @option
  2200. @item frequency, f
  2201. Set frequency in Hz. Default is 500.
  2202. @item poles, p
  2203. Set number of poles. Default is 2.
  2204. @item width_type
  2205. Set method to specify band-width of filter.
  2206. @table @option
  2207. @item h
  2208. Hz
  2209. @item q
  2210. Q-Factor
  2211. @item o
  2212. octave
  2213. @item s
  2214. slope
  2215. @end table
  2216. @item width, w
  2217. Specify the band-width of a filter in width_type units.
  2218. Applies only to double-pole filter.
  2219. The default is 0.707q and gives a Butterworth response.
  2220. @end table
  2221. @anchor{pan}
  2222. @section pan
  2223. Mix channels with specific gain levels. The filter accepts the output
  2224. channel layout followed by a set of channels definitions.
  2225. This filter is also designed to efficiently remap the channels of an audio
  2226. stream.
  2227. The filter accepts parameters of the form:
  2228. "@var{l}|@var{outdef}|@var{outdef}|..."
  2229. @table @option
  2230. @item l
  2231. output channel layout or number of channels
  2232. @item outdef
  2233. output channel specification, of the form:
  2234. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2235. @item out_name
  2236. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2237. number (c0, c1, etc.)
  2238. @item gain
  2239. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2240. @item in_name
  2241. input channel to use, see out_name for details; it is not possible to mix
  2242. named and numbered input channels
  2243. @end table
  2244. If the `=' in a channel specification is replaced by `<', then the gains for
  2245. that specification will be renormalized so that the total is 1, thus
  2246. avoiding clipping noise.
  2247. @subsection Mixing examples
  2248. For example, if you want to down-mix from stereo to mono, but with a bigger
  2249. factor for the left channel:
  2250. @example
  2251. pan=1c|c0=0.9*c0+0.1*c1
  2252. @end example
  2253. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2254. 7-channels surround:
  2255. @example
  2256. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2257. @end example
  2258. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2259. that should be preferred (see "-ac" option) unless you have very specific
  2260. needs.
  2261. @subsection Remapping examples
  2262. The channel remapping will be effective if, and only if:
  2263. @itemize
  2264. @item gain coefficients are zeroes or ones,
  2265. @item only one input per channel output,
  2266. @end itemize
  2267. If all these conditions are satisfied, the filter will notify the user ("Pure
  2268. channel mapping detected"), and use an optimized and lossless method to do the
  2269. remapping.
  2270. For example, if you have a 5.1 source and want a stereo audio stream by
  2271. dropping the extra channels:
  2272. @example
  2273. pan="stereo| c0=FL | c1=FR"
  2274. @end example
  2275. Given the same source, you can also switch front left and front right channels
  2276. and keep the input channel layout:
  2277. @example
  2278. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2279. @end example
  2280. If the input is a stereo audio stream, you can mute the front left channel (and
  2281. still keep the stereo channel layout) with:
  2282. @example
  2283. pan="stereo|c1=c1"
  2284. @end example
  2285. Still with a stereo audio stream input, you can copy the right channel in both
  2286. front left and right:
  2287. @example
  2288. pan="stereo| c0=FR | c1=FR"
  2289. @end example
  2290. @section replaygain
  2291. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2292. outputs it unchanged.
  2293. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2294. @section resample
  2295. Convert the audio sample format, sample rate and channel layout. It is
  2296. not meant to be used directly.
  2297. @section rubberband
  2298. Apply time-stretching and pitch-shifting with librubberband.
  2299. The filter accepts the following options:
  2300. @table @option
  2301. @item tempo
  2302. Set tempo scale factor.
  2303. @item pitch
  2304. Set pitch scale factor.
  2305. @item transients
  2306. Set transients detector.
  2307. Possible values are:
  2308. @table @var
  2309. @item crisp
  2310. @item mixed
  2311. @item smooth
  2312. @end table
  2313. @item detector
  2314. Set detector.
  2315. Possible values are:
  2316. @table @var
  2317. @item compound
  2318. @item percussive
  2319. @item soft
  2320. @end table
  2321. @item phase
  2322. Set phase.
  2323. Possible values are:
  2324. @table @var
  2325. @item laminar
  2326. @item independent
  2327. @end table
  2328. @item window
  2329. Set processing window size.
  2330. Possible values are:
  2331. @table @var
  2332. @item standard
  2333. @item short
  2334. @item long
  2335. @end table
  2336. @item smoothing
  2337. Set smoothing.
  2338. Possible values are:
  2339. @table @var
  2340. @item off
  2341. @item on
  2342. @end table
  2343. @item formant
  2344. Enable formant preservation when shift pitching.
  2345. Possible values are:
  2346. @table @var
  2347. @item shifted
  2348. @item preserved
  2349. @end table
  2350. @item pitchq
  2351. Set pitch quality.
  2352. Possible values are:
  2353. @table @var
  2354. @item quality
  2355. @item speed
  2356. @item consistency
  2357. @end table
  2358. @item channels
  2359. Set channels.
  2360. Possible values are:
  2361. @table @var
  2362. @item apart
  2363. @item together
  2364. @end table
  2365. @end table
  2366. @section sidechaincompress
  2367. This filter acts like normal compressor but has the ability to compress
  2368. detected signal using second input signal.
  2369. It needs two input streams and returns one output stream.
  2370. First input stream will be processed depending on second stream signal.
  2371. The filtered signal then can be filtered with other filters in later stages of
  2372. processing. See @ref{pan} and @ref{amerge} filter.
  2373. The filter accepts the following options:
  2374. @table @option
  2375. @item level_in
  2376. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2377. @item threshold
  2378. If a signal of second stream raises above this level it will affect the gain
  2379. reduction of first stream.
  2380. By default is 0.125. Range is between 0.00097563 and 1.
  2381. @item ratio
  2382. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2383. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2384. Default is 2. Range is between 1 and 20.
  2385. @item attack
  2386. Amount of milliseconds the signal has to rise above the threshold before gain
  2387. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2388. @item release
  2389. Amount of milliseconds the signal has to fall below the threshold before
  2390. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2391. @item makeup
  2392. Set the amount by how much signal will be amplified after processing.
  2393. Default is 2. Range is from 1 and 64.
  2394. @item knee
  2395. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2396. Default is 2.82843. Range is between 1 and 8.
  2397. @item link
  2398. Choose if the @code{average} level between all channels of side-chain stream
  2399. or the louder(@code{maximum}) channel of side-chain stream affects the
  2400. reduction. Default is @code{average}.
  2401. @item detection
  2402. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2403. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2404. @item level_sc
  2405. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2406. @item mix
  2407. How much to use compressed signal in output. Default is 1.
  2408. Range is between 0 and 1.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2414. depending on the signal of 2nd input and later compressed signal to be
  2415. merged with 2nd input:
  2416. @example
  2417. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2418. @end example
  2419. @end itemize
  2420. @section sidechaingate
  2421. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2422. filter the detected signal before sending it to the gain reduction stage.
  2423. Normally a gate uses the full range signal to detect a level above the
  2424. threshold.
  2425. For example: If you cut all lower frequencies from your sidechain signal
  2426. the gate will decrease the volume of your track only if not enough highs
  2427. appear. With this technique you are able to reduce the resonation of a
  2428. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2429. guitar.
  2430. It needs two input streams and returns one output stream.
  2431. First input stream will be processed depending on second stream signal.
  2432. The filter accepts the following options:
  2433. @table @option
  2434. @item level_in
  2435. Set input level before filtering.
  2436. Default is 1. Allowed range is from 0.015625 to 64.
  2437. @item range
  2438. Set the level of gain reduction when the signal is below the threshold.
  2439. Default is 0.06125. Allowed range is from 0 to 1.
  2440. @item threshold
  2441. If a signal rises above this level the gain reduction is released.
  2442. Default is 0.125. Allowed range is from 0 to 1.
  2443. @item ratio
  2444. Set a ratio about which the signal is reduced.
  2445. Default is 2. Allowed range is from 1 to 9000.
  2446. @item attack
  2447. Amount of milliseconds the signal has to rise above the threshold before gain
  2448. reduction stops.
  2449. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2450. @item release
  2451. Amount of milliseconds the signal has to fall below the threshold before the
  2452. reduction is increased again. Default is 250 milliseconds.
  2453. Allowed range is from 0.01 to 9000.
  2454. @item makeup
  2455. Set amount of amplification of signal after processing.
  2456. Default is 1. Allowed range is from 1 to 64.
  2457. @item knee
  2458. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2459. Default is 2.828427125. Allowed range is from 1 to 8.
  2460. @item detection
  2461. Choose if exact signal should be taken for detection or an RMS like one.
  2462. Default is rms. Can be peak or rms.
  2463. @item link
  2464. Choose if the average level between all channels or the louder channel affects
  2465. the reduction.
  2466. Default is average. Can be average or maximum.
  2467. @item level_sc
  2468. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2469. @end table
  2470. @section silencedetect
  2471. Detect silence in an audio stream.
  2472. This filter logs a message when it detects that the input audio volume is less
  2473. or equal to a noise tolerance value for a duration greater or equal to the
  2474. minimum detected noise duration.
  2475. The printed times and duration are expressed in seconds.
  2476. The filter accepts the following options:
  2477. @table @option
  2478. @item duration, d
  2479. Set silence duration until notification (default is 2 seconds).
  2480. @item noise, n
  2481. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2482. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2483. @end table
  2484. @subsection Examples
  2485. @itemize
  2486. @item
  2487. Detect 5 seconds of silence with -50dB noise tolerance:
  2488. @example
  2489. silencedetect=n=-50dB:d=5
  2490. @end example
  2491. @item
  2492. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2493. tolerance in @file{silence.mp3}:
  2494. @example
  2495. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2496. @end example
  2497. @end itemize
  2498. @section silenceremove
  2499. Remove silence from the beginning, middle or end of the audio.
  2500. The filter accepts the following options:
  2501. @table @option
  2502. @item start_periods
  2503. This value is used to indicate if audio should be trimmed at beginning of
  2504. the audio. A value of zero indicates no silence should be trimmed from the
  2505. beginning. When specifying a non-zero value, it trims audio up until it
  2506. finds non-silence. Normally, when trimming silence from beginning of audio
  2507. the @var{start_periods} will be @code{1} but it can be increased to higher
  2508. values to trim all audio up to specific count of non-silence periods.
  2509. Default value is @code{0}.
  2510. @item start_duration
  2511. Specify the amount of time that non-silence must be detected before it stops
  2512. trimming audio. By increasing the duration, bursts of noises can be treated
  2513. as silence and trimmed off. Default value is @code{0}.
  2514. @item start_threshold
  2515. This indicates what sample value should be treated as silence. For digital
  2516. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2517. you may wish to increase the value to account for background noise.
  2518. Can be specified in dB (in case "dB" is appended to the specified value)
  2519. or amplitude ratio. Default value is @code{0}.
  2520. @item stop_periods
  2521. Set the count for trimming silence from the end of audio.
  2522. To remove silence from the middle of a file, specify a @var{stop_periods}
  2523. that is negative. This value is then treated as a positive value and is
  2524. used to indicate the effect should restart processing as specified by
  2525. @var{start_periods}, making it suitable for removing periods of silence
  2526. in the middle of the audio.
  2527. Default value is @code{0}.
  2528. @item stop_duration
  2529. Specify a duration of silence that must exist before audio is not copied any
  2530. more. By specifying a higher duration, silence that is wanted can be left in
  2531. the audio.
  2532. Default value is @code{0}.
  2533. @item stop_threshold
  2534. This is the same as @option{start_threshold} but for trimming silence from
  2535. the end of audio.
  2536. Can be specified in dB (in case "dB" is appended to the specified value)
  2537. or amplitude ratio. Default value is @code{0}.
  2538. @item leave_silence
  2539. This indicate that @var{stop_duration} length of audio should be left intact
  2540. at the beginning of each period of silence.
  2541. For example, if you want to remove long pauses between words but do not want
  2542. to remove the pauses completely. Default value is @code{0}.
  2543. @item detection
  2544. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2545. and works better with digital silence which is exactly 0.
  2546. Default value is @code{rms}.
  2547. @item window
  2548. Set ratio used to calculate size of window for detecting silence.
  2549. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2550. @end table
  2551. @subsection Examples
  2552. @itemize
  2553. @item
  2554. The following example shows how this filter can be used to start a recording
  2555. that does not contain the delay at the start which usually occurs between
  2556. pressing the record button and the start of the performance:
  2557. @example
  2558. silenceremove=1:5:0.02
  2559. @end example
  2560. @item
  2561. Trim all silence encountered from begining to end where there is more than 1
  2562. second of silence in audio:
  2563. @example
  2564. silenceremove=0:0:0:-1:1:-90dB
  2565. @end example
  2566. @end itemize
  2567. @section sofalizer
  2568. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2569. loudspeakers around the user for binaural listening via headphones (audio
  2570. formats up to 9 channels supported).
  2571. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2572. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2573. Austrian Academy of Sciences.
  2574. To enable compilation of this filter you need to configure FFmpeg with
  2575. @code{--enable-netcdf}.
  2576. The filter accepts the following options:
  2577. @table @option
  2578. @item sofa
  2579. Set the SOFA file used for rendering.
  2580. @item gain
  2581. Set gain applied to audio. Value is in dB. Default is 0.
  2582. @item rotation
  2583. Set rotation of virtual loudspeakers in deg. Default is 0.
  2584. @item elevation
  2585. Set elevation of virtual speakers in deg. Default is 0.
  2586. @item radius
  2587. Set distance in meters between loudspeakers and the listener with near-field
  2588. HRTFs. Default is 1.
  2589. @item type
  2590. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2591. processing audio in time domain which is slow.
  2592. @var{freq} is processing audio in frequency domain which is fast.
  2593. Default is @var{freq}.
  2594. @item speakers
  2595. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2596. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2597. Each virtual loudspeaker is described with short channel name following with
  2598. azimuth and elevation in degreees.
  2599. Each virtual loudspeaker description is separated by '|'.
  2600. For example to override front left and front right channel positions use:
  2601. 'speakers=FL 45 15|FR 345 15'.
  2602. Descriptions with unrecognised channel names are ignored.
  2603. @end table
  2604. @subsection Examples
  2605. @itemize
  2606. @item
  2607. Using ClubFritz6 sofa file:
  2608. @example
  2609. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2610. @end example
  2611. @item
  2612. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2613. @example
  2614. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2615. @end example
  2616. @item
  2617. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2618. and also with custom gain:
  2619. @example
  2620. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2621. @end example
  2622. @end itemize
  2623. @section stereotools
  2624. This filter has some handy utilities to manage stereo signals, for converting
  2625. M/S stereo recordings to L/R signal while having control over the parameters
  2626. or spreading the stereo image of master track.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item level_in
  2630. Set input level before filtering for both channels. Defaults is 1.
  2631. Allowed range is from 0.015625 to 64.
  2632. @item level_out
  2633. Set output level after filtering for both channels. Defaults is 1.
  2634. Allowed range is from 0.015625 to 64.
  2635. @item balance_in
  2636. Set input balance between both channels. Default is 0.
  2637. Allowed range is from -1 to 1.
  2638. @item balance_out
  2639. Set output balance between both channels. Default is 0.
  2640. Allowed range is from -1 to 1.
  2641. @item softclip
  2642. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2643. clipping. Disabled by default.
  2644. @item mutel
  2645. Mute the left channel. Disabled by default.
  2646. @item muter
  2647. Mute the right channel. Disabled by default.
  2648. @item phasel
  2649. Change the phase of the left channel. Disabled by default.
  2650. @item phaser
  2651. Change the phase of the right channel. Disabled by default.
  2652. @item mode
  2653. Set stereo mode. Available values are:
  2654. @table @samp
  2655. @item lr>lr
  2656. Left/Right to Left/Right, this is default.
  2657. @item lr>ms
  2658. Left/Right to Mid/Side.
  2659. @item ms>lr
  2660. Mid/Side to Left/Right.
  2661. @item lr>ll
  2662. Left/Right to Left/Left.
  2663. @item lr>rr
  2664. Left/Right to Right/Right.
  2665. @item lr>l+r
  2666. Left/Right to Left + Right.
  2667. @item lr>rl
  2668. Left/Right to Right/Left.
  2669. @end table
  2670. @item slev
  2671. Set level of side signal. Default is 1.
  2672. Allowed range is from 0.015625 to 64.
  2673. @item sbal
  2674. Set balance of side signal. Default is 0.
  2675. Allowed range is from -1 to 1.
  2676. @item mlev
  2677. Set level of the middle signal. Default is 1.
  2678. Allowed range is from 0.015625 to 64.
  2679. @item mpan
  2680. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2681. @item base
  2682. Set stereo base between mono and inversed channels. Default is 0.
  2683. Allowed range is from -1 to 1.
  2684. @item delay
  2685. Set delay in milliseconds how much to delay left from right channel and
  2686. vice versa. Default is 0. Allowed range is from -20 to 20.
  2687. @item sclevel
  2688. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2689. @item phase
  2690. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2691. @end table
  2692. @subsection Examples
  2693. @itemize
  2694. @item
  2695. Apply karaoke like effect:
  2696. @example
  2697. stereotools=mlev=0.015625
  2698. @end example
  2699. @item
  2700. Convert M/S signal to L/R:
  2701. @example
  2702. "stereotools=mode=ms>lr"
  2703. @end example
  2704. @end itemize
  2705. @section stereowiden
  2706. This filter enhance the stereo effect by suppressing signal common to both
  2707. channels and by delaying the signal of left into right and vice versa,
  2708. thereby widening the stereo effect.
  2709. The filter accepts the following options:
  2710. @table @option
  2711. @item delay
  2712. Time in milliseconds of the delay of left signal into right and vice versa.
  2713. Default is 20 milliseconds.
  2714. @item feedback
  2715. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2716. effect of left signal in right output and vice versa which gives widening
  2717. effect. Default is 0.3.
  2718. @item crossfeed
  2719. Cross feed of left into right with inverted phase. This helps in suppressing
  2720. the mono. If the value is 1 it will cancel all the signal common to both
  2721. channels. Default is 0.3.
  2722. @item drymix
  2723. Set level of input signal of original channel. Default is 0.8.
  2724. @end table
  2725. @section scale_npp
  2726. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  2727. format conversion on CUDA video frames. Setting the output width and height
  2728. works in the same way as for the @var{scale} filter.
  2729. The following additional options are accepted:
  2730. @table @option
  2731. @item format
  2732. The pixel format of the output CUDA frames. If set to the string "same" (the
  2733. default), the input format will be kept. Note that automatic format negotiation
  2734. and conversion is not yet supported for hardware frames
  2735. @item interp_algo
  2736. The interpolation algorithm used for resizing. One of the following:
  2737. @table @option
  2738. @item nn
  2739. Nearest neighbour.
  2740. @item linear
  2741. @item cubic
  2742. @item cubic2p_bspline
  2743. 2-parameter cubic (B=1, C=0)
  2744. @item cubic2p_catmullrom
  2745. 2-parameter cubic (B=0, C=1/2)
  2746. @item cubic2p_b05c03
  2747. 2-parameter cubic (B=1/2, C=3/10)
  2748. @item super
  2749. Supersampling
  2750. @item lanczos
  2751. @end table
  2752. @end table
  2753. @section select
  2754. Select frames to pass in output.
  2755. @section treble
  2756. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2757. shelving filter with a response similar to that of a standard
  2758. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2759. The filter accepts the following options:
  2760. @table @option
  2761. @item gain, g
  2762. Give the gain at whichever is the lower of ~22 kHz and the
  2763. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2764. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2765. @item frequency, f
  2766. Set the filter's central frequency and so can be used
  2767. to extend or reduce the frequency range to be boosted or cut.
  2768. The default value is @code{3000} Hz.
  2769. @item width_type
  2770. Set method to specify band-width of filter.
  2771. @table @option
  2772. @item h
  2773. Hz
  2774. @item q
  2775. Q-Factor
  2776. @item o
  2777. octave
  2778. @item s
  2779. slope
  2780. @end table
  2781. @item width, w
  2782. Determine how steep is the filter's shelf transition.
  2783. @end table
  2784. @section tremolo
  2785. Sinusoidal amplitude modulation.
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item f
  2789. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2790. (20 Hz or lower) will result in a tremolo effect.
  2791. This filter may also be used as a ring modulator by specifying
  2792. a modulation frequency higher than 20 Hz.
  2793. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2794. @item d
  2795. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2796. Default value is 0.5.
  2797. @end table
  2798. @section vibrato
  2799. Sinusoidal phase modulation.
  2800. The filter accepts the following options:
  2801. @table @option
  2802. @item f
  2803. Modulation frequency in Hertz.
  2804. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2805. @item d
  2806. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2807. Default value is 0.5.
  2808. @end table
  2809. @section volume
  2810. Adjust the input audio volume.
  2811. It accepts the following parameters:
  2812. @table @option
  2813. @item volume
  2814. Set audio volume expression.
  2815. Output values are clipped to the maximum value.
  2816. The output audio volume is given by the relation:
  2817. @example
  2818. @var{output_volume} = @var{volume} * @var{input_volume}
  2819. @end example
  2820. The default value for @var{volume} is "1.0".
  2821. @item precision
  2822. This parameter represents the mathematical precision.
  2823. It determines which input sample formats will be allowed, which affects the
  2824. precision of the volume scaling.
  2825. @table @option
  2826. @item fixed
  2827. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2828. @item float
  2829. 32-bit floating-point; this limits input sample format to FLT. (default)
  2830. @item double
  2831. 64-bit floating-point; this limits input sample format to DBL.
  2832. @end table
  2833. @item replaygain
  2834. Choose the behaviour on encountering ReplayGain side data in input frames.
  2835. @table @option
  2836. @item drop
  2837. Remove ReplayGain side data, ignoring its contents (the default).
  2838. @item ignore
  2839. Ignore ReplayGain side data, but leave it in the frame.
  2840. @item track
  2841. Prefer the track gain, if present.
  2842. @item album
  2843. Prefer the album gain, if present.
  2844. @end table
  2845. @item replaygain_preamp
  2846. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2847. Default value for @var{replaygain_preamp} is 0.0.
  2848. @item eval
  2849. Set when the volume expression is evaluated.
  2850. It accepts the following values:
  2851. @table @samp
  2852. @item once
  2853. only evaluate expression once during the filter initialization, or
  2854. when the @samp{volume} command is sent
  2855. @item frame
  2856. evaluate expression for each incoming frame
  2857. @end table
  2858. Default value is @samp{once}.
  2859. @end table
  2860. The volume expression can contain the following parameters.
  2861. @table @option
  2862. @item n
  2863. frame number (starting at zero)
  2864. @item nb_channels
  2865. number of channels
  2866. @item nb_consumed_samples
  2867. number of samples consumed by the filter
  2868. @item nb_samples
  2869. number of samples in the current frame
  2870. @item pos
  2871. original frame position in the file
  2872. @item pts
  2873. frame PTS
  2874. @item sample_rate
  2875. sample rate
  2876. @item startpts
  2877. PTS at start of stream
  2878. @item startt
  2879. time at start of stream
  2880. @item t
  2881. frame time
  2882. @item tb
  2883. timestamp timebase
  2884. @item volume
  2885. last set volume value
  2886. @end table
  2887. Note that when @option{eval} is set to @samp{once} only the
  2888. @var{sample_rate} and @var{tb} variables are available, all other
  2889. variables will evaluate to NAN.
  2890. @subsection Commands
  2891. This filter supports the following commands:
  2892. @table @option
  2893. @item volume
  2894. Modify the volume expression.
  2895. The command accepts the same syntax of the corresponding option.
  2896. If the specified expression is not valid, it is kept at its current
  2897. value.
  2898. @item replaygain_noclip
  2899. Prevent clipping by limiting the gain applied.
  2900. Default value for @var{replaygain_noclip} is 1.
  2901. @end table
  2902. @subsection Examples
  2903. @itemize
  2904. @item
  2905. Halve the input audio volume:
  2906. @example
  2907. volume=volume=0.5
  2908. volume=volume=1/2
  2909. volume=volume=-6.0206dB
  2910. @end example
  2911. In all the above example the named key for @option{volume} can be
  2912. omitted, for example like in:
  2913. @example
  2914. volume=0.5
  2915. @end example
  2916. @item
  2917. Increase input audio power by 6 decibels using fixed-point precision:
  2918. @example
  2919. volume=volume=6dB:precision=fixed
  2920. @end example
  2921. @item
  2922. Fade volume after time 10 with an annihilation period of 5 seconds:
  2923. @example
  2924. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2925. @end example
  2926. @end itemize
  2927. @section volumedetect
  2928. Detect the volume of the input video.
  2929. The filter has no parameters. The input is not modified. Statistics about
  2930. the volume will be printed in the log when the input stream end is reached.
  2931. In particular it will show the mean volume (root mean square), maximum
  2932. volume (on a per-sample basis), and the beginning of a histogram of the
  2933. registered volume values (from the maximum value to a cumulated 1/1000 of
  2934. the samples).
  2935. All volumes are in decibels relative to the maximum PCM value.
  2936. @subsection Examples
  2937. Here is an excerpt of the output:
  2938. @example
  2939. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2940. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2941. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2942. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2943. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2944. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2945. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2946. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2947. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2948. @end example
  2949. It means that:
  2950. @itemize
  2951. @item
  2952. The mean square energy is approximately -27 dB, or 10^-2.7.
  2953. @item
  2954. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2955. @item
  2956. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2957. @end itemize
  2958. In other words, raising the volume by +4 dB does not cause any clipping,
  2959. raising it by +5 dB causes clipping for 6 samples, etc.
  2960. @c man end AUDIO FILTERS
  2961. @chapter Audio Sources
  2962. @c man begin AUDIO SOURCES
  2963. Below is a description of the currently available audio sources.
  2964. @section abuffer
  2965. Buffer audio frames, and make them available to the filter chain.
  2966. This source is mainly intended for a programmatic use, in particular
  2967. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2968. It accepts the following parameters:
  2969. @table @option
  2970. @item time_base
  2971. The timebase which will be used for timestamps of submitted frames. It must be
  2972. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2973. @item sample_rate
  2974. The sample rate of the incoming audio buffers.
  2975. @item sample_fmt
  2976. The sample format of the incoming audio buffers.
  2977. Either a sample format name or its corresponding integer representation from
  2978. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2979. @item channel_layout
  2980. The channel layout of the incoming audio buffers.
  2981. Either a channel layout name from channel_layout_map in
  2982. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2983. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2984. @item channels
  2985. The number of channels of the incoming audio buffers.
  2986. If both @var{channels} and @var{channel_layout} are specified, then they
  2987. must be consistent.
  2988. @end table
  2989. @subsection Examples
  2990. @example
  2991. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2992. @end example
  2993. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2994. Since the sample format with name "s16p" corresponds to the number
  2995. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2996. equivalent to:
  2997. @example
  2998. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2999. @end example
  3000. @section aevalsrc
  3001. Generate an audio signal specified by an expression.
  3002. This source accepts in input one or more expressions (one for each
  3003. channel), which are evaluated and used to generate a corresponding
  3004. audio signal.
  3005. This source accepts the following options:
  3006. @table @option
  3007. @item exprs
  3008. Set the '|'-separated expressions list for each separate channel. In case the
  3009. @option{channel_layout} option is not specified, the selected channel layout
  3010. depends on the number of provided expressions. Otherwise the last
  3011. specified expression is applied to the remaining output channels.
  3012. @item channel_layout, c
  3013. Set the channel layout. The number of channels in the specified layout
  3014. must be equal to the number of specified expressions.
  3015. @item duration, d
  3016. Set the minimum duration of the sourced audio. See
  3017. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3018. for the accepted syntax.
  3019. Note that the resulting duration may be greater than the specified
  3020. duration, as the generated audio is always cut at the end of a
  3021. complete frame.
  3022. If not specified, or the expressed duration is negative, the audio is
  3023. supposed to be generated forever.
  3024. @item nb_samples, n
  3025. Set the number of samples per channel per each output frame,
  3026. default to 1024.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100.
  3029. @end table
  3030. Each expression in @var{exprs} can contain the following constants:
  3031. @table @option
  3032. @item n
  3033. number of the evaluated sample, starting from 0
  3034. @item t
  3035. time of the evaluated sample expressed in seconds, starting from 0
  3036. @item s
  3037. sample rate
  3038. @end table
  3039. @subsection Examples
  3040. @itemize
  3041. @item
  3042. Generate silence:
  3043. @example
  3044. aevalsrc=0
  3045. @end example
  3046. @item
  3047. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3048. 8000 Hz:
  3049. @example
  3050. aevalsrc="sin(440*2*PI*t):s=8000"
  3051. @end example
  3052. @item
  3053. Generate a two channels signal, specify the channel layout (Front
  3054. Center + Back Center) explicitly:
  3055. @example
  3056. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3057. @end example
  3058. @item
  3059. Generate white noise:
  3060. @example
  3061. aevalsrc="-2+random(0)"
  3062. @end example
  3063. @item
  3064. Generate an amplitude modulated signal:
  3065. @example
  3066. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3067. @end example
  3068. @item
  3069. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3070. @example
  3071. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3072. @end example
  3073. @end itemize
  3074. @section anullsrc
  3075. The null audio source, return unprocessed audio frames. It is mainly useful
  3076. as a template and to be employed in analysis / debugging tools, or as
  3077. the source for filters which ignore the input data (for example the sox
  3078. synth filter).
  3079. This source accepts the following options:
  3080. @table @option
  3081. @item channel_layout, cl
  3082. Specifies the channel layout, and can be either an integer or a string
  3083. representing a channel layout. The default value of @var{channel_layout}
  3084. is "stereo".
  3085. Check the channel_layout_map definition in
  3086. @file{libavutil/channel_layout.c} for the mapping between strings and
  3087. channel layout values.
  3088. @item sample_rate, r
  3089. Specifies the sample rate, and defaults to 44100.
  3090. @item nb_samples, n
  3091. Set the number of samples per requested frames.
  3092. @end table
  3093. @subsection Examples
  3094. @itemize
  3095. @item
  3096. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3097. @example
  3098. anullsrc=r=48000:cl=4
  3099. @end example
  3100. @item
  3101. Do the same operation with a more obvious syntax:
  3102. @example
  3103. anullsrc=r=48000:cl=mono
  3104. @end example
  3105. @end itemize
  3106. All the parameters need to be explicitly defined.
  3107. @section flite
  3108. Synthesize a voice utterance using the libflite library.
  3109. To enable compilation of this filter you need to configure FFmpeg with
  3110. @code{--enable-libflite}.
  3111. Note that the flite library is not thread-safe.
  3112. The filter accepts the following options:
  3113. @table @option
  3114. @item list_voices
  3115. If set to 1, list the names of the available voices and exit
  3116. immediately. Default value is 0.
  3117. @item nb_samples, n
  3118. Set the maximum number of samples per frame. Default value is 512.
  3119. @item textfile
  3120. Set the filename containing the text to speak.
  3121. @item text
  3122. Set the text to speak.
  3123. @item voice, v
  3124. Set the voice to use for the speech synthesis. Default value is
  3125. @code{kal}. See also the @var{list_voices} option.
  3126. @end table
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. Read from file @file{speech.txt}, and synthesize the text using the
  3131. standard flite voice:
  3132. @example
  3133. flite=textfile=speech.txt
  3134. @end example
  3135. @item
  3136. Read the specified text selecting the @code{slt} voice:
  3137. @example
  3138. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3139. @end example
  3140. @item
  3141. Input text to ffmpeg:
  3142. @example
  3143. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3144. @end example
  3145. @item
  3146. Make @file{ffplay} speak the specified text, using @code{flite} and
  3147. the @code{lavfi} device:
  3148. @example
  3149. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3150. @end example
  3151. @end itemize
  3152. For more information about libflite, check:
  3153. @url{http://www.speech.cs.cmu.edu/flite/}
  3154. @section anoisesrc
  3155. Generate a noise audio signal.
  3156. The filter accepts the following options:
  3157. @table @option
  3158. @item sample_rate, r
  3159. Specify the sample rate. Default value is 48000 Hz.
  3160. @item amplitude, a
  3161. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3162. is 1.0.
  3163. @item duration, d
  3164. Specify the duration of the generated audio stream. Not specifying this option
  3165. results in noise with an infinite length.
  3166. @item color, colour, c
  3167. Specify the color of noise. Available noise colors are white, pink, and brown.
  3168. Default color is white.
  3169. @item seed, s
  3170. Specify a value used to seed the PRNG.
  3171. @item nb_samples, n
  3172. Set the number of samples per each output frame, default is 1024.
  3173. @end table
  3174. @subsection Examples
  3175. @itemize
  3176. @item
  3177. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3178. @example
  3179. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3180. @end example
  3181. @end itemize
  3182. @section sine
  3183. Generate an audio signal made of a sine wave with amplitude 1/8.
  3184. The audio signal is bit-exact.
  3185. The filter accepts the following options:
  3186. @table @option
  3187. @item frequency, f
  3188. Set the carrier frequency. Default is 440 Hz.
  3189. @item beep_factor, b
  3190. Enable a periodic beep every second with frequency @var{beep_factor} times
  3191. the carrier frequency. Default is 0, meaning the beep is disabled.
  3192. @item sample_rate, r
  3193. Specify the sample rate, default is 44100.
  3194. @item duration, d
  3195. Specify the duration of the generated audio stream.
  3196. @item samples_per_frame
  3197. Set the number of samples per output frame.
  3198. The expression can contain the following constants:
  3199. @table @option
  3200. @item n
  3201. The (sequential) number of the output audio frame, starting from 0.
  3202. @item pts
  3203. The PTS (Presentation TimeStamp) of the output audio frame,
  3204. expressed in @var{TB} units.
  3205. @item t
  3206. The PTS of the output audio frame, expressed in seconds.
  3207. @item TB
  3208. The timebase of the output audio frames.
  3209. @end table
  3210. Default is @code{1024}.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Generate a simple 440 Hz sine wave:
  3216. @example
  3217. sine
  3218. @end example
  3219. @item
  3220. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3221. @example
  3222. sine=220:4:d=5
  3223. sine=f=220:b=4:d=5
  3224. sine=frequency=220:beep_factor=4:duration=5
  3225. @end example
  3226. @item
  3227. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3228. pattern:
  3229. @example
  3230. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3231. @end example
  3232. @end itemize
  3233. @c man end AUDIO SOURCES
  3234. @chapter Audio Sinks
  3235. @c man begin AUDIO SINKS
  3236. Below is a description of the currently available audio sinks.
  3237. @section abuffersink
  3238. Buffer audio frames, and make them available to the end of filter chain.
  3239. This sink is mainly intended for programmatic use, in particular
  3240. through the interface defined in @file{libavfilter/buffersink.h}
  3241. or the options system.
  3242. It accepts a pointer to an AVABufferSinkContext structure, which
  3243. defines the incoming buffers' formats, to be passed as the opaque
  3244. parameter to @code{avfilter_init_filter} for initialization.
  3245. @section anullsink
  3246. Null audio sink; do absolutely nothing with the input audio. It is
  3247. mainly useful as a template and for use in analysis / debugging
  3248. tools.
  3249. @c man end AUDIO SINKS
  3250. @chapter Video Filters
  3251. @c man begin VIDEO FILTERS
  3252. When you configure your FFmpeg build, you can disable any of the
  3253. existing filters using @code{--disable-filters}.
  3254. The configure output will show the video filters included in your
  3255. build.
  3256. Below is a description of the currently available video filters.
  3257. @section alphaextract
  3258. Extract the alpha component from the input as a grayscale video. This
  3259. is especially useful with the @var{alphamerge} filter.
  3260. @section alphamerge
  3261. Add or replace the alpha component of the primary input with the
  3262. grayscale value of a second input. This is intended for use with
  3263. @var{alphaextract} to allow the transmission or storage of frame
  3264. sequences that have alpha in a format that doesn't support an alpha
  3265. channel.
  3266. For example, to reconstruct full frames from a normal YUV-encoded video
  3267. and a separate video created with @var{alphaextract}, you might use:
  3268. @example
  3269. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3270. @end example
  3271. Since this filter is designed for reconstruction, it operates on frame
  3272. sequences without considering timestamps, and terminates when either
  3273. input reaches end of stream. This will cause problems if your encoding
  3274. pipeline drops frames. If you're trying to apply an image as an
  3275. overlay to a video stream, consider the @var{overlay} filter instead.
  3276. @section ass
  3277. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3278. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3279. Substation Alpha) subtitles files.
  3280. This filter accepts the following option in addition to the common options from
  3281. the @ref{subtitles} filter:
  3282. @table @option
  3283. @item shaping
  3284. Set the shaping engine
  3285. Available values are:
  3286. @table @samp
  3287. @item auto
  3288. The default libass shaping engine, which is the best available.
  3289. @item simple
  3290. Fast, font-agnostic shaper that can do only substitutions
  3291. @item complex
  3292. Slower shaper using OpenType for substitutions and positioning
  3293. @end table
  3294. The default is @code{auto}.
  3295. @end table
  3296. @section atadenoise
  3297. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3298. The filter accepts the following options:
  3299. @table @option
  3300. @item 0a
  3301. Set threshold A for 1st plane. Default is 0.02.
  3302. Valid range is 0 to 0.3.
  3303. @item 0b
  3304. Set threshold B for 1st plane. Default is 0.04.
  3305. Valid range is 0 to 5.
  3306. @item 1a
  3307. Set threshold A for 2nd plane. Default is 0.02.
  3308. Valid range is 0 to 0.3.
  3309. @item 1b
  3310. Set threshold B for 2nd plane. Default is 0.04.
  3311. Valid range is 0 to 5.
  3312. @item 2a
  3313. Set threshold A for 3rd plane. Default is 0.02.
  3314. Valid range is 0 to 0.3.
  3315. @item 2b
  3316. Set threshold B for 3rd plane. Default is 0.04.
  3317. Valid range is 0 to 5.
  3318. Threshold A is designed to react on abrupt changes in the input signal and
  3319. threshold B is designed to react on continuous changes in the input signal.
  3320. @item s
  3321. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3322. number in range [5, 129].
  3323. @end table
  3324. @section bbox
  3325. Compute the bounding box for the non-black pixels in the input frame
  3326. luminance plane.
  3327. This filter computes the bounding box containing all the pixels with a
  3328. luminance value greater than the minimum allowed value.
  3329. The parameters describing the bounding box are printed on the filter
  3330. log.
  3331. The filter accepts the following option:
  3332. @table @option
  3333. @item min_val
  3334. Set the minimal luminance value. Default is @code{16}.
  3335. @end table
  3336. @section blackdetect
  3337. Detect video intervals that are (almost) completely black. Can be
  3338. useful to detect chapter transitions, commercials, or invalid
  3339. recordings. Output lines contains the time for the start, end and
  3340. duration of the detected black interval expressed in seconds.
  3341. In order to display the output lines, you need to set the loglevel at
  3342. least to the AV_LOG_INFO value.
  3343. The filter accepts the following options:
  3344. @table @option
  3345. @item black_min_duration, d
  3346. Set the minimum detected black duration expressed in seconds. It must
  3347. be a non-negative floating point number.
  3348. Default value is 2.0.
  3349. @item picture_black_ratio_th, pic_th
  3350. Set the threshold for considering a picture "black".
  3351. Express the minimum value for the ratio:
  3352. @example
  3353. @var{nb_black_pixels} / @var{nb_pixels}
  3354. @end example
  3355. for which a picture is considered black.
  3356. Default value is 0.98.
  3357. @item pixel_black_th, pix_th
  3358. Set the threshold for considering a pixel "black".
  3359. The threshold expresses the maximum pixel luminance value for which a
  3360. pixel is considered "black". The provided value is scaled according to
  3361. the following equation:
  3362. @example
  3363. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3364. @end example
  3365. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3366. the input video format, the range is [0-255] for YUV full-range
  3367. formats and [16-235] for YUV non full-range formats.
  3368. Default value is 0.10.
  3369. @end table
  3370. The following example sets the maximum pixel threshold to the minimum
  3371. value, and detects only black intervals of 2 or more seconds:
  3372. @example
  3373. blackdetect=d=2:pix_th=0.00
  3374. @end example
  3375. @section blackframe
  3376. Detect frames that are (almost) completely black. Can be useful to
  3377. detect chapter transitions or commercials. Output lines consist of
  3378. the frame number of the detected frame, the percentage of blackness,
  3379. the position in the file if known or -1 and the timestamp in seconds.
  3380. In order to display the output lines, you need to set the loglevel at
  3381. least to the AV_LOG_INFO value.
  3382. It accepts the following parameters:
  3383. @table @option
  3384. @item amount
  3385. The percentage of the pixels that have to be below the threshold; it defaults to
  3386. @code{98}.
  3387. @item threshold, thresh
  3388. The threshold below which a pixel value is considered black; it defaults to
  3389. @code{32}.
  3390. @end table
  3391. @section blend, tblend
  3392. Blend two video frames into each other.
  3393. The @code{blend} filter takes two input streams and outputs one
  3394. stream, the first input is the "top" layer and second input is
  3395. "bottom" layer. Output terminates when shortest input terminates.
  3396. The @code{tblend} (time blend) filter takes two consecutive frames
  3397. from one single stream, and outputs the result obtained by blending
  3398. the new frame on top of the old frame.
  3399. A description of the accepted options follows.
  3400. @table @option
  3401. @item c0_mode
  3402. @item c1_mode
  3403. @item c2_mode
  3404. @item c3_mode
  3405. @item all_mode
  3406. Set blend mode for specific pixel component or all pixel components in case
  3407. of @var{all_mode}. Default value is @code{normal}.
  3408. Available values for component modes are:
  3409. @table @samp
  3410. @item addition
  3411. @item addition128
  3412. @item and
  3413. @item average
  3414. @item burn
  3415. @item darken
  3416. @item difference
  3417. @item difference128
  3418. @item divide
  3419. @item dodge
  3420. @item freeze
  3421. @item exclusion
  3422. @item glow
  3423. @item hardlight
  3424. @item hardmix
  3425. @item heat
  3426. @item lighten
  3427. @item linearlight
  3428. @item multiply
  3429. @item multiply128
  3430. @item negation
  3431. @item normal
  3432. @item or
  3433. @item overlay
  3434. @item phoenix
  3435. @item pinlight
  3436. @item reflect
  3437. @item screen
  3438. @item softlight
  3439. @item subtract
  3440. @item vividlight
  3441. @item xor
  3442. @end table
  3443. @item c0_opacity
  3444. @item c1_opacity
  3445. @item c2_opacity
  3446. @item c3_opacity
  3447. @item all_opacity
  3448. Set blend opacity for specific pixel component or all pixel components in case
  3449. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3450. @item c0_expr
  3451. @item c1_expr
  3452. @item c2_expr
  3453. @item c3_expr
  3454. @item all_expr
  3455. Set blend expression for specific pixel component or all pixel components in case
  3456. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3457. The expressions can use the following variables:
  3458. @table @option
  3459. @item N
  3460. The sequential number of the filtered frame, starting from @code{0}.
  3461. @item X
  3462. @item Y
  3463. the coordinates of the current sample
  3464. @item W
  3465. @item H
  3466. the width and height of currently filtered plane
  3467. @item SW
  3468. @item SH
  3469. Width and height scale depending on the currently filtered plane. It is the
  3470. ratio between the corresponding luma plane number of pixels and the current
  3471. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3472. @code{0.5,0.5} for chroma planes.
  3473. @item T
  3474. Time of the current frame, expressed in seconds.
  3475. @item TOP, A
  3476. Value of pixel component at current location for first video frame (top layer).
  3477. @item BOTTOM, B
  3478. Value of pixel component at current location for second video frame (bottom layer).
  3479. @end table
  3480. @item shortest
  3481. Force termination when the shortest input terminates. Default is
  3482. @code{0}. This option is only defined for the @code{blend} filter.
  3483. @item repeatlast
  3484. Continue applying the last bottom frame after the end of the stream. A value of
  3485. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3486. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3487. @end table
  3488. @subsection Examples
  3489. @itemize
  3490. @item
  3491. Apply transition from bottom layer to top layer in first 10 seconds:
  3492. @example
  3493. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3494. @end example
  3495. @item
  3496. Apply 1x1 checkerboard effect:
  3497. @example
  3498. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3499. @end example
  3500. @item
  3501. Apply uncover left effect:
  3502. @example
  3503. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3504. @end example
  3505. @item
  3506. Apply uncover down effect:
  3507. @example
  3508. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3509. @end example
  3510. @item
  3511. Apply uncover up-left effect:
  3512. @example
  3513. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3514. @end example
  3515. @item
  3516. Split diagonally video and shows top and bottom layer on each side:
  3517. @example
  3518. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3519. @end example
  3520. @item
  3521. Display differences between the current and the previous frame:
  3522. @example
  3523. tblend=all_mode=difference128
  3524. @end example
  3525. @end itemize
  3526. @section bwdif
  3527. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3528. Deinterlacing Filter").
  3529. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3530. interpolation algorithms.
  3531. It accepts the following parameters:
  3532. @table @option
  3533. @item mode
  3534. The interlacing mode to adopt. It accepts one of the following values:
  3535. @table @option
  3536. @item 0, send_frame
  3537. Output one frame for each frame.
  3538. @item 1, send_field
  3539. Output one frame for each field.
  3540. @end table
  3541. The default value is @code{send_field}.
  3542. @item parity
  3543. The picture field parity assumed for the input interlaced video. It accepts one
  3544. of the following values:
  3545. @table @option
  3546. @item 0, tff
  3547. Assume the top field is first.
  3548. @item 1, bff
  3549. Assume the bottom field is first.
  3550. @item -1, auto
  3551. Enable automatic detection of field parity.
  3552. @end table
  3553. The default value is @code{auto}.
  3554. If the interlacing is unknown or the decoder does not export this information,
  3555. top field first will be assumed.
  3556. @item deint
  3557. Specify which frames to deinterlace. Accept one of the following
  3558. values:
  3559. @table @option
  3560. @item 0, all
  3561. Deinterlace all frames.
  3562. @item 1, interlaced
  3563. Only deinterlace frames marked as interlaced.
  3564. @end table
  3565. The default value is @code{all}.
  3566. @end table
  3567. @section boxblur
  3568. Apply a boxblur algorithm to the input video.
  3569. It accepts the following parameters:
  3570. @table @option
  3571. @item luma_radius, lr
  3572. @item luma_power, lp
  3573. @item chroma_radius, cr
  3574. @item chroma_power, cp
  3575. @item alpha_radius, ar
  3576. @item alpha_power, ap
  3577. @end table
  3578. A description of the accepted options follows.
  3579. @table @option
  3580. @item luma_radius, lr
  3581. @item chroma_radius, cr
  3582. @item alpha_radius, ar
  3583. Set an expression for the box radius in pixels used for blurring the
  3584. corresponding input plane.
  3585. The radius value must be a non-negative number, and must not be
  3586. greater than the value of the expression @code{min(w,h)/2} for the
  3587. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3588. planes.
  3589. Default value for @option{luma_radius} is "2". If not specified,
  3590. @option{chroma_radius} and @option{alpha_radius} default to the
  3591. corresponding value set for @option{luma_radius}.
  3592. The expressions can contain the following constants:
  3593. @table @option
  3594. @item w
  3595. @item h
  3596. The input width and height in pixels.
  3597. @item cw
  3598. @item ch
  3599. The input chroma image width and height in pixels.
  3600. @item hsub
  3601. @item vsub
  3602. The horizontal and vertical chroma subsample values. For example, for the
  3603. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3604. @end table
  3605. @item luma_power, lp
  3606. @item chroma_power, cp
  3607. @item alpha_power, ap
  3608. Specify how many times the boxblur filter is applied to the
  3609. corresponding plane.
  3610. Default value for @option{luma_power} is 2. If not specified,
  3611. @option{chroma_power} and @option{alpha_power} default to the
  3612. corresponding value set for @option{luma_power}.
  3613. A value of 0 will disable the effect.
  3614. @end table
  3615. @subsection Examples
  3616. @itemize
  3617. @item
  3618. Apply a boxblur filter with the luma, chroma, and alpha radii
  3619. set to 2:
  3620. @example
  3621. boxblur=luma_radius=2:luma_power=1
  3622. boxblur=2:1
  3623. @end example
  3624. @item
  3625. Set the luma radius to 2, and alpha and chroma radius to 0:
  3626. @example
  3627. boxblur=2:1:cr=0:ar=0
  3628. @end example
  3629. @item
  3630. Set the luma and chroma radii to a fraction of the video dimension:
  3631. @example
  3632. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3633. @end example
  3634. @end itemize
  3635. @section chromakey
  3636. YUV colorspace color/chroma keying.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item color
  3640. The color which will be replaced with transparency.
  3641. @item similarity
  3642. Similarity percentage with the key color.
  3643. 0.01 matches only the exact key color, while 1.0 matches everything.
  3644. @item blend
  3645. Blend percentage.
  3646. 0.0 makes pixels either fully transparent, or not transparent at all.
  3647. Higher values result in semi-transparent pixels, with a higher transparency
  3648. the more similar the pixels color is to the key color.
  3649. @item yuv
  3650. Signals that the color passed is already in YUV instead of RGB.
  3651. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3652. This can be used to pass exact YUV values as hexadecimal numbers.
  3653. @end table
  3654. @subsection Examples
  3655. @itemize
  3656. @item
  3657. Make every green pixel in the input image transparent:
  3658. @example
  3659. ffmpeg -i input.png -vf chromakey=green out.png
  3660. @end example
  3661. @item
  3662. Overlay a greenscreen-video on top of a static black background.
  3663. @example
  3664. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  3665. @end example
  3666. @end itemize
  3667. @section ciescope
  3668. Display CIE color diagram with pixels overlaid onto it.
  3669. The filter acccepts the following options:
  3670. @table @option
  3671. @item system
  3672. Set color system.
  3673. @table @samp
  3674. @item ntsc, 470m
  3675. @item ebu, 470bg
  3676. @item smpte
  3677. @item 240m
  3678. @item apple
  3679. @item widergb
  3680. @item cie1931
  3681. @item rec709, hdtv
  3682. @item uhdtv, rec2020
  3683. @end table
  3684. @item cie
  3685. Set CIE system.
  3686. @table @samp
  3687. @item xyy
  3688. @item ucs
  3689. @item luv
  3690. @end table
  3691. @item gamuts
  3692. Set what gamuts to draw.
  3693. See @code{system} option for avaiable values.
  3694. @item size, s
  3695. Set ciescope size, by default set to 512.
  3696. @item intensity, i
  3697. Set intensity used to map input pixel values to CIE diagram.
  3698. @item contrast
  3699. Set contrast used to draw tongue colors that are out of active color system gamut.
  3700. @item corrgamma
  3701. Correct gamma displayed on scope, by default enabled.
  3702. @item showwhite
  3703. Show white point on CIE diagram, by default disabled.
  3704. @item gamma
  3705. Set input gamma. Used only with XYZ input color space.
  3706. @end table
  3707. @section codecview
  3708. Visualize information exported by some codecs.
  3709. Some codecs can export information through frames using side-data or other
  3710. means. For example, some MPEG based codecs export motion vectors through the
  3711. @var{export_mvs} flag in the codec @option{flags2} option.
  3712. The filter accepts the following option:
  3713. @table @option
  3714. @item mv
  3715. Set motion vectors to visualize.
  3716. Available flags for @var{mv} are:
  3717. @table @samp
  3718. @item pf
  3719. forward predicted MVs of P-frames
  3720. @item bf
  3721. forward predicted MVs of B-frames
  3722. @item bb
  3723. backward predicted MVs of B-frames
  3724. @end table
  3725. @item qp
  3726. Display quantization parameters using the chroma planes
  3727. @end table
  3728. @subsection Examples
  3729. @itemize
  3730. @item
  3731. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3732. @example
  3733. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3734. @end example
  3735. @end itemize
  3736. @section colorbalance
  3737. Modify intensity of primary colors (red, green and blue) of input frames.
  3738. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3739. regions for the red-cyan, green-magenta or blue-yellow balance.
  3740. A positive adjustment value shifts the balance towards the primary color, a negative
  3741. value towards the complementary color.
  3742. The filter accepts the following options:
  3743. @table @option
  3744. @item rs
  3745. @item gs
  3746. @item bs
  3747. Adjust red, green and blue shadows (darkest pixels).
  3748. @item rm
  3749. @item gm
  3750. @item bm
  3751. Adjust red, green and blue midtones (medium pixels).
  3752. @item rh
  3753. @item gh
  3754. @item bh
  3755. Adjust red, green and blue highlights (brightest pixels).
  3756. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3757. @end table
  3758. @subsection Examples
  3759. @itemize
  3760. @item
  3761. Add red color cast to shadows:
  3762. @example
  3763. colorbalance=rs=.3
  3764. @end example
  3765. @end itemize
  3766. @section colorkey
  3767. RGB colorspace color keying.
  3768. The filter accepts the following options:
  3769. @table @option
  3770. @item color
  3771. The color which will be replaced with transparency.
  3772. @item similarity
  3773. Similarity percentage with the key color.
  3774. 0.01 matches only the exact key color, while 1.0 matches everything.
  3775. @item blend
  3776. Blend percentage.
  3777. 0.0 makes pixels either fully transparent, or not transparent at all.
  3778. Higher values result in semi-transparent pixels, with a higher transparency
  3779. the more similar the pixels color is to the key color.
  3780. @end table
  3781. @subsection Examples
  3782. @itemize
  3783. @item
  3784. Make every green pixel in the input image transparent:
  3785. @example
  3786. ffmpeg -i input.png -vf colorkey=green out.png
  3787. @end example
  3788. @item
  3789. Overlay a greenscreen-video on top of a static background image.
  3790. @example
  3791. 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
  3792. @end example
  3793. @end itemize
  3794. @section colorlevels
  3795. Adjust video input frames using levels.
  3796. The filter accepts the following options:
  3797. @table @option
  3798. @item rimin
  3799. @item gimin
  3800. @item bimin
  3801. @item aimin
  3802. Adjust red, green, blue and alpha input black point.
  3803. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3804. @item rimax
  3805. @item gimax
  3806. @item bimax
  3807. @item aimax
  3808. Adjust red, green, blue and alpha input white point.
  3809. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3810. Input levels are used to lighten highlights (bright tones), darken shadows
  3811. (dark tones), change the balance of bright and dark tones.
  3812. @item romin
  3813. @item gomin
  3814. @item bomin
  3815. @item aomin
  3816. Adjust red, green, blue and alpha output black point.
  3817. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3818. @item romax
  3819. @item gomax
  3820. @item bomax
  3821. @item aomax
  3822. Adjust red, green, blue and alpha output white point.
  3823. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3824. Output levels allows manual selection of a constrained output level range.
  3825. @end table
  3826. @subsection Examples
  3827. @itemize
  3828. @item
  3829. Make video output darker:
  3830. @example
  3831. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3832. @end example
  3833. @item
  3834. Increase contrast:
  3835. @example
  3836. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3837. @end example
  3838. @item
  3839. Make video output lighter:
  3840. @example
  3841. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3842. @end example
  3843. @item
  3844. Increase brightness:
  3845. @example
  3846. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3847. @end example
  3848. @end itemize
  3849. @section colorchannelmixer
  3850. Adjust video input frames by re-mixing color channels.
  3851. This filter modifies a color channel by adding the values associated to
  3852. the other channels of the same pixels. For example if the value to
  3853. modify is red, the output value will be:
  3854. @example
  3855. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3856. @end example
  3857. The filter accepts the following options:
  3858. @table @option
  3859. @item rr
  3860. @item rg
  3861. @item rb
  3862. @item ra
  3863. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3864. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3865. @item gr
  3866. @item gg
  3867. @item gb
  3868. @item ga
  3869. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3870. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3871. @item br
  3872. @item bg
  3873. @item bb
  3874. @item ba
  3875. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3876. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3877. @item ar
  3878. @item ag
  3879. @item ab
  3880. @item aa
  3881. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3882. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3883. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3884. @end table
  3885. @subsection Examples
  3886. @itemize
  3887. @item
  3888. Convert source to grayscale:
  3889. @example
  3890. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3891. @end example
  3892. @item
  3893. Simulate sepia tones:
  3894. @example
  3895. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3896. @end example
  3897. @end itemize
  3898. @section colormatrix
  3899. Convert color matrix.
  3900. The filter accepts the following options:
  3901. @table @option
  3902. @item src
  3903. @item dst
  3904. Specify the source and destination color matrix. Both values must be
  3905. specified.
  3906. The accepted values are:
  3907. @table @samp
  3908. @item bt709
  3909. BT.709
  3910. @item bt601
  3911. BT.601
  3912. @item smpte240m
  3913. SMPTE-240M
  3914. @item fcc
  3915. FCC
  3916. @item bt2020
  3917. BT.2020
  3918. @end table
  3919. @end table
  3920. For example to convert from BT.601 to SMPTE-240M, use the command:
  3921. @example
  3922. colormatrix=bt601:smpte240m
  3923. @end example
  3924. @section colorspace
  3925. Convert colorspace, transfer characteristics or color primaries.
  3926. The filter accepts the following options:
  3927. @table @option
  3928. @item all
  3929. Specify all color properties at once.
  3930. The accepted values are:
  3931. @table @samp
  3932. @item bt470m
  3933. BT.470M
  3934. @item bt470bg
  3935. BT.470BG
  3936. @item bt601-6-525
  3937. BT.601-6 525
  3938. @item bt601-6-625
  3939. BT.601-6 625
  3940. @item bt709
  3941. BT.709
  3942. @item smpte170m
  3943. SMPTE-170M
  3944. @item smpte240m
  3945. SMPTE-240M
  3946. @item bt2020
  3947. BT.2020
  3948. @end table
  3949. @item space
  3950. Specify output colorspace.
  3951. The accepted values are:
  3952. @table @samp
  3953. @item bt709
  3954. BT.709
  3955. @item fcc
  3956. FCC
  3957. @item bt470bg
  3958. BT.470BG or BT.601-6 625
  3959. @item smpte170m
  3960. SMPTE-170M or BT.601-6 525
  3961. @item smpte240m
  3962. SMPTE-240M
  3963. @item bt2020ncl
  3964. BT.2020 with non-constant luminance
  3965. @end table
  3966. @item trc
  3967. Specify output transfer characteristics.
  3968. The accepted values are:
  3969. @table @samp
  3970. @item bt709
  3971. BT.709
  3972. @item gamma22
  3973. Constant gamma of 2.2
  3974. @item gamma28
  3975. Constant gamma of 2.8
  3976. @item smpte170m
  3977. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  3978. @item smpte240m
  3979. SMPTE-240M
  3980. @item bt2020-10
  3981. BT.2020 for 10-bits content
  3982. @item bt2020-12
  3983. BT.2020 for 12-bits content
  3984. @end table
  3985. @item prm
  3986. Specify output color primaries.
  3987. The accepted values are:
  3988. @table @samp
  3989. @item bt709
  3990. BT.709
  3991. @item bt470m
  3992. BT.470M
  3993. @item bt470bg
  3994. BT.470BG or BT.601-6 625
  3995. @item smpte170m
  3996. SMPTE-170M or BT.601-6 525
  3997. @item smpte240m
  3998. SMPTE-240M
  3999. @item bt2020
  4000. BT.2020
  4001. @end table
  4002. @item rng
  4003. Specify output color range.
  4004. The accepted values are:
  4005. @table @samp
  4006. @item mpeg
  4007. MPEG (restricted) range
  4008. @item jpeg
  4009. JPEG (full) range
  4010. @end table
  4011. @item format
  4012. Specify output color format.
  4013. The accepted values are:
  4014. @table @samp
  4015. @item yuv420p
  4016. YUV 4:2:0 planar 8-bits
  4017. @item yuv420p10
  4018. YUV 4:2:0 planar 10-bits
  4019. @item yuv420p12
  4020. YUV 4:2:0 planar 12-bits
  4021. @item yuv422p
  4022. YUV 4:2:2 planar 8-bits
  4023. @item yuv422p10
  4024. YUV 4:2:2 planar 10-bits
  4025. @item yuv422p12
  4026. YUV 4:2:2 planar 12-bits
  4027. @item yuv444p
  4028. YUV 4:4:4 planar 8-bits
  4029. @item yuv444p10
  4030. YUV 4:4:4 planar 10-bits
  4031. @item yuv444p12
  4032. YUV 4:4:4 planar 12-bits
  4033. @end table
  4034. @item fast
  4035. Do a fast conversion, which skips gamma/primary correction. This will take
  4036. significantly less CPU, but will be mathematically incorrect. To get output
  4037. compatible with that produced by the colormatrix filter, use fast=1.
  4038. @item dither
  4039. Specify dithering mode.
  4040. The accepted values are:
  4041. @table @samp
  4042. @item none
  4043. No dithering
  4044. @item fsb
  4045. Floyd-Steinberg dithering
  4046. @end table
  4047. @item wpadapt
  4048. Whitepoint adaptation mode.
  4049. The accepted values are:
  4050. @table @samp
  4051. @item bradford
  4052. Bradford whitepoint adaptation
  4053. @item vonkries
  4054. von Kries whitepoint adaptation
  4055. @item identity
  4056. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4057. @end table
  4058. @end table
  4059. The filter converts the transfer characteristics, color space and color
  4060. primaries to the specified user values. The output value, if not specified,
  4061. is set to a default value based on the "all" property. If that property is
  4062. also not specified, the filter will log an error. The output color range and
  4063. format default to the same value as the input color range and format. The
  4064. input transfer characteristics, color space, color primaries and color range
  4065. should be set on the input data. If any of these are missing, the filter will
  4066. log an error and no conversion will take place.
  4067. For example to convert the input to SMPTE-240M, use the command:
  4068. @example
  4069. colorspace=smpte240m
  4070. @end example
  4071. @section convolution
  4072. Apply convolution 3x3 or 5x5 filter.
  4073. The filter accepts the following options:
  4074. @table @option
  4075. @item 0m
  4076. @item 1m
  4077. @item 2m
  4078. @item 3m
  4079. Set matrix for each plane.
  4080. Matrix is sequence of 9 or 25 signed integers.
  4081. @item 0rdiv
  4082. @item 1rdiv
  4083. @item 2rdiv
  4084. @item 3rdiv
  4085. Set multiplier for calculated value for each plane.
  4086. @item 0bias
  4087. @item 1bias
  4088. @item 2bias
  4089. @item 3bias
  4090. Set bias for each plane. This value is added to the result of the multiplication.
  4091. Useful for making the overall image brighter or darker. Default is 0.0.
  4092. @end table
  4093. @subsection Examples
  4094. @itemize
  4095. @item
  4096. Apply sharpen:
  4097. @example
  4098. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  4099. @end example
  4100. @item
  4101. Apply blur:
  4102. @example
  4103. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  4104. @end example
  4105. @item
  4106. Apply edge enhance:
  4107. @example
  4108. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  4109. @end example
  4110. @item
  4111. Apply edge detect:
  4112. @example
  4113. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  4114. @end example
  4115. @item
  4116. Apply emboss:
  4117. @example
  4118. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  4119. @end example
  4120. @end itemize
  4121. @section copy
  4122. Copy the input source unchanged to the output. This is mainly useful for
  4123. testing purposes.
  4124. @anchor{coreimage}
  4125. @section coreimage
  4126. Video filtering on GPU using Apple's CoreImage API on OSX.
  4127. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4128. processed by video hardware. However, software-based OpenGL implementations
  4129. exist which means there is no guarantee for hardware processing. It depends on
  4130. the respective OSX.
  4131. There are many filters and image generators provided by Apple that come with a
  4132. large variety of options. The filter has to be referenced by its name along
  4133. with its options.
  4134. The coreimage filter accepts the following options:
  4135. @table @option
  4136. @item list_filters
  4137. List all available filters and generators along with all their respective
  4138. options as well as possible minimum and maximum values along with the default
  4139. values.
  4140. @example
  4141. list_filters=true
  4142. @end example
  4143. @item filter
  4144. Specify all filters by their respective name and options.
  4145. Use @var{list_filters} to determine all valid filter names and options.
  4146. Numerical options are specified by a float value and are automatically clamped
  4147. to their respective value range. Vector and color options have to be specified
  4148. by a list of space separated float values. Character escaping has to be done.
  4149. A special option name @code{default} is available to use default options for a
  4150. filter.
  4151. It is required to specify either @code{default} or at least one of the filter options.
  4152. All omitted options are used with their default values.
  4153. The syntax of the filter string is as follows:
  4154. @example
  4155. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4156. @end example
  4157. @item output_rect
  4158. Specify a rectangle where the output of the filter chain is copied into the
  4159. input image. It is given by a list of space separated float values:
  4160. @example
  4161. output_rect=x\ y\ width\ height
  4162. @end example
  4163. If not given, the output rectangle equals the dimensions of the input image.
  4164. The output rectangle is automatically cropped at the borders of the input
  4165. image. Negative values are valid for each component.
  4166. @example
  4167. output_rect=25\ 25\ 100\ 100
  4168. @end example
  4169. @end table
  4170. Several filters can be chained for successive processing without GPU-HOST
  4171. transfers allowing for fast processing of complex filter chains.
  4172. Currently, only filters with zero (generators) or exactly one (filters) input
  4173. image and one output image are supported. Also, transition filters are not yet
  4174. usable as intended.
  4175. Some filters generate output images with additional padding depending on the
  4176. respective filter kernel. The padding is automatically removed to ensure the
  4177. filter output has the same size as the input image.
  4178. For image generators, the size of the output image is determined by the
  4179. previous output image of the filter chain or the input image of the whole
  4180. filterchain, respectively. The generators do not use the pixel information of
  4181. this image to generate their output. However, the generated output is
  4182. blended onto this image, resulting in partial or complete coverage of the
  4183. output image.
  4184. The @ref{coreimagesrc} video source can be used for generating input images
  4185. which are directly fed into the filter chain. By using it, providing input
  4186. images by another video source or an input video is not required.
  4187. @subsection Examples
  4188. @itemize
  4189. @item
  4190. List all filters available:
  4191. @example
  4192. coreimage=list_filters=true
  4193. @end example
  4194. @item
  4195. Use the CIBoxBlur filter with default options to blur an image:
  4196. @example
  4197. coreimage=filter=CIBoxBlur@@default
  4198. @end example
  4199. @item
  4200. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4201. its center at 100x100 and a radius of 50 pixels:
  4202. @example
  4203. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4204. @end example
  4205. @item
  4206. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4207. given as complete and escaped command-line for Apple's standard bash shell:
  4208. @example
  4209. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4210. @end example
  4211. @end itemize
  4212. @section crop
  4213. Crop the input video to given dimensions.
  4214. It accepts the following parameters:
  4215. @table @option
  4216. @item w, out_w
  4217. The width of the output video. It defaults to @code{iw}.
  4218. This expression is evaluated only once during the filter
  4219. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4220. @item h, out_h
  4221. The height of the output video. It defaults to @code{ih}.
  4222. This expression is evaluated only once during the filter
  4223. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4224. @item x
  4225. The horizontal position, in the input video, of the left edge of the output
  4226. video. It defaults to @code{(in_w-out_w)/2}.
  4227. This expression is evaluated per-frame.
  4228. @item y
  4229. The vertical position, in the input video, of the top edge of the output video.
  4230. It defaults to @code{(in_h-out_h)/2}.
  4231. This expression is evaluated per-frame.
  4232. @item keep_aspect
  4233. If set to 1 will force the output display aspect ratio
  4234. to be the same of the input, by changing the output sample aspect
  4235. ratio. It defaults to 0.
  4236. @end table
  4237. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4238. expressions containing the following constants:
  4239. @table @option
  4240. @item x
  4241. @item y
  4242. The computed values for @var{x} and @var{y}. They are evaluated for
  4243. each new frame.
  4244. @item in_w
  4245. @item in_h
  4246. The input width and height.
  4247. @item iw
  4248. @item ih
  4249. These are the same as @var{in_w} and @var{in_h}.
  4250. @item out_w
  4251. @item out_h
  4252. The output (cropped) width and height.
  4253. @item ow
  4254. @item oh
  4255. These are the same as @var{out_w} and @var{out_h}.
  4256. @item a
  4257. same as @var{iw} / @var{ih}
  4258. @item sar
  4259. input sample aspect ratio
  4260. @item dar
  4261. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4262. @item hsub
  4263. @item vsub
  4264. horizontal and vertical chroma subsample values. For example for the
  4265. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4266. @item n
  4267. The number of the input frame, starting from 0.
  4268. @item pos
  4269. the position in the file of the input frame, NAN if unknown
  4270. @item t
  4271. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4272. @end table
  4273. The expression for @var{out_w} may depend on the value of @var{out_h},
  4274. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4275. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4276. evaluated after @var{out_w} and @var{out_h}.
  4277. The @var{x} and @var{y} parameters specify the expressions for the
  4278. position of the top-left corner of the output (non-cropped) area. They
  4279. are evaluated for each frame. If the evaluated value is not valid, it
  4280. is approximated to the nearest valid value.
  4281. The expression for @var{x} may depend on @var{y}, and the expression
  4282. for @var{y} may depend on @var{x}.
  4283. @subsection Examples
  4284. @itemize
  4285. @item
  4286. Crop area with size 100x100 at position (12,34).
  4287. @example
  4288. crop=100:100:12:34
  4289. @end example
  4290. Using named options, the example above becomes:
  4291. @example
  4292. crop=w=100:h=100:x=12:y=34
  4293. @end example
  4294. @item
  4295. Crop the central input area with size 100x100:
  4296. @example
  4297. crop=100:100
  4298. @end example
  4299. @item
  4300. Crop the central input area with size 2/3 of the input video:
  4301. @example
  4302. crop=2/3*in_w:2/3*in_h
  4303. @end example
  4304. @item
  4305. Crop the input video central square:
  4306. @example
  4307. crop=out_w=in_h
  4308. crop=in_h
  4309. @end example
  4310. @item
  4311. Delimit the rectangle with the top-left corner placed at position
  4312. 100:100 and the right-bottom corner corresponding to the right-bottom
  4313. corner of the input image.
  4314. @example
  4315. crop=in_w-100:in_h-100:100:100
  4316. @end example
  4317. @item
  4318. Crop 10 pixels from the left and right borders, and 20 pixels from
  4319. the top and bottom borders
  4320. @example
  4321. crop=in_w-2*10:in_h-2*20
  4322. @end example
  4323. @item
  4324. Keep only the bottom right quarter of the input image:
  4325. @example
  4326. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4327. @end example
  4328. @item
  4329. Crop height for getting Greek harmony:
  4330. @example
  4331. crop=in_w:1/PHI*in_w
  4332. @end example
  4333. @item
  4334. Apply trembling effect:
  4335. @example
  4336. 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)
  4337. @end example
  4338. @item
  4339. Apply erratic camera effect depending on timestamp:
  4340. @example
  4341. 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)"
  4342. @end example
  4343. @item
  4344. Set x depending on the value of y:
  4345. @example
  4346. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4347. @end example
  4348. @end itemize
  4349. @subsection Commands
  4350. This filter supports the following commands:
  4351. @table @option
  4352. @item w, out_w
  4353. @item h, out_h
  4354. @item x
  4355. @item y
  4356. Set width/height of the output video and the horizontal/vertical position
  4357. in the input video.
  4358. The command accepts the same syntax of the corresponding option.
  4359. If the specified expression is not valid, it is kept at its current
  4360. value.
  4361. @end table
  4362. @section cropdetect
  4363. Auto-detect the crop size.
  4364. It calculates the necessary cropping parameters and prints the
  4365. recommended parameters via the logging system. The detected dimensions
  4366. correspond to the non-black area of the input video.
  4367. It accepts the following parameters:
  4368. @table @option
  4369. @item limit
  4370. Set higher black value threshold, which can be optionally specified
  4371. from nothing (0) to everything (255 for 8bit based formats). An intensity
  4372. value greater to the set value is considered non-black. It defaults to 24.
  4373. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4374. on the bitdepth of the pixel format.
  4375. @item round
  4376. The value which the width/height should be divisible by. It defaults to
  4377. 16. The offset is automatically adjusted to center the video. Use 2 to
  4378. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4379. encoding to most video codecs.
  4380. @item reset_count, reset
  4381. Set the counter that determines after how many frames cropdetect will
  4382. reset the previously detected largest video area and start over to
  4383. detect the current optimal crop area. Default value is 0.
  4384. This can be useful when channel logos distort the video area. 0
  4385. indicates 'never reset', and returns the largest area encountered during
  4386. playback.
  4387. @end table
  4388. @anchor{curves}
  4389. @section curves
  4390. Apply color adjustments using curves.
  4391. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4392. component (red, green and blue) has its values defined by @var{N} key points
  4393. tied from each other using a smooth curve. The x-axis represents the pixel
  4394. values from the input frame, and the y-axis the new pixel values to be set for
  4395. the output frame.
  4396. By default, a component curve is defined by the two points @var{(0;0)} and
  4397. @var{(1;1)}. This creates a straight line where each original pixel value is
  4398. "adjusted" to its own value, which means no change to the image.
  4399. The filter allows you to redefine these two points and add some more. A new
  4400. curve (using a natural cubic spline interpolation) will be define to pass
  4401. smoothly through all these new coordinates. The new defined points needs to be
  4402. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4403. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4404. the vector spaces, the values will be clipped accordingly.
  4405. If there is no key point defined in @code{x=0}, the filter will automatically
  4406. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4407. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4408. The filter accepts the following options:
  4409. @table @option
  4410. @item preset
  4411. Select one of the available color presets. This option can be used in addition
  4412. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4413. options takes priority on the preset values.
  4414. Available presets are:
  4415. @table @samp
  4416. @item none
  4417. @item color_negative
  4418. @item cross_process
  4419. @item darker
  4420. @item increase_contrast
  4421. @item lighter
  4422. @item linear_contrast
  4423. @item medium_contrast
  4424. @item negative
  4425. @item strong_contrast
  4426. @item vintage
  4427. @end table
  4428. Default is @code{none}.
  4429. @item master, m
  4430. Set the master key points. These points will define a second pass mapping. It
  4431. is sometimes called a "luminance" or "value" mapping. It can be used with
  4432. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4433. post-processing LUT.
  4434. @item red, r
  4435. Set the key points for the red component.
  4436. @item green, g
  4437. Set the key points for the green component.
  4438. @item blue, b
  4439. Set the key points for the blue component.
  4440. @item all
  4441. Set the key points for all components (not including master).
  4442. Can be used in addition to the other key points component
  4443. options. In this case, the unset component(s) will fallback on this
  4444. @option{all} setting.
  4445. @item psfile
  4446. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4447. @end table
  4448. To avoid some filtergraph syntax conflicts, each key points list need to be
  4449. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4450. @subsection Examples
  4451. @itemize
  4452. @item
  4453. Increase slightly the middle level of blue:
  4454. @example
  4455. curves=blue='0.5/0.58'
  4456. @end example
  4457. @item
  4458. Vintage effect:
  4459. @example
  4460. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4461. @end example
  4462. Here we obtain the following coordinates for each components:
  4463. @table @var
  4464. @item red
  4465. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4466. @item green
  4467. @code{(0;0) (0.50;0.48) (1;1)}
  4468. @item blue
  4469. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4470. @end table
  4471. @item
  4472. The previous example can also be achieved with the associated built-in preset:
  4473. @example
  4474. curves=preset=vintage
  4475. @end example
  4476. @item
  4477. Or simply:
  4478. @example
  4479. curves=vintage
  4480. @end example
  4481. @item
  4482. Use a Photoshop preset and redefine the points of the green component:
  4483. @example
  4484. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4485. @end example
  4486. @end itemize
  4487. @section datascope
  4488. Video data analysis filter.
  4489. This filter shows hexadecimal pixel values of part of video.
  4490. The filter accepts the following options:
  4491. @table @option
  4492. @item size, s
  4493. Set output video size.
  4494. @item x
  4495. Set x offset from where to pick pixels.
  4496. @item y
  4497. Set y offset from where to pick pixels.
  4498. @item mode
  4499. Set scope mode, can be one of the following:
  4500. @table @samp
  4501. @item mono
  4502. Draw hexadecimal pixel values with white color on black background.
  4503. @item color
  4504. Draw hexadecimal pixel values with input video pixel color on black
  4505. background.
  4506. @item color2
  4507. Draw hexadecimal pixel values on color background picked from input video,
  4508. the text color is picked in such way so its always visible.
  4509. @end table
  4510. @item axis
  4511. Draw rows and columns numbers on left and top of video.
  4512. @end table
  4513. @section dctdnoiz
  4514. Denoise frames using 2D DCT (frequency domain filtering).
  4515. This filter is not designed for real time.
  4516. The filter accepts the following options:
  4517. @table @option
  4518. @item sigma, s
  4519. Set the noise sigma constant.
  4520. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4521. coefficient (absolute value) below this threshold with be dropped.
  4522. If you need a more advanced filtering, see @option{expr}.
  4523. Default is @code{0}.
  4524. @item overlap
  4525. Set number overlapping pixels for each block. Since the filter can be slow, you
  4526. may want to reduce this value, at the cost of a less effective filter and the
  4527. risk of various artefacts.
  4528. If the overlapping value doesn't permit processing the whole input width or
  4529. height, a warning will be displayed and according borders won't be denoised.
  4530. Default value is @var{blocksize}-1, which is the best possible setting.
  4531. @item expr, e
  4532. Set the coefficient factor expression.
  4533. For each coefficient of a DCT block, this expression will be evaluated as a
  4534. multiplier value for the coefficient.
  4535. If this is option is set, the @option{sigma} option will be ignored.
  4536. The absolute value of the coefficient can be accessed through the @var{c}
  4537. variable.
  4538. @item n
  4539. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4540. @var{blocksize}, which is the width and height of the processed blocks.
  4541. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4542. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4543. on the speed processing. Also, a larger block size does not necessarily means a
  4544. better de-noising.
  4545. @end table
  4546. @subsection Examples
  4547. Apply a denoise with a @option{sigma} of @code{4.5}:
  4548. @example
  4549. dctdnoiz=4.5
  4550. @end example
  4551. The same operation can be achieved using the expression system:
  4552. @example
  4553. dctdnoiz=e='gte(c, 4.5*3)'
  4554. @end example
  4555. Violent denoise using a block size of @code{16x16}:
  4556. @example
  4557. dctdnoiz=15:n=4
  4558. @end example
  4559. @section deband
  4560. Remove banding artifacts from input video.
  4561. It works by replacing banded pixels with average value of referenced pixels.
  4562. The filter accepts the following options:
  4563. @table @option
  4564. @item 1thr
  4565. @item 2thr
  4566. @item 3thr
  4567. @item 4thr
  4568. Set banding detection threshold for each plane. Default is 0.02.
  4569. Valid range is 0.00003 to 0.5.
  4570. If difference between current pixel and reference pixel is less than threshold,
  4571. it will be considered as banded.
  4572. @item range, r
  4573. Banding detection range in pixels. Default is 16. If positive, random number
  4574. in range 0 to set value will be used. If negative, exact absolute value
  4575. will be used.
  4576. The range defines square of four pixels around current pixel.
  4577. @item direction, d
  4578. Set direction in radians from which four pixel will be compared. If positive,
  4579. random direction from 0 to set direction will be picked. If negative, exact of
  4580. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4581. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4582. column.
  4583. @item blur
  4584. If enabled, current pixel is compared with average value of all four
  4585. surrounding pixels. The default is enabled. If disabled current pixel is
  4586. compared with all four surrounding pixels. The pixel is considered banded
  4587. if only all four differences with surrounding pixels are less than threshold.
  4588. @end table
  4589. @anchor{decimate}
  4590. @section decimate
  4591. Drop duplicated frames at regular intervals.
  4592. The filter accepts the following options:
  4593. @table @option
  4594. @item cycle
  4595. Set the number of frames from which one will be dropped. Setting this to
  4596. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4597. Default is @code{5}.
  4598. @item dupthresh
  4599. Set the threshold for duplicate detection. If the difference metric for a frame
  4600. is less than or equal to this value, then it is declared as duplicate. Default
  4601. is @code{1.1}
  4602. @item scthresh
  4603. Set scene change threshold. Default is @code{15}.
  4604. @item blockx
  4605. @item blocky
  4606. Set the size of the x and y-axis blocks used during metric calculations.
  4607. Larger blocks give better noise suppression, but also give worse detection of
  4608. small movements. Must be a power of two. Default is @code{32}.
  4609. @item ppsrc
  4610. Mark main input as a pre-processed input and activate clean source input
  4611. stream. This allows the input to be pre-processed with various filters to help
  4612. the metrics calculation while keeping the frame selection lossless. When set to
  4613. @code{1}, the first stream is for the pre-processed input, and the second
  4614. stream is the clean source from where the kept frames are chosen. Default is
  4615. @code{0}.
  4616. @item chroma
  4617. Set whether or not chroma is considered in the metric calculations. Default is
  4618. @code{1}.
  4619. @end table
  4620. @section deflate
  4621. Apply deflate effect to the video.
  4622. This filter replaces the pixel by the local(3x3) average by taking into account
  4623. only values lower than the pixel.
  4624. It accepts the following options:
  4625. @table @option
  4626. @item threshold0
  4627. @item threshold1
  4628. @item threshold2
  4629. @item threshold3
  4630. Limit the maximum change for each plane, default is 65535.
  4631. If 0, plane will remain unchanged.
  4632. @end table
  4633. @section dejudder
  4634. Remove judder produced by partially interlaced telecined content.
  4635. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4636. source was partially telecined content then the output of @code{pullup,dejudder}
  4637. will have a variable frame rate. May change the recorded frame rate of the
  4638. container. Aside from that change, this filter will not affect constant frame
  4639. rate video.
  4640. The option available in this filter is:
  4641. @table @option
  4642. @item cycle
  4643. Specify the length of the window over which the judder repeats.
  4644. Accepts any integer greater than 1. Useful values are:
  4645. @table @samp
  4646. @item 4
  4647. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4648. @item 5
  4649. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4650. @item 20
  4651. If a mixture of the two.
  4652. @end table
  4653. The default is @samp{4}.
  4654. @end table
  4655. @section delogo
  4656. Suppress a TV station logo by a simple interpolation of the surrounding
  4657. pixels. Just set a rectangle covering the logo and watch it disappear
  4658. (and sometimes something even uglier appear - your mileage may vary).
  4659. It accepts the following parameters:
  4660. @table @option
  4661. @item x
  4662. @item y
  4663. Specify the top left corner coordinates of the logo. They must be
  4664. specified.
  4665. @item w
  4666. @item h
  4667. Specify the width and height of the logo to clear. They must be
  4668. specified.
  4669. @item band, t
  4670. Specify the thickness of the fuzzy edge of the rectangle (added to
  4671. @var{w} and @var{h}). The default value is 1. This option is
  4672. deprecated, setting higher values should no longer be necessary and
  4673. is not recommended.
  4674. @item show
  4675. When set to 1, a green rectangle is drawn on the screen to simplify
  4676. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4677. The default value is 0.
  4678. The rectangle is drawn on the outermost pixels which will be (partly)
  4679. replaced with interpolated values. The values of the next pixels
  4680. immediately outside this rectangle in each direction will be used to
  4681. compute the interpolated pixel values inside the rectangle.
  4682. @end table
  4683. @subsection Examples
  4684. @itemize
  4685. @item
  4686. Set a rectangle covering the area with top left corner coordinates 0,0
  4687. and size 100x77, and a band of size 10:
  4688. @example
  4689. delogo=x=0:y=0:w=100:h=77:band=10
  4690. @end example
  4691. @end itemize
  4692. @section deshake
  4693. Attempt to fix small changes in horizontal and/or vertical shift. This
  4694. filter helps remove camera shake from hand-holding a camera, bumping a
  4695. tripod, moving on a vehicle, etc.
  4696. The filter accepts the following options:
  4697. @table @option
  4698. @item x
  4699. @item y
  4700. @item w
  4701. @item h
  4702. Specify a rectangular area where to limit the search for motion
  4703. vectors.
  4704. If desired the search for motion vectors can be limited to a
  4705. rectangular area of the frame defined by its top left corner, width
  4706. and height. These parameters have the same meaning as the drawbox
  4707. filter which can be used to visualise the position of the bounding
  4708. box.
  4709. This is useful when simultaneous movement of subjects within the frame
  4710. might be confused for camera motion by the motion vector search.
  4711. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4712. then the full frame is used. This allows later options to be set
  4713. without specifying the bounding box for the motion vector search.
  4714. Default - search the whole frame.
  4715. @item rx
  4716. @item ry
  4717. Specify the maximum extent of movement in x and y directions in the
  4718. range 0-64 pixels. Default 16.
  4719. @item edge
  4720. Specify how to generate pixels to fill blanks at the edge of the
  4721. frame. Available values are:
  4722. @table @samp
  4723. @item blank, 0
  4724. Fill zeroes at blank locations
  4725. @item original, 1
  4726. Original image at blank locations
  4727. @item clamp, 2
  4728. Extruded edge value at blank locations
  4729. @item mirror, 3
  4730. Mirrored edge at blank locations
  4731. @end table
  4732. Default value is @samp{mirror}.
  4733. @item blocksize
  4734. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4735. default 8.
  4736. @item contrast
  4737. Specify the contrast threshold for blocks. Only blocks with more than
  4738. the specified contrast (difference between darkest and lightest
  4739. pixels) will be considered. Range 1-255, default 125.
  4740. @item search
  4741. Specify the search strategy. Available values are:
  4742. @table @samp
  4743. @item exhaustive, 0
  4744. Set exhaustive search
  4745. @item less, 1
  4746. Set less exhaustive search.
  4747. @end table
  4748. Default value is @samp{exhaustive}.
  4749. @item filename
  4750. If set then a detailed log of the motion search is written to the
  4751. specified file.
  4752. @item opencl
  4753. If set to 1, specify using OpenCL capabilities, only available if
  4754. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4755. @end table
  4756. @section detelecine
  4757. Apply an exact inverse of the telecine operation. It requires a predefined
  4758. pattern specified using the pattern option which must be the same as that passed
  4759. to the telecine filter.
  4760. This filter accepts the following options:
  4761. @table @option
  4762. @item first_field
  4763. @table @samp
  4764. @item top, t
  4765. top field first
  4766. @item bottom, b
  4767. bottom field first
  4768. The default value is @code{top}.
  4769. @end table
  4770. @item pattern
  4771. A string of numbers representing the pulldown pattern you wish to apply.
  4772. The default value is @code{23}.
  4773. @item start_frame
  4774. A number representing position of the first frame with respect to the telecine
  4775. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4776. @end table
  4777. @section dilation
  4778. Apply dilation effect to the video.
  4779. This filter replaces the pixel by the local(3x3) maximum.
  4780. It accepts the following options:
  4781. @table @option
  4782. @item threshold0
  4783. @item threshold1
  4784. @item threshold2
  4785. @item threshold3
  4786. Limit the maximum change for each plane, default is 65535.
  4787. If 0, plane will remain unchanged.
  4788. @item coordinates
  4789. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4790. pixels are used.
  4791. Flags to local 3x3 coordinates maps like this:
  4792. 1 2 3
  4793. 4 5
  4794. 6 7 8
  4795. @end table
  4796. @section displace
  4797. Displace pixels as indicated by second and third input stream.
  4798. It takes three input streams and outputs one stream, the first input is the
  4799. source, and second and third input are displacement maps.
  4800. The second input specifies how much to displace pixels along the
  4801. x-axis, while the third input specifies how much to displace pixels
  4802. along the y-axis.
  4803. If one of displacement map streams terminates, last frame from that
  4804. displacement map will be used.
  4805. Note that once generated, displacements maps can be reused over and over again.
  4806. A description of the accepted options follows.
  4807. @table @option
  4808. @item edge
  4809. Set displace behavior for pixels that are out of range.
  4810. Available values are:
  4811. @table @samp
  4812. @item blank
  4813. Missing pixels are replaced by black pixels.
  4814. @item smear
  4815. Adjacent pixels will spread out to replace missing pixels.
  4816. @item wrap
  4817. Out of range pixels are wrapped so they point to pixels of other side.
  4818. @end table
  4819. Default is @samp{smear}.
  4820. @end table
  4821. @subsection Examples
  4822. @itemize
  4823. @item
  4824. Add ripple effect to rgb input of video size hd720:
  4825. @example
  4826. 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
  4827. @end example
  4828. @item
  4829. Add wave effect to rgb input of video size hd720:
  4830. @example
  4831. 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
  4832. @end example
  4833. @end itemize
  4834. @section drawbox
  4835. Draw a colored box on the input image.
  4836. It accepts the following parameters:
  4837. @table @option
  4838. @item x
  4839. @item y
  4840. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4841. @item width, w
  4842. @item height, h
  4843. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4844. the input width and height. It defaults to 0.
  4845. @item color, c
  4846. Specify the color of the box to write. For the general syntax of this option,
  4847. check the "Color" section in the ffmpeg-utils manual. If the special
  4848. value @code{invert} is used, the box edge color is the same as the
  4849. video with inverted luma.
  4850. @item thickness, t
  4851. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4852. See below for the list of accepted constants.
  4853. @end table
  4854. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4855. following constants:
  4856. @table @option
  4857. @item dar
  4858. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4859. @item hsub
  4860. @item vsub
  4861. horizontal and vertical chroma subsample values. For example for the
  4862. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4863. @item in_h, ih
  4864. @item in_w, iw
  4865. The input width and height.
  4866. @item sar
  4867. The input sample aspect ratio.
  4868. @item x
  4869. @item y
  4870. The x and y offset coordinates where the box is drawn.
  4871. @item w
  4872. @item h
  4873. The width and height of the drawn box.
  4874. @item t
  4875. The thickness of the drawn box.
  4876. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4877. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4878. @end table
  4879. @subsection Examples
  4880. @itemize
  4881. @item
  4882. Draw a black box around the edge of the input image:
  4883. @example
  4884. drawbox
  4885. @end example
  4886. @item
  4887. Draw a box with color red and an opacity of 50%:
  4888. @example
  4889. drawbox=10:20:200:60:red@@0.5
  4890. @end example
  4891. The previous example can be specified as:
  4892. @example
  4893. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4894. @end example
  4895. @item
  4896. Fill the box with pink color:
  4897. @example
  4898. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4899. @end example
  4900. @item
  4901. Draw a 2-pixel red 2.40:1 mask:
  4902. @example
  4903. 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
  4904. @end example
  4905. @end itemize
  4906. @section drawgraph, adrawgraph
  4907. Draw a graph using input video or audio metadata.
  4908. It accepts the following parameters:
  4909. @table @option
  4910. @item m1
  4911. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4912. @item fg1
  4913. Set 1st foreground color expression.
  4914. @item m2
  4915. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4916. @item fg2
  4917. Set 2nd foreground color expression.
  4918. @item m3
  4919. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4920. @item fg3
  4921. Set 3rd foreground color expression.
  4922. @item m4
  4923. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4924. @item fg4
  4925. Set 4th foreground color expression.
  4926. @item min
  4927. Set minimal value of metadata value.
  4928. @item max
  4929. Set maximal value of metadata value.
  4930. @item bg
  4931. Set graph background color. Default is white.
  4932. @item mode
  4933. Set graph mode.
  4934. Available values for mode is:
  4935. @table @samp
  4936. @item bar
  4937. @item dot
  4938. @item line
  4939. @end table
  4940. Default is @code{line}.
  4941. @item slide
  4942. Set slide mode.
  4943. Available values for slide is:
  4944. @table @samp
  4945. @item frame
  4946. Draw new frame when right border is reached.
  4947. @item replace
  4948. Replace old columns with new ones.
  4949. @item scroll
  4950. Scroll from right to left.
  4951. @item rscroll
  4952. Scroll from left to right.
  4953. @end table
  4954. Default is @code{frame}.
  4955. @item size
  4956. Set size of graph video. For the syntax of this option, check the
  4957. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4958. The default value is @code{900x256}.
  4959. The foreground color expressions can use the following variables:
  4960. @table @option
  4961. @item MIN
  4962. Minimal value of metadata value.
  4963. @item MAX
  4964. Maximal value of metadata value.
  4965. @item VAL
  4966. Current metadata key value.
  4967. @end table
  4968. The color is defined as 0xAABBGGRR.
  4969. @end table
  4970. Example using metadata from @ref{signalstats} filter:
  4971. @example
  4972. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4973. @end example
  4974. Example using metadata from @ref{ebur128} filter:
  4975. @example
  4976. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4977. @end example
  4978. @section drawgrid
  4979. Draw a grid on the input image.
  4980. It accepts the following parameters:
  4981. @table @option
  4982. @item x
  4983. @item y
  4984. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4985. @item width, w
  4986. @item height, h
  4987. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4988. input width and height, respectively, minus @code{thickness}, so image gets
  4989. framed. Default to 0.
  4990. @item color, c
  4991. Specify the color of the grid. For the general syntax of this option,
  4992. check the "Color" section in the ffmpeg-utils manual. If the special
  4993. value @code{invert} is used, the grid color is the same as the
  4994. video with inverted luma.
  4995. @item thickness, t
  4996. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4997. See below for the list of accepted constants.
  4998. @end table
  4999. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5000. following constants:
  5001. @table @option
  5002. @item dar
  5003. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5004. @item hsub
  5005. @item vsub
  5006. horizontal and vertical chroma subsample values. For example for the
  5007. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5008. @item in_h, ih
  5009. @item in_w, iw
  5010. The input grid cell width and height.
  5011. @item sar
  5012. The input sample aspect ratio.
  5013. @item x
  5014. @item y
  5015. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5016. @item w
  5017. @item h
  5018. The width and height of the drawn cell.
  5019. @item t
  5020. The thickness of the drawn cell.
  5021. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5022. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5023. @end table
  5024. @subsection Examples
  5025. @itemize
  5026. @item
  5027. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5028. @example
  5029. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5030. @end example
  5031. @item
  5032. Draw a white 3x3 grid with an opacity of 50%:
  5033. @example
  5034. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5035. @end example
  5036. @end itemize
  5037. @anchor{drawtext}
  5038. @section drawtext
  5039. Draw a text string or text from a specified file on top of a video, using the
  5040. libfreetype library.
  5041. To enable compilation of this filter, you need to configure FFmpeg with
  5042. @code{--enable-libfreetype}.
  5043. To enable default font fallback and the @var{font} option you need to
  5044. configure FFmpeg with @code{--enable-libfontconfig}.
  5045. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5046. @code{--enable-libfribidi}.
  5047. @subsection Syntax
  5048. It accepts the following parameters:
  5049. @table @option
  5050. @item box
  5051. Used to draw a box around text using the background color.
  5052. The value must be either 1 (enable) or 0 (disable).
  5053. The default value of @var{box} is 0.
  5054. @item boxborderw
  5055. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5056. The default value of @var{boxborderw} is 0.
  5057. @item boxcolor
  5058. The color to be used for drawing box around text. For the syntax of this
  5059. option, check the "Color" section in the ffmpeg-utils manual.
  5060. The default value of @var{boxcolor} is "white".
  5061. @item borderw
  5062. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5063. The default value of @var{borderw} is 0.
  5064. @item bordercolor
  5065. Set the color to be used for drawing border around text. For the syntax of this
  5066. option, check the "Color" section in the ffmpeg-utils manual.
  5067. The default value of @var{bordercolor} is "black".
  5068. @item expansion
  5069. Select how the @var{text} is expanded. Can be either @code{none},
  5070. @code{strftime} (deprecated) or
  5071. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5072. below for details.
  5073. @item fix_bounds
  5074. If true, check and fix text coords to avoid clipping.
  5075. @item fontcolor
  5076. The color to be used for drawing fonts. For the syntax of this option, check
  5077. the "Color" section in the ffmpeg-utils manual.
  5078. The default value of @var{fontcolor} is "black".
  5079. @item fontcolor_expr
  5080. String which is expanded the same way as @var{text} to obtain dynamic
  5081. @var{fontcolor} value. By default this option has empty value and is not
  5082. processed. When this option is set, it overrides @var{fontcolor} option.
  5083. @item font
  5084. The font family to be used for drawing text. By default Sans.
  5085. @item fontfile
  5086. The font file to be used for drawing text. The path must be included.
  5087. This parameter is mandatory if the fontconfig support is disabled.
  5088. @item draw
  5089. This option does not exist, please see the timeline system
  5090. @item alpha
  5091. Draw the text applying alpha blending. The value can
  5092. be either a number between 0.0 and 1.0
  5093. The expression accepts the same variables @var{x, y} do.
  5094. The default value is 1.
  5095. Please see fontcolor_expr
  5096. @item fontsize
  5097. The font size to be used for drawing text.
  5098. The default value of @var{fontsize} is 16.
  5099. @item text_shaping
  5100. If set to 1, attempt to shape the text (for example, reverse the order of
  5101. right-to-left text and join Arabic characters) before drawing it.
  5102. Otherwise, just draw the text exactly as given.
  5103. By default 1 (if supported).
  5104. @item ft_load_flags
  5105. The flags to be used for loading the fonts.
  5106. The flags map the corresponding flags supported by libfreetype, and are
  5107. a combination of the following values:
  5108. @table @var
  5109. @item default
  5110. @item no_scale
  5111. @item no_hinting
  5112. @item render
  5113. @item no_bitmap
  5114. @item vertical_layout
  5115. @item force_autohint
  5116. @item crop_bitmap
  5117. @item pedantic
  5118. @item ignore_global_advance_width
  5119. @item no_recurse
  5120. @item ignore_transform
  5121. @item monochrome
  5122. @item linear_design
  5123. @item no_autohint
  5124. @end table
  5125. Default value is "default".
  5126. For more information consult the documentation for the FT_LOAD_*
  5127. libfreetype flags.
  5128. @item shadowcolor
  5129. The color to be used for drawing a shadow behind the drawn text. For the
  5130. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5131. The default value of @var{shadowcolor} is "black".
  5132. @item shadowx
  5133. @item shadowy
  5134. The x and y offsets for the text shadow position with respect to the
  5135. position of the text. They can be either positive or negative
  5136. values. The default value for both is "0".
  5137. @item start_number
  5138. The starting frame number for the n/frame_num variable. The default value
  5139. is "0".
  5140. @item tabsize
  5141. The size in number of spaces to use for rendering the tab.
  5142. Default value is 4.
  5143. @item timecode
  5144. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5145. format. It can be used with or without text parameter. @var{timecode_rate}
  5146. option must be specified.
  5147. @item timecode_rate, rate, r
  5148. Set the timecode frame rate (timecode only).
  5149. @item text
  5150. The text string to be drawn. The text must be a sequence of UTF-8
  5151. encoded characters.
  5152. This parameter is mandatory if no file is specified with the parameter
  5153. @var{textfile}.
  5154. @item textfile
  5155. A text file containing text to be drawn. The text must be a sequence
  5156. of UTF-8 encoded characters.
  5157. This parameter is mandatory if no text string is specified with the
  5158. parameter @var{text}.
  5159. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5160. @item reload
  5161. If set to 1, the @var{textfile} will be reloaded before each frame.
  5162. Be sure to update it atomically, or it may be read partially, or even fail.
  5163. @item x
  5164. @item y
  5165. The expressions which specify the offsets where text will be drawn
  5166. within the video frame. They are relative to the top/left border of the
  5167. output image.
  5168. The default value of @var{x} and @var{y} is "0".
  5169. See below for the list of accepted constants and functions.
  5170. @end table
  5171. The parameters for @var{x} and @var{y} are expressions containing the
  5172. following constants and functions:
  5173. @table @option
  5174. @item dar
  5175. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5176. @item hsub
  5177. @item vsub
  5178. horizontal and vertical chroma subsample values. For example for the
  5179. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5180. @item line_h, lh
  5181. the height of each text line
  5182. @item main_h, h, H
  5183. the input height
  5184. @item main_w, w, W
  5185. the input width
  5186. @item max_glyph_a, ascent
  5187. the maximum distance from the baseline to the highest/upper grid
  5188. coordinate used to place a glyph outline point, for all the rendered
  5189. glyphs.
  5190. It is a positive value, due to the grid's orientation with the Y axis
  5191. upwards.
  5192. @item max_glyph_d, descent
  5193. the maximum distance from the baseline to the lowest grid coordinate
  5194. used to place a glyph outline point, for all the rendered glyphs.
  5195. This is a negative value, due to the grid's orientation, with the Y axis
  5196. upwards.
  5197. @item max_glyph_h
  5198. maximum glyph height, that is the maximum height for all the glyphs
  5199. contained in the rendered text, it is equivalent to @var{ascent} -
  5200. @var{descent}.
  5201. @item max_glyph_w
  5202. maximum glyph width, that is the maximum width for all the glyphs
  5203. contained in the rendered text
  5204. @item n
  5205. the number of input frame, starting from 0
  5206. @item rand(min, max)
  5207. return a random number included between @var{min} and @var{max}
  5208. @item sar
  5209. The input sample aspect ratio.
  5210. @item t
  5211. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5212. @item text_h, th
  5213. the height of the rendered text
  5214. @item text_w, tw
  5215. the width of the rendered text
  5216. @item x
  5217. @item y
  5218. the x and y offset coordinates where the text is drawn.
  5219. These parameters allow the @var{x} and @var{y} expressions to refer
  5220. each other, so you can for example specify @code{y=x/dar}.
  5221. @end table
  5222. @anchor{drawtext_expansion}
  5223. @subsection Text expansion
  5224. If @option{expansion} is set to @code{strftime},
  5225. the filter recognizes strftime() sequences in the provided text and
  5226. expands them accordingly. Check the documentation of strftime(). This
  5227. feature is deprecated.
  5228. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5229. If @option{expansion} is set to @code{normal} (which is the default),
  5230. the following expansion mechanism is used.
  5231. The backslash character @samp{\}, followed by any character, always expands to
  5232. the second character.
  5233. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5234. braces is a function name, possibly followed by arguments separated by ':'.
  5235. If the arguments contain special characters or delimiters (':' or '@}'),
  5236. they should be escaped.
  5237. Note that they probably must also be escaped as the value for the
  5238. @option{text} option in the filter argument string and as the filter
  5239. argument in the filtergraph description, and possibly also for the shell,
  5240. that makes up to four levels of escaping; using a text file avoids these
  5241. problems.
  5242. The following functions are available:
  5243. @table @command
  5244. @item expr, e
  5245. The expression evaluation result.
  5246. It must take one argument specifying the expression to be evaluated,
  5247. which accepts the same constants and functions as the @var{x} and
  5248. @var{y} values. Note that not all constants should be used, for
  5249. example the text size is not known when evaluating the expression, so
  5250. the constants @var{text_w} and @var{text_h} will have an undefined
  5251. value.
  5252. @item expr_int_format, eif
  5253. Evaluate the expression's value and output as formatted integer.
  5254. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5255. The second argument specifies the output format. Allowed values are @samp{x},
  5256. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5257. @code{printf} function.
  5258. The third parameter is optional and sets the number of positions taken by the output.
  5259. It can be used to add padding with zeros from the left.
  5260. @item gmtime
  5261. The time at which the filter is running, expressed in UTC.
  5262. It can accept an argument: a strftime() format string.
  5263. @item localtime
  5264. The time at which the filter is running, expressed in the local time zone.
  5265. It can accept an argument: a strftime() format string.
  5266. @item metadata
  5267. Frame metadata. Takes one or two arguments.
  5268. The first argument is mandatory and specifies the metadata key.
  5269. The second argument is optional and specifies a default value, used when the
  5270. metadata key is not found or empty.
  5271. @item n, frame_num
  5272. The frame number, starting from 0.
  5273. @item pict_type
  5274. A 1 character description of the current picture type.
  5275. @item pts
  5276. The timestamp of the current frame.
  5277. It can take up to three arguments.
  5278. The first argument is the format of the timestamp; it defaults to @code{flt}
  5279. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5280. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5281. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5282. @code{localtime} stands for the timestamp of the frame formatted as
  5283. local time zone time.
  5284. The second argument is an offset added to the timestamp.
  5285. If the format is set to @code{localtime} or @code{gmtime},
  5286. a third argument may be supplied: a strftime() format string.
  5287. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5288. @end table
  5289. @subsection Examples
  5290. @itemize
  5291. @item
  5292. Draw "Test Text" with font FreeSerif, using the default values for the
  5293. optional parameters.
  5294. @example
  5295. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5296. @end example
  5297. @item
  5298. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5299. and y=50 (counting from the top-left corner of the screen), text is
  5300. yellow with a red box around it. Both the text and the box have an
  5301. opacity of 20%.
  5302. @example
  5303. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5304. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5305. @end example
  5306. Note that the double quotes are not necessary if spaces are not used
  5307. within the parameter list.
  5308. @item
  5309. Show the text at the center of the video frame:
  5310. @example
  5311. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5312. @end example
  5313. @item
  5314. Show the text at a random position, switching to a new position every 30 seconds:
  5315. @example
  5316. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5317. @end example
  5318. @item
  5319. Show a text line sliding from right to left in the last row of the video
  5320. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5321. with no newlines.
  5322. @example
  5323. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5324. @end example
  5325. @item
  5326. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5327. @example
  5328. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5329. @end example
  5330. @item
  5331. Draw a single green letter "g", at the center of the input video.
  5332. The glyph baseline is placed at half screen height.
  5333. @example
  5334. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5335. @end example
  5336. @item
  5337. Show text for 1 second every 3 seconds:
  5338. @example
  5339. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5340. @end example
  5341. @item
  5342. Use fontconfig to set the font. Note that the colons need to be escaped.
  5343. @example
  5344. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5345. @end example
  5346. @item
  5347. Print the date of a real-time encoding (see strftime(3)):
  5348. @example
  5349. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5350. @end example
  5351. @item
  5352. Show text fading in and out (appearing/disappearing):
  5353. @example
  5354. #!/bin/sh
  5355. DS=1.0 # display start
  5356. DE=10.0 # display end
  5357. FID=1.5 # fade in duration
  5358. FOD=5 # fade out duration
  5359. 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 @}"
  5360. @end example
  5361. @end itemize
  5362. For more information about libfreetype, check:
  5363. @url{http://www.freetype.org/}.
  5364. For more information about fontconfig, check:
  5365. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5366. For more information about libfribidi, check:
  5367. @url{http://fribidi.org/}.
  5368. @section edgedetect
  5369. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5370. The filter accepts the following options:
  5371. @table @option
  5372. @item low
  5373. @item high
  5374. Set low and high threshold values used by the Canny thresholding
  5375. algorithm.
  5376. The high threshold selects the "strong" edge pixels, which are then
  5377. connected through 8-connectivity with the "weak" edge pixels selected
  5378. by the low threshold.
  5379. @var{low} and @var{high} threshold values must be chosen in the range
  5380. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5381. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5382. is @code{50/255}.
  5383. @item mode
  5384. Define the drawing mode.
  5385. @table @samp
  5386. @item wires
  5387. Draw white/gray wires on black background.
  5388. @item colormix
  5389. Mix the colors to create a paint/cartoon effect.
  5390. @end table
  5391. Default value is @var{wires}.
  5392. @end table
  5393. @subsection Examples
  5394. @itemize
  5395. @item
  5396. Standard edge detection with custom values for the hysteresis thresholding:
  5397. @example
  5398. edgedetect=low=0.1:high=0.4
  5399. @end example
  5400. @item
  5401. Painting effect without thresholding:
  5402. @example
  5403. edgedetect=mode=colormix:high=0
  5404. @end example
  5405. @end itemize
  5406. @section eq
  5407. Set brightness, contrast, saturation and approximate gamma adjustment.
  5408. The filter accepts the following options:
  5409. @table @option
  5410. @item contrast
  5411. Set the contrast expression. The value must be a float value in range
  5412. @code{-2.0} to @code{2.0}. The default value is "1".
  5413. @item brightness
  5414. Set the brightness expression. The value must be a float value in
  5415. range @code{-1.0} to @code{1.0}. The default value is "0".
  5416. @item saturation
  5417. Set the saturation expression. The value must be a float in
  5418. range @code{0.0} to @code{3.0}. The default value is "1".
  5419. @item gamma
  5420. Set the gamma expression. The value must be a float in range
  5421. @code{0.1} to @code{10.0}. The default value is "1".
  5422. @item gamma_r
  5423. Set the gamma expression for red. The value must be a float in
  5424. range @code{0.1} to @code{10.0}. The default value is "1".
  5425. @item gamma_g
  5426. Set the gamma expression for green. The value must be a float in range
  5427. @code{0.1} to @code{10.0}. The default value is "1".
  5428. @item gamma_b
  5429. Set the gamma expression for blue. The value must be a float in range
  5430. @code{0.1} to @code{10.0}. The default value is "1".
  5431. @item gamma_weight
  5432. Set the gamma weight expression. It can be used to reduce the effect
  5433. of a high gamma value on bright image areas, e.g. keep them from
  5434. getting overamplified and just plain white. The value must be a float
  5435. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5436. gamma correction all the way down while @code{1.0} leaves it at its
  5437. full strength. Default is "1".
  5438. @item eval
  5439. Set when the expressions for brightness, contrast, saturation and
  5440. gamma expressions are evaluated.
  5441. It accepts the following values:
  5442. @table @samp
  5443. @item init
  5444. only evaluate expressions once during the filter initialization or
  5445. when a command is processed
  5446. @item frame
  5447. evaluate expressions for each incoming frame
  5448. @end table
  5449. Default value is @samp{init}.
  5450. @end table
  5451. The expressions accept the following parameters:
  5452. @table @option
  5453. @item n
  5454. frame count of the input frame starting from 0
  5455. @item pos
  5456. byte position of the corresponding packet in the input file, NAN if
  5457. unspecified
  5458. @item r
  5459. frame rate of the input video, NAN if the input frame rate is unknown
  5460. @item t
  5461. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5462. @end table
  5463. @subsection Commands
  5464. The filter supports the following commands:
  5465. @table @option
  5466. @item contrast
  5467. Set the contrast expression.
  5468. @item brightness
  5469. Set the brightness expression.
  5470. @item saturation
  5471. Set the saturation expression.
  5472. @item gamma
  5473. Set the gamma expression.
  5474. @item gamma_r
  5475. Set the gamma_r expression.
  5476. @item gamma_g
  5477. Set gamma_g expression.
  5478. @item gamma_b
  5479. Set gamma_b expression.
  5480. @item gamma_weight
  5481. Set gamma_weight expression.
  5482. The command accepts the same syntax of the corresponding option.
  5483. If the specified expression is not valid, it is kept at its current
  5484. value.
  5485. @end table
  5486. @section erosion
  5487. Apply erosion effect to the video.
  5488. This filter replaces the pixel by the local(3x3) minimum.
  5489. It accepts the following options:
  5490. @table @option
  5491. @item threshold0
  5492. @item threshold1
  5493. @item threshold2
  5494. @item threshold3
  5495. Limit the maximum change for each plane, default is 65535.
  5496. If 0, plane will remain unchanged.
  5497. @item coordinates
  5498. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5499. pixels are used.
  5500. Flags to local 3x3 coordinates maps like this:
  5501. 1 2 3
  5502. 4 5
  5503. 6 7 8
  5504. @end table
  5505. @section extractplanes
  5506. Extract color channel components from input video stream into
  5507. separate grayscale video streams.
  5508. The filter accepts the following option:
  5509. @table @option
  5510. @item planes
  5511. Set plane(s) to extract.
  5512. Available values for planes are:
  5513. @table @samp
  5514. @item y
  5515. @item u
  5516. @item v
  5517. @item a
  5518. @item r
  5519. @item g
  5520. @item b
  5521. @end table
  5522. Choosing planes not available in the input will result in an error.
  5523. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5524. with @code{y}, @code{u}, @code{v} planes at same time.
  5525. @end table
  5526. @subsection Examples
  5527. @itemize
  5528. @item
  5529. Extract luma, u and v color channel component from input video frame
  5530. into 3 grayscale outputs:
  5531. @example
  5532. 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
  5533. @end example
  5534. @end itemize
  5535. @section elbg
  5536. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5537. For each input image, the filter will compute the optimal mapping from
  5538. the input to the output given the codebook length, that is the number
  5539. of distinct output colors.
  5540. This filter accepts the following options.
  5541. @table @option
  5542. @item codebook_length, l
  5543. Set codebook length. The value must be a positive integer, and
  5544. represents the number of distinct output colors. Default value is 256.
  5545. @item nb_steps, n
  5546. Set the maximum number of iterations to apply for computing the optimal
  5547. mapping. The higher the value the better the result and the higher the
  5548. computation time. Default value is 1.
  5549. @item seed, s
  5550. Set a random seed, must be an integer included between 0 and
  5551. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5552. will try to use a good random seed on a best effort basis.
  5553. @item pal8
  5554. Set pal8 output pixel format. This option does not work with codebook
  5555. length greater than 256.
  5556. @end table
  5557. @section fade
  5558. Apply a fade-in/out effect to the input video.
  5559. It accepts the following parameters:
  5560. @table @option
  5561. @item type, t
  5562. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5563. effect.
  5564. Default is @code{in}.
  5565. @item start_frame, s
  5566. Specify the number of the frame to start applying the fade
  5567. effect at. Default is 0.
  5568. @item nb_frames, n
  5569. The number of frames that the fade effect lasts. At the end of the
  5570. fade-in effect, the output video will have the same intensity as the input video.
  5571. At the end of the fade-out transition, the output video will be filled with the
  5572. selected @option{color}.
  5573. Default is 25.
  5574. @item alpha
  5575. If set to 1, fade only alpha channel, if one exists on the input.
  5576. Default value is 0.
  5577. @item start_time, st
  5578. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5579. effect. If both start_frame and start_time are specified, the fade will start at
  5580. whichever comes last. Default is 0.
  5581. @item duration, d
  5582. The number of seconds for which the fade effect has to last. At the end of the
  5583. fade-in effect the output video will have the same intensity as the input video,
  5584. at the end of the fade-out transition the output video will be filled with the
  5585. selected @option{color}.
  5586. If both duration and nb_frames are specified, duration is used. Default is 0
  5587. (nb_frames is used by default).
  5588. @item color, c
  5589. Specify the color of the fade. Default is "black".
  5590. @end table
  5591. @subsection Examples
  5592. @itemize
  5593. @item
  5594. Fade in the first 30 frames of video:
  5595. @example
  5596. fade=in:0:30
  5597. @end example
  5598. The command above is equivalent to:
  5599. @example
  5600. fade=t=in:s=0:n=30
  5601. @end example
  5602. @item
  5603. Fade out the last 45 frames of a 200-frame video:
  5604. @example
  5605. fade=out:155:45
  5606. fade=type=out:start_frame=155:nb_frames=45
  5607. @end example
  5608. @item
  5609. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5610. @example
  5611. fade=in:0:25, fade=out:975:25
  5612. @end example
  5613. @item
  5614. Make the first 5 frames yellow, then fade in from frame 5-24:
  5615. @example
  5616. fade=in:5:20:color=yellow
  5617. @end example
  5618. @item
  5619. Fade in alpha over first 25 frames of video:
  5620. @example
  5621. fade=in:0:25:alpha=1
  5622. @end example
  5623. @item
  5624. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5625. @example
  5626. fade=t=in:st=5.5:d=0.5
  5627. @end example
  5628. @end itemize
  5629. @section fftfilt
  5630. Apply arbitrary expressions to samples in frequency domain
  5631. @table @option
  5632. @item dc_Y
  5633. Adjust the dc value (gain) of the luma plane of the image. The filter
  5634. accepts an integer value in range @code{0} to @code{1000}. The default
  5635. value is set to @code{0}.
  5636. @item dc_U
  5637. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5638. filter accepts an integer value in range @code{0} to @code{1000}. The
  5639. default value is set to @code{0}.
  5640. @item dc_V
  5641. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5642. filter accepts an integer value in range @code{0} to @code{1000}. The
  5643. default value is set to @code{0}.
  5644. @item weight_Y
  5645. Set the frequency domain weight expression for the luma plane.
  5646. @item weight_U
  5647. Set the frequency domain weight expression for the 1st chroma plane.
  5648. @item weight_V
  5649. Set the frequency domain weight expression for the 2nd chroma plane.
  5650. The filter accepts the following variables:
  5651. @item X
  5652. @item Y
  5653. The coordinates of the current sample.
  5654. @item W
  5655. @item H
  5656. The width and height of the image.
  5657. @end table
  5658. @subsection Examples
  5659. @itemize
  5660. @item
  5661. High-pass:
  5662. @example
  5663. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5664. @end example
  5665. @item
  5666. Low-pass:
  5667. @example
  5668. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5669. @end example
  5670. @item
  5671. Sharpen:
  5672. @example
  5673. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5674. @end example
  5675. @item
  5676. Blur:
  5677. @example
  5678. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5679. @end example
  5680. @end itemize
  5681. @section field
  5682. Extract a single field from an interlaced image using stride
  5683. arithmetic to avoid wasting CPU time. The output frames are marked as
  5684. non-interlaced.
  5685. The filter accepts the following options:
  5686. @table @option
  5687. @item type
  5688. Specify whether to extract the top (if the value is @code{0} or
  5689. @code{top}) or the bottom field (if the value is @code{1} or
  5690. @code{bottom}).
  5691. @end table
  5692. @section fieldhint
  5693. Create new frames by copying the top and bottom fields from surrounding frames
  5694. supplied as numbers by the hint file.
  5695. @table @option
  5696. @item hint
  5697. Set file containing hints: absolute/relative frame numbers.
  5698. There must be one line for each frame in a clip. Each line must contain two
  5699. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5700. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5701. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5702. for @code{relative} mode. First number tells from which frame to pick up top
  5703. field and second number tells from which frame to pick up bottom field.
  5704. If optionally followed by @code{+} output frame will be marked as interlaced,
  5705. else if followed by @code{-} output frame will be marked as progressive, else
  5706. it will be marked same as input frame.
  5707. If line starts with @code{#} or @code{;} that line is skipped.
  5708. @item mode
  5709. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5710. @end table
  5711. Example of first several lines of @code{hint} file for @code{relative} mode:
  5712. @example
  5713. 0,0 - # first frame
  5714. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5715. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5716. 1,0 -
  5717. 0,0 -
  5718. 0,0 -
  5719. 1,0 -
  5720. 1,0 -
  5721. 1,0 -
  5722. 0,0 -
  5723. 0,0 -
  5724. 1,0 -
  5725. 1,0 -
  5726. 1,0 -
  5727. 0,0 -
  5728. @end example
  5729. @section fieldmatch
  5730. Field matching filter for inverse telecine. It is meant to reconstruct the
  5731. progressive frames from a telecined stream. The filter does not drop duplicated
  5732. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5733. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5734. The separation of the field matching and the decimation is notably motivated by
  5735. the possibility of inserting a de-interlacing filter fallback between the two.
  5736. If the source has mixed telecined and real interlaced content,
  5737. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5738. But these remaining combed frames will be marked as interlaced, and thus can be
  5739. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5740. In addition to the various configuration options, @code{fieldmatch} can take an
  5741. optional second stream, activated through the @option{ppsrc} option. If
  5742. enabled, the frames reconstruction will be based on the fields and frames from
  5743. this second stream. This allows the first input to be pre-processed in order to
  5744. help the various algorithms of the filter, while keeping the output lossless
  5745. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5746. or brightness/contrast adjustments can help.
  5747. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5748. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5749. which @code{fieldmatch} is based on. While the semantic and usage are very
  5750. close, some behaviour and options names can differ.
  5751. The @ref{decimate} filter currently only works for constant frame rate input.
  5752. If your input has mixed telecined (30fps) and progressive content with a lower
  5753. framerate like 24fps use the following filterchain to produce the necessary cfr
  5754. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5755. The filter accepts the following options:
  5756. @table @option
  5757. @item order
  5758. Specify the assumed field order of the input stream. Available values are:
  5759. @table @samp
  5760. @item auto
  5761. Auto detect parity (use FFmpeg's internal parity value).
  5762. @item bff
  5763. Assume bottom field first.
  5764. @item tff
  5765. Assume top field first.
  5766. @end table
  5767. Note that it is sometimes recommended not to trust the parity announced by the
  5768. stream.
  5769. Default value is @var{auto}.
  5770. @item mode
  5771. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5772. sense that it won't risk creating jerkiness due to duplicate frames when
  5773. possible, but if there are bad edits or blended fields it will end up
  5774. outputting combed frames when a good match might actually exist. On the other
  5775. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5776. but will almost always find a good frame if there is one. The other values are
  5777. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5778. jerkiness and creating duplicate frames versus finding good matches in sections
  5779. with bad edits, orphaned fields, blended fields, etc.
  5780. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5781. Available values are:
  5782. @table @samp
  5783. @item pc
  5784. 2-way matching (p/c)
  5785. @item pc_n
  5786. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5787. @item pc_u
  5788. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5789. @item pc_n_ub
  5790. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5791. still combed (p/c + n + u/b)
  5792. @item pcn
  5793. 3-way matching (p/c/n)
  5794. @item pcn_ub
  5795. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5796. detected as combed (p/c/n + u/b)
  5797. @end table
  5798. The parenthesis at the end indicate the matches that would be used for that
  5799. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5800. @var{top}).
  5801. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5802. the slowest.
  5803. Default value is @var{pc_n}.
  5804. @item ppsrc
  5805. Mark the main input stream as a pre-processed input, and enable the secondary
  5806. input stream as the clean source to pick the fields from. See the filter
  5807. introduction for more details. It is similar to the @option{clip2} feature from
  5808. VFM/TFM.
  5809. Default value is @code{0} (disabled).
  5810. @item field
  5811. Set the field to match from. It is recommended to set this to the same value as
  5812. @option{order} unless you experience matching failures with that setting. In
  5813. certain circumstances changing the field that is used to match from can have a
  5814. large impact on matching performance. Available values are:
  5815. @table @samp
  5816. @item auto
  5817. Automatic (same value as @option{order}).
  5818. @item bottom
  5819. Match from the bottom field.
  5820. @item top
  5821. Match from the top field.
  5822. @end table
  5823. Default value is @var{auto}.
  5824. @item mchroma
  5825. Set whether or not chroma is included during the match comparisons. In most
  5826. cases it is recommended to leave this enabled. You should set this to @code{0}
  5827. only if your clip has bad chroma problems such as heavy rainbowing or other
  5828. artifacts. Setting this to @code{0} could also be used to speed things up at
  5829. the cost of some accuracy.
  5830. Default value is @code{1}.
  5831. @item y0
  5832. @item y1
  5833. These define an exclusion band which excludes the lines between @option{y0} and
  5834. @option{y1} from being included in the field matching decision. An exclusion
  5835. band can be used to ignore subtitles, a logo, or other things that may
  5836. interfere with the matching. @option{y0} sets the starting scan line and
  5837. @option{y1} sets the ending line; all lines in between @option{y0} and
  5838. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5839. @option{y0} and @option{y1} to the same value will disable the feature.
  5840. @option{y0} and @option{y1} defaults to @code{0}.
  5841. @item scthresh
  5842. Set the scene change detection threshold as a percentage of maximum change on
  5843. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5844. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5845. @option{scthresh} is @code{[0.0, 100.0]}.
  5846. Default value is @code{12.0}.
  5847. @item combmatch
  5848. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5849. account the combed scores of matches when deciding what match to use as the
  5850. final match. Available values are:
  5851. @table @samp
  5852. @item none
  5853. No final matching based on combed scores.
  5854. @item sc
  5855. Combed scores are only used when a scene change is detected.
  5856. @item full
  5857. Use combed scores all the time.
  5858. @end table
  5859. Default is @var{sc}.
  5860. @item combdbg
  5861. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5862. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5863. Available values are:
  5864. @table @samp
  5865. @item none
  5866. No forced calculation.
  5867. @item pcn
  5868. Force p/c/n calculations.
  5869. @item pcnub
  5870. Force p/c/n/u/b calculations.
  5871. @end table
  5872. Default value is @var{none}.
  5873. @item cthresh
  5874. This is the area combing threshold used for combed frame detection. This
  5875. essentially controls how "strong" or "visible" combing must be to be detected.
  5876. Larger values mean combing must be more visible and smaller values mean combing
  5877. can be less visible or strong and still be detected. Valid settings are from
  5878. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5879. be detected as combed). This is basically a pixel difference value. A good
  5880. range is @code{[8, 12]}.
  5881. Default value is @code{9}.
  5882. @item chroma
  5883. Sets whether or not chroma is considered in the combed frame decision. Only
  5884. disable this if your source has chroma problems (rainbowing, etc.) that are
  5885. causing problems for the combed frame detection with chroma enabled. Actually,
  5886. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5887. where there is chroma only combing in the source.
  5888. Default value is @code{0}.
  5889. @item blockx
  5890. @item blocky
  5891. Respectively set the x-axis and y-axis size of the window used during combed
  5892. frame detection. This has to do with the size of the area in which
  5893. @option{combpel} pixels are required to be detected as combed for a frame to be
  5894. declared combed. See the @option{combpel} parameter description for more info.
  5895. Possible values are any number that is a power of 2 starting at 4 and going up
  5896. to 512.
  5897. Default value is @code{16}.
  5898. @item combpel
  5899. The number of combed pixels inside any of the @option{blocky} by
  5900. @option{blockx} size blocks on the frame for the frame to be detected as
  5901. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5902. setting controls "how much" combing there must be in any localized area (a
  5903. window defined by the @option{blockx} and @option{blocky} settings) on the
  5904. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5905. which point no frames will ever be detected as combed). This setting is known
  5906. as @option{MI} in TFM/VFM vocabulary.
  5907. Default value is @code{80}.
  5908. @end table
  5909. @anchor{p/c/n/u/b meaning}
  5910. @subsection p/c/n/u/b meaning
  5911. @subsubsection p/c/n
  5912. We assume the following telecined stream:
  5913. @example
  5914. Top fields: 1 2 2 3 4
  5915. Bottom fields: 1 2 3 4 4
  5916. @end example
  5917. The numbers correspond to the progressive frame the fields relate to. Here, the
  5918. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5919. When @code{fieldmatch} is configured to run a matching from bottom
  5920. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5921. @example
  5922. Input stream:
  5923. T 1 2 2 3 4
  5924. B 1 2 3 4 4 <-- matching reference
  5925. Matches: c c n n c
  5926. Output stream:
  5927. T 1 2 3 4 4
  5928. B 1 2 3 4 4
  5929. @end example
  5930. As a result of the field matching, we can see that some frames get duplicated.
  5931. To perform a complete inverse telecine, you need to rely on a decimation filter
  5932. after this operation. See for instance the @ref{decimate} filter.
  5933. The same operation now matching from top fields (@option{field}=@var{top})
  5934. looks like this:
  5935. @example
  5936. Input stream:
  5937. T 1 2 2 3 4 <-- matching reference
  5938. B 1 2 3 4 4
  5939. Matches: c c p p c
  5940. Output stream:
  5941. T 1 2 2 3 4
  5942. B 1 2 2 3 4
  5943. @end example
  5944. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5945. basically, they refer to the frame and field of the opposite parity:
  5946. @itemize
  5947. @item @var{p} matches the field of the opposite parity in the previous frame
  5948. @item @var{c} matches the field of the opposite parity in the current frame
  5949. @item @var{n} matches the field of the opposite parity in the next frame
  5950. @end itemize
  5951. @subsubsection u/b
  5952. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5953. from the opposite parity flag. In the following examples, we assume that we are
  5954. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5955. 'x' is placed above and below each matched fields.
  5956. With bottom matching (@option{field}=@var{bottom}):
  5957. @example
  5958. Match: c p n b u
  5959. x x x x x
  5960. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5961. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5962. x x x x x
  5963. Output frames:
  5964. 2 1 2 2 2
  5965. 2 2 2 1 3
  5966. @end example
  5967. With top matching (@option{field}=@var{top}):
  5968. @example
  5969. Match: c p n b u
  5970. x x x x x
  5971. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5972. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5973. x x x x x
  5974. Output frames:
  5975. 2 2 2 1 2
  5976. 2 1 3 2 2
  5977. @end example
  5978. @subsection Examples
  5979. Simple IVTC of a top field first telecined stream:
  5980. @example
  5981. fieldmatch=order=tff:combmatch=none, decimate
  5982. @end example
  5983. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5984. @example
  5985. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5986. @end example
  5987. @section fieldorder
  5988. Transform the field order of the input video.
  5989. It accepts the following parameters:
  5990. @table @option
  5991. @item order
  5992. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5993. for bottom field first.
  5994. @end table
  5995. The default value is @samp{tff}.
  5996. The transformation is done by shifting the picture content up or down
  5997. by one line, and filling the remaining line with appropriate picture content.
  5998. This method is consistent with most broadcast field order converters.
  5999. If the input video is not flagged as being interlaced, or it is already
  6000. flagged as being of the required output field order, then this filter does
  6001. not alter the incoming video.
  6002. It is very useful when converting to or from PAL DV material,
  6003. which is bottom field first.
  6004. For example:
  6005. @example
  6006. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6007. @end example
  6008. @section fifo, afifo
  6009. Buffer input images and send them when they are requested.
  6010. It is mainly useful when auto-inserted by the libavfilter
  6011. framework.
  6012. It does not take parameters.
  6013. @section find_rect
  6014. Find a rectangular object
  6015. It accepts the following options:
  6016. @table @option
  6017. @item object
  6018. Filepath of the object image, needs to be in gray8.
  6019. @item threshold
  6020. Detection threshold, default is 0.5.
  6021. @item mipmaps
  6022. Number of mipmaps, default is 3.
  6023. @item xmin, ymin, xmax, ymax
  6024. Specifies the rectangle in which to search.
  6025. @end table
  6026. @subsection Examples
  6027. @itemize
  6028. @item
  6029. Generate a representative palette of a given video using @command{ffmpeg}:
  6030. @example
  6031. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6032. @end example
  6033. @end itemize
  6034. @section cover_rect
  6035. Cover a rectangular object
  6036. It accepts the following options:
  6037. @table @option
  6038. @item cover
  6039. Filepath of the optional cover image, needs to be in yuv420.
  6040. @item mode
  6041. Set covering mode.
  6042. It accepts the following values:
  6043. @table @samp
  6044. @item cover
  6045. cover it by the supplied image
  6046. @item blur
  6047. cover it by interpolating the surrounding pixels
  6048. @end table
  6049. Default value is @var{blur}.
  6050. @end table
  6051. @subsection Examples
  6052. @itemize
  6053. @item
  6054. Generate a representative palette of a given video using @command{ffmpeg}:
  6055. @example
  6056. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6057. @end example
  6058. @end itemize
  6059. @anchor{format}
  6060. @section format
  6061. Convert the input video to one of the specified pixel formats.
  6062. Libavfilter will try to pick one that is suitable as input to
  6063. the next filter.
  6064. It accepts the following parameters:
  6065. @table @option
  6066. @item pix_fmts
  6067. A '|'-separated list of pixel format names, such as
  6068. "pix_fmts=yuv420p|monow|rgb24".
  6069. @end table
  6070. @subsection Examples
  6071. @itemize
  6072. @item
  6073. Convert the input video to the @var{yuv420p} format
  6074. @example
  6075. format=pix_fmts=yuv420p
  6076. @end example
  6077. Convert the input video to any of the formats in the list
  6078. @example
  6079. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6080. @end example
  6081. @end itemize
  6082. @anchor{fps}
  6083. @section fps
  6084. Convert the video to specified constant frame rate by duplicating or dropping
  6085. frames as necessary.
  6086. It accepts the following parameters:
  6087. @table @option
  6088. @item fps
  6089. The desired output frame rate. The default is @code{25}.
  6090. @item round
  6091. Rounding method.
  6092. Possible values are:
  6093. @table @option
  6094. @item zero
  6095. zero round towards 0
  6096. @item inf
  6097. round away from 0
  6098. @item down
  6099. round towards -infinity
  6100. @item up
  6101. round towards +infinity
  6102. @item near
  6103. round to nearest
  6104. @end table
  6105. The default is @code{near}.
  6106. @item start_time
  6107. Assume the first PTS should be the given value, in seconds. This allows for
  6108. padding/trimming at the start of stream. By default, no assumption is made
  6109. about the first frame's expected PTS, so no padding or trimming is done.
  6110. For example, this could be set to 0 to pad the beginning with duplicates of
  6111. the first frame if a video stream starts after the audio stream or to trim any
  6112. frames with a negative PTS.
  6113. @end table
  6114. Alternatively, the options can be specified as a flat string:
  6115. @var{fps}[:@var{round}].
  6116. See also the @ref{setpts} filter.
  6117. @subsection Examples
  6118. @itemize
  6119. @item
  6120. A typical usage in order to set the fps to 25:
  6121. @example
  6122. fps=fps=25
  6123. @end example
  6124. @item
  6125. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6126. @example
  6127. fps=fps=film:round=near
  6128. @end example
  6129. @end itemize
  6130. @section framepack
  6131. Pack two different video streams into a stereoscopic video, setting proper
  6132. metadata on supported codecs. The two views should have the same size and
  6133. framerate and processing will stop when the shorter video ends. Please note
  6134. that you may conveniently adjust view properties with the @ref{scale} and
  6135. @ref{fps} filters.
  6136. It accepts the following parameters:
  6137. @table @option
  6138. @item format
  6139. The desired packing format. Supported values are:
  6140. @table @option
  6141. @item sbs
  6142. The views are next to each other (default).
  6143. @item tab
  6144. The views are on top of each other.
  6145. @item lines
  6146. The views are packed by line.
  6147. @item columns
  6148. The views are packed by column.
  6149. @item frameseq
  6150. The views are temporally interleaved.
  6151. @end table
  6152. @end table
  6153. Some examples:
  6154. @example
  6155. # Convert left and right views into a frame-sequential video
  6156. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6157. # Convert views into a side-by-side video with the same output resolution as the input
  6158. 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
  6159. @end example
  6160. @section framerate
  6161. Change the frame rate by interpolating new video output frames from the source
  6162. frames.
  6163. This filter is not designed to function correctly with interlaced media. If
  6164. you wish to change the frame rate of interlaced media then you are required
  6165. to deinterlace before this filter and re-interlace after this filter.
  6166. A description of the accepted options follows.
  6167. @table @option
  6168. @item fps
  6169. Specify the output frames per second. This option can also be specified
  6170. as a value alone. The default is @code{50}.
  6171. @item interp_start
  6172. Specify the start of a range where the output frame will be created as a
  6173. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6174. the default is @code{15}.
  6175. @item interp_end
  6176. Specify the end of a range where the output frame will be created as a
  6177. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6178. the default is @code{240}.
  6179. @item scene
  6180. Specify the level at which a scene change is detected as a value between
  6181. 0 and 100 to indicate a new scene; a low value reflects a low
  6182. probability for the current frame to introduce a new scene, while a higher
  6183. value means the current frame is more likely to be one.
  6184. The default is @code{7}.
  6185. @item flags
  6186. Specify flags influencing the filter process.
  6187. Available value for @var{flags} is:
  6188. @table @option
  6189. @item scene_change_detect, scd
  6190. Enable scene change detection using the value of the option @var{scene}.
  6191. This flag is enabled by default.
  6192. @end table
  6193. @end table
  6194. @section framestep
  6195. Select one frame every N-th frame.
  6196. This filter accepts the following option:
  6197. @table @option
  6198. @item step
  6199. Select frame after every @code{step} frames.
  6200. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6201. @end table
  6202. @anchor{frei0r}
  6203. @section frei0r
  6204. Apply a frei0r effect to the input video.
  6205. To enable the compilation of this filter, you need to install the frei0r
  6206. header and configure FFmpeg with @code{--enable-frei0r}.
  6207. It accepts the following parameters:
  6208. @table @option
  6209. @item filter_name
  6210. The name of the frei0r effect to load. If the environment variable
  6211. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6212. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6213. Otherwise, the standard frei0r paths are searched, in this order:
  6214. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6215. @file{/usr/lib/frei0r-1/}.
  6216. @item filter_params
  6217. A '|'-separated list of parameters to pass to the frei0r effect.
  6218. @end table
  6219. A frei0r effect parameter can be a boolean (its value is either
  6220. "y" or "n"), a double, a color (specified as
  6221. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6222. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6223. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6224. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6225. The number and types of parameters depend on the loaded effect. If an
  6226. effect parameter is not specified, the default value is set.
  6227. @subsection Examples
  6228. @itemize
  6229. @item
  6230. Apply the distort0r effect, setting the first two double parameters:
  6231. @example
  6232. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6233. @end example
  6234. @item
  6235. Apply the colordistance effect, taking a color as the first parameter:
  6236. @example
  6237. frei0r=colordistance:0.2/0.3/0.4
  6238. frei0r=colordistance:violet
  6239. frei0r=colordistance:0x112233
  6240. @end example
  6241. @item
  6242. Apply the perspective effect, specifying the top left and top right image
  6243. positions:
  6244. @example
  6245. frei0r=perspective:0.2/0.2|0.8/0.2
  6246. @end example
  6247. @end itemize
  6248. For more information, see
  6249. @url{http://frei0r.dyne.org}
  6250. @section fspp
  6251. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6252. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6253. processing filter, one of them is performed once per block, not per pixel.
  6254. This allows for much higher speed.
  6255. The filter accepts the following options:
  6256. @table @option
  6257. @item quality
  6258. Set quality. This option defines the number of levels for averaging. It accepts
  6259. an integer in the range 4-5. Default value is @code{4}.
  6260. @item qp
  6261. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6262. If not set, the filter will use the QP from the video stream (if available).
  6263. @item strength
  6264. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6265. more details but also more artifacts, while higher values make the image smoother
  6266. but also blurrier. Default value is @code{0} − PSNR optimal.
  6267. @item use_bframe_qp
  6268. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6269. option may cause flicker since the B-Frames have often larger QP. Default is
  6270. @code{0} (not enabled).
  6271. @end table
  6272. @section geq
  6273. The filter accepts the following options:
  6274. @table @option
  6275. @item lum_expr, lum
  6276. Set the luminance expression.
  6277. @item cb_expr, cb
  6278. Set the chrominance blue expression.
  6279. @item cr_expr, cr
  6280. Set the chrominance red expression.
  6281. @item alpha_expr, a
  6282. Set the alpha expression.
  6283. @item red_expr, r
  6284. Set the red expression.
  6285. @item green_expr, g
  6286. Set the green expression.
  6287. @item blue_expr, b
  6288. Set the blue expression.
  6289. @end table
  6290. The colorspace is selected according to the specified options. If one
  6291. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6292. options is specified, the filter will automatically select a YCbCr
  6293. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6294. @option{blue_expr} options is specified, it will select an RGB
  6295. colorspace.
  6296. If one of the chrominance expression is not defined, it falls back on the other
  6297. one. If no alpha expression is specified it will evaluate to opaque value.
  6298. If none of chrominance expressions are specified, they will evaluate
  6299. to the luminance expression.
  6300. The expressions can use the following variables and functions:
  6301. @table @option
  6302. @item N
  6303. The sequential number of the filtered frame, starting from @code{0}.
  6304. @item X
  6305. @item Y
  6306. The coordinates of the current sample.
  6307. @item W
  6308. @item H
  6309. The width and height of the image.
  6310. @item SW
  6311. @item SH
  6312. Width and height scale depending on the currently filtered plane. It is the
  6313. ratio between the corresponding luma plane number of pixels and the current
  6314. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6315. @code{0.5,0.5} for chroma planes.
  6316. @item T
  6317. Time of the current frame, expressed in seconds.
  6318. @item p(x, y)
  6319. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6320. plane.
  6321. @item lum(x, y)
  6322. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6323. plane.
  6324. @item cb(x, y)
  6325. Return the value of the pixel at location (@var{x},@var{y}) of the
  6326. blue-difference chroma plane. Return 0 if there is no such plane.
  6327. @item cr(x, y)
  6328. Return the value of the pixel at location (@var{x},@var{y}) of the
  6329. red-difference chroma plane. Return 0 if there is no such plane.
  6330. @item r(x, y)
  6331. @item g(x, y)
  6332. @item b(x, y)
  6333. Return the value of the pixel at location (@var{x},@var{y}) of the
  6334. red/green/blue component. Return 0 if there is no such component.
  6335. @item alpha(x, y)
  6336. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6337. plane. Return 0 if there is no such plane.
  6338. @end table
  6339. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6340. automatically clipped to the closer edge.
  6341. @subsection Examples
  6342. @itemize
  6343. @item
  6344. Flip the image horizontally:
  6345. @example
  6346. geq=p(W-X\,Y)
  6347. @end example
  6348. @item
  6349. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6350. wavelength of 100 pixels:
  6351. @example
  6352. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6353. @end example
  6354. @item
  6355. Generate a fancy enigmatic moving light:
  6356. @example
  6357. 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
  6358. @end example
  6359. @item
  6360. Generate a quick emboss effect:
  6361. @example
  6362. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6363. @end example
  6364. @item
  6365. Modify RGB components depending on pixel position:
  6366. @example
  6367. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6368. @end example
  6369. @item
  6370. Create a radial gradient that is the same size as the input (also see
  6371. the @ref{vignette} filter):
  6372. @example
  6373. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6374. @end example
  6375. @end itemize
  6376. @section gradfun
  6377. Fix the banding artifacts that are sometimes introduced into nearly flat
  6378. regions by truncation to 8bit color depth.
  6379. Interpolate the gradients that should go where the bands are, and
  6380. dither them.
  6381. It is designed for playback only. Do not use it prior to
  6382. lossy compression, because compression tends to lose the dither and
  6383. bring back the bands.
  6384. It accepts the following parameters:
  6385. @table @option
  6386. @item strength
  6387. The maximum amount by which the filter will change any one pixel. This is also
  6388. the threshold for detecting nearly flat regions. Acceptable values range from
  6389. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6390. valid range.
  6391. @item radius
  6392. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6393. gradients, but also prevents the filter from modifying the pixels near detailed
  6394. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6395. values will be clipped to the valid range.
  6396. @end table
  6397. Alternatively, the options can be specified as a flat string:
  6398. @var{strength}[:@var{radius}]
  6399. @subsection Examples
  6400. @itemize
  6401. @item
  6402. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6403. @example
  6404. gradfun=3.5:8
  6405. @end example
  6406. @item
  6407. Specify radius, omitting the strength (which will fall-back to the default
  6408. value):
  6409. @example
  6410. gradfun=radius=8
  6411. @end example
  6412. @end itemize
  6413. @anchor{haldclut}
  6414. @section haldclut
  6415. Apply a Hald CLUT to a video stream.
  6416. First input is the video stream to process, and second one is the Hald CLUT.
  6417. The Hald CLUT input can be a simple picture or a complete video stream.
  6418. The filter accepts the following options:
  6419. @table @option
  6420. @item shortest
  6421. Force termination when the shortest input terminates. Default is @code{0}.
  6422. @item repeatlast
  6423. Continue applying the last CLUT after the end of the stream. A value of
  6424. @code{0} disable the filter after the last frame of the CLUT is reached.
  6425. Default is @code{1}.
  6426. @end table
  6427. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6428. filters share the same internals).
  6429. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6430. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6431. @subsection Workflow examples
  6432. @subsubsection Hald CLUT video stream
  6433. Generate an identity Hald CLUT stream altered with various effects:
  6434. @example
  6435. 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
  6436. @end example
  6437. Note: make sure you use a lossless codec.
  6438. Then use it with @code{haldclut} to apply it on some random stream:
  6439. @example
  6440. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6441. @end example
  6442. The Hald CLUT will be applied to the 10 first seconds (duration of
  6443. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6444. to the remaining frames of the @code{mandelbrot} stream.
  6445. @subsubsection Hald CLUT with preview
  6446. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6447. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6448. biggest possible square starting at the top left of the picture. The remaining
  6449. padding pixels (bottom or right) will be ignored. This area can be used to add
  6450. a preview of the Hald CLUT.
  6451. Typically, the following generated Hald CLUT will be supported by the
  6452. @code{haldclut} filter:
  6453. @example
  6454. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6455. pad=iw+320 [padded_clut];
  6456. smptebars=s=320x256, split [a][b];
  6457. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6458. [main][b] overlay=W-320" -frames:v 1 clut.png
  6459. @end example
  6460. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6461. bars are displayed on the right-top, and below the same color bars processed by
  6462. the color changes.
  6463. Then, the effect of this Hald CLUT can be visualized with:
  6464. @example
  6465. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6466. @end example
  6467. @section hdcd
  6468. Decodes high definition audio cd data. 16-Bit PCM stream containing hdcd flags
  6469. is converted to 20-bit PCM stream.
  6470. @section hflip
  6471. Flip the input video horizontally.
  6472. For example, to horizontally flip the input video with @command{ffmpeg}:
  6473. @example
  6474. ffmpeg -i in.avi -vf "hflip" out.avi
  6475. @end example
  6476. @section histeq
  6477. This filter applies a global color histogram equalization on a
  6478. per-frame basis.
  6479. It can be used to correct video that has a compressed range of pixel
  6480. intensities. The filter redistributes the pixel intensities to
  6481. equalize their distribution across the intensity range. It may be
  6482. viewed as an "automatically adjusting contrast filter". This filter is
  6483. useful only for correcting degraded or poorly captured source
  6484. video.
  6485. The filter accepts the following options:
  6486. @table @option
  6487. @item strength
  6488. Determine the amount of equalization to be applied. As the strength
  6489. is reduced, the distribution of pixel intensities more-and-more
  6490. approaches that of the input frame. The value must be a float number
  6491. in the range [0,1] and defaults to 0.200.
  6492. @item intensity
  6493. Set the maximum intensity that can generated and scale the output
  6494. values appropriately. The strength should be set as desired and then
  6495. the intensity can be limited if needed to avoid washing-out. The value
  6496. must be a float number in the range [0,1] and defaults to 0.210.
  6497. @item antibanding
  6498. Set the antibanding level. If enabled the filter will randomly vary
  6499. the luminance of output pixels by a small amount to avoid banding of
  6500. the histogram. Possible values are @code{none}, @code{weak} or
  6501. @code{strong}. It defaults to @code{none}.
  6502. @end table
  6503. @section histogram
  6504. Compute and draw a color distribution histogram for the input video.
  6505. The computed histogram is a representation of the color component
  6506. distribution in an image.
  6507. Standard histogram displays the color components distribution in an image.
  6508. Displays color graph for each color component. Shows distribution of
  6509. the Y, U, V, A or R, G, B components, depending on input format, in the
  6510. current frame. Below each graph a color component scale meter is shown.
  6511. The filter accepts the following options:
  6512. @table @option
  6513. @item level_height
  6514. Set height of level. Default value is @code{200}.
  6515. Allowed range is [50, 2048].
  6516. @item scale_height
  6517. Set height of color scale. Default value is @code{12}.
  6518. Allowed range is [0, 40].
  6519. @item display_mode
  6520. Set display mode.
  6521. It accepts the following values:
  6522. @table @samp
  6523. @item parade
  6524. Per color component graphs are placed below each other.
  6525. @item overlay
  6526. Presents information identical to that in the @code{parade}, except
  6527. that the graphs representing color components are superimposed directly
  6528. over one another.
  6529. @end table
  6530. Default is @code{parade}.
  6531. @item levels_mode
  6532. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6533. Default is @code{linear}.
  6534. @item components
  6535. Set what color components to display.
  6536. Default is @code{7}.
  6537. @end table
  6538. @subsection Examples
  6539. @itemize
  6540. @item
  6541. Calculate and draw histogram:
  6542. @example
  6543. ffplay -i input -vf histogram
  6544. @end example
  6545. @end itemize
  6546. @anchor{hqdn3d}
  6547. @section hqdn3d
  6548. This is a high precision/quality 3d denoise filter. It aims to reduce
  6549. image noise, producing smooth images and making still images really
  6550. still. It should enhance compressibility.
  6551. It accepts the following optional parameters:
  6552. @table @option
  6553. @item luma_spatial
  6554. A non-negative floating point number which specifies spatial luma strength.
  6555. It defaults to 4.0.
  6556. @item chroma_spatial
  6557. A non-negative floating point number which specifies spatial chroma strength.
  6558. It defaults to 3.0*@var{luma_spatial}/4.0.
  6559. @item luma_tmp
  6560. A floating point number which specifies luma temporal strength. It defaults to
  6561. 6.0*@var{luma_spatial}/4.0.
  6562. @item chroma_tmp
  6563. A floating point number which specifies chroma temporal strength. It defaults to
  6564. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6565. @end table
  6566. @anchor{hwupload_cuda}
  6567. @section hwupload_cuda
  6568. Upload system memory frames to a CUDA device.
  6569. It accepts the following optional parameters:
  6570. @table @option
  6571. @item device
  6572. The number of the CUDA device to use
  6573. @end table
  6574. @section hqx
  6575. Apply a high-quality magnification filter designed for pixel art. This filter
  6576. was originally created by Maxim Stepin.
  6577. It accepts the following option:
  6578. @table @option
  6579. @item n
  6580. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6581. @code{hq3x} and @code{4} for @code{hq4x}.
  6582. Default is @code{3}.
  6583. @end table
  6584. @section hstack
  6585. Stack input videos horizontally.
  6586. All streams must be of same pixel format and of same height.
  6587. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6588. to create same output.
  6589. The filter accept the following option:
  6590. @table @option
  6591. @item inputs
  6592. Set number of input streams. Default is 2.
  6593. @item shortest
  6594. If set to 1, force the output to terminate when the shortest input
  6595. terminates. Default value is 0.
  6596. @end table
  6597. @section hue
  6598. Modify the hue and/or the saturation of the input.
  6599. It accepts the following parameters:
  6600. @table @option
  6601. @item h
  6602. Specify the hue angle as a number of degrees. It accepts an expression,
  6603. and defaults to "0".
  6604. @item s
  6605. Specify the saturation in the [-10,10] range. It accepts an expression and
  6606. defaults to "1".
  6607. @item H
  6608. Specify the hue angle as a number of radians. It accepts an
  6609. expression, and defaults to "0".
  6610. @item b
  6611. Specify the brightness in the [-10,10] range. It accepts an expression and
  6612. defaults to "0".
  6613. @end table
  6614. @option{h} and @option{H} are mutually exclusive, and can't be
  6615. specified at the same time.
  6616. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6617. expressions containing the following constants:
  6618. @table @option
  6619. @item n
  6620. frame count of the input frame starting from 0
  6621. @item pts
  6622. presentation timestamp of the input frame expressed in time base units
  6623. @item r
  6624. frame rate of the input video, NAN if the input frame rate is unknown
  6625. @item t
  6626. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6627. @item tb
  6628. time base of the input video
  6629. @end table
  6630. @subsection Examples
  6631. @itemize
  6632. @item
  6633. Set the hue to 90 degrees and the saturation to 1.0:
  6634. @example
  6635. hue=h=90:s=1
  6636. @end example
  6637. @item
  6638. Same command but expressing the hue in radians:
  6639. @example
  6640. hue=H=PI/2:s=1
  6641. @end example
  6642. @item
  6643. Rotate hue and make the saturation swing between 0
  6644. and 2 over a period of 1 second:
  6645. @example
  6646. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6647. @end example
  6648. @item
  6649. Apply a 3 seconds saturation fade-in effect starting at 0:
  6650. @example
  6651. hue="s=min(t/3\,1)"
  6652. @end example
  6653. The general fade-in expression can be written as:
  6654. @example
  6655. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6656. @end example
  6657. @item
  6658. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6659. @example
  6660. hue="s=max(0\, min(1\, (8-t)/3))"
  6661. @end example
  6662. The general fade-out expression can be written as:
  6663. @example
  6664. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6665. @end example
  6666. @end itemize
  6667. @subsection Commands
  6668. This filter supports the following commands:
  6669. @table @option
  6670. @item b
  6671. @item s
  6672. @item h
  6673. @item H
  6674. Modify the hue and/or the saturation and/or brightness of the input video.
  6675. The command accepts the same syntax of the corresponding option.
  6676. If the specified expression is not valid, it is kept at its current
  6677. value.
  6678. @end table
  6679. @section idet
  6680. Detect video interlacing type.
  6681. This filter tries to detect if the input frames as interlaced, progressive,
  6682. top or bottom field first. It will also try and detect fields that are
  6683. repeated between adjacent frames (a sign of telecine).
  6684. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6685. Multiple frame detection incorporates the classification history of previous frames.
  6686. The filter will log these metadata values:
  6687. @table @option
  6688. @item single.current_frame
  6689. Detected type of current frame using single-frame detection. One of:
  6690. ``tff'' (top field first), ``bff'' (bottom field first),
  6691. ``progressive'', or ``undetermined''
  6692. @item single.tff
  6693. Cumulative number of frames detected as top field first using single-frame detection.
  6694. @item multiple.tff
  6695. Cumulative number of frames detected as top field first using multiple-frame detection.
  6696. @item single.bff
  6697. Cumulative number of frames detected as bottom field first using single-frame detection.
  6698. @item multiple.current_frame
  6699. Detected type of current frame using multiple-frame detection. One of:
  6700. ``tff'' (top field first), ``bff'' (bottom field first),
  6701. ``progressive'', or ``undetermined''
  6702. @item multiple.bff
  6703. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6704. @item single.progressive
  6705. Cumulative number of frames detected as progressive using single-frame detection.
  6706. @item multiple.progressive
  6707. Cumulative number of frames detected as progressive using multiple-frame detection.
  6708. @item single.undetermined
  6709. Cumulative number of frames that could not be classified using single-frame detection.
  6710. @item multiple.undetermined
  6711. Cumulative number of frames that could not be classified using multiple-frame detection.
  6712. @item repeated.current_frame
  6713. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6714. @item repeated.neither
  6715. Cumulative number of frames with no repeated field.
  6716. @item repeated.top
  6717. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6718. @item repeated.bottom
  6719. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6720. @end table
  6721. The filter accepts the following options:
  6722. @table @option
  6723. @item intl_thres
  6724. Set interlacing threshold.
  6725. @item prog_thres
  6726. Set progressive threshold.
  6727. @item rep_thres
  6728. Threshold for repeated field detection.
  6729. @item half_life
  6730. Number of frames after which a given frame's contribution to the
  6731. statistics is halved (i.e., it contributes only 0.5 to it's
  6732. classification). The default of 0 means that all frames seen are given
  6733. full weight of 1.0 forever.
  6734. @item analyze_interlaced_flag
  6735. When this is not 0 then idet will use the specified number of frames to determine
  6736. if the interlaced flag is accurate, it will not count undetermined frames.
  6737. If the flag is found to be accurate it will be used without any further
  6738. computations, if it is found to be inaccurate it will be cleared without any
  6739. further computations. This allows inserting the idet filter as a low computational
  6740. method to clean up the interlaced flag
  6741. @end table
  6742. @section il
  6743. Deinterleave or interleave fields.
  6744. This filter allows one to process interlaced images fields without
  6745. deinterlacing them. Deinterleaving splits the input frame into 2
  6746. fields (so called half pictures). Odd lines are moved to the top
  6747. half of the output image, even lines to the bottom half.
  6748. You can process (filter) them independently and then re-interleave them.
  6749. The filter accepts the following options:
  6750. @table @option
  6751. @item luma_mode, l
  6752. @item chroma_mode, c
  6753. @item alpha_mode, a
  6754. Available values for @var{luma_mode}, @var{chroma_mode} and
  6755. @var{alpha_mode} are:
  6756. @table @samp
  6757. @item none
  6758. Do nothing.
  6759. @item deinterleave, d
  6760. Deinterleave fields, placing one above the other.
  6761. @item interleave, i
  6762. Interleave fields. Reverse the effect of deinterleaving.
  6763. @end table
  6764. Default value is @code{none}.
  6765. @item luma_swap, ls
  6766. @item chroma_swap, cs
  6767. @item alpha_swap, as
  6768. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6769. @end table
  6770. @section inflate
  6771. Apply inflate effect to the video.
  6772. This filter replaces the pixel by the local(3x3) average by taking into account
  6773. only values higher than the pixel.
  6774. It accepts the following options:
  6775. @table @option
  6776. @item threshold0
  6777. @item threshold1
  6778. @item threshold2
  6779. @item threshold3
  6780. Limit the maximum change for each plane, default is 65535.
  6781. If 0, plane will remain unchanged.
  6782. @end table
  6783. @section interlace
  6784. Simple interlacing filter from progressive contents. This interleaves upper (or
  6785. lower) lines from odd frames with lower (or upper) lines from even frames,
  6786. halving the frame rate and preserving image height.
  6787. @example
  6788. Original Original New Frame
  6789. Frame 'j' Frame 'j+1' (tff)
  6790. ========== =========== ==================
  6791. Line 0 --------------------> Frame 'j' Line 0
  6792. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6793. Line 2 ---------------------> Frame 'j' Line 2
  6794. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6795. ... ... ...
  6796. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6797. @end example
  6798. It accepts the following optional parameters:
  6799. @table @option
  6800. @item scan
  6801. This determines whether the interlaced frame is taken from the even
  6802. (tff - default) or odd (bff) lines of the progressive frame.
  6803. @item lowpass
  6804. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6805. interlacing and reduce moire patterns.
  6806. @end table
  6807. @section kerndeint
  6808. Deinterlace input video by applying Donald Graft's adaptive kernel
  6809. deinterling. Work on interlaced parts of a video to produce
  6810. progressive frames.
  6811. The description of the accepted parameters follows.
  6812. @table @option
  6813. @item thresh
  6814. Set the threshold which affects the filter's tolerance when
  6815. determining if a pixel line must be processed. It must be an integer
  6816. in the range [0,255] and defaults to 10. A value of 0 will result in
  6817. applying the process on every pixels.
  6818. @item map
  6819. Paint pixels exceeding the threshold value to white if set to 1.
  6820. Default is 0.
  6821. @item order
  6822. Set the fields order. Swap fields if set to 1, leave fields alone if
  6823. 0. Default is 0.
  6824. @item sharp
  6825. Enable additional sharpening if set to 1. Default is 0.
  6826. @item twoway
  6827. Enable twoway sharpening if set to 1. Default is 0.
  6828. @end table
  6829. @subsection Examples
  6830. @itemize
  6831. @item
  6832. Apply default values:
  6833. @example
  6834. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6835. @end example
  6836. @item
  6837. Enable additional sharpening:
  6838. @example
  6839. kerndeint=sharp=1
  6840. @end example
  6841. @item
  6842. Paint processed pixels in white:
  6843. @example
  6844. kerndeint=map=1
  6845. @end example
  6846. @end itemize
  6847. @section lenscorrection
  6848. Correct radial lens distortion
  6849. This filter can be used to correct for radial distortion as can result from the use
  6850. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6851. one can use tools available for example as part of opencv or simply trial-and-error.
  6852. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6853. and extract the k1 and k2 coefficients from the resulting matrix.
  6854. Note that effectively the same filter is available in the open-source tools Krita and
  6855. Digikam from the KDE project.
  6856. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6857. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6858. brightness distribution, so you may want to use both filters together in certain
  6859. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6860. be applied before or after lens correction.
  6861. @subsection Options
  6862. The filter accepts the following options:
  6863. @table @option
  6864. @item cx
  6865. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6866. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6867. width.
  6868. @item cy
  6869. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6870. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6871. height.
  6872. @item k1
  6873. Coefficient of the quadratic correction term. 0.5 means no correction.
  6874. @item k2
  6875. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6876. @end table
  6877. The formula that generates the correction is:
  6878. @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)
  6879. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6880. distances from the focal point in the source and target images, respectively.
  6881. @section loop, aloop
  6882. Loop video frames or audio samples.
  6883. Those filters accepts the following options:
  6884. @table @option
  6885. @item loop
  6886. Set the number of loops.
  6887. @item size
  6888. Set maximal size in number of frames for @code{loop} filter or maximal number
  6889. of samples in case of @code{aloop} filter.
  6890. @item start
  6891. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6892. of @code{aloop} filter.
  6893. @end table
  6894. @anchor{lut3d}
  6895. @section lut3d
  6896. Apply a 3D LUT to an input video.
  6897. The filter accepts the following options:
  6898. @table @option
  6899. @item file
  6900. Set the 3D LUT file name.
  6901. Currently supported formats:
  6902. @table @samp
  6903. @item 3dl
  6904. AfterEffects
  6905. @item cube
  6906. Iridas
  6907. @item dat
  6908. DaVinci
  6909. @item m3d
  6910. Pandora
  6911. @end table
  6912. @item interp
  6913. Select interpolation mode.
  6914. Available values are:
  6915. @table @samp
  6916. @item nearest
  6917. Use values from the nearest defined point.
  6918. @item trilinear
  6919. Interpolate values using the 8 points defining a cube.
  6920. @item tetrahedral
  6921. Interpolate values using a tetrahedron.
  6922. @end table
  6923. @end table
  6924. @section lut, lutrgb, lutyuv
  6925. Compute a look-up table for binding each pixel component input value
  6926. to an output value, and apply it to the input video.
  6927. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6928. to an RGB input video.
  6929. These filters accept the following parameters:
  6930. @table @option
  6931. @item c0
  6932. set first pixel component expression
  6933. @item c1
  6934. set second pixel component expression
  6935. @item c2
  6936. set third pixel component expression
  6937. @item c3
  6938. set fourth pixel component expression, corresponds to the alpha component
  6939. @item r
  6940. set red component expression
  6941. @item g
  6942. set green component expression
  6943. @item b
  6944. set blue component expression
  6945. @item a
  6946. alpha component expression
  6947. @item y
  6948. set Y/luminance component expression
  6949. @item u
  6950. set U/Cb component expression
  6951. @item v
  6952. set V/Cr component expression
  6953. @end table
  6954. Each of them specifies the expression to use for computing the lookup table for
  6955. the corresponding pixel component values.
  6956. The exact component associated to each of the @var{c*} options depends on the
  6957. format in input.
  6958. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6959. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6960. The expressions can contain the following constants and functions:
  6961. @table @option
  6962. @item w
  6963. @item h
  6964. The input width and height.
  6965. @item val
  6966. The input value for the pixel component.
  6967. @item clipval
  6968. The input value, clipped to the @var{minval}-@var{maxval} range.
  6969. @item maxval
  6970. The maximum value for the pixel component.
  6971. @item minval
  6972. The minimum value for the pixel component.
  6973. @item negval
  6974. The negated value for the pixel component value, clipped to the
  6975. @var{minval}-@var{maxval} range; it corresponds to the expression
  6976. "maxval-clipval+minval".
  6977. @item clip(val)
  6978. The computed value in @var{val}, clipped to the
  6979. @var{minval}-@var{maxval} range.
  6980. @item gammaval(gamma)
  6981. The computed gamma correction value of the pixel component value,
  6982. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6983. expression
  6984. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6985. @end table
  6986. All expressions default to "val".
  6987. @subsection Examples
  6988. @itemize
  6989. @item
  6990. Negate input video:
  6991. @example
  6992. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6993. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6994. @end example
  6995. The above is the same as:
  6996. @example
  6997. lutrgb="r=negval:g=negval:b=negval"
  6998. lutyuv="y=negval:u=negval:v=negval"
  6999. @end example
  7000. @item
  7001. Negate luminance:
  7002. @example
  7003. lutyuv=y=negval
  7004. @end example
  7005. @item
  7006. Remove chroma components, turning the video into a graytone image:
  7007. @example
  7008. lutyuv="u=128:v=128"
  7009. @end example
  7010. @item
  7011. Apply a luma burning effect:
  7012. @example
  7013. lutyuv="y=2*val"
  7014. @end example
  7015. @item
  7016. Remove green and blue components:
  7017. @example
  7018. lutrgb="g=0:b=0"
  7019. @end example
  7020. @item
  7021. Set a constant alpha channel value on input:
  7022. @example
  7023. format=rgba,lutrgb=a="maxval-minval/2"
  7024. @end example
  7025. @item
  7026. Correct luminance gamma by a factor of 0.5:
  7027. @example
  7028. lutyuv=y=gammaval(0.5)
  7029. @end example
  7030. @item
  7031. Discard least significant bits of luma:
  7032. @example
  7033. lutyuv=y='bitand(val, 128+64+32)'
  7034. @end example
  7035. @end itemize
  7036. @section maskedmerge
  7037. Merge the first input stream with the second input stream using per pixel
  7038. weights in the third input stream.
  7039. A value of 0 in the third stream pixel component means that pixel component
  7040. from first stream is returned unchanged, while maximum value (eg. 255 for
  7041. 8-bit videos) means that pixel component from second stream is returned
  7042. unchanged. Intermediate values define the amount of merging between both
  7043. input stream's pixel components.
  7044. This filter accepts the following options:
  7045. @table @option
  7046. @item planes
  7047. Set which planes will be processed as bitmap, unprocessed planes will be
  7048. copied from first stream.
  7049. By default value 0xf, all planes will be processed.
  7050. @end table
  7051. @section mcdeint
  7052. Apply motion-compensation deinterlacing.
  7053. It needs one field per frame as input and must thus be used together
  7054. with yadif=1/3 or equivalent.
  7055. This filter accepts the following options:
  7056. @table @option
  7057. @item mode
  7058. Set the deinterlacing mode.
  7059. It accepts one of the following values:
  7060. @table @samp
  7061. @item fast
  7062. @item medium
  7063. @item slow
  7064. use iterative motion estimation
  7065. @item extra_slow
  7066. like @samp{slow}, but use multiple reference frames.
  7067. @end table
  7068. Default value is @samp{fast}.
  7069. @item parity
  7070. Set the picture field parity assumed for the input video. It must be
  7071. one of the following values:
  7072. @table @samp
  7073. @item 0, tff
  7074. assume top field first
  7075. @item 1, bff
  7076. assume bottom field first
  7077. @end table
  7078. Default value is @samp{bff}.
  7079. @item qp
  7080. Set per-block quantization parameter (QP) used by the internal
  7081. encoder.
  7082. Higher values should result in a smoother motion vector field but less
  7083. optimal individual vectors. Default value is 1.
  7084. @end table
  7085. @section mergeplanes
  7086. Merge color channel components from several video streams.
  7087. The filter accepts up to 4 input streams, and merge selected input
  7088. planes to the output video.
  7089. This filter accepts the following options:
  7090. @table @option
  7091. @item mapping
  7092. Set input to output plane mapping. Default is @code{0}.
  7093. The mappings is specified as a bitmap. It should be specified as a
  7094. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7095. mapping for the first plane of the output stream. 'A' sets the number of
  7096. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7097. corresponding input to use (from 0 to 3). The rest of the mappings is
  7098. similar, 'Bb' describes the mapping for the output stream second
  7099. plane, 'Cc' describes the mapping for the output stream third plane and
  7100. 'Dd' describes the mapping for the output stream fourth plane.
  7101. @item format
  7102. Set output pixel format. Default is @code{yuva444p}.
  7103. @end table
  7104. @subsection Examples
  7105. @itemize
  7106. @item
  7107. Merge three gray video streams of same width and height into single video stream:
  7108. @example
  7109. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7110. @end example
  7111. @item
  7112. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7113. @example
  7114. [a0][a1]mergeplanes=0x00010210:yuva444p
  7115. @end example
  7116. @item
  7117. Swap Y and A plane in yuva444p stream:
  7118. @example
  7119. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7120. @end example
  7121. @item
  7122. Swap U and V plane in yuv420p stream:
  7123. @example
  7124. format=yuv420p,mergeplanes=0x000201:yuv420p
  7125. @end example
  7126. @item
  7127. Cast a rgb24 clip to yuv444p:
  7128. @example
  7129. format=rgb24,mergeplanes=0x000102:yuv444p
  7130. @end example
  7131. @end itemize
  7132. @section metadata, ametadata
  7133. Manipulate frame metadata.
  7134. This filter accepts the following options:
  7135. @table @option
  7136. @item mode
  7137. Set mode of operation of the filter.
  7138. Can be one of the following:
  7139. @table @samp
  7140. @item select
  7141. If both @code{value} and @code{key} is set, select frames
  7142. which have such metadata. If only @code{key} is set, select
  7143. every frame that has such key in metadata.
  7144. @item add
  7145. Add new metadata @code{key} and @code{value}. If key is already available
  7146. do nothing.
  7147. @item modify
  7148. Modify value of already present key.
  7149. @item delete
  7150. If @code{value} is set, delete only keys that have such value.
  7151. Otherwise, delete key.
  7152. @item print
  7153. Print key and its value if metadata was found. If @code{key} is not set print all
  7154. metadata values available in frame.
  7155. @end table
  7156. @item key
  7157. Set key used with all modes. Must be set for all modes except @code{print}.
  7158. @item value
  7159. Set metadata value which will be used. This option is mandatory for
  7160. @code{modify} and @code{add} mode.
  7161. @item function
  7162. Which function to use when comparing metadata value and @code{value}.
  7163. Can be one of following:
  7164. @table @samp
  7165. @item same_str
  7166. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  7167. @item starts_with
  7168. Values are interpreted as strings, returns true if metadata value starts with
  7169. the @code{value} option string.
  7170. @item less
  7171. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  7172. @item equal
  7173. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  7174. @item greater
  7175. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  7176. @item expr
  7177. Values are interpreted as floats, returns true if expression from option @code{expr}
  7178. evaluates to true.
  7179. @end table
  7180. @item expr
  7181. Set expression which is used when @code{function} is set to @code{expr}.
  7182. The expression is evaluated through the eval API and can contain the following
  7183. constants:
  7184. @table @option
  7185. @item VALUE1
  7186. Float representation of @code{value} from metadata key.
  7187. @item VALUE2
  7188. Float representation of @code{value} as supplied by user in @code{value} option.
  7189. @end table
  7190. @item file
  7191. If specified in @code{print} mode, output is written to the named file. When
  7192. filename equals "-" data is written to standard output.
  7193. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  7194. loglevel.
  7195. @end table
  7196. @subsection Examples
  7197. @itemize
  7198. @item
  7199. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  7200. between 0 and 1.
  7201. @example
  7202. @end example
  7203. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  7204. @end itemize
  7205. @section mpdecimate
  7206. Drop frames that do not differ greatly from the previous frame in
  7207. order to reduce frame rate.
  7208. The main use of this filter is for very-low-bitrate encoding
  7209. (e.g. streaming over dialup modem), but it could in theory be used for
  7210. fixing movies that were inverse-telecined incorrectly.
  7211. A description of the accepted options follows.
  7212. @table @option
  7213. @item max
  7214. Set the maximum number of consecutive frames which can be dropped (if
  7215. positive), or the minimum interval between dropped frames (if
  7216. negative). If the value is 0, the frame is dropped unregarding the
  7217. number of previous sequentially dropped frames.
  7218. Default value is 0.
  7219. @item hi
  7220. @item lo
  7221. @item frac
  7222. Set the dropping threshold values.
  7223. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7224. represent actual pixel value differences, so a threshold of 64
  7225. corresponds to 1 unit of difference for each pixel, or the same spread
  7226. out differently over the block.
  7227. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7228. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7229. meaning the whole image) differ by more than a threshold of @option{lo}.
  7230. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7231. 64*5, and default value for @option{frac} is 0.33.
  7232. @end table
  7233. @section negate
  7234. Negate input video.
  7235. It accepts an integer in input; if non-zero it negates the
  7236. alpha component (if available). The default value in input is 0.
  7237. @section nnedi
  7238. Deinterlace video using neural network edge directed interpolation.
  7239. This filter accepts the following options:
  7240. @table @option
  7241. @item weights
  7242. Mandatory option, without binary file filter can not work.
  7243. Currently file can be found here:
  7244. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7245. @item deint
  7246. Set which frames to deinterlace, by default it is @code{all}.
  7247. Can be @code{all} or @code{interlaced}.
  7248. @item field
  7249. Set mode of operation.
  7250. Can be one of the following:
  7251. @table @samp
  7252. @item af
  7253. Use frame flags, both fields.
  7254. @item a
  7255. Use frame flags, single field.
  7256. @item t
  7257. Use top field only.
  7258. @item b
  7259. Use bottom field only.
  7260. @item tf
  7261. Use both fields, top first.
  7262. @item bf
  7263. Use both fields, bottom first.
  7264. @end table
  7265. @item planes
  7266. Set which planes to process, by default filter process all frames.
  7267. @item nsize
  7268. Set size of local neighborhood around each pixel, used by the predictor neural
  7269. network.
  7270. Can be one of the following:
  7271. @table @samp
  7272. @item s8x6
  7273. @item s16x6
  7274. @item s32x6
  7275. @item s48x6
  7276. @item s8x4
  7277. @item s16x4
  7278. @item s32x4
  7279. @end table
  7280. @item nns
  7281. Set the number of neurons in predicctor neural network.
  7282. Can be one of the following:
  7283. @table @samp
  7284. @item n16
  7285. @item n32
  7286. @item n64
  7287. @item n128
  7288. @item n256
  7289. @end table
  7290. @item qual
  7291. Controls the number of different neural network predictions that are blended
  7292. together to compute the final output value. Can be @code{fast}, default or
  7293. @code{slow}.
  7294. @item etype
  7295. Set which set of weights to use in the predictor.
  7296. Can be one of the following:
  7297. @table @samp
  7298. @item a
  7299. weights trained to minimize absolute error
  7300. @item s
  7301. weights trained to minimize squared error
  7302. @end table
  7303. @item pscrn
  7304. Controls whether or not the prescreener neural network is used to decide
  7305. which pixels should be processed by the predictor neural network and which
  7306. can be handled by simple cubic interpolation.
  7307. The prescreener is trained to know whether cubic interpolation will be
  7308. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7309. The computational complexity of the prescreener nn is much less than that of
  7310. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7311. using the prescreener generally results in much faster processing.
  7312. The prescreener is pretty accurate, so the difference between using it and not
  7313. using it is almost always unnoticeable.
  7314. Can be one of the following:
  7315. @table @samp
  7316. @item none
  7317. @item original
  7318. @item new
  7319. @end table
  7320. Default is @code{new}.
  7321. @item fapprox
  7322. Set various debugging flags.
  7323. @end table
  7324. @section noformat
  7325. Force libavfilter not to use any of the specified pixel formats for the
  7326. input to the next filter.
  7327. It accepts the following parameters:
  7328. @table @option
  7329. @item pix_fmts
  7330. A '|'-separated list of pixel format names, such as
  7331. apix_fmts=yuv420p|monow|rgb24".
  7332. @end table
  7333. @subsection Examples
  7334. @itemize
  7335. @item
  7336. Force libavfilter to use a format different from @var{yuv420p} for the
  7337. input to the vflip filter:
  7338. @example
  7339. noformat=pix_fmts=yuv420p,vflip
  7340. @end example
  7341. @item
  7342. Convert the input video to any of the formats not contained in the list:
  7343. @example
  7344. noformat=yuv420p|yuv444p|yuv410p
  7345. @end example
  7346. @end itemize
  7347. @section noise
  7348. Add noise on video input frame.
  7349. The filter accepts the following options:
  7350. @table @option
  7351. @item all_seed
  7352. @item c0_seed
  7353. @item c1_seed
  7354. @item c2_seed
  7355. @item c3_seed
  7356. Set noise seed for specific pixel component or all pixel components in case
  7357. of @var{all_seed}. Default value is @code{123457}.
  7358. @item all_strength, alls
  7359. @item c0_strength, c0s
  7360. @item c1_strength, c1s
  7361. @item c2_strength, c2s
  7362. @item c3_strength, c3s
  7363. Set noise strength for specific pixel component or all pixel components in case
  7364. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7365. @item all_flags, allf
  7366. @item c0_flags, c0f
  7367. @item c1_flags, c1f
  7368. @item c2_flags, c2f
  7369. @item c3_flags, c3f
  7370. Set pixel component flags or set flags for all components if @var{all_flags}.
  7371. Available values for component flags are:
  7372. @table @samp
  7373. @item a
  7374. averaged temporal noise (smoother)
  7375. @item p
  7376. mix random noise with a (semi)regular pattern
  7377. @item t
  7378. temporal noise (noise pattern changes between frames)
  7379. @item u
  7380. uniform noise (gaussian otherwise)
  7381. @end table
  7382. @end table
  7383. @subsection Examples
  7384. Add temporal and uniform noise to input video:
  7385. @example
  7386. noise=alls=20:allf=t+u
  7387. @end example
  7388. @section null
  7389. Pass the video source unchanged to the output.
  7390. @section ocr
  7391. Optical Character Recognition
  7392. This filter uses Tesseract for optical character recognition.
  7393. It accepts the following options:
  7394. @table @option
  7395. @item datapath
  7396. Set datapath to tesseract data. Default is to use whatever was
  7397. set at installation.
  7398. @item language
  7399. Set language, default is "eng".
  7400. @item whitelist
  7401. Set character whitelist.
  7402. @item blacklist
  7403. Set character blacklist.
  7404. @end table
  7405. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7406. @section ocv
  7407. Apply a video transform using libopencv.
  7408. To enable this filter, install the libopencv library and headers and
  7409. configure FFmpeg with @code{--enable-libopencv}.
  7410. It accepts the following parameters:
  7411. @table @option
  7412. @item filter_name
  7413. The name of the libopencv filter to apply.
  7414. @item filter_params
  7415. The parameters to pass to the libopencv filter. If not specified, the default
  7416. values are assumed.
  7417. @end table
  7418. Refer to the official libopencv documentation for more precise
  7419. information:
  7420. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7421. Several libopencv filters are supported; see the following subsections.
  7422. @anchor{dilate}
  7423. @subsection dilate
  7424. Dilate an image by using a specific structuring element.
  7425. It corresponds to the libopencv function @code{cvDilate}.
  7426. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7427. @var{struct_el} represents a structuring element, and has the syntax:
  7428. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7429. @var{cols} and @var{rows} represent the number of columns and rows of
  7430. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7431. point, and @var{shape} the shape for the structuring element. @var{shape}
  7432. must be "rect", "cross", "ellipse", or "custom".
  7433. If the value for @var{shape} is "custom", it must be followed by a
  7434. string of the form "=@var{filename}". The file with name
  7435. @var{filename} is assumed to represent a binary image, with each
  7436. printable character corresponding to a bright pixel. When a custom
  7437. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7438. or columns and rows of the read file are assumed instead.
  7439. The default value for @var{struct_el} is "3x3+0x0/rect".
  7440. @var{nb_iterations} specifies the number of times the transform is
  7441. applied to the image, and defaults to 1.
  7442. Some examples:
  7443. @example
  7444. # Use the default values
  7445. ocv=dilate
  7446. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7447. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7448. # Read the shape from the file diamond.shape, iterating two times.
  7449. # The file diamond.shape may contain a pattern of characters like this
  7450. # *
  7451. # ***
  7452. # *****
  7453. # ***
  7454. # *
  7455. # The specified columns and rows are ignored
  7456. # but the anchor point coordinates are not
  7457. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7458. @end example
  7459. @subsection erode
  7460. Erode an image by using a specific structuring element.
  7461. It corresponds to the libopencv function @code{cvErode}.
  7462. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7463. with the same syntax and semantics as the @ref{dilate} filter.
  7464. @subsection smooth
  7465. Smooth the input video.
  7466. The filter takes the following parameters:
  7467. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7468. @var{type} is the type of smooth filter to apply, and must be one of
  7469. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7470. or "bilateral". The default value is "gaussian".
  7471. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7472. depend on the smooth type. @var{param1} and
  7473. @var{param2} accept integer positive values or 0. @var{param3} and
  7474. @var{param4} accept floating point values.
  7475. The default value for @var{param1} is 3. The default value for the
  7476. other parameters is 0.
  7477. These parameters correspond to the parameters assigned to the
  7478. libopencv function @code{cvSmooth}.
  7479. @anchor{overlay}
  7480. @section overlay
  7481. Overlay one video on top of another.
  7482. It takes two inputs and has one output. The first input is the "main"
  7483. video on which the second input is overlaid.
  7484. It accepts the following parameters:
  7485. A description of the accepted options follows.
  7486. @table @option
  7487. @item x
  7488. @item y
  7489. Set the expression for the x and y coordinates of the overlaid video
  7490. on the main video. Default value is "0" for both expressions. In case
  7491. the expression is invalid, it is set to a huge value (meaning that the
  7492. overlay will not be displayed within the output visible area).
  7493. @item eof_action
  7494. The action to take when EOF is encountered on the secondary input; it accepts
  7495. one of the following values:
  7496. @table @option
  7497. @item repeat
  7498. Repeat the last frame (the default).
  7499. @item endall
  7500. End both streams.
  7501. @item pass
  7502. Pass the main input through.
  7503. @end table
  7504. @item eval
  7505. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7506. It accepts the following values:
  7507. @table @samp
  7508. @item init
  7509. only evaluate expressions once during the filter initialization or
  7510. when a command is processed
  7511. @item frame
  7512. evaluate expressions for each incoming frame
  7513. @end table
  7514. Default value is @samp{frame}.
  7515. @item shortest
  7516. If set to 1, force the output to terminate when the shortest input
  7517. terminates. Default value is 0.
  7518. @item format
  7519. Set the format for the output video.
  7520. It accepts the following values:
  7521. @table @samp
  7522. @item yuv420
  7523. force YUV420 output
  7524. @item yuv422
  7525. force YUV422 output
  7526. @item yuv444
  7527. force YUV444 output
  7528. @item rgb
  7529. force RGB output
  7530. @end table
  7531. Default value is @samp{yuv420}.
  7532. @item rgb @emph{(deprecated)}
  7533. If set to 1, force the filter to accept inputs in the RGB
  7534. color space. Default value is 0. This option is deprecated, use
  7535. @option{format} instead.
  7536. @item repeatlast
  7537. If set to 1, force the filter to draw the last overlay frame over the
  7538. main input until the end of the stream. A value of 0 disables this
  7539. behavior. Default value is 1.
  7540. @end table
  7541. The @option{x}, and @option{y} expressions can contain the following
  7542. parameters.
  7543. @table @option
  7544. @item main_w, W
  7545. @item main_h, H
  7546. The main input width and height.
  7547. @item overlay_w, w
  7548. @item overlay_h, h
  7549. The overlay input width and height.
  7550. @item x
  7551. @item y
  7552. The computed values for @var{x} and @var{y}. They are evaluated for
  7553. each new frame.
  7554. @item hsub
  7555. @item vsub
  7556. horizontal and vertical chroma subsample values of the output
  7557. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7558. @var{vsub} is 1.
  7559. @item n
  7560. the number of input frame, starting from 0
  7561. @item pos
  7562. the position in the file of the input frame, NAN if unknown
  7563. @item t
  7564. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7565. @end table
  7566. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7567. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7568. when @option{eval} is set to @samp{init}.
  7569. Be aware that frames are taken from each input video in timestamp
  7570. order, hence, if their initial timestamps differ, it is a good idea
  7571. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7572. have them begin in the same zero timestamp, as the example for
  7573. the @var{movie} filter does.
  7574. You can chain together more overlays but you should test the
  7575. efficiency of such approach.
  7576. @subsection Commands
  7577. This filter supports the following commands:
  7578. @table @option
  7579. @item x
  7580. @item y
  7581. Modify the x and y of the overlay input.
  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. @subsection Examples
  7587. @itemize
  7588. @item
  7589. Draw the overlay at 10 pixels from the bottom right corner of the main
  7590. video:
  7591. @example
  7592. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7593. @end example
  7594. Using named options the example above becomes:
  7595. @example
  7596. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7597. @end example
  7598. @item
  7599. Insert a transparent PNG logo in the bottom left corner of the input,
  7600. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7601. @example
  7602. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7603. @end example
  7604. @item
  7605. Insert 2 different transparent PNG logos (second logo on bottom
  7606. right corner) using the @command{ffmpeg} tool:
  7607. @example
  7608. 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
  7609. @end example
  7610. @item
  7611. Add a transparent color layer on top of the main video; @code{WxH}
  7612. must specify the size of the main input to the overlay filter:
  7613. @example
  7614. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7615. @end example
  7616. @item
  7617. Play an original video and a filtered version (here with the deshake
  7618. filter) side by side using the @command{ffplay} tool:
  7619. @example
  7620. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7621. @end example
  7622. The above command is the same as:
  7623. @example
  7624. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7625. @end example
  7626. @item
  7627. Make a sliding overlay appearing from the left to the right top part of the
  7628. screen starting since time 2:
  7629. @example
  7630. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7631. @end example
  7632. @item
  7633. Compose output by putting two input videos side to side:
  7634. @example
  7635. ffmpeg -i left.avi -i right.avi -filter_complex "
  7636. nullsrc=size=200x100 [background];
  7637. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7638. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7639. [background][left] overlay=shortest=1 [background+left];
  7640. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7641. "
  7642. @end example
  7643. @item
  7644. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7645. @example
  7646. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7647. -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]'
  7648. masked.avi
  7649. @end example
  7650. @item
  7651. Chain several overlays in cascade:
  7652. @example
  7653. nullsrc=s=200x200 [bg];
  7654. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7655. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7656. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7657. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7658. [in3] null, [mid2] overlay=100:100 [out0]
  7659. @end example
  7660. @end itemize
  7661. @section owdenoise
  7662. Apply Overcomplete Wavelet denoiser.
  7663. The filter accepts the following options:
  7664. @table @option
  7665. @item depth
  7666. Set depth.
  7667. Larger depth values will denoise lower frequency components more, but
  7668. slow down filtering.
  7669. Must be an int in the range 8-16, default is @code{8}.
  7670. @item luma_strength, ls
  7671. Set luma strength.
  7672. Must be a double value in the range 0-1000, default is @code{1.0}.
  7673. @item chroma_strength, cs
  7674. Set chroma strength.
  7675. Must be a double value in the range 0-1000, default is @code{1.0}.
  7676. @end table
  7677. @anchor{pad}
  7678. @section pad
  7679. Add paddings to the input image, and place the original input at the
  7680. provided @var{x}, @var{y} coordinates.
  7681. It accepts the following parameters:
  7682. @table @option
  7683. @item width, w
  7684. @item height, h
  7685. Specify an expression for the size of the output image with the
  7686. paddings added. If the value for @var{width} or @var{height} is 0, the
  7687. corresponding input size is used for the output.
  7688. The @var{width} expression can reference the value set by the
  7689. @var{height} expression, and vice versa.
  7690. The default value of @var{width} and @var{height} is 0.
  7691. @item x
  7692. @item y
  7693. Specify the offsets to place the input image at within the padded area,
  7694. with respect to the top/left border of the output image.
  7695. The @var{x} expression can reference the value set by the @var{y}
  7696. expression, and vice versa.
  7697. The default value of @var{x} and @var{y} is 0.
  7698. @item color
  7699. Specify the color of the padded area. For the syntax of this option,
  7700. check the "Color" section in the ffmpeg-utils manual.
  7701. The default value of @var{color} is "black".
  7702. @end table
  7703. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7704. options are expressions containing the following constants:
  7705. @table @option
  7706. @item in_w
  7707. @item in_h
  7708. The input video width and height.
  7709. @item iw
  7710. @item ih
  7711. These are the same as @var{in_w} and @var{in_h}.
  7712. @item out_w
  7713. @item out_h
  7714. The output width and height (the size of the padded area), as
  7715. specified by the @var{width} and @var{height} expressions.
  7716. @item ow
  7717. @item oh
  7718. These are the same as @var{out_w} and @var{out_h}.
  7719. @item x
  7720. @item y
  7721. The x and y offsets as specified by the @var{x} and @var{y}
  7722. expressions, or NAN if not yet specified.
  7723. @item a
  7724. same as @var{iw} / @var{ih}
  7725. @item sar
  7726. input sample aspect ratio
  7727. @item dar
  7728. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7729. @item hsub
  7730. @item vsub
  7731. The horizontal and vertical chroma subsample values. For example for the
  7732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7733. @end table
  7734. @subsection Examples
  7735. @itemize
  7736. @item
  7737. Add paddings with the color "violet" to the input video. The output video
  7738. size is 640x480, and the top-left corner of the input video is placed at
  7739. column 0, row 40
  7740. @example
  7741. pad=640:480:0:40:violet
  7742. @end example
  7743. The example above is equivalent to the following command:
  7744. @example
  7745. pad=width=640:height=480:x=0:y=40:color=violet
  7746. @end example
  7747. @item
  7748. Pad the input to get an output with dimensions increased by 3/2,
  7749. and put the input video at the center of the padded area:
  7750. @example
  7751. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7752. @end example
  7753. @item
  7754. Pad the input to get a squared output with size equal to the maximum
  7755. value between the input width and height, and put the input video at
  7756. the center of the padded area:
  7757. @example
  7758. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7759. @end example
  7760. @item
  7761. Pad the input to get a final w/h ratio of 16:9:
  7762. @example
  7763. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7764. @end example
  7765. @item
  7766. In case of anamorphic video, in order to set the output display aspect
  7767. correctly, it is necessary to use @var{sar} in the expression,
  7768. according to the relation:
  7769. @example
  7770. (ih * X / ih) * sar = output_dar
  7771. X = output_dar / sar
  7772. @end example
  7773. Thus the previous example needs to be modified to:
  7774. @example
  7775. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7776. @end example
  7777. @item
  7778. Double the output size and put the input video in the bottom-right
  7779. corner of the output padded area:
  7780. @example
  7781. pad="2*iw:2*ih:ow-iw:oh-ih"
  7782. @end example
  7783. @end itemize
  7784. @anchor{palettegen}
  7785. @section palettegen
  7786. Generate one palette for a whole video stream.
  7787. It accepts the following options:
  7788. @table @option
  7789. @item max_colors
  7790. Set the maximum number of colors to quantize in the palette.
  7791. Note: the palette will still contain 256 colors; the unused palette entries
  7792. will be black.
  7793. @item reserve_transparent
  7794. Create a palette of 255 colors maximum and reserve the last one for
  7795. transparency. Reserving the transparency color is useful for GIF optimization.
  7796. If not set, the maximum of colors in the palette will be 256. You probably want
  7797. to disable this option for a standalone image.
  7798. Set by default.
  7799. @item stats_mode
  7800. Set statistics mode.
  7801. It accepts the following values:
  7802. @table @samp
  7803. @item full
  7804. Compute full frame histograms.
  7805. @item diff
  7806. Compute histograms only for the part that differs from previous frame. This
  7807. might be relevant to give more importance to the moving part of your input if
  7808. the background is static.
  7809. @end table
  7810. Default value is @var{full}.
  7811. @end table
  7812. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7813. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7814. color quantization of the palette. This information is also visible at
  7815. @var{info} logging level.
  7816. @subsection Examples
  7817. @itemize
  7818. @item
  7819. Generate a representative palette of a given video using @command{ffmpeg}:
  7820. @example
  7821. ffmpeg -i input.mkv -vf palettegen palette.png
  7822. @end example
  7823. @end itemize
  7824. @section paletteuse
  7825. Use a palette to downsample an input video stream.
  7826. The filter takes two inputs: one video stream and a palette. The palette must
  7827. be a 256 pixels image.
  7828. It accepts the following options:
  7829. @table @option
  7830. @item dither
  7831. Select dithering mode. Available algorithms are:
  7832. @table @samp
  7833. @item bayer
  7834. Ordered 8x8 bayer dithering (deterministic)
  7835. @item heckbert
  7836. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7837. Note: this dithering is sometimes considered "wrong" and is included as a
  7838. reference.
  7839. @item floyd_steinberg
  7840. Floyd and Steingberg dithering (error diffusion)
  7841. @item sierra2
  7842. Frankie Sierra dithering v2 (error diffusion)
  7843. @item sierra2_4a
  7844. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7845. @end table
  7846. Default is @var{sierra2_4a}.
  7847. @item bayer_scale
  7848. When @var{bayer} dithering is selected, this option defines the scale of the
  7849. pattern (how much the crosshatch pattern is visible). A low value means more
  7850. visible pattern for less banding, and higher value means less visible pattern
  7851. at the cost of more banding.
  7852. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7853. @item diff_mode
  7854. If set, define the zone to process
  7855. @table @samp
  7856. @item rectangle
  7857. Only the changing rectangle will be reprocessed. This is similar to GIF
  7858. cropping/offsetting compression mechanism. This option can be useful for speed
  7859. if only a part of the image is changing, and has use cases such as limiting the
  7860. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7861. moving scene (it leads to more deterministic output if the scene doesn't change
  7862. much, and as a result less moving noise and better GIF compression).
  7863. @end table
  7864. Default is @var{none}.
  7865. @end table
  7866. @subsection Examples
  7867. @itemize
  7868. @item
  7869. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7870. using @command{ffmpeg}:
  7871. @example
  7872. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7873. @end example
  7874. @end itemize
  7875. @section perspective
  7876. Correct perspective of video not recorded perpendicular to the screen.
  7877. A description of the accepted parameters follows.
  7878. @table @option
  7879. @item x0
  7880. @item y0
  7881. @item x1
  7882. @item y1
  7883. @item x2
  7884. @item y2
  7885. @item x3
  7886. @item y3
  7887. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7888. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7889. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7890. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7891. then the corners of the source will be sent to the specified coordinates.
  7892. The expressions can use the following variables:
  7893. @table @option
  7894. @item W
  7895. @item H
  7896. the width and height of video frame.
  7897. @item in
  7898. Input frame count.
  7899. @item on
  7900. Output frame count.
  7901. @end table
  7902. @item interpolation
  7903. Set interpolation for perspective correction.
  7904. It accepts the following values:
  7905. @table @samp
  7906. @item linear
  7907. @item cubic
  7908. @end table
  7909. Default value is @samp{linear}.
  7910. @item sense
  7911. Set interpretation of coordinate options.
  7912. It accepts the following values:
  7913. @table @samp
  7914. @item 0, source
  7915. Send point in the source specified by the given coordinates to
  7916. the corners of the destination.
  7917. @item 1, destination
  7918. Send the corners of the source to the point in the destination specified
  7919. by the given coordinates.
  7920. Default value is @samp{source}.
  7921. @end table
  7922. @item eval
  7923. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7924. It accepts the following values:
  7925. @table @samp
  7926. @item init
  7927. only evaluate expressions once during the filter initialization or
  7928. when a command is processed
  7929. @item frame
  7930. evaluate expressions for each incoming frame
  7931. @end table
  7932. Default value is @samp{init}.
  7933. @end table
  7934. @section phase
  7935. Delay interlaced video by one field time so that the field order changes.
  7936. The intended use is to fix PAL movies that have been captured with the
  7937. opposite field order to the film-to-video transfer.
  7938. A description of the accepted parameters follows.
  7939. @table @option
  7940. @item mode
  7941. Set phase mode.
  7942. It accepts the following values:
  7943. @table @samp
  7944. @item t
  7945. Capture field order top-first, transfer bottom-first.
  7946. Filter will delay the bottom field.
  7947. @item b
  7948. Capture field order bottom-first, transfer top-first.
  7949. Filter will delay the top field.
  7950. @item p
  7951. Capture and transfer with the same field order. This mode only exists
  7952. for the documentation of the other options to refer to, but if you
  7953. actually select it, the filter will faithfully do nothing.
  7954. @item a
  7955. Capture field order determined automatically by field flags, transfer
  7956. opposite.
  7957. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7958. basis using field flags. If no field information is available,
  7959. then this works just like @samp{u}.
  7960. @item u
  7961. Capture unknown or varying, transfer opposite.
  7962. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7963. analyzing the images and selecting the alternative that produces best
  7964. match between the fields.
  7965. @item T
  7966. Capture top-first, transfer unknown or varying.
  7967. Filter selects among @samp{t} and @samp{p} using image analysis.
  7968. @item B
  7969. Capture bottom-first, transfer unknown or varying.
  7970. Filter selects among @samp{b} and @samp{p} using image analysis.
  7971. @item A
  7972. Capture determined by field flags, transfer unknown or varying.
  7973. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7974. image analysis. If no field information is available, then this works just
  7975. like @samp{U}. This is the default mode.
  7976. @item U
  7977. Both capture and transfer unknown or varying.
  7978. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7979. @end table
  7980. @end table
  7981. @section pixdesctest
  7982. Pixel format descriptor test filter, mainly useful for internal
  7983. testing. The output video should be equal to the input video.
  7984. For example:
  7985. @example
  7986. format=monow, pixdesctest
  7987. @end example
  7988. can be used to test the monowhite pixel format descriptor definition.
  7989. @section pp
  7990. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7991. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7992. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7993. Each subfilter and some options have a short and a long name that can be used
  7994. interchangeably, i.e. dr/dering are the same.
  7995. The filters accept the following options:
  7996. @table @option
  7997. @item subfilters
  7998. Set postprocessing subfilters string.
  7999. @end table
  8000. All subfilters share common options to determine their scope:
  8001. @table @option
  8002. @item a/autoq
  8003. Honor the quality commands for this subfilter.
  8004. @item c/chrom
  8005. Do chrominance filtering, too (default).
  8006. @item y/nochrom
  8007. Do luminance filtering only (no chrominance).
  8008. @item n/noluma
  8009. Do chrominance filtering only (no luminance).
  8010. @end table
  8011. These options can be appended after the subfilter name, separated by a '|'.
  8012. Available subfilters are:
  8013. @table @option
  8014. @item hb/hdeblock[|difference[|flatness]]
  8015. Horizontal deblocking filter
  8016. @table @option
  8017. @item difference
  8018. Difference factor where higher values mean more deblocking (default: @code{32}).
  8019. @item flatness
  8020. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8021. @end table
  8022. @item vb/vdeblock[|difference[|flatness]]
  8023. Vertical deblocking filter
  8024. @table @option
  8025. @item difference
  8026. Difference factor where higher values mean more deblocking (default: @code{32}).
  8027. @item flatness
  8028. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8029. @end table
  8030. @item ha/hadeblock[|difference[|flatness]]
  8031. Accurate horizontal deblocking filter
  8032. @table @option
  8033. @item difference
  8034. Difference factor where higher values mean more deblocking (default: @code{32}).
  8035. @item flatness
  8036. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8037. @end table
  8038. @item va/vadeblock[|difference[|flatness]]
  8039. Accurate vertical deblocking filter
  8040. @table @option
  8041. @item difference
  8042. Difference factor where higher values mean more deblocking (default: @code{32}).
  8043. @item flatness
  8044. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8045. @end table
  8046. @end table
  8047. The horizontal and vertical deblocking filters share the difference and
  8048. flatness values so you cannot set different horizontal and vertical
  8049. thresholds.
  8050. @table @option
  8051. @item h1/x1hdeblock
  8052. Experimental horizontal deblocking filter
  8053. @item v1/x1vdeblock
  8054. Experimental vertical deblocking filter
  8055. @item dr/dering
  8056. Deringing filter
  8057. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8058. @table @option
  8059. @item threshold1
  8060. larger -> stronger filtering
  8061. @item threshold2
  8062. larger -> stronger filtering
  8063. @item threshold3
  8064. larger -> stronger filtering
  8065. @end table
  8066. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8067. @table @option
  8068. @item f/fullyrange
  8069. Stretch luminance to @code{0-255}.
  8070. @end table
  8071. @item lb/linblenddeint
  8072. Linear blend deinterlacing filter that deinterlaces the given block by
  8073. filtering all lines with a @code{(1 2 1)} filter.
  8074. @item li/linipoldeint
  8075. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8076. linearly interpolating every second line.
  8077. @item ci/cubicipoldeint
  8078. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8079. cubically interpolating every second line.
  8080. @item md/mediandeint
  8081. Median deinterlacing filter that deinterlaces the given block by applying a
  8082. median filter to every second line.
  8083. @item fd/ffmpegdeint
  8084. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8085. second line with a @code{(-1 4 2 4 -1)} filter.
  8086. @item l5/lowpass5
  8087. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8088. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8089. @item fq/forceQuant[|quantizer]
  8090. Overrides the quantizer table from the input with the constant quantizer you
  8091. specify.
  8092. @table @option
  8093. @item quantizer
  8094. Quantizer to use
  8095. @end table
  8096. @item de/default
  8097. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8098. @item fa/fast
  8099. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8100. @item ac
  8101. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8102. @end table
  8103. @subsection Examples
  8104. @itemize
  8105. @item
  8106. Apply horizontal and vertical deblocking, deringing and automatic
  8107. brightness/contrast:
  8108. @example
  8109. pp=hb/vb/dr/al
  8110. @end example
  8111. @item
  8112. Apply default filters without brightness/contrast correction:
  8113. @example
  8114. pp=de/-al
  8115. @end example
  8116. @item
  8117. Apply default filters and temporal denoiser:
  8118. @example
  8119. pp=default/tmpnoise|1|2|3
  8120. @end example
  8121. @item
  8122. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8123. automatically depending on available CPU time:
  8124. @example
  8125. pp=hb|y/vb|a
  8126. @end example
  8127. @end itemize
  8128. @section pp7
  8129. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8130. similar to spp = 6 with 7 point DCT, where only the center sample is
  8131. used after IDCT.
  8132. The filter accepts the following options:
  8133. @table @option
  8134. @item qp
  8135. Force a constant quantization parameter. It accepts an integer in range
  8136. 0 to 63. If not set, the filter will use the QP from the video stream
  8137. (if available).
  8138. @item mode
  8139. Set thresholding mode. Available modes are:
  8140. @table @samp
  8141. @item hard
  8142. Set hard thresholding.
  8143. @item soft
  8144. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8145. @item medium
  8146. Set medium thresholding (good results, default).
  8147. @end table
  8148. @end table
  8149. @section psnr
  8150. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8151. Ratio) between two input videos.
  8152. This filter takes in input two input videos, the first input is
  8153. considered the "main" source and is passed unchanged to the
  8154. output. The second input is used as a "reference" video for computing
  8155. the PSNR.
  8156. Both video inputs must have the same resolution and pixel format for
  8157. this filter to work correctly. Also it assumes that both inputs
  8158. have the same number of frames, which are compared one by one.
  8159. The obtained average PSNR is printed through the logging system.
  8160. The filter stores the accumulated MSE (mean squared error) of each
  8161. frame, and at the end of the processing it is averaged across all frames
  8162. equally, and the following formula is applied to obtain the PSNR:
  8163. @example
  8164. PSNR = 10*log10(MAX^2/MSE)
  8165. @end example
  8166. Where MAX is the average of the maximum values of each component of the
  8167. image.
  8168. The description of the accepted parameters follows.
  8169. @table @option
  8170. @item stats_file, f
  8171. If specified the filter will use the named file to save the PSNR of
  8172. each individual frame. When filename equals "-" the data is sent to
  8173. standard output.
  8174. @end table
  8175. The file printed if @var{stats_file} is selected, contains a sequence of
  8176. key/value pairs of the form @var{key}:@var{value} for each compared
  8177. couple of frames.
  8178. A description of each shown parameter follows:
  8179. @table @option
  8180. @item n
  8181. sequential number of the input frame, starting from 1
  8182. @item mse_avg
  8183. Mean Square Error pixel-by-pixel average difference of the compared
  8184. frames, averaged over all the image components.
  8185. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8186. Mean Square Error pixel-by-pixel average difference of the compared
  8187. frames for the component specified by the suffix.
  8188. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8189. Peak Signal to Noise ratio of the compared frames for the component
  8190. specified by the suffix.
  8191. @end table
  8192. For example:
  8193. @example
  8194. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8195. [main][ref] psnr="stats_file=stats.log" [out]
  8196. @end example
  8197. On this example the input file being processed is compared with the
  8198. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8199. is stored in @file{stats.log}.
  8200. @anchor{pullup}
  8201. @section pullup
  8202. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8203. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8204. content.
  8205. The pullup filter is designed to take advantage of future context in making
  8206. its decisions. This filter is stateless in the sense that it does not lock
  8207. onto a pattern to follow, but it instead looks forward to the following
  8208. fields in order to identify matches and rebuild progressive frames.
  8209. To produce content with an even framerate, insert the fps filter after
  8210. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8211. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8212. The filter accepts the following options:
  8213. @table @option
  8214. @item jl
  8215. @item jr
  8216. @item jt
  8217. @item jb
  8218. These options set the amount of "junk" to ignore at the left, right, top, and
  8219. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8220. while top and bottom are in units of 2 lines.
  8221. The default is 8 pixels on each side.
  8222. @item sb
  8223. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8224. filter generating an occasional mismatched frame, but it may also cause an
  8225. excessive number of frames to be dropped during high motion sequences.
  8226. Conversely, setting it to -1 will make filter match fields more easily.
  8227. This may help processing of video where there is slight blurring between
  8228. the fields, but may also cause there to be interlaced frames in the output.
  8229. Default value is @code{0}.
  8230. @item mp
  8231. Set the metric plane to use. It accepts the following values:
  8232. @table @samp
  8233. @item l
  8234. Use luma plane.
  8235. @item u
  8236. Use chroma blue plane.
  8237. @item v
  8238. Use chroma red plane.
  8239. @end table
  8240. This option may be set to use chroma plane instead of the default luma plane
  8241. for doing filter's computations. This may improve accuracy on very clean
  8242. source material, but more likely will decrease accuracy, especially if there
  8243. is chroma noise (rainbow effect) or any grayscale video.
  8244. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8245. load and make pullup usable in realtime on slow machines.
  8246. @end table
  8247. For best results (without duplicated frames in the output file) it is
  8248. necessary to change the output frame rate. For example, to inverse
  8249. telecine NTSC input:
  8250. @example
  8251. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8252. @end example
  8253. @section qp
  8254. Change video quantization parameters (QP).
  8255. The filter accepts the following option:
  8256. @table @option
  8257. @item qp
  8258. Set expression for quantization parameter.
  8259. @end table
  8260. The expression is evaluated through the eval API and can contain, among others,
  8261. the following constants:
  8262. @table @var
  8263. @item known
  8264. 1 if index is not 129, 0 otherwise.
  8265. @item qp
  8266. Sequentional index starting from -129 to 128.
  8267. @end table
  8268. @subsection Examples
  8269. @itemize
  8270. @item
  8271. Some equation like:
  8272. @example
  8273. qp=2+2*sin(PI*qp)
  8274. @end example
  8275. @end itemize
  8276. @section random
  8277. Flush video frames from internal cache of frames into a random order.
  8278. No frame is discarded.
  8279. Inspired by @ref{frei0r} nervous filter.
  8280. @table @option
  8281. @item frames
  8282. Set size in number of frames of internal cache, in range from @code{2} to
  8283. @code{512}. Default is @code{30}.
  8284. @item seed
  8285. Set seed for random number generator, must be an integer included between
  8286. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8287. less than @code{0}, the filter will try to use a good random seed on a
  8288. best effort basis.
  8289. @end table
  8290. @section readvitc
  8291. Read vertical interval timecode (VITC) information from the top lines of a
  8292. video frame.
  8293. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8294. timecode value, if a valid timecode has been detected. Further metadata key
  8295. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8296. timecode data has been found or not.
  8297. This filter accepts the following options:
  8298. @table @option
  8299. @item scan_max
  8300. Set the maximum number of lines to scan for VITC data. If the value is set to
  8301. @code{-1} the full video frame is scanned. Default is @code{45}.
  8302. @item thr_b
  8303. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8304. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8305. @item thr_w
  8306. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8307. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8308. @end table
  8309. @subsection Examples
  8310. @itemize
  8311. @item
  8312. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8313. draw @code{--:--:--:--} as a placeholder:
  8314. @example
  8315. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8316. @end example
  8317. @end itemize
  8318. @section remap
  8319. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8320. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8321. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8322. value for pixel will be used for destination pixel.
  8323. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8324. will have Xmap/Ymap video stream dimensions.
  8325. Xmap and Ymap input video streams are 16bit depth, single channel.
  8326. @section removegrain
  8327. The removegrain filter is a spatial denoiser for progressive video.
  8328. @table @option
  8329. @item m0
  8330. Set mode for the first plane.
  8331. @item m1
  8332. Set mode for the second plane.
  8333. @item m2
  8334. Set mode for the third plane.
  8335. @item m3
  8336. Set mode for the fourth plane.
  8337. @end table
  8338. Range of mode is from 0 to 24. Description of each mode follows:
  8339. @table @var
  8340. @item 0
  8341. Leave input plane unchanged. Default.
  8342. @item 1
  8343. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8344. @item 2
  8345. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8346. @item 3
  8347. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8348. @item 4
  8349. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8350. This is equivalent to a median filter.
  8351. @item 5
  8352. Line-sensitive clipping giving the minimal change.
  8353. @item 6
  8354. Line-sensitive clipping, intermediate.
  8355. @item 7
  8356. Line-sensitive clipping, intermediate.
  8357. @item 8
  8358. Line-sensitive clipping, intermediate.
  8359. @item 9
  8360. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8361. @item 10
  8362. Replaces the target pixel with the closest neighbour.
  8363. @item 11
  8364. [1 2 1] horizontal and vertical kernel blur.
  8365. @item 12
  8366. Same as mode 11.
  8367. @item 13
  8368. Bob mode, interpolates top field from the line where the neighbours
  8369. pixels are the closest.
  8370. @item 14
  8371. Bob mode, interpolates bottom field from the line where the neighbours
  8372. pixels are the closest.
  8373. @item 15
  8374. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8375. interpolation formula.
  8376. @item 16
  8377. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8378. interpolation formula.
  8379. @item 17
  8380. Clips the pixel with the minimum and maximum of respectively the maximum and
  8381. minimum of each pair of opposite neighbour pixels.
  8382. @item 18
  8383. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8384. the current pixel is minimal.
  8385. @item 19
  8386. Replaces the pixel with the average of its 8 neighbours.
  8387. @item 20
  8388. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8389. @item 21
  8390. Clips pixels using the averages of opposite neighbour.
  8391. @item 22
  8392. Same as mode 21 but simpler and faster.
  8393. @item 23
  8394. Small edge and halo removal, but reputed useless.
  8395. @item 24
  8396. Similar as 23.
  8397. @end table
  8398. @section removelogo
  8399. Suppress a TV station logo, using an image file to determine which
  8400. pixels comprise the logo. It works by filling in the pixels that
  8401. comprise the logo with neighboring pixels.
  8402. The filter accepts the following options:
  8403. @table @option
  8404. @item filename, f
  8405. Set the filter bitmap file, which can be any image format supported by
  8406. libavformat. The width and height of the image file must match those of the
  8407. video stream being processed.
  8408. @end table
  8409. Pixels in the provided bitmap image with a value of zero are not
  8410. considered part of the logo, non-zero pixels are considered part of
  8411. the logo. If you use white (255) for the logo and black (0) for the
  8412. rest, you will be safe. For making the filter bitmap, it is
  8413. recommended to take a screen capture of a black frame with the logo
  8414. visible, and then using a threshold filter followed by the erode
  8415. filter once or twice.
  8416. If needed, little splotches can be fixed manually. Remember that if
  8417. logo pixels are not covered, the filter quality will be much
  8418. reduced. Marking too many pixels as part of the logo does not hurt as
  8419. much, but it will increase the amount of blurring needed to cover over
  8420. the image and will destroy more information than necessary, and extra
  8421. pixels will slow things down on a large logo.
  8422. @section repeatfields
  8423. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8424. fields based on its value.
  8425. @section reverse, areverse
  8426. Reverse a clip.
  8427. Warning: This filter requires memory to buffer the entire clip, so trimming
  8428. is suggested.
  8429. @subsection Examples
  8430. @itemize
  8431. @item
  8432. Take the first 5 seconds of a clip, and reverse it.
  8433. @example
  8434. trim=end=5,reverse
  8435. @end example
  8436. @end itemize
  8437. @section rotate
  8438. Rotate video by an arbitrary angle expressed in radians.
  8439. The filter accepts the following options:
  8440. A description of the optional parameters follows.
  8441. @table @option
  8442. @item angle, a
  8443. Set an expression for the angle by which to rotate the input video
  8444. clockwise, expressed as a number of radians. A negative value will
  8445. result in a counter-clockwise rotation. By default it is set to "0".
  8446. This expression is evaluated for each frame.
  8447. @item out_w, ow
  8448. Set the output width expression, default value is "iw".
  8449. This expression is evaluated just once during configuration.
  8450. @item out_h, oh
  8451. Set the output height expression, default value is "ih".
  8452. This expression is evaluated just once during configuration.
  8453. @item bilinear
  8454. Enable bilinear interpolation if set to 1, a value of 0 disables
  8455. it. Default value is 1.
  8456. @item fillcolor, c
  8457. Set the color used to fill the output area not covered by the rotated
  8458. image. For the general syntax of this option, check the "Color" section in the
  8459. ffmpeg-utils manual. If the special value "none" is selected then no
  8460. background is printed (useful for example if the background is never shown).
  8461. Default value is "black".
  8462. @end table
  8463. The expressions for the angle and the output size can contain the
  8464. following constants and functions:
  8465. @table @option
  8466. @item n
  8467. sequential number of the input frame, starting from 0. It is always NAN
  8468. before the first frame is filtered.
  8469. @item t
  8470. time in seconds of the input frame, it is set to 0 when the filter is
  8471. configured. It is always NAN before the first frame is filtered.
  8472. @item hsub
  8473. @item vsub
  8474. horizontal and vertical chroma subsample values. For example for the
  8475. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8476. @item in_w, iw
  8477. @item in_h, ih
  8478. the input video width and height
  8479. @item out_w, ow
  8480. @item out_h, oh
  8481. the output width and height, that is the size of the padded area as
  8482. specified by the @var{width} and @var{height} expressions
  8483. @item rotw(a)
  8484. @item roth(a)
  8485. the minimal width/height required for completely containing the input
  8486. video rotated by @var{a} radians.
  8487. These are only available when computing the @option{out_w} and
  8488. @option{out_h} expressions.
  8489. @end table
  8490. @subsection Examples
  8491. @itemize
  8492. @item
  8493. Rotate the input by PI/6 radians clockwise:
  8494. @example
  8495. rotate=PI/6
  8496. @end example
  8497. @item
  8498. Rotate the input by PI/6 radians counter-clockwise:
  8499. @example
  8500. rotate=-PI/6
  8501. @end example
  8502. @item
  8503. Rotate the input by 45 degrees clockwise:
  8504. @example
  8505. rotate=45*PI/180
  8506. @end example
  8507. @item
  8508. Apply a constant rotation with period T, starting from an angle of PI/3:
  8509. @example
  8510. rotate=PI/3+2*PI*t/T
  8511. @end example
  8512. @item
  8513. Make the input video rotation oscillating with a period of T
  8514. seconds and an amplitude of A radians:
  8515. @example
  8516. rotate=A*sin(2*PI/T*t)
  8517. @end example
  8518. @item
  8519. Rotate the video, output size is chosen so that the whole rotating
  8520. input video is always completely contained in the output:
  8521. @example
  8522. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8523. @end example
  8524. @item
  8525. Rotate the video, reduce the output size so that no background is ever
  8526. shown:
  8527. @example
  8528. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8529. @end example
  8530. @end itemize
  8531. @subsection Commands
  8532. The filter supports the following commands:
  8533. @table @option
  8534. @item a, angle
  8535. Set the angle expression.
  8536. The command accepts the same syntax of the corresponding option.
  8537. If the specified expression is not valid, it is kept at its current
  8538. value.
  8539. @end table
  8540. @section sab
  8541. Apply Shape Adaptive Blur.
  8542. The filter accepts the following options:
  8543. @table @option
  8544. @item luma_radius, lr
  8545. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8546. value is 1.0. A greater value will result in a more blurred image, and
  8547. in slower processing.
  8548. @item luma_pre_filter_radius, lpfr
  8549. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8550. value is 1.0.
  8551. @item luma_strength, ls
  8552. Set luma maximum difference between pixels to still be considered, must
  8553. be a value in the 0.1-100.0 range, default value is 1.0.
  8554. @item chroma_radius, cr
  8555. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8556. greater value will result in a more blurred image, and in slower
  8557. processing.
  8558. @item chroma_pre_filter_radius, cpfr
  8559. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8560. @item chroma_strength, cs
  8561. Set chroma maximum difference between pixels to still be considered,
  8562. must be a value in the 0.1-100.0 range.
  8563. @end table
  8564. Each chroma option value, if not explicitly specified, is set to the
  8565. corresponding luma option value.
  8566. @anchor{scale}
  8567. @section scale
  8568. Scale (resize) the input video, using the libswscale library.
  8569. The scale filter forces the output display aspect ratio to be the same
  8570. of the input, by changing the output sample aspect ratio.
  8571. If the input image format is different from the format requested by
  8572. the next filter, the scale filter will convert the input to the
  8573. requested format.
  8574. @subsection Options
  8575. The filter accepts the following options, or any of the options
  8576. supported by the libswscale scaler.
  8577. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8578. the complete list of scaler options.
  8579. @table @option
  8580. @item width, w
  8581. @item height, h
  8582. Set the output video dimension expression. Default value is the input
  8583. dimension.
  8584. If the value is 0, the input width is used for the output.
  8585. If one of the values is -1, the scale filter will use a value that
  8586. maintains the aspect ratio of the input image, calculated from the
  8587. other specified dimension. If both of them are -1, the input size is
  8588. used
  8589. If one of the values is -n with n > 1, the scale filter will also use a value
  8590. that maintains the aspect ratio of the input image, calculated from the other
  8591. specified dimension. After that it will, however, make sure that the calculated
  8592. dimension is divisible by n and adjust the value if necessary.
  8593. See below for the list of accepted constants for use in the dimension
  8594. expression.
  8595. @item eval
  8596. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8597. @table @samp
  8598. @item init
  8599. Only evaluate expressions once during the filter initialization or when a command is processed.
  8600. @item frame
  8601. Evaluate expressions for each incoming frame.
  8602. @end table
  8603. Default value is @samp{init}.
  8604. @item interl
  8605. Set the interlacing mode. It accepts the following values:
  8606. @table @samp
  8607. @item 1
  8608. Force interlaced aware scaling.
  8609. @item 0
  8610. Do not apply interlaced scaling.
  8611. @item -1
  8612. Select interlaced aware scaling depending on whether the source frames
  8613. are flagged as interlaced or not.
  8614. @end table
  8615. Default value is @samp{0}.
  8616. @item flags
  8617. Set libswscale scaling flags. See
  8618. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8619. complete list of values. If not explicitly specified the filter applies
  8620. the default flags.
  8621. @item param0, param1
  8622. Set libswscale input parameters for scaling algorithms that need them. See
  8623. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8624. complete documentation. If not explicitly specified the filter applies
  8625. empty parameters.
  8626. @item size, s
  8627. Set the video size. For the syntax of this option, check the
  8628. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8629. @item in_color_matrix
  8630. @item out_color_matrix
  8631. Set in/output YCbCr color space type.
  8632. This allows the autodetected value to be overridden as well as allows forcing
  8633. a specific value used for the output and encoder.
  8634. If not specified, the color space type depends on the pixel format.
  8635. Possible values:
  8636. @table @samp
  8637. @item auto
  8638. Choose automatically.
  8639. @item bt709
  8640. Format conforming to International Telecommunication Union (ITU)
  8641. Recommendation BT.709.
  8642. @item fcc
  8643. Set color space conforming to the United States Federal Communications
  8644. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8645. @item bt601
  8646. Set color space conforming to:
  8647. @itemize
  8648. @item
  8649. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8650. @item
  8651. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8652. @item
  8653. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8654. @end itemize
  8655. @item smpte240m
  8656. Set color space conforming to SMPTE ST 240:1999.
  8657. @end table
  8658. @item in_range
  8659. @item out_range
  8660. Set in/output YCbCr sample range.
  8661. This allows the autodetected value to be overridden as well as allows forcing
  8662. a specific value used for the output and encoder. If not specified, the
  8663. range depends on the pixel format. Possible values:
  8664. @table @samp
  8665. @item auto
  8666. Choose automatically.
  8667. @item jpeg/full/pc
  8668. Set full range (0-255 in case of 8-bit luma).
  8669. @item mpeg/tv
  8670. Set "MPEG" range (16-235 in case of 8-bit luma).
  8671. @end table
  8672. @item force_original_aspect_ratio
  8673. Enable decreasing or increasing output video width or height if necessary to
  8674. keep the original aspect ratio. Possible values:
  8675. @table @samp
  8676. @item disable
  8677. Scale the video as specified and disable this feature.
  8678. @item decrease
  8679. The output video dimensions will automatically be decreased if needed.
  8680. @item increase
  8681. The output video dimensions will automatically be increased if needed.
  8682. @end table
  8683. One useful instance of this option is that when you know a specific device's
  8684. maximum allowed resolution, you can use this to limit the output video to
  8685. that, while retaining the aspect ratio. For example, device A allows
  8686. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8687. decrease) and specifying 1280x720 to the command line makes the output
  8688. 1280x533.
  8689. Please note that this is a different thing than specifying -1 for @option{w}
  8690. or @option{h}, you still need to specify the output resolution for this option
  8691. to work.
  8692. @end table
  8693. The values of the @option{w} and @option{h} options are expressions
  8694. containing the following constants:
  8695. @table @var
  8696. @item in_w
  8697. @item in_h
  8698. The input width and height
  8699. @item iw
  8700. @item ih
  8701. These are the same as @var{in_w} and @var{in_h}.
  8702. @item out_w
  8703. @item out_h
  8704. The output (scaled) width and height
  8705. @item ow
  8706. @item oh
  8707. These are the same as @var{out_w} and @var{out_h}
  8708. @item a
  8709. The same as @var{iw} / @var{ih}
  8710. @item sar
  8711. input sample aspect ratio
  8712. @item dar
  8713. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8714. @item hsub
  8715. @item vsub
  8716. horizontal and vertical input chroma subsample values. For example for the
  8717. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8718. @item ohsub
  8719. @item ovsub
  8720. horizontal and vertical output chroma subsample values. For example for the
  8721. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8722. @end table
  8723. @subsection Examples
  8724. @itemize
  8725. @item
  8726. Scale the input video to a size of 200x100
  8727. @example
  8728. scale=w=200:h=100
  8729. @end example
  8730. This is equivalent to:
  8731. @example
  8732. scale=200:100
  8733. @end example
  8734. or:
  8735. @example
  8736. scale=200x100
  8737. @end example
  8738. @item
  8739. Specify a size abbreviation for the output size:
  8740. @example
  8741. scale=qcif
  8742. @end example
  8743. which can also be written as:
  8744. @example
  8745. scale=size=qcif
  8746. @end example
  8747. @item
  8748. Scale the input to 2x:
  8749. @example
  8750. scale=w=2*iw:h=2*ih
  8751. @end example
  8752. @item
  8753. The above is the same as:
  8754. @example
  8755. scale=2*in_w:2*in_h
  8756. @end example
  8757. @item
  8758. Scale the input to 2x with forced interlaced scaling:
  8759. @example
  8760. scale=2*iw:2*ih:interl=1
  8761. @end example
  8762. @item
  8763. Scale the input to half size:
  8764. @example
  8765. scale=w=iw/2:h=ih/2
  8766. @end example
  8767. @item
  8768. Increase the width, and set the height to the same size:
  8769. @example
  8770. scale=3/2*iw:ow
  8771. @end example
  8772. @item
  8773. Seek Greek harmony:
  8774. @example
  8775. scale=iw:1/PHI*iw
  8776. scale=ih*PHI:ih
  8777. @end example
  8778. @item
  8779. Increase the height, and set the width to 3/2 of the height:
  8780. @example
  8781. scale=w=3/2*oh:h=3/5*ih
  8782. @end example
  8783. @item
  8784. Increase the size, making the size a multiple of the chroma
  8785. subsample values:
  8786. @example
  8787. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8788. @end example
  8789. @item
  8790. Increase the width to a maximum of 500 pixels,
  8791. keeping the same aspect ratio as the input:
  8792. @example
  8793. scale=w='min(500\, iw*3/2):h=-1'
  8794. @end example
  8795. @end itemize
  8796. @subsection Commands
  8797. This filter supports the following commands:
  8798. @table @option
  8799. @item width, w
  8800. @item height, h
  8801. Set the output video dimension expression.
  8802. The command accepts the same syntax of the corresponding option.
  8803. If the specified expression is not valid, it is kept at its current
  8804. value.
  8805. @end table
  8806. @section scale2ref
  8807. Scale (resize) the input video, based on a reference video.
  8808. See the scale filter for available options, scale2ref supports the same but
  8809. uses the reference video instead of the main input as basis.
  8810. @subsection Examples
  8811. @itemize
  8812. @item
  8813. Scale a subtitle stream to match the main video in size before overlaying
  8814. @example
  8815. 'scale2ref[b][a];[a][b]overlay'
  8816. @end example
  8817. @end itemize
  8818. @anchor{selectivecolor}
  8819. @section selectivecolor
  8820. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8821. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8822. by the "purity" of the color (that is, how saturated it already is).
  8823. This filter is similar to the Adobe Photoshop Selective Color tool.
  8824. The filter accepts the following options:
  8825. @table @option
  8826. @item correction_method
  8827. Select color correction method.
  8828. Available values are:
  8829. @table @samp
  8830. @item absolute
  8831. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8832. component value).
  8833. @item relative
  8834. Specified adjustments are relative to the original component value.
  8835. @end table
  8836. Default is @code{absolute}.
  8837. @item reds
  8838. Adjustments for red pixels (pixels where the red component is the maximum)
  8839. @item yellows
  8840. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8841. @item greens
  8842. Adjustments for green pixels (pixels where the green component is the maximum)
  8843. @item cyans
  8844. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8845. @item blues
  8846. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8847. @item magentas
  8848. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8849. @item whites
  8850. Adjustments for white pixels (pixels where all components are greater than 128)
  8851. @item neutrals
  8852. Adjustments for all pixels except pure black and pure white
  8853. @item blacks
  8854. Adjustments for black pixels (pixels where all components are lesser than 128)
  8855. @item psfile
  8856. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8857. @end table
  8858. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8859. 4 space separated floating point adjustment values in the [-1,1] range,
  8860. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8861. pixels of its range.
  8862. @subsection Examples
  8863. @itemize
  8864. @item
  8865. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8866. increase magenta by 27% in blue areas:
  8867. @example
  8868. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8869. @end example
  8870. @item
  8871. Use a Photoshop selective color preset:
  8872. @example
  8873. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8874. @end example
  8875. @end itemize
  8876. @section separatefields
  8877. The @code{separatefields} takes a frame-based video input and splits
  8878. each frame into its components fields, producing a new half height clip
  8879. with twice the frame rate and twice the frame count.
  8880. This filter use field-dominance information in frame to decide which
  8881. of each pair of fields to place first in the output.
  8882. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8883. @section setdar, setsar
  8884. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8885. output video.
  8886. This is done by changing the specified Sample (aka Pixel) Aspect
  8887. Ratio, according to the following equation:
  8888. @example
  8889. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8890. @end example
  8891. Keep in mind that the @code{setdar} filter does not modify the pixel
  8892. dimensions of the video frame. Also, the display aspect ratio set by
  8893. this filter may be changed by later filters in the filterchain,
  8894. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8895. applied.
  8896. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8897. the filter output video.
  8898. Note that as a consequence of the application of this filter, the
  8899. output display aspect ratio will change according to the equation
  8900. above.
  8901. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8902. filter may be changed by later filters in the filterchain, e.g. if
  8903. another "setsar" or a "setdar" filter is applied.
  8904. It accepts the following parameters:
  8905. @table @option
  8906. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8907. Set the aspect ratio used by the filter.
  8908. The parameter can be a floating point number string, an expression, or
  8909. a string of the form @var{num}:@var{den}, where @var{num} and
  8910. @var{den} are the numerator and denominator of the aspect ratio. If
  8911. the parameter is not specified, it is assumed the value "0".
  8912. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8913. should be escaped.
  8914. @item max
  8915. Set the maximum integer value to use for expressing numerator and
  8916. denominator when reducing the expressed aspect ratio to a rational.
  8917. Default value is @code{100}.
  8918. @end table
  8919. The parameter @var{sar} is an expression containing
  8920. the following constants:
  8921. @table @option
  8922. @item E, PI, PHI
  8923. These are approximated values for the mathematical constants e
  8924. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8925. @item w, h
  8926. The input width and height.
  8927. @item a
  8928. These are the same as @var{w} / @var{h}.
  8929. @item sar
  8930. The input sample aspect ratio.
  8931. @item dar
  8932. The input display aspect ratio. It is the same as
  8933. (@var{w} / @var{h}) * @var{sar}.
  8934. @item hsub, vsub
  8935. Horizontal and vertical chroma subsample values. For example, for the
  8936. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8937. @end table
  8938. @subsection Examples
  8939. @itemize
  8940. @item
  8941. To change the display aspect ratio to 16:9, specify one of the following:
  8942. @example
  8943. setdar=dar=1.77777
  8944. setdar=dar=16/9
  8945. @end example
  8946. @item
  8947. To change the sample aspect ratio to 10:11, specify:
  8948. @example
  8949. setsar=sar=10/11
  8950. @end example
  8951. @item
  8952. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8953. 1000 in the aspect ratio reduction, use the command:
  8954. @example
  8955. setdar=ratio=16/9:max=1000
  8956. @end example
  8957. @end itemize
  8958. @anchor{setfield}
  8959. @section setfield
  8960. Force field for the output video frame.
  8961. The @code{setfield} filter marks the interlace type field for the
  8962. output frames. It does not change the input frame, but only sets the
  8963. corresponding property, which affects how the frame is treated by
  8964. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8965. The filter accepts the following options:
  8966. @table @option
  8967. @item mode
  8968. Available values are:
  8969. @table @samp
  8970. @item auto
  8971. Keep the same field property.
  8972. @item bff
  8973. Mark the frame as bottom-field-first.
  8974. @item tff
  8975. Mark the frame as top-field-first.
  8976. @item prog
  8977. Mark the frame as progressive.
  8978. @end table
  8979. @end table
  8980. @section showinfo
  8981. Show a line containing various information for each input video frame.
  8982. The input video is not modified.
  8983. The shown line contains a sequence of key/value pairs of the form
  8984. @var{key}:@var{value}.
  8985. The following values are shown in the output:
  8986. @table @option
  8987. @item n
  8988. The (sequential) number of the input frame, starting from 0.
  8989. @item pts
  8990. The Presentation TimeStamp of the input frame, expressed as a number of
  8991. time base units. The time base unit depends on the filter input pad.
  8992. @item pts_time
  8993. The Presentation TimeStamp of the input frame, expressed as a number of
  8994. seconds.
  8995. @item pos
  8996. The position of the frame in the input stream, or -1 if this information is
  8997. unavailable and/or meaningless (for example in case of synthetic video).
  8998. @item fmt
  8999. The pixel format name.
  9000. @item sar
  9001. The sample aspect ratio of the input frame, expressed in the form
  9002. @var{num}/@var{den}.
  9003. @item s
  9004. The size of the input frame. For the syntax of this option, check the
  9005. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9006. @item i
  9007. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9008. for bottom field first).
  9009. @item iskey
  9010. This is 1 if the frame is a key frame, 0 otherwise.
  9011. @item type
  9012. The picture type of the input frame ("I" for an I-frame, "P" for a
  9013. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9014. Also refer to the documentation of the @code{AVPictureType} enum and of
  9015. the @code{av_get_picture_type_char} function defined in
  9016. @file{libavutil/avutil.h}.
  9017. @item checksum
  9018. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9019. @item plane_checksum
  9020. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9021. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9022. @end table
  9023. @section showpalette
  9024. Displays the 256 colors palette of each frame. This filter is only relevant for
  9025. @var{pal8} pixel format frames.
  9026. It accepts the following option:
  9027. @table @option
  9028. @item s
  9029. Set the size of the box used to represent one palette color entry. Default is
  9030. @code{30} (for a @code{30x30} pixel box).
  9031. @end table
  9032. @section shuffleframes
  9033. Reorder and/or duplicate video frames.
  9034. It accepts the following parameters:
  9035. @table @option
  9036. @item mapping
  9037. Set the destination indexes of input frames.
  9038. This is space or '|' separated list of indexes that maps input frames to output
  9039. frames. Number of indexes also sets maximal value that each index may have.
  9040. @end table
  9041. The first frame has the index 0. The default is to keep the input unchanged.
  9042. Swap second and third frame of every three frames of the input:
  9043. @example
  9044. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9045. @end example
  9046. @section shuffleplanes
  9047. Reorder and/or duplicate video planes.
  9048. It accepts the following parameters:
  9049. @table @option
  9050. @item map0
  9051. The index of the input plane to be used as the first output plane.
  9052. @item map1
  9053. The index of the input plane to be used as the second output plane.
  9054. @item map2
  9055. The index of the input plane to be used as the third output plane.
  9056. @item map3
  9057. The index of the input plane to be used as the fourth output plane.
  9058. @end table
  9059. The first plane has the index 0. The default is to keep the input unchanged.
  9060. Swap the second and third planes of the input:
  9061. @example
  9062. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9063. @end example
  9064. @anchor{signalstats}
  9065. @section signalstats
  9066. Evaluate various visual metrics that assist in determining issues associated
  9067. with the digitization of analog video media.
  9068. By default the filter will log these metadata values:
  9069. @table @option
  9070. @item YMIN
  9071. Display the minimal Y value contained within the input frame. Expressed in
  9072. range of [0-255].
  9073. @item YLOW
  9074. Display the Y value at the 10% percentile within the input frame. Expressed in
  9075. range of [0-255].
  9076. @item YAVG
  9077. Display the average Y value within the input frame. Expressed in range of
  9078. [0-255].
  9079. @item YHIGH
  9080. Display the Y value at the 90% percentile within the input frame. Expressed in
  9081. range of [0-255].
  9082. @item YMAX
  9083. Display the maximum Y value contained within the input frame. Expressed in
  9084. range of [0-255].
  9085. @item UMIN
  9086. Display the minimal U value contained within the input frame. Expressed in
  9087. range of [0-255].
  9088. @item ULOW
  9089. Display the U value at the 10% percentile within the input frame. Expressed in
  9090. range of [0-255].
  9091. @item UAVG
  9092. Display the average U value within the input frame. Expressed in range of
  9093. [0-255].
  9094. @item UHIGH
  9095. Display the U value at the 90% percentile within the input frame. Expressed in
  9096. range of [0-255].
  9097. @item UMAX
  9098. Display the maximum U value contained within the input frame. Expressed in
  9099. range of [0-255].
  9100. @item VMIN
  9101. Display the minimal V value contained within the input frame. Expressed in
  9102. range of [0-255].
  9103. @item VLOW
  9104. Display the V value at the 10% percentile within the input frame. Expressed in
  9105. range of [0-255].
  9106. @item VAVG
  9107. Display the average V value within the input frame. Expressed in range of
  9108. [0-255].
  9109. @item VHIGH
  9110. Display the V value at the 90% percentile within the input frame. Expressed in
  9111. range of [0-255].
  9112. @item VMAX
  9113. Display the maximum V value contained within the input frame. Expressed in
  9114. range of [0-255].
  9115. @item SATMIN
  9116. Display the minimal saturation value contained within the input frame.
  9117. Expressed in range of [0-~181.02].
  9118. @item SATLOW
  9119. Display the saturation value at the 10% percentile within the input frame.
  9120. Expressed in range of [0-~181.02].
  9121. @item SATAVG
  9122. Display the average saturation value within the input frame. Expressed in range
  9123. of [0-~181.02].
  9124. @item SATHIGH
  9125. Display the saturation value at the 90% percentile within the input frame.
  9126. Expressed in range of [0-~181.02].
  9127. @item SATMAX
  9128. Display the maximum saturation value contained within the input frame.
  9129. Expressed in range of [0-~181.02].
  9130. @item HUEMED
  9131. Display the median value for hue within the input frame. Expressed in range of
  9132. [0-360].
  9133. @item HUEAVG
  9134. Display the average value for hue within the input frame. Expressed in range of
  9135. [0-360].
  9136. @item YDIF
  9137. Display the average of sample value difference between all values of the Y
  9138. plane in the current frame and corresponding values of the previous input frame.
  9139. Expressed in range of [0-255].
  9140. @item UDIF
  9141. Display the average of sample value difference between all values of the U
  9142. plane in the current frame and corresponding values of the previous input frame.
  9143. Expressed in range of [0-255].
  9144. @item VDIF
  9145. Display the average of sample value difference between all values of the V
  9146. plane in the current frame and corresponding values of the previous input frame.
  9147. Expressed in range of [0-255].
  9148. @end table
  9149. The filter accepts the following options:
  9150. @table @option
  9151. @item stat
  9152. @item out
  9153. @option{stat} specify an additional form of image analysis.
  9154. @option{out} output video with the specified type of pixel highlighted.
  9155. Both options accept the following values:
  9156. @table @samp
  9157. @item tout
  9158. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9159. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9160. include the results of video dropouts, head clogs, or tape tracking issues.
  9161. @item vrep
  9162. Identify @var{vertical line repetition}. Vertical line repetition includes
  9163. similar rows of pixels within a frame. In born-digital video vertical line
  9164. repetition is common, but this pattern is uncommon in video digitized from an
  9165. analog source. When it occurs in video that results from the digitization of an
  9166. analog source it can indicate concealment from a dropout compensator.
  9167. @item brng
  9168. Identify pixels that fall outside of legal broadcast range.
  9169. @end table
  9170. @item color, c
  9171. Set the highlight color for the @option{out} option. The default color is
  9172. yellow.
  9173. @end table
  9174. @subsection Examples
  9175. @itemize
  9176. @item
  9177. Output data of various video metrics:
  9178. @example
  9179. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9180. @end example
  9181. @item
  9182. Output specific data about the minimum and maximum values of the Y plane per frame:
  9183. @example
  9184. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9185. @end example
  9186. @item
  9187. Playback video while highlighting pixels that are outside of broadcast range in red.
  9188. @example
  9189. ffplay example.mov -vf signalstats="out=brng:color=red"
  9190. @end example
  9191. @item
  9192. Playback video with signalstats metadata drawn over the frame.
  9193. @example
  9194. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9195. @end example
  9196. The contents of signalstat_drawtext.txt used in the command are:
  9197. @example
  9198. time %@{pts:hms@}
  9199. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9200. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9201. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9202. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9203. @end example
  9204. @end itemize
  9205. @anchor{smartblur}
  9206. @section smartblur
  9207. Blur the input video without impacting the outlines.
  9208. It accepts the following options:
  9209. @table @option
  9210. @item luma_radius, lr
  9211. Set the luma radius. The option value must be a float number in
  9212. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9213. used to blur the image (slower if larger). Default value is 1.0.
  9214. @item luma_strength, ls
  9215. Set the luma strength. The option value must be a float number
  9216. in the range [-1.0,1.0] that configures the blurring. A value included
  9217. in [0.0,1.0] will blur the image whereas a value included in
  9218. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9219. @item luma_threshold, lt
  9220. Set the luma threshold used as a coefficient to determine
  9221. whether a pixel should be blurred or not. The option value must be an
  9222. integer in the range [-30,30]. A value of 0 will filter all the image,
  9223. a value included in [0,30] will filter flat areas and a value included
  9224. in [-30,0] will filter edges. Default value is 0.
  9225. @item chroma_radius, cr
  9226. Set the chroma radius. The option value must be a float number in
  9227. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9228. used to blur the image (slower if larger). Default value is 1.0.
  9229. @item chroma_strength, cs
  9230. Set the chroma strength. The option value must be a float number
  9231. in the range [-1.0,1.0] that configures the blurring. A value included
  9232. in [0.0,1.0] will blur the image whereas a value included in
  9233. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9234. @item chroma_threshold, ct
  9235. Set the chroma threshold used as a coefficient to determine
  9236. whether a pixel should be blurred or not. The option value must be an
  9237. integer in the range [-30,30]. A value of 0 will filter all the image,
  9238. a value included in [0,30] will filter flat areas and a value included
  9239. in [-30,0] will filter edges. Default value is 0.
  9240. @end table
  9241. If a chroma option is not explicitly set, the corresponding luma value
  9242. is set.
  9243. @section ssim
  9244. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9245. This filter takes in input two input videos, the first input is
  9246. considered the "main" source and is passed unchanged to the
  9247. output. The second input is used as a "reference" video for computing
  9248. the SSIM.
  9249. Both video inputs must have the same resolution and pixel format for
  9250. this filter to work correctly. Also it assumes that both inputs
  9251. have the same number of frames, which are compared one by one.
  9252. The filter stores the calculated SSIM of each frame.
  9253. The description of the accepted parameters follows.
  9254. @table @option
  9255. @item stats_file, f
  9256. If specified the filter will use the named file to save the SSIM of
  9257. each individual frame. When filename equals "-" the data is sent to
  9258. standard output.
  9259. @end table
  9260. The file printed if @var{stats_file} is selected, contains a sequence of
  9261. key/value pairs of the form @var{key}:@var{value} for each compared
  9262. couple of frames.
  9263. A description of each shown parameter follows:
  9264. @table @option
  9265. @item n
  9266. sequential number of the input frame, starting from 1
  9267. @item Y, U, V, R, G, B
  9268. SSIM of the compared frames for the component specified by the suffix.
  9269. @item All
  9270. SSIM of the compared frames for the whole frame.
  9271. @item dB
  9272. Same as above but in dB representation.
  9273. @end table
  9274. For example:
  9275. @example
  9276. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9277. [main][ref] ssim="stats_file=stats.log" [out]
  9278. @end example
  9279. On this example the input file being processed is compared with the
  9280. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9281. is stored in @file{stats.log}.
  9282. Another example with both psnr and ssim at same time:
  9283. @example
  9284. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9285. @end example
  9286. @section stereo3d
  9287. Convert between different stereoscopic image formats.
  9288. The filters accept the following options:
  9289. @table @option
  9290. @item in
  9291. Set stereoscopic image format of input.
  9292. Available values for input image formats are:
  9293. @table @samp
  9294. @item sbsl
  9295. side by side parallel (left eye left, right eye right)
  9296. @item sbsr
  9297. side by side crosseye (right eye left, left eye right)
  9298. @item sbs2l
  9299. side by side parallel with half width resolution
  9300. (left eye left, right eye right)
  9301. @item sbs2r
  9302. side by side crosseye with half width resolution
  9303. (right eye left, left eye right)
  9304. @item abl
  9305. above-below (left eye above, right eye below)
  9306. @item abr
  9307. above-below (right eye above, left eye below)
  9308. @item ab2l
  9309. above-below with half height resolution
  9310. (left eye above, right eye below)
  9311. @item ab2r
  9312. above-below with half height resolution
  9313. (right eye above, left eye below)
  9314. @item al
  9315. alternating frames (left eye first, right eye second)
  9316. @item ar
  9317. alternating frames (right eye first, left eye second)
  9318. @item irl
  9319. interleaved rows (left eye has top row, right eye starts on next row)
  9320. @item irr
  9321. interleaved rows (right eye has top row, left eye starts on next row)
  9322. @item icl
  9323. interleaved columns, left eye first
  9324. @item icr
  9325. interleaved columns, right eye first
  9326. Default value is @samp{sbsl}.
  9327. @end table
  9328. @item out
  9329. Set stereoscopic image format of output.
  9330. @table @samp
  9331. @item sbsl
  9332. side by side parallel (left eye left, right eye right)
  9333. @item sbsr
  9334. side by side crosseye (right eye left, left eye right)
  9335. @item sbs2l
  9336. side by side parallel with half width resolution
  9337. (left eye left, right eye right)
  9338. @item sbs2r
  9339. side by side crosseye with half width resolution
  9340. (right eye left, left eye right)
  9341. @item abl
  9342. above-below (left eye above, right eye below)
  9343. @item abr
  9344. above-below (right eye above, left eye below)
  9345. @item ab2l
  9346. above-below with half height resolution
  9347. (left eye above, right eye below)
  9348. @item ab2r
  9349. above-below with half height resolution
  9350. (right eye above, left eye below)
  9351. @item al
  9352. alternating frames (left eye first, right eye second)
  9353. @item ar
  9354. alternating frames (right eye first, left eye second)
  9355. @item irl
  9356. interleaved rows (left eye has top row, right eye starts on next row)
  9357. @item irr
  9358. interleaved rows (right eye has top row, left eye starts on next row)
  9359. @item arbg
  9360. anaglyph red/blue gray
  9361. (red filter on left eye, blue filter on right eye)
  9362. @item argg
  9363. anaglyph red/green gray
  9364. (red filter on left eye, green filter on right eye)
  9365. @item arcg
  9366. anaglyph red/cyan gray
  9367. (red filter on left eye, cyan filter on right eye)
  9368. @item arch
  9369. anaglyph red/cyan half colored
  9370. (red filter on left eye, cyan filter on right eye)
  9371. @item arcc
  9372. anaglyph red/cyan color
  9373. (red filter on left eye, cyan filter on right eye)
  9374. @item arcd
  9375. anaglyph red/cyan color optimized with the least squares projection of dubois
  9376. (red filter on left eye, cyan filter on right eye)
  9377. @item agmg
  9378. anaglyph green/magenta gray
  9379. (green filter on left eye, magenta filter on right eye)
  9380. @item agmh
  9381. anaglyph green/magenta half colored
  9382. (green filter on left eye, magenta filter on right eye)
  9383. @item agmc
  9384. anaglyph green/magenta colored
  9385. (green filter on left eye, magenta filter on right eye)
  9386. @item agmd
  9387. anaglyph green/magenta color optimized with the least squares projection of dubois
  9388. (green filter on left eye, magenta filter on right eye)
  9389. @item aybg
  9390. anaglyph yellow/blue gray
  9391. (yellow filter on left eye, blue filter on right eye)
  9392. @item aybh
  9393. anaglyph yellow/blue half colored
  9394. (yellow filter on left eye, blue filter on right eye)
  9395. @item aybc
  9396. anaglyph yellow/blue colored
  9397. (yellow filter on left eye, blue filter on right eye)
  9398. @item aybd
  9399. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9400. (yellow filter on left eye, blue filter on right eye)
  9401. @item ml
  9402. mono output (left eye only)
  9403. @item mr
  9404. mono output (right eye only)
  9405. @item chl
  9406. checkerboard, left eye first
  9407. @item chr
  9408. checkerboard, right eye first
  9409. @item icl
  9410. interleaved columns, left eye first
  9411. @item icr
  9412. interleaved columns, right eye first
  9413. @end table
  9414. Default value is @samp{arcd}.
  9415. @end table
  9416. @subsection Examples
  9417. @itemize
  9418. @item
  9419. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9420. @example
  9421. stereo3d=sbsl:aybd
  9422. @end example
  9423. @item
  9424. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9425. @example
  9426. stereo3d=abl:sbsr
  9427. @end example
  9428. @end itemize
  9429. @section streamselect, astreamselect
  9430. Select video or audio streams.
  9431. The filter accepts the following options:
  9432. @table @option
  9433. @item inputs
  9434. Set number of inputs. Default is 2.
  9435. @item map
  9436. Set input indexes to remap to outputs.
  9437. @end table
  9438. @subsection Commands
  9439. The @code{streamselect} and @code{astreamselect} filter supports the following
  9440. commands:
  9441. @table @option
  9442. @item map
  9443. Set input indexes to remap to outputs.
  9444. @end table
  9445. @subsection Examples
  9446. @itemize
  9447. @item
  9448. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9449. @example
  9450. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9451. @end example
  9452. @item
  9453. Same as above, but for audio:
  9454. @example
  9455. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9456. @end example
  9457. @end itemize
  9458. @anchor{spp}
  9459. @section spp
  9460. Apply a simple postprocessing filter that compresses and decompresses the image
  9461. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9462. and average the results.
  9463. The filter accepts the following options:
  9464. @table @option
  9465. @item quality
  9466. Set quality. This option defines the number of levels for averaging. It accepts
  9467. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9468. effect. A value of @code{6} means the higher quality. For each increment of
  9469. that value the speed drops by a factor of approximately 2. Default value is
  9470. @code{3}.
  9471. @item qp
  9472. Force a constant quantization parameter. If not set, the filter will use the QP
  9473. from the video stream (if available).
  9474. @item mode
  9475. Set thresholding mode. Available modes are:
  9476. @table @samp
  9477. @item hard
  9478. Set hard thresholding (default).
  9479. @item soft
  9480. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9481. @end table
  9482. @item use_bframe_qp
  9483. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9484. option may cause flicker since the B-Frames have often larger QP. Default is
  9485. @code{0} (not enabled).
  9486. @end table
  9487. @anchor{subtitles}
  9488. @section subtitles
  9489. Draw subtitles on top of input video using the libass library.
  9490. To enable compilation of this filter you need to configure FFmpeg with
  9491. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9492. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9493. Alpha) subtitles format.
  9494. The filter accepts the following options:
  9495. @table @option
  9496. @item filename, f
  9497. Set the filename of the subtitle file to read. It must be specified.
  9498. @item original_size
  9499. Specify the size of the original video, the video for which the ASS file
  9500. was composed. For the syntax of this option, check the
  9501. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9502. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9503. correctly scale the fonts if the aspect ratio has been changed.
  9504. @item fontsdir
  9505. Set a directory path containing fonts that can be used by the filter.
  9506. These fonts will be used in addition to whatever the font provider uses.
  9507. @item charenc
  9508. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9509. useful if not UTF-8.
  9510. @item stream_index, si
  9511. Set subtitles stream index. @code{subtitles} filter only.
  9512. @item force_style
  9513. Override default style or script info parameters of the subtitles. It accepts a
  9514. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9515. @end table
  9516. If the first key is not specified, it is assumed that the first value
  9517. specifies the @option{filename}.
  9518. For example, to render the file @file{sub.srt} on top of the input
  9519. video, use the command:
  9520. @example
  9521. subtitles=sub.srt
  9522. @end example
  9523. which is equivalent to:
  9524. @example
  9525. subtitles=filename=sub.srt
  9526. @end example
  9527. To render the default subtitles stream from file @file{video.mkv}, use:
  9528. @example
  9529. subtitles=video.mkv
  9530. @end example
  9531. To render the second subtitles stream from that file, use:
  9532. @example
  9533. subtitles=video.mkv:si=1
  9534. @end example
  9535. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9536. @code{DejaVu Serif}, use:
  9537. @example
  9538. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9539. @end example
  9540. @section super2xsai
  9541. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9542. Interpolate) pixel art scaling algorithm.
  9543. Useful for enlarging pixel art images without reducing sharpness.
  9544. @section swaprect
  9545. Swap two rectangular objects in video.
  9546. This filter accepts the following options:
  9547. @table @option
  9548. @item w
  9549. Set object width.
  9550. @item h
  9551. Set object height.
  9552. @item x1
  9553. Set 1st rect x coordinate.
  9554. @item y1
  9555. Set 1st rect y coordinate.
  9556. @item x2
  9557. Set 2nd rect x coordinate.
  9558. @item y2
  9559. Set 2nd rect y coordinate.
  9560. All expressions are evaluated once for each frame.
  9561. @end table
  9562. The all options are expressions containing the following constants:
  9563. @table @option
  9564. @item w
  9565. @item h
  9566. The input width and height.
  9567. @item a
  9568. same as @var{w} / @var{h}
  9569. @item sar
  9570. input sample aspect ratio
  9571. @item dar
  9572. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9573. @item n
  9574. The number of the input frame, starting from 0.
  9575. @item t
  9576. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9577. @item pos
  9578. the position in the file of the input frame, NAN if unknown
  9579. @end table
  9580. @section swapuv
  9581. Swap U & V plane.
  9582. @section telecine
  9583. Apply telecine process to the video.
  9584. This filter accepts the following options:
  9585. @table @option
  9586. @item first_field
  9587. @table @samp
  9588. @item top, t
  9589. top field first
  9590. @item bottom, b
  9591. bottom field first
  9592. The default value is @code{top}.
  9593. @end table
  9594. @item pattern
  9595. A string of numbers representing the pulldown pattern you wish to apply.
  9596. The default value is @code{23}.
  9597. @end table
  9598. @example
  9599. Some typical patterns:
  9600. NTSC output (30i):
  9601. 27.5p: 32222
  9602. 24p: 23 (classic)
  9603. 24p: 2332 (preferred)
  9604. 20p: 33
  9605. 18p: 334
  9606. 16p: 3444
  9607. PAL output (25i):
  9608. 27.5p: 12222
  9609. 24p: 222222222223 ("Euro pulldown")
  9610. 16.67p: 33
  9611. 16p: 33333334
  9612. @end example
  9613. @section thumbnail
  9614. Select the most representative frame in a given sequence of consecutive frames.
  9615. The filter accepts the following options:
  9616. @table @option
  9617. @item n
  9618. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9619. will pick one of them, and then handle the next batch of @var{n} frames until
  9620. the end. Default is @code{100}.
  9621. @end table
  9622. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9623. value will result in a higher memory usage, so a high value is not recommended.
  9624. @subsection Examples
  9625. @itemize
  9626. @item
  9627. Extract one picture each 50 frames:
  9628. @example
  9629. thumbnail=50
  9630. @end example
  9631. @item
  9632. Complete example of a thumbnail creation with @command{ffmpeg}:
  9633. @example
  9634. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9635. @end example
  9636. @end itemize
  9637. @section tile
  9638. Tile several successive frames together.
  9639. The filter accepts the following options:
  9640. @table @option
  9641. @item layout
  9642. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9643. this option, check the
  9644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9645. @item nb_frames
  9646. Set the maximum number of frames to render in the given area. It must be less
  9647. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9648. the area will be used.
  9649. @item margin
  9650. Set the outer border margin in pixels.
  9651. @item padding
  9652. Set the inner border thickness (i.e. the number of pixels between frames). For
  9653. more advanced padding options (such as having different values for the edges),
  9654. refer to the pad video filter.
  9655. @item color
  9656. Specify the color of the unused area. For the syntax of this option, check the
  9657. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9658. is "black".
  9659. @end table
  9660. @subsection Examples
  9661. @itemize
  9662. @item
  9663. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9664. @example
  9665. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9666. @end example
  9667. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9668. duplicating each output frame to accommodate the originally detected frame
  9669. rate.
  9670. @item
  9671. Display @code{5} pictures in an area of @code{3x2} frames,
  9672. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9673. mixed flat and named options:
  9674. @example
  9675. tile=3x2:nb_frames=5:padding=7:margin=2
  9676. @end example
  9677. @end itemize
  9678. @section tinterlace
  9679. Perform various types of temporal field interlacing.
  9680. Frames are counted starting from 1, so the first input frame is
  9681. considered odd.
  9682. The filter accepts the following options:
  9683. @table @option
  9684. @item mode
  9685. Specify the mode of the interlacing. This option can also be specified
  9686. as a value alone. See below for a list of values for this option.
  9687. Available values are:
  9688. @table @samp
  9689. @item merge, 0
  9690. Move odd frames into the upper field, even into the lower field,
  9691. generating a double height frame at half frame rate.
  9692. @example
  9693. ------> time
  9694. Input:
  9695. Frame 1 Frame 2 Frame 3 Frame 4
  9696. 11111 22222 33333 44444
  9697. 11111 22222 33333 44444
  9698. 11111 22222 33333 44444
  9699. 11111 22222 33333 44444
  9700. Output:
  9701. 11111 33333
  9702. 22222 44444
  9703. 11111 33333
  9704. 22222 44444
  9705. 11111 33333
  9706. 22222 44444
  9707. 11111 33333
  9708. 22222 44444
  9709. @end example
  9710. @item drop_even, 1
  9711. Only output odd frames, even frames are dropped, generating a frame with
  9712. unchanged height at half frame rate.
  9713. @example
  9714. ------> time
  9715. Input:
  9716. Frame 1 Frame 2 Frame 3 Frame 4
  9717. 11111 22222 33333 44444
  9718. 11111 22222 33333 44444
  9719. 11111 22222 33333 44444
  9720. 11111 22222 33333 44444
  9721. Output:
  9722. 11111 33333
  9723. 11111 33333
  9724. 11111 33333
  9725. 11111 33333
  9726. @end example
  9727. @item drop_odd, 2
  9728. Only output even frames, odd frames are dropped, generating a frame with
  9729. unchanged height at half frame rate.
  9730. @example
  9731. ------> time
  9732. Input:
  9733. Frame 1 Frame 2 Frame 3 Frame 4
  9734. 11111 22222 33333 44444
  9735. 11111 22222 33333 44444
  9736. 11111 22222 33333 44444
  9737. 11111 22222 33333 44444
  9738. Output:
  9739. 22222 44444
  9740. 22222 44444
  9741. 22222 44444
  9742. 22222 44444
  9743. @end example
  9744. @item pad, 3
  9745. Expand each frame to full height, but pad alternate lines with black,
  9746. generating a frame with double height at the same input frame rate.
  9747. @example
  9748. ------> time
  9749. Input:
  9750. Frame 1 Frame 2 Frame 3 Frame 4
  9751. 11111 22222 33333 44444
  9752. 11111 22222 33333 44444
  9753. 11111 22222 33333 44444
  9754. 11111 22222 33333 44444
  9755. Output:
  9756. 11111 ..... 33333 .....
  9757. ..... 22222 ..... 44444
  9758. 11111 ..... 33333 .....
  9759. ..... 22222 ..... 44444
  9760. 11111 ..... 33333 .....
  9761. ..... 22222 ..... 44444
  9762. 11111 ..... 33333 .....
  9763. ..... 22222 ..... 44444
  9764. @end example
  9765. @item interleave_top, 4
  9766. Interleave the upper field from odd frames with the lower field from
  9767. even frames, generating a frame with unchanged height at half frame rate.
  9768. @example
  9769. ------> time
  9770. Input:
  9771. Frame 1 Frame 2 Frame 3 Frame 4
  9772. 11111<- 22222 33333<- 44444
  9773. 11111 22222<- 33333 44444<-
  9774. 11111<- 22222 33333<- 44444
  9775. 11111 22222<- 33333 44444<-
  9776. Output:
  9777. 11111 33333
  9778. 22222 44444
  9779. 11111 33333
  9780. 22222 44444
  9781. @end example
  9782. @item interleave_bottom, 5
  9783. Interleave the lower field from odd frames with the upper field from
  9784. even frames, generating a frame with unchanged height at half frame rate.
  9785. @example
  9786. ------> time
  9787. Input:
  9788. Frame 1 Frame 2 Frame 3 Frame 4
  9789. 11111 22222<- 33333 44444<-
  9790. 11111<- 22222 33333<- 44444
  9791. 11111 22222<- 33333 44444<-
  9792. 11111<- 22222 33333<- 44444
  9793. Output:
  9794. 22222 44444
  9795. 11111 33333
  9796. 22222 44444
  9797. 11111 33333
  9798. @end example
  9799. @item interlacex2, 6
  9800. Double frame rate with unchanged height. Frames are inserted each
  9801. containing the second temporal field from the previous input frame and
  9802. the first temporal field from the next input frame. This mode relies on
  9803. the top_field_first flag. Useful for interlaced video displays with no
  9804. field synchronisation.
  9805. @example
  9806. ------> time
  9807. Input:
  9808. Frame 1 Frame 2 Frame 3 Frame 4
  9809. 11111 22222 33333 44444
  9810. 11111 22222 33333 44444
  9811. 11111 22222 33333 44444
  9812. 11111 22222 33333 44444
  9813. Output:
  9814. 11111 22222 22222 33333 33333 44444 44444
  9815. 11111 11111 22222 22222 33333 33333 44444
  9816. 11111 22222 22222 33333 33333 44444 44444
  9817. 11111 11111 22222 22222 33333 33333 44444
  9818. @end example
  9819. @item mergex2, 7
  9820. Move odd frames into the upper field, even into the lower field,
  9821. generating a double height frame at same frame rate.
  9822. @example
  9823. ------> time
  9824. Input:
  9825. Frame 1 Frame 2 Frame 3 Frame 4
  9826. 11111 22222 33333 44444
  9827. 11111 22222 33333 44444
  9828. 11111 22222 33333 44444
  9829. 11111 22222 33333 44444
  9830. Output:
  9831. 11111 33333 33333 55555
  9832. 22222 22222 44444 44444
  9833. 11111 33333 33333 55555
  9834. 22222 22222 44444 44444
  9835. 11111 33333 33333 55555
  9836. 22222 22222 44444 44444
  9837. 11111 33333 33333 55555
  9838. 22222 22222 44444 44444
  9839. @end example
  9840. @end table
  9841. Numeric values are deprecated but are accepted for backward
  9842. compatibility reasons.
  9843. Default mode is @code{merge}.
  9844. @item flags
  9845. Specify flags influencing the filter process.
  9846. Available value for @var{flags} is:
  9847. @table @option
  9848. @item low_pass_filter, vlfp
  9849. Enable vertical low-pass filtering in the filter.
  9850. Vertical low-pass filtering is required when creating an interlaced
  9851. destination from a progressive source which contains high-frequency
  9852. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9853. patterning.
  9854. Vertical low-pass filtering can only be enabled for @option{mode}
  9855. @var{interleave_top} and @var{interleave_bottom}.
  9856. @end table
  9857. @end table
  9858. @section transpose
  9859. Transpose rows with columns in the input video and optionally flip it.
  9860. It accepts the following parameters:
  9861. @table @option
  9862. @item dir
  9863. Specify the transposition direction.
  9864. Can assume the following values:
  9865. @table @samp
  9866. @item 0, 4, cclock_flip
  9867. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9868. @example
  9869. L.R L.l
  9870. . . -> . .
  9871. l.r R.r
  9872. @end example
  9873. @item 1, 5, clock
  9874. Rotate by 90 degrees clockwise, that is:
  9875. @example
  9876. L.R l.L
  9877. . . -> . .
  9878. l.r r.R
  9879. @end example
  9880. @item 2, 6, cclock
  9881. Rotate by 90 degrees counterclockwise, that is:
  9882. @example
  9883. L.R R.r
  9884. . . -> . .
  9885. l.r L.l
  9886. @end example
  9887. @item 3, 7, clock_flip
  9888. Rotate by 90 degrees clockwise and vertically flip, that is:
  9889. @example
  9890. L.R r.R
  9891. . . -> . .
  9892. l.r l.L
  9893. @end example
  9894. @end table
  9895. For values between 4-7, the transposition is only done if the input
  9896. video geometry is portrait and not landscape. These values are
  9897. deprecated, the @code{passthrough} option should be used instead.
  9898. Numerical values are deprecated, and should be dropped in favor of
  9899. symbolic constants.
  9900. @item passthrough
  9901. Do not apply the transposition if the input geometry matches the one
  9902. specified by the specified value. It accepts the following values:
  9903. @table @samp
  9904. @item none
  9905. Always apply transposition.
  9906. @item portrait
  9907. Preserve portrait geometry (when @var{height} >= @var{width}).
  9908. @item landscape
  9909. Preserve landscape geometry (when @var{width} >= @var{height}).
  9910. @end table
  9911. Default value is @code{none}.
  9912. @end table
  9913. For example to rotate by 90 degrees clockwise and preserve portrait
  9914. layout:
  9915. @example
  9916. transpose=dir=1:passthrough=portrait
  9917. @end example
  9918. The command above can also be specified as:
  9919. @example
  9920. transpose=1:portrait
  9921. @end example
  9922. @section trim
  9923. Trim the input so that the output contains one continuous subpart of the input.
  9924. It accepts the following parameters:
  9925. @table @option
  9926. @item start
  9927. Specify the time of the start of the kept section, i.e. the frame with the
  9928. timestamp @var{start} will be the first frame in the output.
  9929. @item end
  9930. Specify the time of the first frame that will be dropped, i.e. the frame
  9931. immediately preceding the one with the timestamp @var{end} will be the last
  9932. frame in the output.
  9933. @item start_pts
  9934. This is the same as @var{start}, except this option sets the start timestamp
  9935. in timebase units instead of seconds.
  9936. @item end_pts
  9937. This is the same as @var{end}, except this option sets the end timestamp
  9938. in timebase units instead of seconds.
  9939. @item duration
  9940. The maximum duration of the output in seconds.
  9941. @item start_frame
  9942. The number of the first frame that should be passed to the output.
  9943. @item end_frame
  9944. The number of the first frame that should be dropped.
  9945. @end table
  9946. @option{start}, @option{end}, and @option{duration} are expressed as time
  9947. duration specifications; see
  9948. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9949. for the accepted syntax.
  9950. Note that the first two sets of the start/end options and the @option{duration}
  9951. option look at the frame timestamp, while the _frame variants simply count the
  9952. frames that pass through the filter. Also note that this filter does not modify
  9953. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9954. setpts filter after the trim filter.
  9955. If multiple start or end options are set, this filter tries to be greedy and
  9956. keep all the frames that match at least one of the specified constraints. To keep
  9957. only the part that matches all the constraints at once, chain multiple trim
  9958. filters.
  9959. The defaults are such that all the input is kept. So it is possible to set e.g.
  9960. just the end values to keep everything before the specified time.
  9961. Examples:
  9962. @itemize
  9963. @item
  9964. Drop everything except the second minute of input:
  9965. @example
  9966. ffmpeg -i INPUT -vf trim=60:120
  9967. @end example
  9968. @item
  9969. Keep only the first second:
  9970. @example
  9971. ffmpeg -i INPUT -vf trim=duration=1
  9972. @end example
  9973. @end itemize
  9974. @anchor{unsharp}
  9975. @section unsharp
  9976. Sharpen or blur the input video.
  9977. It accepts the following parameters:
  9978. @table @option
  9979. @item luma_msize_x, lx
  9980. Set the luma matrix horizontal size. It must be an odd integer between
  9981. 3 and 63. The default value is 5.
  9982. @item luma_msize_y, ly
  9983. Set the luma matrix vertical size. It must be an odd integer between 3
  9984. and 63. The default value is 5.
  9985. @item luma_amount, la
  9986. Set the luma effect strength. It must be a floating point number, reasonable
  9987. values lay between -1.5 and 1.5.
  9988. Negative values will blur the input video, while positive values will
  9989. sharpen it, a value of zero will disable the effect.
  9990. Default value is 1.0.
  9991. @item chroma_msize_x, cx
  9992. Set the chroma matrix horizontal size. It must be an odd integer
  9993. between 3 and 63. The default value is 5.
  9994. @item chroma_msize_y, cy
  9995. Set the chroma matrix vertical size. It must be an odd integer
  9996. between 3 and 63. The default value is 5.
  9997. @item chroma_amount, ca
  9998. Set the chroma effect strength. It must be a floating point number, reasonable
  9999. values lay between -1.5 and 1.5.
  10000. Negative values will blur the input video, while positive values will
  10001. sharpen it, a value of zero will disable the effect.
  10002. Default value is 0.0.
  10003. @item opencl
  10004. If set to 1, specify using OpenCL capabilities, only available if
  10005. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10006. @end table
  10007. All parameters are optional and default to the equivalent of the
  10008. string '5:5:1.0:5:5:0.0'.
  10009. @subsection Examples
  10010. @itemize
  10011. @item
  10012. Apply strong luma sharpen effect:
  10013. @example
  10014. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10015. @end example
  10016. @item
  10017. Apply a strong blur of both luma and chroma parameters:
  10018. @example
  10019. unsharp=7:7:-2:7:7:-2
  10020. @end example
  10021. @end itemize
  10022. @section uspp
  10023. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10024. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10025. shifts and average the results.
  10026. The way this differs from the behavior of spp is that uspp actually encodes &
  10027. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10028. DCT similar to MJPEG.
  10029. The filter accepts the following options:
  10030. @table @option
  10031. @item quality
  10032. Set quality. This option defines the number of levels for averaging. It accepts
  10033. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10034. effect. A value of @code{8} means the higher quality. For each increment of
  10035. that value the speed drops by a factor of approximately 2. Default value is
  10036. @code{3}.
  10037. @item qp
  10038. Force a constant quantization parameter. If not set, the filter will use the QP
  10039. from the video stream (if available).
  10040. @end table
  10041. @section vectorscope
  10042. Display 2 color component values in the two dimensional graph (which is called
  10043. a vectorscope).
  10044. This filter accepts the following options:
  10045. @table @option
  10046. @item mode, m
  10047. Set vectorscope mode.
  10048. It accepts the following values:
  10049. @table @samp
  10050. @item gray
  10051. Gray values are displayed on graph, higher brightness means more pixels have
  10052. same component color value on location in graph. This is the default mode.
  10053. @item color
  10054. Gray values are displayed on graph. Surrounding pixels values which are not
  10055. present in video frame are drawn in gradient of 2 color components which are
  10056. set by option @code{x} and @code{y}. The 3rd color component is static.
  10057. @item color2
  10058. Actual color components values present in video frame are displayed on graph.
  10059. @item color3
  10060. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10061. on graph increases value of another color component, which is luminance by
  10062. default values of @code{x} and @code{y}.
  10063. @item color4
  10064. Actual colors present in video frame are displayed on graph. If two different
  10065. colors map to same position on graph then color with higher value of component
  10066. not present in graph is picked.
  10067. @item color5
  10068. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10069. component picked from radial gradient.
  10070. @end table
  10071. @item x
  10072. Set which color component will be represented on X-axis. Default is @code{1}.
  10073. @item y
  10074. Set which color component will be represented on Y-axis. Default is @code{2}.
  10075. @item intensity, i
  10076. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10077. of color component which represents frequency of (X, Y) location in graph.
  10078. @item envelope, e
  10079. @table @samp
  10080. @item none
  10081. No envelope, this is default.
  10082. @item instant
  10083. Instant envelope, even darkest single pixel will be clearly highlighted.
  10084. @item peak
  10085. Hold maximum and minimum values presented in graph over time. This way you
  10086. can still spot out of range values without constantly looking at vectorscope.
  10087. @item peak+instant
  10088. Peak and instant envelope combined together.
  10089. @end table
  10090. @item graticule, g
  10091. Set what kind of graticule to draw.
  10092. @table @samp
  10093. @item none
  10094. @item green
  10095. @item color
  10096. @end table
  10097. @item opacity, o
  10098. Set graticule opacity.
  10099. @item flags, f
  10100. Set graticule flags.
  10101. @table @samp
  10102. @item white
  10103. Draw graticule for white point.
  10104. @item black
  10105. Draw graticule for black point.
  10106. @item name
  10107. Draw color points short names.
  10108. @end table
  10109. @item bgopacity, b
  10110. Set background opacity.
  10111. @item lthreshold, l
  10112. Set low threshold for color component not represented on X or Y axis.
  10113. Values lower than this value will be ignored. Default is 0.
  10114. Note this value is multiplied with actual max possible value one pixel component
  10115. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10116. is 0.1 * 255 = 25.
  10117. @item hthreshold, h
  10118. Set high threshold for color component not represented on X or Y axis.
  10119. Values higher than this value will be ignored. Default is 1.
  10120. Note this value is multiplied with actual max possible value one pixel component
  10121. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10122. is 0.9 * 255 = 230.
  10123. @item colorspace, c
  10124. Set what kind of colorspace to use when drawing graticule.
  10125. @table @samp
  10126. @item auto
  10127. @item 601
  10128. @item 709
  10129. @end table
  10130. Default is auto.
  10131. @end table
  10132. @anchor{vidstabdetect}
  10133. @section vidstabdetect
  10134. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10135. @ref{vidstabtransform} for pass 2.
  10136. This filter generates a file with relative translation and rotation
  10137. transform information about subsequent frames, which is then used by
  10138. the @ref{vidstabtransform} filter.
  10139. To enable compilation of this filter you need to configure FFmpeg with
  10140. @code{--enable-libvidstab}.
  10141. This filter accepts the following options:
  10142. @table @option
  10143. @item result
  10144. Set the path to the file used to write the transforms information.
  10145. Default value is @file{transforms.trf}.
  10146. @item shakiness
  10147. Set how shaky the video is and how quick the camera is. It accepts an
  10148. integer in the range 1-10, a value of 1 means little shakiness, a
  10149. value of 10 means strong shakiness. Default value is 5.
  10150. @item accuracy
  10151. Set the accuracy of the detection process. It must be a value in the
  10152. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10153. accuracy. Default value is 15.
  10154. @item stepsize
  10155. Set stepsize of the search process. The region around minimum is
  10156. scanned with 1 pixel resolution. Default value is 6.
  10157. @item mincontrast
  10158. Set minimum contrast. Below this value a local measurement field is
  10159. discarded. Must be a floating point value in the range 0-1. Default
  10160. value is 0.3.
  10161. @item tripod
  10162. Set reference frame number for tripod mode.
  10163. If enabled, the motion of the frames is compared to a reference frame
  10164. in the filtered stream, identified by the specified number. The idea
  10165. is to compensate all movements in a more-or-less static scene and keep
  10166. the camera view absolutely still.
  10167. If set to 0, it is disabled. The frames are counted starting from 1.
  10168. @item show
  10169. Show fields and transforms in the resulting frames. It accepts an
  10170. integer in the range 0-2. Default value is 0, which disables any
  10171. visualization.
  10172. @end table
  10173. @subsection Examples
  10174. @itemize
  10175. @item
  10176. Use default values:
  10177. @example
  10178. vidstabdetect
  10179. @end example
  10180. @item
  10181. Analyze strongly shaky movie and put the results in file
  10182. @file{mytransforms.trf}:
  10183. @example
  10184. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10185. @end example
  10186. @item
  10187. Visualize the result of internal transformations in the resulting
  10188. video:
  10189. @example
  10190. vidstabdetect=show=1
  10191. @end example
  10192. @item
  10193. Analyze a video with medium shakiness using @command{ffmpeg}:
  10194. @example
  10195. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10196. @end example
  10197. @end itemize
  10198. @anchor{vidstabtransform}
  10199. @section vidstabtransform
  10200. Video stabilization/deshaking: pass 2 of 2,
  10201. see @ref{vidstabdetect} for pass 1.
  10202. Read a file with transform information for each frame and
  10203. apply/compensate them. Together with the @ref{vidstabdetect}
  10204. filter this can be used to deshake videos. See also
  10205. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10206. the @ref{unsharp} filter, see below.
  10207. To enable compilation of this filter you need to configure FFmpeg with
  10208. @code{--enable-libvidstab}.
  10209. @subsection Options
  10210. @table @option
  10211. @item input
  10212. Set path to the file used to read the transforms. Default value is
  10213. @file{transforms.trf}.
  10214. @item smoothing
  10215. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10216. camera movements. Default value is 10.
  10217. For example a number of 10 means that 21 frames are used (10 in the
  10218. past and 10 in the future) to smoothen the motion in the video. A
  10219. larger value leads to a smoother video, but limits the acceleration of
  10220. the camera (pan/tilt movements). 0 is a special case where a static
  10221. camera is simulated.
  10222. @item optalgo
  10223. Set the camera path optimization algorithm.
  10224. Accepted values are:
  10225. @table @samp
  10226. @item gauss
  10227. gaussian kernel low-pass filter on camera motion (default)
  10228. @item avg
  10229. averaging on transformations
  10230. @end table
  10231. @item maxshift
  10232. Set maximal number of pixels to translate frames. Default value is -1,
  10233. meaning no limit.
  10234. @item maxangle
  10235. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10236. value is -1, meaning no limit.
  10237. @item crop
  10238. Specify how to deal with borders that may be visible due to movement
  10239. compensation.
  10240. Available values are:
  10241. @table @samp
  10242. @item keep
  10243. keep image information from previous frame (default)
  10244. @item black
  10245. fill the border black
  10246. @end table
  10247. @item invert
  10248. Invert transforms if set to 1. Default value is 0.
  10249. @item relative
  10250. Consider transforms as relative to previous frame if set to 1,
  10251. absolute if set to 0. Default value is 0.
  10252. @item zoom
  10253. Set percentage to zoom. A positive value will result in a zoom-in
  10254. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10255. zoom).
  10256. @item optzoom
  10257. Set optimal zooming to avoid borders.
  10258. Accepted values are:
  10259. @table @samp
  10260. @item 0
  10261. disabled
  10262. @item 1
  10263. optimal static zoom value is determined (only very strong movements
  10264. will lead to visible borders) (default)
  10265. @item 2
  10266. optimal adaptive zoom value is determined (no borders will be
  10267. visible), see @option{zoomspeed}
  10268. @end table
  10269. Note that the value given at zoom is added to the one calculated here.
  10270. @item zoomspeed
  10271. Set percent to zoom maximally each frame (enabled when
  10272. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10273. 0.25.
  10274. @item interpol
  10275. Specify type of interpolation.
  10276. Available values are:
  10277. @table @samp
  10278. @item no
  10279. no interpolation
  10280. @item linear
  10281. linear only horizontal
  10282. @item bilinear
  10283. linear in both directions (default)
  10284. @item bicubic
  10285. cubic in both directions (slow)
  10286. @end table
  10287. @item tripod
  10288. Enable virtual tripod mode if set to 1, which is equivalent to
  10289. @code{relative=0:smoothing=0}. Default value is 0.
  10290. Use also @code{tripod} option of @ref{vidstabdetect}.
  10291. @item debug
  10292. Increase log verbosity if set to 1. Also the detected global motions
  10293. are written to the temporary file @file{global_motions.trf}. Default
  10294. value is 0.
  10295. @end table
  10296. @subsection Examples
  10297. @itemize
  10298. @item
  10299. Use @command{ffmpeg} for a typical stabilization with default values:
  10300. @example
  10301. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10302. @end example
  10303. Note the use of the @ref{unsharp} filter which is always recommended.
  10304. @item
  10305. Zoom in a bit more and load transform data from a given file:
  10306. @example
  10307. vidstabtransform=zoom=5:input="mytransforms.trf"
  10308. @end example
  10309. @item
  10310. Smoothen the video even more:
  10311. @example
  10312. vidstabtransform=smoothing=30
  10313. @end example
  10314. @end itemize
  10315. @section vflip
  10316. Flip the input video vertically.
  10317. For example, to vertically flip a video with @command{ffmpeg}:
  10318. @example
  10319. ffmpeg -i in.avi -vf "vflip" out.avi
  10320. @end example
  10321. @anchor{vignette}
  10322. @section vignette
  10323. Make or reverse a natural vignetting effect.
  10324. The filter accepts the following options:
  10325. @table @option
  10326. @item angle, a
  10327. Set lens angle expression as a number of radians.
  10328. The value is clipped in the @code{[0,PI/2]} range.
  10329. Default value: @code{"PI/5"}
  10330. @item x0
  10331. @item y0
  10332. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10333. by default.
  10334. @item mode
  10335. Set forward/backward mode.
  10336. Available modes are:
  10337. @table @samp
  10338. @item forward
  10339. The larger the distance from the central point, the darker the image becomes.
  10340. @item backward
  10341. The larger the distance from the central point, the brighter the image becomes.
  10342. This can be used to reverse a vignette effect, though there is no automatic
  10343. detection to extract the lens @option{angle} and other settings (yet). It can
  10344. also be used to create a burning effect.
  10345. @end table
  10346. Default value is @samp{forward}.
  10347. @item eval
  10348. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10349. It accepts the following values:
  10350. @table @samp
  10351. @item init
  10352. Evaluate expressions only once during the filter initialization.
  10353. @item frame
  10354. Evaluate expressions for each incoming frame. This is way slower than the
  10355. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10356. allows advanced dynamic expressions.
  10357. @end table
  10358. Default value is @samp{init}.
  10359. @item dither
  10360. Set dithering to reduce the circular banding effects. Default is @code{1}
  10361. (enabled).
  10362. @item aspect
  10363. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10364. Setting this value to the SAR of the input will make a rectangular vignetting
  10365. following the dimensions of the video.
  10366. Default is @code{1/1}.
  10367. @end table
  10368. @subsection Expressions
  10369. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10370. following parameters.
  10371. @table @option
  10372. @item w
  10373. @item h
  10374. input width and height
  10375. @item n
  10376. the number of input frame, starting from 0
  10377. @item pts
  10378. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10379. @var{TB} units, NAN if undefined
  10380. @item r
  10381. frame rate of the input video, NAN if the input frame rate is unknown
  10382. @item t
  10383. the PTS (Presentation TimeStamp) of the filtered video frame,
  10384. expressed in seconds, NAN if undefined
  10385. @item tb
  10386. time base of the input video
  10387. @end table
  10388. @subsection Examples
  10389. @itemize
  10390. @item
  10391. Apply simple strong vignetting effect:
  10392. @example
  10393. vignette=PI/4
  10394. @end example
  10395. @item
  10396. Make a flickering vignetting:
  10397. @example
  10398. vignette='PI/4+random(1)*PI/50':eval=frame
  10399. @end example
  10400. @end itemize
  10401. @section vstack
  10402. Stack input videos vertically.
  10403. All streams must be of same pixel format and of same width.
  10404. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10405. to create same output.
  10406. The filter accept the following option:
  10407. @table @option
  10408. @item inputs
  10409. Set number of input streams. Default is 2.
  10410. @item shortest
  10411. If set to 1, force the output to terminate when the shortest input
  10412. terminates. Default value is 0.
  10413. @end table
  10414. @section w3fdif
  10415. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10416. Deinterlacing Filter").
  10417. Based on the process described by Martin Weston for BBC R&D, and
  10418. implemented based on the de-interlace algorithm written by Jim
  10419. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10420. uses filter coefficients calculated by BBC R&D.
  10421. There are two sets of filter coefficients, so called "simple":
  10422. and "complex". Which set of filter coefficients is used can
  10423. be set by passing an optional parameter:
  10424. @table @option
  10425. @item filter
  10426. Set the interlacing filter coefficients. Accepts one of the following values:
  10427. @table @samp
  10428. @item simple
  10429. Simple filter coefficient set.
  10430. @item complex
  10431. More-complex filter coefficient set.
  10432. @end table
  10433. Default value is @samp{complex}.
  10434. @item deint
  10435. Specify which frames to deinterlace. Accept one of the following values:
  10436. @table @samp
  10437. @item all
  10438. Deinterlace all frames,
  10439. @item interlaced
  10440. Only deinterlace frames marked as interlaced.
  10441. @end table
  10442. Default value is @samp{all}.
  10443. @end table
  10444. @section waveform
  10445. Video waveform monitor.
  10446. The waveform monitor plots color component intensity. By default luminance
  10447. only. Each column of the waveform corresponds to a column of pixels in the
  10448. source video.
  10449. It accepts the following options:
  10450. @table @option
  10451. @item mode, m
  10452. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10453. In row mode, the graph on the left side represents color component value 0 and
  10454. the right side represents value = 255. In column mode, the top side represents
  10455. color component value = 0 and bottom side represents value = 255.
  10456. @item intensity, i
  10457. Set intensity. Smaller values are useful to find out how many values of the same
  10458. luminance are distributed across input rows/columns.
  10459. Default value is @code{0.04}. Allowed range is [0, 1].
  10460. @item mirror, r
  10461. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10462. In mirrored mode, higher values will be represented on the left
  10463. side for @code{row} mode and at the top for @code{column} mode. Default is
  10464. @code{1} (mirrored).
  10465. @item display, d
  10466. Set display mode.
  10467. It accepts the following values:
  10468. @table @samp
  10469. @item overlay
  10470. Presents information identical to that in the @code{parade}, except
  10471. that the graphs representing color components are superimposed directly
  10472. over one another.
  10473. This display mode makes it easier to spot relative differences or similarities
  10474. in overlapping areas of the color components that are supposed to be identical,
  10475. such as neutral whites, grays, or blacks.
  10476. @item stack
  10477. Display separate graph for the color components side by side in
  10478. @code{row} mode or one below the other in @code{column} mode.
  10479. @item parade
  10480. Display separate graph for the color components side by side in
  10481. @code{column} mode or one below the other in @code{row} mode.
  10482. Using this display mode makes it easy to spot color casts in the highlights
  10483. and shadows of an image, by comparing the contours of the top and the bottom
  10484. graphs of each waveform. Since whites, grays, and blacks are characterized
  10485. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10486. should display three waveforms of roughly equal width/height. If not, the
  10487. correction is easy to perform by making level adjustments the three waveforms.
  10488. @end table
  10489. Default is @code{stack}.
  10490. @item components, c
  10491. Set which color components to display. Default is 1, which means only luminance
  10492. or red color component if input is in RGB colorspace. If is set for example to
  10493. 7 it will display all 3 (if) available color components.
  10494. @item envelope, e
  10495. @table @samp
  10496. @item none
  10497. No envelope, this is default.
  10498. @item instant
  10499. Instant envelope, minimum and maximum values presented in graph will be easily
  10500. visible even with small @code{step} value.
  10501. @item peak
  10502. Hold minimum and maximum values presented in graph across time. This way you
  10503. can still spot out of range values without constantly looking at waveforms.
  10504. @item peak+instant
  10505. Peak and instant envelope combined together.
  10506. @end table
  10507. @item filter, f
  10508. @table @samp
  10509. @item lowpass
  10510. No filtering, this is default.
  10511. @item flat
  10512. Luma and chroma combined together.
  10513. @item aflat
  10514. Similar as above, but shows difference between blue and red chroma.
  10515. @item chroma
  10516. Displays only chroma.
  10517. @item color
  10518. Displays actual color value on waveform.
  10519. @item acolor
  10520. Similar as above, but with luma showing frequency of chroma values.
  10521. @end table
  10522. @item graticule, g
  10523. Set which graticule to display.
  10524. @table @samp
  10525. @item none
  10526. Do not display graticule.
  10527. @item green
  10528. Display green graticule showing legal broadcast ranges.
  10529. @end table
  10530. @item opacity, o
  10531. Set graticule opacity.
  10532. @item flags, fl
  10533. Set graticule flags.
  10534. @table @samp
  10535. @item numbers
  10536. Draw numbers above lines. By default enabled.
  10537. @item dots
  10538. Draw dots instead of lines.
  10539. @end table
  10540. @item scale, s
  10541. Set scale used for displaying graticule.
  10542. @table @samp
  10543. @item digital
  10544. @item millivolts
  10545. @item ire
  10546. @end table
  10547. Default is digital.
  10548. @end table
  10549. @section xbr
  10550. Apply the xBR high-quality magnification filter which is designed for pixel
  10551. art. It follows a set of edge-detection rules, see
  10552. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10553. It accepts the following option:
  10554. @table @option
  10555. @item n
  10556. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10557. @code{3xBR} and @code{4} for @code{4xBR}.
  10558. Default is @code{3}.
  10559. @end table
  10560. @anchor{yadif}
  10561. @section yadif
  10562. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10563. filter").
  10564. It accepts the following parameters:
  10565. @table @option
  10566. @item mode
  10567. The interlacing mode to adopt. It accepts one of the following values:
  10568. @table @option
  10569. @item 0, send_frame
  10570. Output one frame for each frame.
  10571. @item 1, send_field
  10572. Output one frame for each field.
  10573. @item 2, send_frame_nospatial
  10574. Like @code{send_frame}, but it skips the spatial interlacing check.
  10575. @item 3, send_field_nospatial
  10576. Like @code{send_field}, but it skips the spatial interlacing check.
  10577. @end table
  10578. The default value is @code{send_frame}.
  10579. @item parity
  10580. The picture field parity assumed for the input interlaced video. It accepts one
  10581. of the following values:
  10582. @table @option
  10583. @item 0, tff
  10584. Assume the top field is first.
  10585. @item 1, bff
  10586. Assume the bottom field is first.
  10587. @item -1, auto
  10588. Enable automatic detection of field parity.
  10589. @end table
  10590. The default value is @code{auto}.
  10591. If the interlacing is unknown or the decoder does not export this information,
  10592. top field first will be assumed.
  10593. @item deint
  10594. Specify which frames to deinterlace. Accept one of the following
  10595. values:
  10596. @table @option
  10597. @item 0, all
  10598. Deinterlace all frames.
  10599. @item 1, interlaced
  10600. Only deinterlace frames marked as interlaced.
  10601. @end table
  10602. The default value is @code{all}.
  10603. @end table
  10604. @section zoompan
  10605. Apply Zoom & Pan effect.
  10606. This filter accepts the following options:
  10607. @table @option
  10608. @item zoom, z
  10609. Set the zoom expression. Default is 1.
  10610. @item x
  10611. @item y
  10612. Set the x and y expression. Default is 0.
  10613. @item d
  10614. Set the duration expression in number of frames.
  10615. This sets for how many number of frames effect will last for
  10616. single input image.
  10617. @item s
  10618. Set the output image size, default is 'hd720'.
  10619. @item fps
  10620. Set the output frame rate, default is '25'.
  10621. @end table
  10622. Each expression can contain the following constants:
  10623. @table @option
  10624. @item in_w, iw
  10625. Input width.
  10626. @item in_h, ih
  10627. Input height.
  10628. @item out_w, ow
  10629. Output width.
  10630. @item out_h, oh
  10631. Output height.
  10632. @item in
  10633. Input frame count.
  10634. @item on
  10635. Output frame count.
  10636. @item x
  10637. @item y
  10638. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10639. for current input frame.
  10640. @item px
  10641. @item py
  10642. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10643. not yet such frame (first input frame).
  10644. @item zoom
  10645. Last calculated zoom from 'z' expression for current input frame.
  10646. @item pzoom
  10647. Last calculated zoom of last output frame of previous input frame.
  10648. @item duration
  10649. Number of output frames for current input frame. Calculated from 'd' expression
  10650. for each input frame.
  10651. @item pduration
  10652. number of output frames created for previous input frame
  10653. @item a
  10654. Rational number: input width / input height
  10655. @item sar
  10656. sample aspect ratio
  10657. @item dar
  10658. display aspect ratio
  10659. @end table
  10660. @subsection Examples
  10661. @itemize
  10662. @item
  10663. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10664. @example
  10665. 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
  10666. @end example
  10667. @item
  10668. Zoom-in up to 1.5 and pan always at center of picture:
  10669. @example
  10670. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10671. @end example
  10672. @end itemize
  10673. @section zscale
  10674. Scale (resize) the input video, using the z.lib library:
  10675. https://github.com/sekrit-twc/zimg.
  10676. The zscale filter forces the output display aspect ratio to be the same
  10677. as the input, by changing the output sample aspect ratio.
  10678. If the input image format is different from the format requested by
  10679. the next filter, the zscale filter will convert the input to the
  10680. requested format.
  10681. @subsection Options
  10682. The filter accepts the following options.
  10683. @table @option
  10684. @item width, w
  10685. @item height, h
  10686. Set the output video dimension expression. Default value is the input
  10687. dimension.
  10688. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10689. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10690. If one of the values is -1, the zscale filter will use a value that
  10691. maintains the aspect ratio of the input image, calculated from the
  10692. other specified dimension. If both of them are -1, the input size is
  10693. used
  10694. If one of the values is -n with n > 1, the zscale filter will also use a value
  10695. that maintains the aspect ratio of the input image, calculated from the other
  10696. specified dimension. After that it will, however, make sure that the calculated
  10697. dimension is divisible by n and adjust the value if necessary.
  10698. See below for the list of accepted constants for use in the dimension
  10699. expression.
  10700. @item size, s
  10701. Set the video size. For the syntax of this option, check the
  10702. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10703. @item dither, d
  10704. Set the dither type.
  10705. Possible values are:
  10706. @table @var
  10707. @item none
  10708. @item ordered
  10709. @item random
  10710. @item error_diffusion
  10711. @end table
  10712. Default is none.
  10713. @item filter, f
  10714. Set the resize filter type.
  10715. Possible values are:
  10716. @table @var
  10717. @item point
  10718. @item bilinear
  10719. @item bicubic
  10720. @item spline16
  10721. @item spline36
  10722. @item lanczos
  10723. @end table
  10724. Default is bilinear.
  10725. @item range, r
  10726. Set the color range.
  10727. Possible values are:
  10728. @table @var
  10729. @item input
  10730. @item limited
  10731. @item full
  10732. @end table
  10733. Default is same as input.
  10734. @item primaries, p
  10735. Set the color primaries.
  10736. Possible values are:
  10737. @table @var
  10738. @item input
  10739. @item 709
  10740. @item unspecified
  10741. @item 170m
  10742. @item 240m
  10743. @item 2020
  10744. @end table
  10745. Default is same as input.
  10746. @item transfer, t
  10747. Set the transfer characteristics.
  10748. Possible values are:
  10749. @table @var
  10750. @item input
  10751. @item 709
  10752. @item unspecified
  10753. @item 601
  10754. @item linear
  10755. @item 2020_10
  10756. @item 2020_12
  10757. @end table
  10758. Default is same as input.
  10759. @item matrix, m
  10760. Set the colorspace matrix.
  10761. Possible value are:
  10762. @table @var
  10763. @item input
  10764. @item 709
  10765. @item unspecified
  10766. @item 470bg
  10767. @item 170m
  10768. @item 2020_ncl
  10769. @item 2020_cl
  10770. @end table
  10771. Default is same as input.
  10772. @item rangein, rin
  10773. Set the input color range.
  10774. Possible values are:
  10775. @table @var
  10776. @item input
  10777. @item limited
  10778. @item full
  10779. @end table
  10780. Default is same as input.
  10781. @item primariesin, pin
  10782. Set the input color primaries.
  10783. Possible values are:
  10784. @table @var
  10785. @item input
  10786. @item 709
  10787. @item unspecified
  10788. @item 170m
  10789. @item 240m
  10790. @item 2020
  10791. @end table
  10792. Default is same as input.
  10793. @item transferin, tin
  10794. Set the input transfer characteristics.
  10795. Possible values are:
  10796. @table @var
  10797. @item input
  10798. @item 709
  10799. @item unspecified
  10800. @item 601
  10801. @item linear
  10802. @item 2020_10
  10803. @item 2020_12
  10804. @end table
  10805. Default is same as input.
  10806. @item matrixin, min
  10807. Set the input colorspace matrix.
  10808. Possible value are:
  10809. @table @var
  10810. @item input
  10811. @item 709
  10812. @item unspecified
  10813. @item 470bg
  10814. @item 170m
  10815. @item 2020_ncl
  10816. @item 2020_cl
  10817. @end table
  10818. @end table
  10819. The values of the @option{w} and @option{h} options are expressions
  10820. containing the following constants:
  10821. @table @var
  10822. @item in_w
  10823. @item in_h
  10824. The input width and height
  10825. @item iw
  10826. @item ih
  10827. These are the same as @var{in_w} and @var{in_h}.
  10828. @item out_w
  10829. @item out_h
  10830. The output (scaled) width and height
  10831. @item ow
  10832. @item oh
  10833. These are the same as @var{out_w} and @var{out_h}
  10834. @item a
  10835. The same as @var{iw} / @var{ih}
  10836. @item sar
  10837. input sample aspect ratio
  10838. @item dar
  10839. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10840. @item hsub
  10841. @item vsub
  10842. horizontal and vertical input chroma subsample values. For example for the
  10843. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10844. @item ohsub
  10845. @item ovsub
  10846. horizontal and vertical output chroma subsample values. For example for the
  10847. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10848. @end table
  10849. @table @option
  10850. @end table
  10851. @c man end VIDEO FILTERS
  10852. @chapter Video Sources
  10853. @c man begin VIDEO SOURCES
  10854. Below is a description of the currently available video sources.
  10855. @section buffer
  10856. Buffer video frames, and make them available to the filter chain.
  10857. This source is mainly intended for a programmatic use, in particular
  10858. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10859. It accepts the following parameters:
  10860. @table @option
  10861. @item video_size
  10862. Specify the size (width and height) of the buffered video frames. For the
  10863. syntax of this option, check the
  10864. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10865. @item width
  10866. The input video width.
  10867. @item height
  10868. The input video height.
  10869. @item pix_fmt
  10870. A string representing the pixel format of the buffered video frames.
  10871. It may be a number corresponding to a pixel format, or a pixel format
  10872. name.
  10873. @item time_base
  10874. Specify the timebase assumed by the timestamps of the buffered frames.
  10875. @item frame_rate
  10876. Specify the frame rate expected for the video stream.
  10877. @item pixel_aspect, sar
  10878. The sample (pixel) aspect ratio of the input video.
  10879. @item sws_param
  10880. Specify the optional parameters to be used for the scale filter which
  10881. is automatically inserted when an input change is detected in the
  10882. input size or format.
  10883. @item hw_frames_ctx
  10884. When using a hardware pixel format, this should be a reference to an
  10885. AVHWFramesContext describing input frames.
  10886. @end table
  10887. For example:
  10888. @example
  10889. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10890. @end example
  10891. will instruct the source to accept video frames with size 320x240 and
  10892. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10893. square pixels (1:1 sample aspect ratio).
  10894. Since the pixel format with name "yuv410p" corresponds to the number 6
  10895. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10896. this example corresponds to:
  10897. @example
  10898. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10899. @end example
  10900. Alternatively, the options can be specified as a flat string, but this
  10901. syntax is deprecated:
  10902. @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}]
  10903. @section cellauto
  10904. Create a pattern generated by an elementary cellular automaton.
  10905. The initial state of the cellular automaton can be defined through the
  10906. @option{filename}, and @option{pattern} options. If such options are
  10907. not specified an initial state is created randomly.
  10908. At each new frame a new row in the video is filled with the result of
  10909. the cellular automaton next generation. The behavior when the whole
  10910. frame is filled is defined by the @option{scroll} option.
  10911. This source accepts the following options:
  10912. @table @option
  10913. @item filename, f
  10914. Read the initial cellular automaton state, i.e. the starting row, from
  10915. the specified file.
  10916. In the file, each non-whitespace character is considered an alive
  10917. cell, a newline will terminate the row, and further characters in the
  10918. file will be ignored.
  10919. @item pattern, p
  10920. Read the initial cellular automaton state, i.e. the starting row, from
  10921. the specified string.
  10922. Each non-whitespace character in the string is considered an alive
  10923. cell, a newline will terminate the row, and further characters in the
  10924. string will be ignored.
  10925. @item rate, r
  10926. Set the video rate, that is the number of frames generated per second.
  10927. Default is 25.
  10928. @item random_fill_ratio, ratio
  10929. Set the random fill ratio for the initial cellular automaton row. It
  10930. is a floating point number value ranging from 0 to 1, defaults to
  10931. 1/PHI.
  10932. This option is ignored when a file or a pattern is specified.
  10933. @item random_seed, seed
  10934. Set the seed for filling randomly the initial row, must be an integer
  10935. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10936. set to -1, the filter will try to use a good random seed on a best
  10937. effort basis.
  10938. @item rule
  10939. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10940. Default value is 110.
  10941. @item size, s
  10942. Set the size of the output video. For the syntax of this option, check the
  10943. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10944. If @option{filename} or @option{pattern} is specified, the size is set
  10945. by default to the width of the specified initial state row, and the
  10946. height is set to @var{width} * PHI.
  10947. If @option{size} is set, it must contain the width of the specified
  10948. pattern string, and the specified pattern will be centered in the
  10949. larger row.
  10950. If a filename or a pattern string is not specified, the size value
  10951. defaults to "320x518" (used for a randomly generated initial state).
  10952. @item scroll
  10953. If set to 1, scroll the output upward when all the rows in the output
  10954. have been already filled. If set to 0, the new generated row will be
  10955. written over the top row just after the bottom row is filled.
  10956. Defaults to 1.
  10957. @item start_full, full
  10958. If set to 1, completely fill the output with generated rows before
  10959. outputting the first frame.
  10960. This is the default behavior, for disabling set the value to 0.
  10961. @item stitch
  10962. If set to 1, stitch the left and right row edges together.
  10963. This is the default behavior, for disabling set the value to 0.
  10964. @end table
  10965. @subsection Examples
  10966. @itemize
  10967. @item
  10968. Read the initial state from @file{pattern}, and specify an output of
  10969. size 200x400.
  10970. @example
  10971. cellauto=f=pattern:s=200x400
  10972. @end example
  10973. @item
  10974. Generate a random initial row with a width of 200 cells, with a fill
  10975. ratio of 2/3:
  10976. @example
  10977. cellauto=ratio=2/3:s=200x200
  10978. @end example
  10979. @item
  10980. Create a pattern generated by rule 18 starting by a single alive cell
  10981. centered on an initial row with width 100:
  10982. @example
  10983. cellauto=p=@@:s=100x400:full=0:rule=18
  10984. @end example
  10985. @item
  10986. Specify a more elaborated initial pattern:
  10987. @example
  10988. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10989. @end example
  10990. @end itemize
  10991. @anchor{coreimagesrc}
  10992. @section coreimagesrc
  10993. Video source generated on GPU using Apple's CoreImage API on OSX.
  10994. This video source is a specialized version of the @ref{coreimage} video filter.
  10995. Use a core image generator at the beginning of the applied filterchain to
  10996. generate the content.
  10997. The coreimagesrc video source accepts the following options:
  10998. @table @option
  10999. @item list_generators
  11000. List all available generators along with all their respective options as well as
  11001. possible minimum and maximum values along with the default values.
  11002. @example
  11003. list_generators=true
  11004. @end example
  11005. @item size, s
  11006. Specify the size of the sourced video. For the syntax of this option, check the
  11007. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11008. The default value is @code{320x240}.
  11009. @item rate, r
  11010. Specify the frame rate of the sourced video, as the number of frames
  11011. generated per second. It has to be a string in the format
  11012. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11013. number or a valid video frame rate abbreviation. The default value is
  11014. "25".
  11015. @item sar
  11016. Set the sample aspect ratio of the sourced video.
  11017. @item duration, d
  11018. Set the duration of the sourced video. See
  11019. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11020. for the accepted syntax.
  11021. If not specified, or the expressed duration is negative, the video is
  11022. supposed to be generated forever.
  11023. @end table
  11024. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11025. A complete filterchain can be used for further processing of the
  11026. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11027. and examples for details.
  11028. @subsection Examples
  11029. @itemize
  11030. @item
  11031. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11032. given as complete and escaped command-line for Apple's standard bash shell:
  11033. @example
  11034. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11035. @end example
  11036. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11037. need for a nullsrc video source.
  11038. @end itemize
  11039. @section mandelbrot
  11040. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11041. point specified with @var{start_x} and @var{start_y}.
  11042. This source accepts the following options:
  11043. @table @option
  11044. @item end_pts
  11045. Set the terminal pts value. Default value is 400.
  11046. @item end_scale
  11047. Set the terminal scale value.
  11048. Must be a floating point value. Default value is 0.3.
  11049. @item inner
  11050. Set the inner coloring mode, that is the algorithm used to draw the
  11051. Mandelbrot fractal internal region.
  11052. It shall assume one of the following values:
  11053. @table @option
  11054. @item black
  11055. Set black mode.
  11056. @item convergence
  11057. Show time until convergence.
  11058. @item mincol
  11059. Set color based on point closest to the origin of the iterations.
  11060. @item period
  11061. Set period mode.
  11062. @end table
  11063. Default value is @var{mincol}.
  11064. @item bailout
  11065. Set the bailout value. Default value is 10.0.
  11066. @item maxiter
  11067. Set the maximum of iterations performed by the rendering
  11068. algorithm. Default value is 7189.
  11069. @item outer
  11070. Set outer coloring mode.
  11071. It shall assume one of following values:
  11072. @table @option
  11073. @item iteration_count
  11074. Set iteration cound mode.
  11075. @item normalized_iteration_count
  11076. set normalized iteration count mode.
  11077. @end table
  11078. Default value is @var{normalized_iteration_count}.
  11079. @item rate, r
  11080. Set frame rate, expressed as number of frames per second. Default
  11081. value is "25".
  11082. @item size, s
  11083. Set frame size. For the syntax of this option, check the "Video
  11084. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11085. @item start_scale
  11086. Set the initial scale value. Default value is 3.0.
  11087. @item start_x
  11088. Set the initial x position. Must be a floating point value between
  11089. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11090. @item start_y
  11091. Set the initial y position. Must be a floating point value between
  11092. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11093. @end table
  11094. @section mptestsrc
  11095. Generate various test patterns, as generated by the MPlayer test filter.
  11096. The size of the generated video is fixed, and is 256x256.
  11097. This source is useful in particular for testing encoding features.
  11098. This source accepts the following options:
  11099. @table @option
  11100. @item rate, r
  11101. Specify the frame rate of the sourced video, as the number of frames
  11102. generated per second. It has to be a string in the format
  11103. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11104. number or a valid video frame rate abbreviation. The default value is
  11105. "25".
  11106. @item duration, d
  11107. Set the duration of the sourced video. See
  11108. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11109. for the accepted syntax.
  11110. If not specified, or the expressed duration is negative, the video is
  11111. supposed to be generated forever.
  11112. @item test, t
  11113. Set the number or the name of the test to perform. Supported tests are:
  11114. @table @option
  11115. @item dc_luma
  11116. @item dc_chroma
  11117. @item freq_luma
  11118. @item freq_chroma
  11119. @item amp_luma
  11120. @item amp_chroma
  11121. @item cbp
  11122. @item mv
  11123. @item ring1
  11124. @item ring2
  11125. @item all
  11126. @end table
  11127. Default value is "all", which will cycle through the list of all tests.
  11128. @end table
  11129. Some examples:
  11130. @example
  11131. mptestsrc=t=dc_luma
  11132. @end example
  11133. will generate a "dc_luma" test pattern.
  11134. @section frei0r_src
  11135. Provide a frei0r source.
  11136. To enable compilation of this filter you need to install the frei0r
  11137. header and configure FFmpeg with @code{--enable-frei0r}.
  11138. This source accepts the following parameters:
  11139. @table @option
  11140. @item size
  11141. The size of the video to generate. For the syntax of this option, check the
  11142. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11143. @item framerate
  11144. The framerate of the generated video. It may be a string of the form
  11145. @var{num}/@var{den} or a frame rate abbreviation.
  11146. @item filter_name
  11147. The name to the frei0r source to load. For more information regarding frei0r and
  11148. how to set the parameters, read the @ref{frei0r} section in the video filters
  11149. documentation.
  11150. @item filter_params
  11151. A '|'-separated list of parameters to pass to the frei0r source.
  11152. @end table
  11153. For example, to generate a frei0r partik0l source with size 200x200
  11154. and frame rate 10 which is overlaid on the overlay filter main input:
  11155. @example
  11156. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11157. @end example
  11158. @section life
  11159. Generate a life pattern.
  11160. This source is based on a generalization of John Conway's life game.
  11161. The sourced input represents a life grid, each pixel represents a cell
  11162. which can be in one of two possible states, alive or dead. Every cell
  11163. interacts with its eight neighbours, which are the cells that are
  11164. horizontally, vertically, or diagonally adjacent.
  11165. At each interaction the grid evolves according to the adopted rule,
  11166. which specifies the number of neighbor alive cells which will make a
  11167. cell stay alive or born. The @option{rule} option allows one to specify
  11168. the rule to adopt.
  11169. This source accepts the following options:
  11170. @table @option
  11171. @item filename, f
  11172. Set the file from which to read the initial grid state. In the file,
  11173. each non-whitespace character is considered an alive cell, and newline
  11174. is used to delimit the end of each row.
  11175. If this option is not specified, the initial grid is generated
  11176. randomly.
  11177. @item rate, r
  11178. Set the video rate, that is the number of frames generated per second.
  11179. Default is 25.
  11180. @item random_fill_ratio, ratio
  11181. Set the random fill ratio for the initial random grid. It is a
  11182. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11183. It is ignored when a file is specified.
  11184. @item random_seed, seed
  11185. Set the seed for filling the initial random grid, must be an integer
  11186. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11187. set to -1, the filter will try to use a good random seed on a best
  11188. effort basis.
  11189. @item rule
  11190. Set the life rule.
  11191. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11192. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11193. @var{NS} specifies the number of alive neighbor cells which make a
  11194. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11195. which make a dead cell to become alive (i.e. to "born").
  11196. "s" and "b" can be used in place of "S" and "B", respectively.
  11197. Alternatively a rule can be specified by an 18-bits integer. The 9
  11198. high order bits are used to encode the next cell state if it is alive
  11199. for each number of neighbor alive cells, the low order bits specify
  11200. the rule for "borning" new cells. Higher order bits encode for an
  11201. higher number of neighbor cells.
  11202. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11203. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11204. Default value is "S23/B3", which is the original Conway's game of life
  11205. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11206. cells, and will born a new cell if there are three alive cells around
  11207. a dead cell.
  11208. @item size, s
  11209. Set the size of the output video. For the syntax of this option, check the
  11210. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11211. If @option{filename} is specified, the size is set by default to the
  11212. same size of the input file. If @option{size} is set, it must contain
  11213. the size specified in the input file, and the initial grid defined in
  11214. that file is centered in the larger resulting area.
  11215. If a filename is not specified, the size value defaults to "320x240"
  11216. (used for a randomly generated initial grid).
  11217. @item stitch
  11218. If set to 1, stitch the left and right grid edges together, and the
  11219. top and bottom edges also. Defaults to 1.
  11220. @item mold
  11221. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11222. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11223. value from 0 to 255.
  11224. @item life_color
  11225. Set the color of living (or new born) cells.
  11226. @item death_color
  11227. Set the color of dead cells. If @option{mold} is set, this is the first color
  11228. used to represent a dead cell.
  11229. @item mold_color
  11230. Set mold color, for definitely dead and moldy cells.
  11231. For the syntax of these 3 color options, check the "Color" section in the
  11232. ffmpeg-utils manual.
  11233. @end table
  11234. @subsection Examples
  11235. @itemize
  11236. @item
  11237. Read a grid from @file{pattern}, and center it on a grid of size
  11238. 300x300 pixels:
  11239. @example
  11240. life=f=pattern:s=300x300
  11241. @end example
  11242. @item
  11243. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11244. @example
  11245. life=ratio=2/3:s=200x200
  11246. @end example
  11247. @item
  11248. Specify a custom rule for evolving a randomly generated grid:
  11249. @example
  11250. life=rule=S14/B34
  11251. @end example
  11252. @item
  11253. Full example with slow death effect (mold) using @command{ffplay}:
  11254. @example
  11255. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11256. @end example
  11257. @end itemize
  11258. @anchor{allrgb}
  11259. @anchor{allyuv}
  11260. @anchor{color}
  11261. @anchor{haldclutsrc}
  11262. @anchor{nullsrc}
  11263. @anchor{rgbtestsrc}
  11264. @anchor{smptebars}
  11265. @anchor{smptehdbars}
  11266. @anchor{testsrc}
  11267. @anchor{testsrc2}
  11268. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11269. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11270. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11271. The @code{color} source provides an uniformly colored input.
  11272. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11273. @ref{haldclut} filter.
  11274. The @code{nullsrc} source returns unprocessed video frames. It is
  11275. mainly useful to be employed in analysis / debugging tools, or as the
  11276. source for filters which ignore the input data.
  11277. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11278. detecting RGB vs BGR issues. You should see a red, green and blue
  11279. stripe from top to bottom.
  11280. The @code{smptebars} source generates a color bars pattern, based on
  11281. the SMPTE Engineering Guideline EG 1-1990.
  11282. The @code{smptehdbars} source generates a color bars pattern, based on
  11283. the SMPTE RP 219-2002.
  11284. The @code{testsrc} source generates a test video pattern, showing a
  11285. color pattern, a scrolling gradient and a timestamp. This is mainly
  11286. intended for testing purposes.
  11287. The @code{testsrc2} source is similar to testsrc, but supports more
  11288. pixel formats instead of just @code{rgb24}. This allows using it as an
  11289. input for other tests without requiring a format conversion.
  11290. The sources accept the following parameters:
  11291. @table @option
  11292. @item color, c
  11293. Specify the color of the source, only available in the @code{color}
  11294. source. For the syntax of this option, check the "Color" section in the
  11295. ffmpeg-utils manual.
  11296. @item level
  11297. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11298. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11299. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11300. coded on a @code{1/(N*N)} scale.
  11301. @item size, s
  11302. Specify the size of the sourced video. For the syntax of this option, check the
  11303. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11304. The default value is @code{320x240}.
  11305. This option is not available with the @code{haldclutsrc} filter.
  11306. @item rate, r
  11307. Specify the frame rate of the sourced video, as the number of frames
  11308. generated per second. It has to be a string in the format
  11309. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11310. number or a valid video frame rate abbreviation. The default value is
  11311. "25".
  11312. @item sar
  11313. Set the sample aspect ratio of the sourced video.
  11314. @item duration, d
  11315. Set the duration of the sourced video. See
  11316. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11317. for the accepted syntax.
  11318. If not specified, or the expressed duration is negative, the video is
  11319. supposed to be generated forever.
  11320. @item decimals, n
  11321. Set the number of decimals to show in the timestamp, only available in the
  11322. @code{testsrc} source.
  11323. The displayed timestamp value will correspond to the original
  11324. timestamp value multiplied by the power of 10 of the specified
  11325. value. Default value is 0.
  11326. @end table
  11327. For example the following:
  11328. @example
  11329. testsrc=duration=5.3:size=qcif:rate=10
  11330. @end example
  11331. will generate a video with a duration of 5.3 seconds, with size
  11332. 176x144 and a frame rate of 10 frames per second.
  11333. The following graph description will generate a red source
  11334. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11335. frames per second.
  11336. @example
  11337. color=c=red@@0.2:s=qcif:r=10
  11338. @end example
  11339. If the input content is to be ignored, @code{nullsrc} can be used. The
  11340. following command generates noise in the luminance plane by employing
  11341. the @code{geq} filter:
  11342. @example
  11343. nullsrc=s=256x256, geq=random(1)*255:128:128
  11344. @end example
  11345. @subsection Commands
  11346. The @code{color} source supports the following commands:
  11347. @table @option
  11348. @item c, color
  11349. Set the color of the created image. Accepts the same syntax of the
  11350. corresponding @option{color} option.
  11351. @end table
  11352. @c man end VIDEO SOURCES
  11353. @chapter Video Sinks
  11354. @c man begin VIDEO SINKS
  11355. Below is a description of the currently available video sinks.
  11356. @section buffersink
  11357. Buffer video frames, and make them available to the end of the filter
  11358. graph.
  11359. This sink is mainly intended for programmatic use, in particular
  11360. through the interface defined in @file{libavfilter/buffersink.h}
  11361. or the options system.
  11362. It accepts a pointer to an AVBufferSinkContext structure, which
  11363. defines the incoming buffers' formats, to be passed as the opaque
  11364. parameter to @code{avfilter_init_filter} for initialization.
  11365. @section nullsink
  11366. Null video sink: do absolutely nothing with the input video. It is
  11367. mainly useful as a template and for use in analysis / debugging
  11368. tools.
  11369. @c man end VIDEO SINKS
  11370. @chapter Multimedia Filters
  11371. @c man begin MULTIMEDIA FILTERS
  11372. Below is a description of the currently available multimedia filters.
  11373. @section ahistogram
  11374. Convert input audio to a video output, displaying the volume histogram.
  11375. The filter accepts the following options:
  11376. @table @option
  11377. @item dmode
  11378. Specify how histogram is calculated.
  11379. It accepts the following values:
  11380. @table @samp
  11381. @item single
  11382. Use single histogram for all channels.
  11383. @item separate
  11384. Use separate histogram for each channel.
  11385. @end table
  11386. Default is @code{single}.
  11387. @item rate, r
  11388. Set frame rate, expressed as number of frames per second. Default
  11389. value is "25".
  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{hd720}.
  11394. @item scale
  11395. Set display scale.
  11396. It accepts the following values:
  11397. @table @samp
  11398. @item log
  11399. logarithmic
  11400. @item sqrt
  11401. square root
  11402. @item cbrt
  11403. cubic root
  11404. @item lin
  11405. linear
  11406. @item rlog
  11407. reverse logarithmic
  11408. @end table
  11409. Default is @code{log}.
  11410. @item ascale
  11411. Set amplitude scale.
  11412. It accepts the following values:
  11413. @table @samp
  11414. @item log
  11415. logarithmic
  11416. @item lin
  11417. linear
  11418. @end table
  11419. Default is @code{log}.
  11420. @item acount
  11421. Set how much frames to accumulate in histogram.
  11422. Defauls is 1. Setting this to -1 accumulates all frames.
  11423. @item rheight
  11424. Set histogram ratio of window height.
  11425. @item slide
  11426. Set sonogram sliding.
  11427. It accepts the following values:
  11428. @table @samp
  11429. @item replace
  11430. replace old rows with new ones.
  11431. @item scroll
  11432. scroll from top to bottom.
  11433. @end table
  11434. Default is @code{replace}.
  11435. @end table
  11436. @section aphasemeter
  11437. Convert input audio to a video output, displaying the audio phase.
  11438. The filter accepts the following options:
  11439. @table @option
  11440. @item rate, r
  11441. Set the output frame rate. Default value is @code{25}.
  11442. @item size, s
  11443. Set the video size for the output. For the syntax of this option, check the
  11444. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11445. Default value is @code{800x400}.
  11446. @item rc
  11447. @item gc
  11448. @item bc
  11449. Specify the red, green, blue contrast. Default values are @code{2},
  11450. @code{7} and @code{1}.
  11451. Allowed range is @code{[0, 255]}.
  11452. @item mpc
  11453. Set color which will be used for drawing median phase. If color is
  11454. @code{none} which is default, no median phase value will be drawn.
  11455. @end table
  11456. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11457. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11458. The @code{-1} means left and right channels are completely out of phase and
  11459. @code{1} means channels are in phase.
  11460. @section avectorscope
  11461. Convert input audio to a video output, representing the audio vector
  11462. scope.
  11463. The filter is used to measure the difference between channels of stereo
  11464. audio stream. A monoaural signal, consisting of identical left and right
  11465. signal, results in straight vertical line. Any stereo separation is visible
  11466. as a deviation from this line, creating a Lissajous figure.
  11467. If the straight (or deviation from it) but horizontal line appears this
  11468. indicates that the left and right channels are out of phase.
  11469. The filter accepts the following options:
  11470. @table @option
  11471. @item mode, m
  11472. Set the vectorscope mode.
  11473. Available values are:
  11474. @table @samp
  11475. @item lissajous
  11476. Lissajous rotated by 45 degrees.
  11477. @item lissajous_xy
  11478. Same as above but not rotated.
  11479. @item polar
  11480. Shape resembling half of circle.
  11481. @end table
  11482. Default value is @samp{lissajous}.
  11483. @item size, s
  11484. Set the video size for the output. For the syntax of this option, check the
  11485. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11486. Default value is @code{400x400}.
  11487. @item rate, r
  11488. Set the output frame rate. Default value is @code{25}.
  11489. @item rc
  11490. @item gc
  11491. @item bc
  11492. @item ac
  11493. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11494. @code{160}, @code{80} and @code{255}.
  11495. Allowed range is @code{[0, 255]}.
  11496. @item rf
  11497. @item gf
  11498. @item bf
  11499. @item af
  11500. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11501. @code{10}, @code{5} and @code{5}.
  11502. Allowed range is @code{[0, 255]}.
  11503. @item zoom
  11504. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11505. @item draw
  11506. Set the vectorscope drawing mode.
  11507. Available values are:
  11508. @table @samp
  11509. @item dot
  11510. Draw dot for each sample.
  11511. @item line
  11512. Draw line between previous and current sample.
  11513. @end table
  11514. Default value is @samp{dot}.
  11515. @end table
  11516. @subsection Examples
  11517. @itemize
  11518. @item
  11519. Complete example using @command{ffplay}:
  11520. @example
  11521. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11522. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11523. @end example
  11524. @end itemize
  11525. @section bench, abench
  11526. Benchmark part of a filtergraph.
  11527. The filter accepts the following options:
  11528. @table @option
  11529. @item action
  11530. Start or stop a timer.
  11531. Available values are:
  11532. @table @samp
  11533. @item start
  11534. Get the current time, set it as frame metadata (using the key
  11535. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11536. @item stop
  11537. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11538. the input frame metadata to get the time difference. Time difference, average,
  11539. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11540. @code{min}) are then printed. The timestamps are expressed in seconds.
  11541. @end table
  11542. @end table
  11543. @subsection Examples
  11544. @itemize
  11545. @item
  11546. Benchmark @ref{selectivecolor} filter:
  11547. @example
  11548. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11549. @end example
  11550. @end itemize
  11551. @section concat
  11552. Concatenate audio and video streams, joining them together one after the
  11553. other.
  11554. The filter works on segments of synchronized video and audio streams. All
  11555. segments must have the same number of streams of each type, and that will
  11556. also be the number of streams at output.
  11557. The filter accepts the following options:
  11558. @table @option
  11559. @item n
  11560. Set the number of segments. Default is 2.
  11561. @item v
  11562. Set the number of output video streams, that is also the number of video
  11563. streams in each segment. Default is 1.
  11564. @item a
  11565. Set the number of output audio streams, that is also the number of audio
  11566. streams in each segment. Default is 0.
  11567. @item unsafe
  11568. Activate unsafe mode: do not fail if segments have a different format.
  11569. @end table
  11570. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11571. @var{a} audio outputs.
  11572. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11573. segment, in the same order as the outputs, then the inputs for the second
  11574. segment, etc.
  11575. Related streams do not always have exactly the same duration, for various
  11576. reasons including codec frame size or sloppy authoring. For that reason,
  11577. related synchronized streams (e.g. a video and its audio track) should be
  11578. concatenated at once. The concat filter will use the duration of the longest
  11579. stream in each segment (except the last one), and if necessary pad shorter
  11580. audio streams with silence.
  11581. For this filter to work correctly, all segments must start at timestamp 0.
  11582. All corresponding streams must have the same parameters in all segments; the
  11583. filtering system will automatically select a common pixel format for video
  11584. streams, and a common sample format, sample rate and channel layout for
  11585. audio streams, but other settings, such as resolution, must be converted
  11586. explicitly by the user.
  11587. Different frame rates are acceptable but will result in variable frame rate
  11588. at output; be sure to configure the output file to handle it.
  11589. @subsection Examples
  11590. @itemize
  11591. @item
  11592. Concatenate an opening, an episode and an ending, all in bilingual version
  11593. (video in stream 0, audio in streams 1 and 2):
  11594. @example
  11595. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11596. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11597. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11598. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11599. @end example
  11600. @item
  11601. Concatenate two parts, handling audio and video separately, using the
  11602. (a)movie sources, and adjusting the resolution:
  11603. @example
  11604. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11605. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11606. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11607. @end example
  11608. Note that a desync will happen at the stitch if the audio and video streams
  11609. do not have exactly the same duration in the first file.
  11610. @end itemize
  11611. @anchor{ebur128}
  11612. @section ebur128
  11613. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11614. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11615. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11616. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11617. The filter also has a video output (see the @var{video} option) with a real
  11618. time graph to observe the loudness evolution. The graphic contains the logged
  11619. message mentioned above, so it is not printed anymore when this option is set,
  11620. unless the verbose logging is set. The main graphing area contains the
  11621. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11622. the momentary loudness (400 milliseconds).
  11623. More information about the Loudness Recommendation EBU R128 on
  11624. @url{http://tech.ebu.ch/loudness}.
  11625. The filter accepts the following options:
  11626. @table @option
  11627. @item video
  11628. Activate the video output. The audio stream is passed unchanged whether this
  11629. option is set or no. The video stream will be the first output stream if
  11630. activated. Default is @code{0}.
  11631. @item size
  11632. Set the video size. This option is for video only. For the syntax of this
  11633. option, check the
  11634. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11635. Default and minimum resolution is @code{640x480}.
  11636. @item meter
  11637. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11638. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11639. other integer value between this range is allowed.
  11640. @item metadata
  11641. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11642. into 100ms output frames, each of them containing various loudness information
  11643. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11644. Default is @code{0}.
  11645. @item framelog
  11646. Force the frame logging level.
  11647. Available values are:
  11648. @table @samp
  11649. @item info
  11650. information logging level
  11651. @item verbose
  11652. verbose logging level
  11653. @end table
  11654. By default, the logging level is set to @var{info}. If the @option{video} or
  11655. the @option{metadata} options are set, it switches to @var{verbose}.
  11656. @item peak
  11657. Set peak mode(s).
  11658. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11659. values are:
  11660. @table @samp
  11661. @item none
  11662. Disable any peak mode (default).
  11663. @item sample
  11664. Enable sample-peak mode.
  11665. Simple peak mode looking for the higher sample value. It logs a message
  11666. for sample-peak (identified by @code{SPK}).
  11667. @item true
  11668. Enable true-peak mode.
  11669. If enabled, the peak lookup is done on an over-sampled version of the input
  11670. stream for better peak accuracy. It logs a message for true-peak.
  11671. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11672. This mode requires a build with @code{libswresample}.
  11673. @end table
  11674. @item dualmono
  11675. Treat mono input files as "dual mono". If a mono file is intended for playback
  11676. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11677. If set to @code{true}, this option will compensate for this effect.
  11678. Multi-channel input files are not affected by this option.
  11679. @item panlaw
  11680. Set a specific pan law to be used for the measurement of dual mono files.
  11681. This parameter is optional, and has a default value of -3.01dB.
  11682. @end table
  11683. @subsection Examples
  11684. @itemize
  11685. @item
  11686. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11687. @example
  11688. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11689. @end example
  11690. @item
  11691. Run an analysis with @command{ffmpeg}:
  11692. @example
  11693. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11694. @end example
  11695. @end itemize
  11696. @section interleave, ainterleave
  11697. Temporally interleave frames from several inputs.
  11698. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11699. These filters read frames from several inputs and send the oldest
  11700. queued frame to the output.
  11701. Input streams must have a well defined, monotonically increasing frame
  11702. timestamp values.
  11703. In order to submit one frame to output, these filters need to enqueue
  11704. at least one frame for each input, so they cannot work in case one
  11705. input is not yet terminated and will not receive incoming frames.
  11706. For example consider the case when one input is a @code{select} filter
  11707. which always drop input frames. The @code{interleave} filter will keep
  11708. reading from that input, but it will never be able to send new frames
  11709. to output until the input will send an end-of-stream signal.
  11710. Also, depending on inputs synchronization, the filters will drop
  11711. frames in case one input receives more frames than the other ones, and
  11712. the queue is already filled.
  11713. These filters accept the following options:
  11714. @table @option
  11715. @item nb_inputs, n
  11716. Set the number of different inputs, it is 2 by default.
  11717. @end table
  11718. @subsection Examples
  11719. @itemize
  11720. @item
  11721. Interleave frames belonging to different streams using @command{ffmpeg}:
  11722. @example
  11723. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11724. @end example
  11725. @item
  11726. Add flickering blur effect:
  11727. @example
  11728. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11729. @end example
  11730. @end itemize
  11731. @section perms, aperms
  11732. Set read/write permissions for the output frames.
  11733. These filters are mainly aimed at developers to test direct path in the
  11734. following filter in the filtergraph.
  11735. The filters accept the following options:
  11736. @table @option
  11737. @item mode
  11738. Select the permissions mode.
  11739. It accepts the following values:
  11740. @table @samp
  11741. @item none
  11742. Do nothing. This is the default.
  11743. @item ro
  11744. Set all the output frames read-only.
  11745. @item rw
  11746. Set all the output frames directly writable.
  11747. @item toggle
  11748. Make the frame read-only if writable, and writable if read-only.
  11749. @item random
  11750. Set each output frame read-only or writable randomly.
  11751. @end table
  11752. @item seed
  11753. Set the seed for the @var{random} mode, must be an integer included between
  11754. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11755. @code{-1}, the filter will try to use a good random seed on a best effort
  11756. basis.
  11757. @end table
  11758. Note: in case of auto-inserted filter between the permission filter and the
  11759. following one, the permission might not be received as expected in that
  11760. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11761. perms/aperms filter can avoid this problem.
  11762. @section realtime, arealtime
  11763. Slow down filtering to match real time approximatively.
  11764. These filters will pause the filtering for a variable amount of time to
  11765. match the output rate with the input timestamps.
  11766. They are similar to the @option{re} option to @code{ffmpeg}.
  11767. They accept the following options:
  11768. @table @option
  11769. @item limit
  11770. Time limit for the pauses. Any pause longer than that will be considered
  11771. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11772. @end table
  11773. @section select, aselect
  11774. Select frames to pass in output.
  11775. This filter accepts the following options:
  11776. @table @option
  11777. @item expr, e
  11778. Set expression, which is evaluated for each input frame.
  11779. If the expression is evaluated to zero, the frame is discarded.
  11780. If the evaluation result is negative or NaN, the frame is sent to the
  11781. first output; otherwise it is sent to the output with index
  11782. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11783. For example a value of @code{1.2} corresponds to the output with index
  11784. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11785. @item outputs, n
  11786. Set the number of outputs. The output to which to send the selected
  11787. frame is based on the result of the evaluation. Default value is 1.
  11788. @end table
  11789. The expression can contain the following constants:
  11790. @table @option
  11791. @item n
  11792. The (sequential) number of the filtered frame, starting from 0.
  11793. @item selected_n
  11794. The (sequential) number of the selected frame, starting from 0.
  11795. @item prev_selected_n
  11796. The sequential number of the last selected frame. It's NAN if undefined.
  11797. @item TB
  11798. The timebase of the input timestamps.
  11799. @item pts
  11800. The PTS (Presentation TimeStamp) of the filtered video frame,
  11801. expressed in @var{TB} units. It's NAN if undefined.
  11802. @item t
  11803. The PTS of the filtered video frame,
  11804. expressed in seconds. It's NAN if undefined.
  11805. @item prev_pts
  11806. The PTS of the previously filtered video frame. It's NAN if undefined.
  11807. @item prev_selected_pts
  11808. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11809. @item prev_selected_t
  11810. The PTS of the last previously selected video frame. It's NAN if undefined.
  11811. @item start_pts
  11812. The PTS of the first video frame in the video. It's NAN if undefined.
  11813. @item start_t
  11814. The time of the first video frame in the video. It's NAN if undefined.
  11815. @item pict_type @emph{(video only)}
  11816. The type of the filtered frame. It can assume one of the following
  11817. values:
  11818. @table @option
  11819. @item I
  11820. @item P
  11821. @item B
  11822. @item S
  11823. @item SI
  11824. @item SP
  11825. @item BI
  11826. @end table
  11827. @item interlace_type @emph{(video only)}
  11828. The frame interlace type. It can assume one of the following values:
  11829. @table @option
  11830. @item PROGRESSIVE
  11831. The frame is progressive (not interlaced).
  11832. @item TOPFIRST
  11833. The frame is top-field-first.
  11834. @item BOTTOMFIRST
  11835. The frame is bottom-field-first.
  11836. @end table
  11837. @item consumed_sample_n @emph{(audio only)}
  11838. the number of selected samples before the current frame
  11839. @item samples_n @emph{(audio only)}
  11840. the number of samples in the current frame
  11841. @item sample_rate @emph{(audio only)}
  11842. the input sample rate
  11843. @item key
  11844. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11845. @item pos
  11846. the position in the file of the filtered frame, -1 if the information
  11847. is not available (e.g. for synthetic video)
  11848. @item scene @emph{(video only)}
  11849. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11850. probability for the current frame to introduce a new scene, while a higher
  11851. value means the current frame is more likely to be one (see the example below)
  11852. @item concatdec_select
  11853. The concat demuxer can select only part of a concat input file by setting an
  11854. inpoint and an outpoint, but the output packets may not be entirely contained
  11855. in the selected interval. By using this variable, it is possible to skip frames
  11856. generated by the concat demuxer which are not exactly contained in the selected
  11857. interval.
  11858. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11859. and the @var{lavf.concat.duration} packet metadata values which are also
  11860. present in the decoded frames.
  11861. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11862. start_time and either the duration metadata is missing or the frame pts is less
  11863. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11864. missing.
  11865. That basically means that an input frame is selected if its pts is within the
  11866. interval set by the concat demuxer.
  11867. @end table
  11868. The default value of the select expression is "1".
  11869. @subsection Examples
  11870. @itemize
  11871. @item
  11872. Select all frames in input:
  11873. @example
  11874. select
  11875. @end example
  11876. The example above is the same as:
  11877. @example
  11878. select=1
  11879. @end example
  11880. @item
  11881. Skip all frames:
  11882. @example
  11883. select=0
  11884. @end example
  11885. @item
  11886. Select only I-frames:
  11887. @example
  11888. select='eq(pict_type\,I)'
  11889. @end example
  11890. @item
  11891. Select one frame every 100:
  11892. @example
  11893. select='not(mod(n\,100))'
  11894. @end example
  11895. @item
  11896. Select only frames contained in the 10-20 time interval:
  11897. @example
  11898. select=between(t\,10\,20)
  11899. @end example
  11900. @item
  11901. Select only I frames contained in the 10-20 time interval:
  11902. @example
  11903. select=between(t\,10\,20)*eq(pict_type\,I)
  11904. @end example
  11905. @item
  11906. Select frames with a minimum distance of 10 seconds:
  11907. @example
  11908. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11909. @end example
  11910. @item
  11911. Use aselect to select only audio frames with samples number > 100:
  11912. @example
  11913. aselect='gt(samples_n\,100)'
  11914. @end example
  11915. @item
  11916. Create a mosaic of the first scenes:
  11917. @example
  11918. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11919. @end example
  11920. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11921. choice.
  11922. @item
  11923. Send even and odd frames to separate outputs, and compose them:
  11924. @example
  11925. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11926. @end example
  11927. @item
  11928. Select useful frames from an ffconcat file which is using inpoints and
  11929. outpoints but where the source files are not intra frame only.
  11930. @example
  11931. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11932. @end example
  11933. @end itemize
  11934. @section sendcmd, asendcmd
  11935. Send commands to filters in the filtergraph.
  11936. These filters read commands to be sent to other filters in the
  11937. filtergraph.
  11938. @code{sendcmd} must be inserted between two video filters,
  11939. @code{asendcmd} must be inserted between two audio filters, but apart
  11940. from that they act the same way.
  11941. The specification of commands can be provided in the filter arguments
  11942. with the @var{commands} option, or in a file specified by the
  11943. @var{filename} option.
  11944. These filters accept the following options:
  11945. @table @option
  11946. @item commands, c
  11947. Set the commands to be read and sent to the other filters.
  11948. @item filename, f
  11949. Set the filename of the commands to be read and sent to the other
  11950. filters.
  11951. @end table
  11952. @subsection Commands syntax
  11953. A commands description consists of a sequence of interval
  11954. specifications, comprising a list of commands to be executed when a
  11955. particular event related to that interval occurs. The occurring event
  11956. is typically the current frame time entering or leaving a given time
  11957. interval.
  11958. An interval is specified by the following syntax:
  11959. @example
  11960. @var{START}[-@var{END}] @var{COMMANDS};
  11961. @end example
  11962. The time interval is specified by the @var{START} and @var{END} times.
  11963. @var{END} is optional and defaults to the maximum time.
  11964. The current frame time is considered within the specified interval if
  11965. it is included in the interval [@var{START}, @var{END}), that is when
  11966. the time is greater or equal to @var{START} and is lesser than
  11967. @var{END}.
  11968. @var{COMMANDS} consists of a sequence of one or more command
  11969. specifications, separated by ",", relating to that interval. The
  11970. syntax of a command specification is given by:
  11971. @example
  11972. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11973. @end example
  11974. @var{FLAGS} is optional and specifies the type of events relating to
  11975. the time interval which enable sending the specified command, and must
  11976. be a non-null sequence of identifier flags separated by "+" or "|" and
  11977. enclosed between "[" and "]".
  11978. The following flags are recognized:
  11979. @table @option
  11980. @item enter
  11981. The command is sent when the current frame timestamp enters the
  11982. specified interval. In other words, the command is sent when the
  11983. previous frame timestamp was not in the given interval, and the
  11984. current is.
  11985. @item leave
  11986. The command is sent when the current frame timestamp leaves the
  11987. specified interval. In other words, the command is sent when the
  11988. previous frame timestamp was in the given interval, and the
  11989. current is not.
  11990. @end table
  11991. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11992. assumed.
  11993. @var{TARGET} specifies the target of the command, usually the name of
  11994. the filter class or a specific filter instance name.
  11995. @var{COMMAND} specifies the name of the command for the target filter.
  11996. @var{ARG} is optional and specifies the optional list of argument for
  11997. the given @var{COMMAND}.
  11998. Between one interval specification and another, whitespaces, or
  11999. sequences of characters starting with @code{#} until the end of line,
  12000. are ignored and can be used to annotate comments.
  12001. A simplified BNF description of the commands specification syntax
  12002. follows:
  12003. @example
  12004. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12005. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12006. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12007. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12008. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12009. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12010. @end example
  12011. @subsection Examples
  12012. @itemize
  12013. @item
  12014. Specify audio tempo change at second 4:
  12015. @example
  12016. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12017. @end example
  12018. @item
  12019. Specify a list of drawtext and hue commands in a file.
  12020. @example
  12021. # show text in the interval 5-10
  12022. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12023. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12024. # desaturate the image in the interval 15-20
  12025. 15.0-20.0 [enter] hue s 0,
  12026. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12027. [leave] hue s 1,
  12028. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12029. # apply an exponential saturation fade-out effect, starting from time 25
  12030. 25 [enter] hue s exp(25-t)
  12031. @end example
  12032. A filtergraph allowing to read and process the above command list
  12033. stored in a file @file{test.cmd}, can be specified with:
  12034. @example
  12035. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12036. @end example
  12037. @end itemize
  12038. @anchor{setpts}
  12039. @section setpts, asetpts
  12040. Change the PTS (presentation timestamp) of the input frames.
  12041. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12042. This filter accepts the following options:
  12043. @table @option
  12044. @item expr
  12045. The expression which is evaluated for each frame to construct its timestamp.
  12046. @end table
  12047. The expression is evaluated through the eval API and can contain the following
  12048. constants:
  12049. @table @option
  12050. @item FRAME_RATE
  12051. frame rate, only defined for constant frame-rate video
  12052. @item PTS
  12053. The presentation timestamp in input
  12054. @item N
  12055. The count of the input frame for video or the number of consumed samples,
  12056. not including the current frame for audio, starting from 0.
  12057. @item NB_CONSUMED_SAMPLES
  12058. The number of consumed samples, not including the current frame (only
  12059. audio)
  12060. @item NB_SAMPLES, S
  12061. The number of samples in the current frame (only audio)
  12062. @item SAMPLE_RATE, SR
  12063. The audio sample rate.
  12064. @item STARTPTS
  12065. The PTS of the first frame.
  12066. @item STARTT
  12067. the time in seconds of the first frame
  12068. @item INTERLACED
  12069. State whether the current frame is interlaced.
  12070. @item T
  12071. the time in seconds of the current frame
  12072. @item POS
  12073. original position in the file of the frame, or undefined if undefined
  12074. for the current frame
  12075. @item PREV_INPTS
  12076. The previous input PTS.
  12077. @item PREV_INT
  12078. previous input time in seconds
  12079. @item PREV_OUTPTS
  12080. The previous output PTS.
  12081. @item PREV_OUTT
  12082. previous output time in seconds
  12083. @item RTCTIME
  12084. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12085. instead.
  12086. @item RTCSTART
  12087. The wallclock (RTC) time at the start of the movie in microseconds.
  12088. @item TB
  12089. The timebase of the input timestamps.
  12090. @end table
  12091. @subsection Examples
  12092. @itemize
  12093. @item
  12094. Start counting PTS from zero
  12095. @example
  12096. setpts=PTS-STARTPTS
  12097. @end example
  12098. @item
  12099. Apply fast motion effect:
  12100. @example
  12101. setpts=0.5*PTS
  12102. @end example
  12103. @item
  12104. Apply slow motion effect:
  12105. @example
  12106. setpts=2.0*PTS
  12107. @end example
  12108. @item
  12109. Set fixed rate of 25 frames per second:
  12110. @example
  12111. setpts=N/(25*TB)
  12112. @end example
  12113. @item
  12114. Set fixed rate 25 fps with some jitter:
  12115. @example
  12116. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12117. @end example
  12118. @item
  12119. Apply an offset of 10 seconds to the input PTS:
  12120. @example
  12121. setpts=PTS+10/TB
  12122. @end example
  12123. @item
  12124. Generate timestamps from a "live source" and rebase onto the current timebase:
  12125. @example
  12126. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12127. @end example
  12128. @item
  12129. Generate timestamps by counting samples:
  12130. @example
  12131. asetpts=N/SR/TB
  12132. @end example
  12133. @end itemize
  12134. @section settb, asettb
  12135. Set the timebase to use for the output frames timestamps.
  12136. It is mainly useful for testing timebase configuration.
  12137. It accepts the following parameters:
  12138. @table @option
  12139. @item expr, tb
  12140. The expression which is evaluated into the output timebase.
  12141. @end table
  12142. The value for @option{tb} is an arithmetic expression representing a
  12143. rational. The expression can contain the constants "AVTB" (the default
  12144. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12145. audio only). Default value is "intb".
  12146. @subsection Examples
  12147. @itemize
  12148. @item
  12149. Set the timebase to 1/25:
  12150. @example
  12151. settb=expr=1/25
  12152. @end example
  12153. @item
  12154. Set the timebase to 1/10:
  12155. @example
  12156. settb=expr=0.1
  12157. @end example
  12158. @item
  12159. Set the timebase to 1001/1000:
  12160. @example
  12161. settb=1+0.001
  12162. @end example
  12163. @item
  12164. Set the timebase to 2*intb:
  12165. @example
  12166. settb=2*intb
  12167. @end example
  12168. @item
  12169. Set the default timebase value:
  12170. @example
  12171. settb=AVTB
  12172. @end example
  12173. @end itemize
  12174. @section showcqt
  12175. Convert input audio to a video output representing frequency spectrum
  12176. logarithmically using Brown-Puckette constant Q transform algorithm with
  12177. direct frequency domain coefficient calculation (but the transform itself
  12178. is not really constant Q, instead the Q factor is actually variable/clamped),
  12179. with musical tone scale, from E0 to D#10.
  12180. The filter accepts the following options:
  12181. @table @option
  12182. @item size, s
  12183. Specify the video size for the output. It must be even. For the syntax of this option,
  12184. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12185. Default value is @code{1920x1080}.
  12186. @item fps, rate, r
  12187. Set the output frame rate. Default value is @code{25}.
  12188. @item bar_h
  12189. Set the bargraph height. It must be even. Default value is @code{-1} which
  12190. computes the bargraph height automatically.
  12191. @item axis_h
  12192. Set the axis height. It must be even. Default value is @code{-1} which computes
  12193. the axis height automatically.
  12194. @item sono_h
  12195. Set the sonogram height. It must be even. Default value is @code{-1} which
  12196. computes the sonogram height automatically.
  12197. @item fullhd
  12198. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12199. instead. Default value is @code{1}.
  12200. @item sono_v, volume
  12201. Specify the sonogram volume expression. It can contain variables:
  12202. @table @option
  12203. @item bar_v
  12204. the @var{bar_v} evaluated expression
  12205. @item frequency, freq, f
  12206. the frequency where it is evaluated
  12207. @item timeclamp, tc
  12208. the value of @var{timeclamp} option
  12209. @end table
  12210. and functions:
  12211. @table @option
  12212. @item a_weighting(f)
  12213. A-weighting of equal loudness
  12214. @item b_weighting(f)
  12215. B-weighting of equal loudness
  12216. @item c_weighting(f)
  12217. C-weighting of equal loudness.
  12218. @end table
  12219. Default value is @code{16}.
  12220. @item bar_v, volume2
  12221. Specify the bargraph volume expression. It can contain variables:
  12222. @table @option
  12223. @item sono_v
  12224. the @var{sono_v} evaluated expression
  12225. @item frequency, freq, f
  12226. the frequency where it is evaluated
  12227. @item timeclamp, tc
  12228. the value of @var{timeclamp} option
  12229. @end table
  12230. and functions:
  12231. @table @option
  12232. @item a_weighting(f)
  12233. A-weighting of equal loudness
  12234. @item b_weighting(f)
  12235. B-weighting of equal loudness
  12236. @item c_weighting(f)
  12237. C-weighting of equal loudness.
  12238. @end table
  12239. Default value is @code{sono_v}.
  12240. @item sono_g, gamma
  12241. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12242. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12243. Acceptable range is @code{[1, 7]}.
  12244. @item bar_g, gamma2
  12245. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12246. @code{[1, 7]}.
  12247. @item timeclamp, tc
  12248. Specify the transform timeclamp. At low frequency, there is trade-off between
  12249. accuracy in time domain and frequency domain. If timeclamp is lower,
  12250. event in time domain is represented more accurately (such as fast bass drum),
  12251. otherwise event in frequency domain is represented more accurately
  12252. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12253. @item basefreq
  12254. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12255. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12256. @item endfreq
  12257. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12258. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12259. @item coeffclamp
  12260. This option is deprecated and ignored.
  12261. @item tlength
  12262. Specify the transform length in time domain. Use this option to control accuracy
  12263. trade-off between time domain and frequency domain at every frequency sample.
  12264. It can contain variables:
  12265. @table @option
  12266. @item frequency, freq, f
  12267. the frequency where it is evaluated
  12268. @item timeclamp, tc
  12269. the value of @var{timeclamp} option.
  12270. @end table
  12271. Default value is @code{384*tc/(384+tc*f)}.
  12272. @item count
  12273. Specify the transform count for every video frame. Default value is @code{6}.
  12274. Acceptable range is @code{[1, 30]}.
  12275. @item fcount
  12276. Specify the transform count for every single pixel. Default value is @code{0},
  12277. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12278. @item fontfile
  12279. Specify font file for use with freetype to draw the axis. If not specified,
  12280. use embedded font. Note that drawing with font file or embedded font is not
  12281. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12282. option instead.
  12283. @item fontcolor
  12284. Specify font color expression. This is arithmetic expression that should return
  12285. integer value 0xRRGGBB. It can contain variables:
  12286. @table @option
  12287. @item frequency, freq, f
  12288. the frequency where it is evaluated
  12289. @item timeclamp, tc
  12290. the value of @var{timeclamp} option
  12291. @end table
  12292. and functions:
  12293. @table @option
  12294. @item midi(f)
  12295. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12296. @item r(x), g(x), b(x)
  12297. red, green, and blue value of intensity x.
  12298. @end table
  12299. Default value is @code{st(0, (midi(f)-59.5)/12);
  12300. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12301. r(1-ld(1)) + b(ld(1))}.
  12302. @item axisfile
  12303. Specify image file to draw the axis. This option override @var{fontfile} and
  12304. @var{fontcolor} option.
  12305. @item axis, text
  12306. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12307. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12308. Default value is @code{1}.
  12309. @end table
  12310. @subsection Examples
  12311. @itemize
  12312. @item
  12313. Playing audio while showing the spectrum:
  12314. @example
  12315. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12316. @end example
  12317. @item
  12318. Same as above, but with frame rate 30 fps:
  12319. @example
  12320. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12321. @end example
  12322. @item
  12323. Playing at 1280x720:
  12324. @example
  12325. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12326. @end example
  12327. @item
  12328. Disable sonogram display:
  12329. @example
  12330. sono_h=0
  12331. @end example
  12332. @item
  12333. A1 and its harmonics: A1, A2, (near)E3, A3:
  12334. @example
  12335. 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),
  12336. asplit[a][out1]; [a] showcqt [out0]'
  12337. @end example
  12338. @item
  12339. Same as above, but with more accuracy in frequency domain:
  12340. @example
  12341. 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),
  12342. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12343. @end example
  12344. @item
  12345. Custom volume:
  12346. @example
  12347. bar_v=10:sono_v=bar_v*a_weighting(f)
  12348. @end example
  12349. @item
  12350. Custom gamma, now spectrum is linear to the amplitude.
  12351. @example
  12352. bar_g=2:sono_g=2
  12353. @end example
  12354. @item
  12355. Custom tlength equation:
  12356. @example
  12357. 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)))'
  12358. @end example
  12359. @item
  12360. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12361. @example
  12362. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12363. @end example
  12364. @item
  12365. Custom frequency range with custom axis using image file:
  12366. @example
  12367. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12368. @end example
  12369. @end itemize
  12370. @section showfreqs
  12371. Convert input audio to video output representing the audio power spectrum.
  12372. Audio amplitude is on Y-axis while frequency is on X-axis.
  12373. The filter accepts the following options:
  12374. @table @option
  12375. @item size, s
  12376. Specify size of video. For the syntax of this option, check the
  12377. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12378. Default is @code{1024x512}.
  12379. @item mode
  12380. Set display mode.
  12381. This set how each frequency bin will be represented.
  12382. It accepts the following values:
  12383. @table @samp
  12384. @item line
  12385. @item bar
  12386. @item dot
  12387. @end table
  12388. Default is @code{bar}.
  12389. @item ascale
  12390. Set amplitude scale.
  12391. It accepts the following values:
  12392. @table @samp
  12393. @item lin
  12394. Linear scale.
  12395. @item sqrt
  12396. Square root scale.
  12397. @item cbrt
  12398. Cubic root scale.
  12399. @item log
  12400. Logarithmic scale.
  12401. @end table
  12402. Default is @code{log}.
  12403. @item fscale
  12404. Set frequency scale.
  12405. It accepts the following values:
  12406. @table @samp
  12407. @item lin
  12408. Linear scale.
  12409. @item log
  12410. Logarithmic scale.
  12411. @item rlog
  12412. Reverse logarithmic scale.
  12413. @end table
  12414. Default is @code{lin}.
  12415. @item win_size
  12416. Set window size.
  12417. It accepts the following values:
  12418. @table @samp
  12419. @item w16
  12420. @item w32
  12421. @item w64
  12422. @item w128
  12423. @item w256
  12424. @item w512
  12425. @item w1024
  12426. @item w2048
  12427. @item w4096
  12428. @item w8192
  12429. @item w16384
  12430. @item w32768
  12431. @item w65536
  12432. @end table
  12433. Default is @code{w2048}
  12434. @item win_func
  12435. Set windowing function.
  12436. It accepts the following values:
  12437. @table @samp
  12438. @item rect
  12439. @item bartlett
  12440. @item hanning
  12441. @item hamming
  12442. @item blackman
  12443. @item welch
  12444. @item flattop
  12445. @item bharris
  12446. @item bnuttall
  12447. @item bhann
  12448. @item sine
  12449. @item nuttall
  12450. @item lanczos
  12451. @item gauss
  12452. @item tukey
  12453. @end table
  12454. Default is @code{hanning}.
  12455. @item overlap
  12456. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12457. which means optimal overlap for selected window function will be picked.
  12458. @item averaging
  12459. Set time averaging. Setting this to 0 will display current maximal peaks.
  12460. Default is @code{1}, which means time averaging is disabled.
  12461. @item colors
  12462. Specify list of colors separated by space or by '|' which will be used to
  12463. draw channel frequencies. Unrecognized or missing colors will be replaced
  12464. by white color.
  12465. @item cmode
  12466. Set channel display mode.
  12467. It accepts the following values:
  12468. @table @samp
  12469. @item combined
  12470. @item separate
  12471. @end table
  12472. Default is @code{combined}.
  12473. @end table
  12474. @anchor{showspectrum}
  12475. @section showspectrum
  12476. Convert input audio to a video output, representing the audio frequency
  12477. spectrum.
  12478. The filter accepts the following options:
  12479. @table @option
  12480. @item size, s
  12481. Specify the video size for the output. For the syntax of this option, check the
  12482. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12483. Default value is @code{640x512}.
  12484. @item slide
  12485. Specify how the spectrum should slide along the window.
  12486. It accepts the following values:
  12487. @table @samp
  12488. @item replace
  12489. the samples start again on the left when they reach the right
  12490. @item scroll
  12491. the samples scroll from right to left
  12492. @item rscroll
  12493. the samples scroll from left to right
  12494. @item fullframe
  12495. frames are only produced when the samples reach the right
  12496. @end table
  12497. Default value is @code{replace}.
  12498. @item mode
  12499. Specify display mode.
  12500. It accepts the following values:
  12501. @table @samp
  12502. @item combined
  12503. all channels are displayed in the same row
  12504. @item separate
  12505. all channels are displayed in separate rows
  12506. @end table
  12507. Default value is @samp{combined}.
  12508. @item color
  12509. Specify display color mode.
  12510. It accepts the following values:
  12511. @table @samp
  12512. @item channel
  12513. each channel is displayed in a separate color
  12514. @item intensity
  12515. each channel is displayed using the same color scheme
  12516. @item rainbow
  12517. each channel is displayed using the rainbow color scheme
  12518. @item moreland
  12519. each channel is displayed using the moreland color scheme
  12520. @item nebulae
  12521. each channel is displayed using the nebulae color scheme
  12522. @item fire
  12523. each channel is displayed using the fire color scheme
  12524. @item fiery
  12525. each channel is displayed using the fiery color scheme
  12526. @item fruit
  12527. each channel is displayed using the fruit color scheme
  12528. @item cool
  12529. each channel is displayed using the cool color scheme
  12530. @end table
  12531. Default value is @samp{channel}.
  12532. @item scale
  12533. Specify scale used for calculating intensity color values.
  12534. It accepts the following values:
  12535. @table @samp
  12536. @item lin
  12537. linear
  12538. @item sqrt
  12539. square root, default
  12540. @item cbrt
  12541. cubic root
  12542. @item 4thrt
  12543. 4th root
  12544. @item 5thrt
  12545. 5th root
  12546. @item log
  12547. logarithmic
  12548. @end table
  12549. Default value is @samp{sqrt}.
  12550. @item saturation
  12551. Set saturation modifier for displayed colors. Negative values provide
  12552. alternative color scheme. @code{0} is no saturation at all.
  12553. Saturation must be in [-10.0, 10.0] range.
  12554. Default value is @code{1}.
  12555. @item win_func
  12556. Set window function.
  12557. It accepts the following values:
  12558. @table @samp
  12559. @item rect
  12560. @item bartlett
  12561. @item hann
  12562. @item hanning
  12563. @item hamming
  12564. @item blackman
  12565. @item welch
  12566. @item flattop
  12567. @item bharris
  12568. @item bnuttall
  12569. @item bhann
  12570. @item sine
  12571. @item nuttall
  12572. @item lanczos
  12573. @item gauss
  12574. @item tukey
  12575. @end table
  12576. Default value is @code{hann}.
  12577. @item orientation
  12578. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12579. @code{horizontal}. Default is @code{vertical}.
  12580. @item overlap
  12581. Set ratio of overlap window. Default value is @code{0}.
  12582. When value is @code{1} overlap is set to recommended size for specific
  12583. window function currently used.
  12584. @item gain
  12585. Set scale gain for calculating intensity color values.
  12586. Default value is @code{1}.
  12587. @item data
  12588. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12589. @end table
  12590. The usage is very similar to the showwaves filter; see the examples in that
  12591. section.
  12592. @subsection Examples
  12593. @itemize
  12594. @item
  12595. Large window with logarithmic color scaling:
  12596. @example
  12597. showspectrum=s=1280x480:scale=log
  12598. @end example
  12599. @item
  12600. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12601. @example
  12602. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12603. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12604. @end example
  12605. @end itemize
  12606. @section showspectrumpic
  12607. Convert input audio to a single video frame, representing the audio frequency
  12608. spectrum.
  12609. The filter accepts the following options:
  12610. @table @option
  12611. @item size, s
  12612. Specify the video size for the output. For the syntax of this option, check the
  12613. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12614. Default value is @code{4096x2048}.
  12615. @item mode
  12616. Specify display mode.
  12617. It accepts the following values:
  12618. @table @samp
  12619. @item combined
  12620. all channels are displayed in the same row
  12621. @item separate
  12622. all channels are displayed in separate rows
  12623. @end table
  12624. Default value is @samp{combined}.
  12625. @item color
  12626. Specify display color mode.
  12627. It accepts the following values:
  12628. @table @samp
  12629. @item channel
  12630. each channel is displayed in a separate color
  12631. @item intensity
  12632. each channel is displayed using the same color scheme
  12633. @item rainbow
  12634. each channel is displayed using the rainbow color scheme
  12635. @item moreland
  12636. each channel is displayed using the moreland color scheme
  12637. @item nebulae
  12638. each channel is displayed using the nebulae color scheme
  12639. @item fire
  12640. each channel is displayed using the fire color scheme
  12641. @item fiery
  12642. each channel is displayed using the fiery color scheme
  12643. @item fruit
  12644. each channel is displayed using the fruit color scheme
  12645. @item cool
  12646. each channel is displayed using the cool color scheme
  12647. @end table
  12648. Default value is @samp{intensity}.
  12649. @item scale
  12650. Specify scale used for calculating intensity color values.
  12651. It accepts the following values:
  12652. @table @samp
  12653. @item lin
  12654. linear
  12655. @item sqrt
  12656. square root, default
  12657. @item cbrt
  12658. cubic root
  12659. @item 4thrt
  12660. 4th root
  12661. @item 5thrt
  12662. 5th root
  12663. @item log
  12664. logarithmic
  12665. @end table
  12666. Default value is @samp{log}.
  12667. @item saturation
  12668. Set saturation modifier for displayed colors. Negative values provide
  12669. alternative color scheme. @code{0} is no saturation at all.
  12670. Saturation must be in [-10.0, 10.0] range.
  12671. Default value is @code{1}.
  12672. @item win_func
  12673. Set window function.
  12674. It accepts the following values:
  12675. @table @samp
  12676. @item rect
  12677. @item bartlett
  12678. @item hann
  12679. @item hanning
  12680. @item hamming
  12681. @item blackman
  12682. @item welch
  12683. @item flattop
  12684. @item bharris
  12685. @item bnuttall
  12686. @item bhann
  12687. @item sine
  12688. @item nuttall
  12689. @item lanczos
  12690. @item gauss
  12691. @item tukey
  12692. @end table
  12693. Default value is @code{hann}.
  12694. @item orientation
  12695. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12696. @code{horizontal}. Default is @code{vertical}.
  12697. @item gain
  12698. Set scale gain for calculating intensity color values.
  12699. Default value is @code{1}.
  12700. @item legend
  12701. Draw time and frequency axes and legends. Default is enabled.
  12702. @end table
  12703. @subsection Examples
  12704. @itemize
  12705. @item
  12706. Extract an audio spectrogram of a whole audio track
  12707. in a 1024x1024 picture using @command{ffmpeg}:
  12708. @example
  12709. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12710. @end example
  12711. @end itemize
  12712. @section showvolume
  12713. Convert input audio volume to a video output.
  12714. The filter accepts the following options:
  12715. @table @option
  12716. @item rate, r
  12717. Set video rate.
  12718. @item b
  12719. Set border width, allowed range is [0, 5]. Default is 1.
  12720. @item w
  12721. Set channel width, allowed range is [80, 8192]. Default is 400.
  12722. @item h
  12723. Set channel height, allowed range is [1, 900]. Default is 20.
  12724. @item f
  12725. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12726. @item c
  12727. Set volume color expression.
  12728. The expression can use the following variables:
  12729. @table @option
  12730. @item VOLUME
  12731. Current max volume of channel in dB.
  12732. @item CHANNEL
  12733. Current channel number, starting from 0.
  12734. @end table
  12735. @item t
  12736. If set, displays channel names. Default is enabled.
  12737. @item v
  12738. If set, displays volume values. Default is enabled.
  12739. @item o
  12740. Set orientation, can be @code{horizontal} or @code{vertical},
  12741. default is @code{horizontal}.
  12742. @item s
  12743. Set step size, allowed range s [0, 5]. Default is 0, which means
  12744. step is disabled.
  12745. @end table
  12746. @section showwaves
  12747. Convert input audio to a video output, representing the samples waves.
  12748. The filter accepts the following options:
  12749. @table @option
  12750. @item size, s
  12751. Specify the video size for the output. For the syntax of this option, check the
  12752. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12753. Default value is @code{600x240}.
  12754. @item mode
  12755. Set display mode.
  12756. Available values are:
  12757. @table @samp
  12758. @item point
  12759. Draw a point for each sample.
  12760. @item line
  12761. Draw a vertical line for each sample.
  12762. @item p2p
  12763. Draw a point for each sample and a line between them.
  12764. @item cline
  12765. Draw a centered vertical line for each sample.
  12766. @end table
  12767. Default value is @code{point}.
  12768. @item n
  12769. Set the number of samples which are printed on the same column. A
  12770. larger value will decrease the frame rate. Must be a positive
  12771. integer. This option can be set only if the value for @var{rate}
  12772. is not explicitly specified.
  12773. @item rate, r
  12774. Set the (approximate) output frame rate. This is done by setting the
  12775. option @var{n}. Default value is "25".
  12776. @item split_channels
  12777. Set if channels should be drawn separately or overlap. Default value is 0.
  12778. @item colors
  12779. Set colors separated by '|' which are going to be used for drawing of each channel.
  12780. @item scale
  12781. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12782. Default is linear.
  12783. @end table
  12784. @subsection Examples
  12785. @itemize
  12786. @item
  12787. Output the input file audio and the corresponding video representation
  12788. at the same time:
  12789. @example
  12790. amovie=a.mp3,asplit[out0],showwaves[out1]
  12791. @end example
  12792. @item
  12793. Create a synthetic signal and show it with showwaves, forcing a
  12794. frame rate of 30 frames per second:
  12795. @example
  12796. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12797. @end example
  12798. @end itemize
  12799. @section showwavespic
  12800. Convert input audio to a single video frame, representing the samples waves.
  12801. The filter accepts the following options:
  12802. @table @option
  12803. @item size, s
  12804. Specify the video size for the output. For the syntax of this option, check the
  12805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12806. Default value is @code{600x240}.
  12807. @item split_channels
  12808. Set if channels should be drawn separately or overlap. Default value is 0.
  12809. @item colors
  12810. Set colors separated by '|' which are going to be used for drawing of each channel.
  12811. @item scale
  12812. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12813. Default is linear.
  12814. @end table
  12815. @subsection Examples
  12816. @itemize
  12817. @item
  12818. Extract a channel split representation of the wave form of a whole audio track
  12819. in a 1024x800 picture using @command{ffmpeg}:
  12820. @example
  12821. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12822. @end example
  12823. @end itemize
  12824. @section spectrumsynth
  12825. Sythesize audio from 2 input video spectrums, first input stream represents
  12826. magnitude across time and second represents phase across time.
  12827. The filter will transform from frequency domain as displayed in videos back
  12828. to time domain as presented in audio output.
  12829. This filter is primarly created for reversing processed @ref{showspectrum}
  12830. filter outputs, but can synthesize sound from other spectrograms too.
  12831. But in such case results are going to be poor if the phase data is not
  12832. available, because in such cases phase data need to be recreated, usually
  12833. its just recreated from random noise.
  12834. For best results use gray only output (@code{channel} color mode in
  12835. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12836. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12837. @code{data} option. Inputs videos should generally use @code{fullframe}
  12838. slide mode as that saves resources needed for decoding video.
  12839. The filter accepts the following options:
  12840. @table @option
  12841. @item sample_rate
  12842. Specify sample rate of output audio, the sample rate of audio from which
  12843. spectrum was generated may differ.
  12844. @item channels
  12845. Set number of channels represented in input video spectrums.
  12846. @item scale
  12847. Set scale which was used when generating magnitude input spectrum.
  12848. Can be @code{lin} or @code{log}. Default is @code{log}.
  12849. @item slide
  12850. Set slide which was used when generating inputs spectrums.
  12851. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12852. Default is @code{fullframe}.
  12853. @item win_func
  12854. Set window function used for resynthesis.
  12855. @item overlap
  12856. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12857. which means optimal overlap for selected window function will be picked.
  12858. @item orientation
  12859. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12860. Default is @code{vertical}.
  12861. @end table
  12862. @subsection Examples
  12863. @itemize
  12864. @item
  12865. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12866. then resynthesize videos back to audio with spectrumsynth:
  12867. @example
  12868. 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
  12869. 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
  12870. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12871. @end example
  12872. @end itemize
  12873. @section split, asplit
  12874. Split input into several identical outputs.
  12875. @code{asplit} works with audio input, @code{split} with video.
  12876. The filter accepts a single parameter which specifies the number of outputs. If
  12877. unspecified, it defaults to 2.
  12878. @subsection Examples
  12879. @itemize
  12880. @item
  12881. Create two separate outputs from the same input:
  12882. @example
  12883. [in] split [out0][out1]
  12884. @end example
  12885. @item
  12886. To create 3 or more outputs, you need to specify the number of
  12887. outputs, like in:
  12888. @example
  12889. [in] asplit=3 [out0][out1][out2]
  12890. @end example
  12891. @item
  12892. Create two separate outputs from the same input, one cropped and
  12893. one padded:
  12894. @example
  12895. [in] split [splitout1][splitout2];
  12896. [splitout1] crop=100:100:0:0 [cropout];
  12897. [splitout2] pad=200:200:100:100 [padout];
  12898. @end example
  12899. @item
  12900. Create 5 copies of the input audio with @command{ffmpeg}:
  12901. @example
  12902. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12903. @end example
  12904. @end itemize
  12905. @section zmq, azmq
  12906. Receive commands sent through a libzmq client, and forward them to
  12907. filters in the filtergraph.
  12908. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12909. must be inserted between two video filters, @code{azmq} between two
  12910. audio filters.
  12911. To enable these filters you need to install the libzmq library and
  12912. headers and configure FFmpeg with @code{--enable-libzmq}.
  12913. For more information about libzmq see:
  12914. @url{http://www.zeromq.org/}
  12915. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12916. receives messages sent through a network interface defined by the
  12917. @option{bind_address} option.
  12918. The received message must be in the form:
  12919. @example
  12920. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12921. @end example
  12922. @var{TARGET} specifies the target of the command, usually the name of
  12923. the filter class or a specific filter instance name.
  12924. @var{COMMAND} specifies the name of the command for the target filter.
  12925. @var{ARG} is optional and specifies the optional argument list for the
  12926. given @var{COMMAND}.
  12927. Upon reception, the message is processed and the corresponding command
  12928. is injected into the filtergraph. Depending on the result, the filter
  12929. will send a reply to the client, adopting the format:
  12930. @example
  12931. @var{ERROR_CODE} @var{ERROR_REASON}
  12932. @var{MESSAGE}
  12933. @end example
  12934. @var{MESSAGE} is optional.
  12935. @subsection Examples
  12936. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12937. be used to send commands processed by these filters.
  12938. Consider the following filtergraph generated by @command{ffplay}
  12939. @example
  12940. ffplay -dumpgraph 1 -f lavfi "
  12941. color=s=100x100:c=red [l];
  12942. color=s=100x100:c=blue [r];
  12943. nullsrc=s=200x100, zmq [bg];
  12944. [bg][l] overlay [bg+l];
  12945. [bg+l][r] overlay=x=100 "
  12946. @end example
  12947. To change the color of the left side of the video, the following
  12948. command can be used:
  12949. @example
  12950. echo Parsed_color_0 c yellow | tools/zmqsend
  12951. @end example
  12952. To change the right side:
  12953. @example
  12954. echo Parsed_color_1 c pink | tools/zmqsend
  12955. @end example
  12956. @c man end MULTIMEDIA FILTERS
  12957. @chapter Multimedia Sources
  12958. @c man begin MULTIMEDIA SOURCES
  12959. Below is a description of the currently available multimedia sources.
  12960. @section amovie
  12961. This is the same as @ref{movie} source, except it selects an audio
  12962. stream by default.
  12963. @anchor{movie}
  12964. @section movie
  12965. Read audio and/or video stream(s) from a movie container.
  12966. It accepts the following parameters:
  12967. @table @option
  12968. @item filename
  12969. The name of the resource to read (not necessarily a file; it can also be a
  12970. device or a stream accessed through some protocol).
  12971. @item format_name, f
  12972. Specifies the format assumed for the movie to read, and can be either
  12973. the name of a container or an input device. If not specified, the
  12974. format is guessed from @var{movie_name} or by probing.
  12975. @item seek_point, sp
  12976. Specifies the seek point in seconds. The frames will be output
  12977. starting from this seek point. The parameter is evaluated with
  12978. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12979. postfix. The default value is "0".
  12980. @item streams, s
  12981. Specifies the streams to read. Several streams can be specified,
  12982. separated by "+". The source will then have as many outputs, in the
  12983. same order. The syntax is explained in the ``Stream specifiers''
  12984. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12985. respectively the default (best suited) video and audio stream. Default
  12986. is "dv", or "da" if the filter is called as "amovie".
  12987. @item stream_index, si
  12988. Specifies the index of the video stream to read. If the value is -1,
  12989. the most suitable video stream will be automatically selected. The default
  12990. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12991. audio instead of video.
  12992. @item loop
  12993. Specifies how many times to read the stream in sequence.
  12994. If the value is less than 1, the stream will be read again and again.
  12995. Default value is "1".
  12996. Note that when the movie is looped the source timestamps are not
  12997. changed, so it will generate non monotonically increasing timestamps.
  12998. @end table
  12999. It allows overlaying a second video on top of the main input of
  13000. a filtergraph, as shown in this graph:
  13001. @example
  13002. input -----------> deltapts0 --> overlay --> output
  13003. ^
  13004. |
  13005. movie --> scale--> deltapts1 -------+
  13006. @end example
  13007. @subsection Examples
  13008. @itemize
  13009. @item
  13010. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13011. on top of the input labelled "in":
  13012. @example
  13013. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13014. [in] setpts=PTS-STARTPTS [main];
  13015. [main][over] overlay=16:16 [out]
  13016. @end example
  13017. @item
  13018. Read from a video4linux2 device, and overlay it on top of the input
  13019. labelled "in":
  13020. @example
  13021. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13022. [in] setpts=PTS-STARTPTS [main];
  13023. [main][over] overlay=16:16 [out]
  13024. @end example
  13025. @item
  13026. Read the first video stream and the audio stream with id 0x81 from
  13027. dvd.vob; the video is connected to the pad named "video" and the audio is
  13028. connected to the pad named "audio":
  13029. @example
  13030. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13031. @end example
  13032. @end itemize
  13033. @subsection Commands
  13034. Both movie and amovie support the following commands:
  13035. @table @option
  13036. @item seek
  13037. Perform seek using "av_seek_frame".
  13038. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13039. @itemize
  13040. @item
  13041. @var{stream_index}: If stream_index is -1, a default
  13042. stream is selected, and @var{timestamp} is automatically converted
  13043. from AV_TIME_BASE units to the stream specific time_base.
  13044. @item
  13045. @var{timestamp}: Timestamp in AVStream.time_base units
  13046. or, if no stream is specified, in AV_TIME_BASE units.
  13047. @item
  13048. @var{flags}: Flags which select direction and seeking mode.
  13049. @end itemize
  13050. @item get_duration
  13051. Get movie duration in AV_TIME_BASE units.
  13052. @end table
  13053. @c man end MULTIMEDIA SOURCES