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.

20530 lines
544KB

  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{id}=@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 optionally followed by "@@@var{id}".
  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{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adelay
  434. Delay one or more audio channels.
  435. Samples in delayed channel are filled with silence.
  436. The filter accepts the following option:
  437. @table @option
  438. @item delays
  439. Set list of delays in milliseconds for each channel separated by '|'.
  440. Unused delays will be silently ignored. If number of given delays is
  441. smaller than number of channels all remaining channels will not be delayed.
  442. If you want to delay exact number of samples, append 'S' to number.
  443. @end table
  444. @subsection Examples
  445. @itemize
  446. @item
  447. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  448. the second channel (and any other channels that may be present) unchanged.
  449. @example
  450. adelay=1500|0|500
  451. @end example
  452. @item
  453. Delay second channel by 500 samples, the third channel by 700 samples and leave
  454. the first channel (and any other channels that may be present) unchanged.
  455. @example
  456. adelay=0|500S|700S
  457. @end example
  458. @end itemize
  459. @section aecho
  460. Apply echoing to the input audio.
  461. Echoes are reflected sound and can occur naturally amongst mountains
  462. (and sometimes large buildings) when talking or shouting; digital echo
  463. effects emulate this behaviour and are often used to help fill out the
  464. sound of a single instrument or vocal. The time difference between the
  465. original signal and the reflection is the @code{delay}, and the
  466. loudness of the reflected signal is the @code{decay}.
  467. Multiple echoes can have different delays and decays.
  468. A description of the accepted parameters follows.
  469. @table @option
  470. @item in_gain
  471. Set input gain of reflected signal. Default is @code{0.6}.
  472. @item out_gain
  473. Set output gain of reflected signal. Default is @code{0.3}.
  474. @item delays
  475. Set list of time intervals in milliseconds between original signal and reflections
  476. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  477. Default is @code{1000}.
  478. @item decays
  479. Set list of loudness of reflected signals separated by '|'.
  480. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  481. Default is @code{0.5}.
  482. @end table
  483. @subsection Examples
  484. @itemize
  485. @item
  486. Make it sound as if there are twice as many instruments as are actually playing:
  487. @example
  488. aecho=0.8:0.88:60:0.4
  489. @end example
  490. @item
  491. If delay is very short, then it sound like a (metallic) robot playing music:
  492. @example
  493. aecho=0.8:0.88:6:0.4
  494. @end example
  495. @item
  496. A longer delay will sound like an open air concert in the mountains:
  497. @example
  498. aecho=0.8:0.9:1000:0.3
  499. @end example
  500. @item
  501. Same as above but with one more mountain:
  502. @example
  503. aecho=0.8:0.9:1000|1800:0.3|0.25
  504. @end example
  505. @end itemize
  506. @section aemphasis
  507. Audio emphasis filter creates or restores material directly taken from LPs or
  508. emphased CDs with different filter curves. E.g. to store music on vinyl the
  509. signal has to be altered by a filter first to even out the disadvantages of
  510. this recording medium.
  511. Once the material is played back the inverse filter has to be applied to
  512. restore the distortion of the frequency response.
  513. The filter accepts the following options:
  514. @table @option
  515. @item level_in
  516. Set input gain.
  517. @item level_out
  518. Set output gain.
  519. @item mode
  520. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  521. use @code{production} mode. Default is @code{reproduction} mode.
  522. @item type
  523. Set filter type. Selects medium. Can be one of the following:
  524. @table @option
  525. @item col
  526. select Columbia.
  527. @item emi
  528. select EMI.
  529. @item bsi
  530. select BSI (78RPM).
  531. @item riaa
  532. select RIAA.
  533. @item cd
  534. select Compact Disc (CD).
  535. @item 50fm
  536. select 50µs (FM).
  537. @item 75fm
  538. select 75µs (FM).
  539. @item 50kf
  540. select 50µs (FM-KF).
  541. @item 75kf
  542. select 75µs (FM-KF).
  543. @end table
  544. @end table
  545. @section aeval
  546. Modify an audio signal according to the specified expressions.
  547. This filter accepts one or more expressions (one for each channel),
  548. which are evaluated and used to modify a corresponding audio signal.
  549. It accepts the following parameters:
  550. @table @option
  551. @item exprs
  552. Set the '|'-separated expressions list for each separate channel. If
  553. the number of input channels is greater than the number of
  554. expressions, the last specified expression is used for the remaining
  555. output channels.
  556. @item channel_layout, c
  557. Set output channel layout. If not specified, the channel layout is
  558. specified by the number of expressions. If set to @samp{same}, it will
  559. use by default the same input channel layout.
  560. @end table
  561. Each expression in @var{exprs} can contain the following constants and functions:
  562. @table @option
  563. @item ch
  564. channel number of the current expression
  565. @item n
  566. number of the evaluated sample, starting from 0
  567. @item s
  568. sample rate
  569. @item t
  570. time of the evaluated sample expressed in seconds
  571. @item nb_in_channels
  572. @item nb_out_channels
  573. input and output number of channels
  574. @item val(CH)
  575. the value of input channel with number @var{CH}
  576. @end table
  577. Note: this filter is slow. For faster processing you should use a
  578. dedicated filter.
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Half volume:
  583. @example
  584. aeval=val(ch)/2:c=same
  585. @end example
  586. @item
  587. Invert phase of the second channel:
  588. @example
  589. aeval=val(0)|-val(1)
  590. @end example
  591. @end itemize
  592. @anchor{afade}
  593. @section afade
  594. Apply fade-in/out effect to input audio.
  595. A description of the accepted parameters follows.
  596. @table @option
  597. @item type, t
  598. Specify the effect type, can be either @code{in} for fade-in, or
  599. @code{out} for a fade-out effect. Default is @code{in}.
  600. @item start_sample, ss
  601. Specify the number of the start sample for starting to apply the fade
  602. effect. Default is 0.
  603. @item nb_samples, ns
  604. Specify the number of samples for which the fade effect has to last. At
  605. the end of the fade-in effect the output audio will have the same
  606. volume as the input audio, at the end of the fade-out transition
  607. the output audio will be silence. Default is 44100.
  608. @item start_time, st
  609. Specify the start time of the fade effect. Default is 0.
  610. The value must be specified as a time duration; see
  611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  612. for the accepted syntax.
  613. If set this option is used instead of @var{start_sample}.
  614. @item duration, d
  615. Specify the duration of the fade effect. See
  616. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  617. for the accepted syntax.
  618. At the end of the fade-in effect the output audio will have the same
  619. volume as the input audio, at the end of the fade-out transition
  620. the output audio will be silence.
  621. By default the duration is determined by @var{nb_samples}.
  622. If set this option is used instead of @var{nb_samples}.
  623. @item curve
  624. Set curve for fade transition.
  625. It accepts the following values:
  626. @table @option
  627. @item tri
  628. select triangular, linear slope (default)
  629. @item qsin
  630. select quarter of sine wave
  631. @item hsin
  632. select half of sine wave
  633. @item esin
  634. select exponential sine wave
  635. @item log
  636. select logarithmic
  637. @item ipar
  638. select inverted parabola
  639. @item qua
  640. select quadratic
  641. @item cub
  642. select cubic
  643. @item squ
  644. select square root
  645. @item cbr
  646. select cubic root
  647. @item par
  648. select parabola
  649. @item exp
  650. select exponential
  651. @item iqsin
  652. select inverted quarter of sine wave
  653. @item ihsin
  654. select inverted half of sine wave
  655. @item dese
  656. select double-exponential seat
  657. @item desi
  658. select double-exponential sigmoid
  659. @end table
  660. @end table
  661. @subsection Examples
  662. @itemize
  663. @item
  664. Fade in first 15 seconds of audio:
  665. @example
  666. afade=t=in:ss=0:d=15
  667. @end example
  668. @item
  669. Fade out last 25 seconds of a 900 seconds audio:
  670. @example
  671. afade=t=out:st=875:d=25
  672. @end example
  673. @end itemize
  674. @section afftfilt
  675. Apply arbitrary expressions to samples in frequency domain.
  676. @table @option
  677. @item real
  678. Set frequency domain real expression for each separate channel separated
  679. by '|'. Default is "1".
  680. If the number of input channels is greater than the number of
  681. expressions, the last specified expression is used for the remaining
  682. output channels.
  683. @item imag
  684. Set frequency domain imaginary expression for each separate channel
  685. separated by '|'. If not set, @var{real} option is used.
  686. Each expression in @var{real} and @var{imag} can contain the following
  687. constants:
  688. @table @option
  689. @item sr
  690. sample rate
  691. @item b
  692. current frequency bin number
  693. @item nb
  694. number of available bins
  695. @item ch
  696. channel number of the current expression
  697. @item chs
  698. number of channels
  699. @item pts
  700. current frame pts
  701. @end table
  702. @item win_size
  703. Set window size.
  704. It accepts the following values:
  705. @table @samp
  706. @item w16
  707. @item w32
  708. @item w64
  709. @item w128
  710. @item w256
  711. @item w512
  712. @item w1024
  713. @item w2048
  714. @item w4096
  715. @item w8192
  716. @item w16384
  717. @item w32768
  718. @item w65536
  719. @end table
  720. Default is @code{w4096}
  721. @item win_func
  722. Set window function. Default is @code{hann}.
  723. @item overlap
  724. Set window overlap. If set to 1, the recommended overlap for selected
  725. window function will be picked. Default is @code{0.75}.
  726. @end table
  727. @subsection Examples
  728. @itemize
  729. @item
  730. Leave almost only low frequencies in audio:
  731. @example
  732. afftfilt="1-clip((b/nb)*b,0,1)"
  733. @end example
  734. @end itemize
  735. @anchor{afir}
  736. @section afir
  737. Apply an arbitrary Frequency Impulse Response filter.
  738. This filter is designed for applying long FIR filters,
  739. up to 30 seconds long.
  740. It can be used as component for digital crossover filters,
  741. room equalization, cross talk cancellation, wavefield synthesis,
  742. auralization, ambiophonics and ambisonics.
  743. This filter uses second stream as FIR coefficients.
  744. If second stream holds single channel, it will be used
  745. for all input channels in first stream, otherwise
  746. number of channels in second stream must be same as
  747. number of channels in first stream.
  748. It accepts the following parameters:
  749. @table @option
  750. @item dry
  751. Set dry gain. This sets input gain.
  752. @item wet
  753. Set wet gain. This sets final output gain.
  754. @item length
  755. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  756. @item again
  757. Enable applying gain measured from power of IR.
  758. @item maxir
  759. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  760. Allowed range is 0.1 to 60 seconds.
  761. @end table
  762. @subsection Examples
  763. @itemize
  764. @item
  765. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  766. @example
  767. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  768. @end example
  769. @end itemize
  770. @anchor{aformat}
  771. @section aformat
  772. Set output format constraints for the input audio. The framework will
  773. negotiate the most appropriate format to minimize conversions.
  774. It accepts the following parameters:
  775. @table @option
  776. @item sample_fmts
  777. A '|'-separated list of requested sample formats.
  778. @item sample_rates
  779. A '|'-separated list of requested sample rates.
  780. @item channel_layouts
  781. A '|'-separated list of requested channel layouts.
  782. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  783. for the required syntax.
  784. @end table
  785. If a parameter is omitted, all values are allowed.
  786. Force the output to either unsigned 8-bit or signed 16-bit stereo
  787. @example
  788. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  789. @end example
  790. @section agate
  791. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  792. processing reduces disturbing noise between useful signals.
  793. Gating is done by detecting the volume below a chosen level @var{threshold}
  794. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  795. floor is set via @var{range}. Because an exact manipulation of the signal
  796. would cause distortion of the waveform the reduction can be levelled over
  797. time. This is done by setting @var{attack} and @var{release}.
  798. @var{attack} determines how long the signal has to fall below the threshold
  799. before any reduction will occur and @var{release} sets the time the signal
  800. has to rise above the threshold to reduce the reduction again.
  801. Shorter signals than the chosen attack time will be left untouched.
  802. @table @option
  803. @item level_in
  804. Set input level before filtering.
  805. Default is 1. Allowed range is from 0.015625 to 64.
  806. @item range
  807. Set the level of gain reduction when the signal is below the threshold.
  808. Default is 0.06125. Allowed range is from 0 to 1.
  809. @item threshold
  810. If a signal rises above this level the gain reduction is released.
  811. Default is 0.125. Allowed range is from 0 to 1.
  812. @item ratio
  813. Set a ratio by which the signal is reduced.
  814. Default is 2. Allowed range is from 1 to 9000.
  815. @item attack
  816. Amount of milliseconds the signal has to rise above the threshold before gain
  817. reduction stops.
  818. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  819. @item release
  820. Amount of milliseconds the signal has to fall below the threshold before the
  821. reduction is increased again. Default is 250 milliseconds.
  822. Allowed range is from 0.01 to 9000.
  823. @item makeup
  824. Set amount of amplification of signal after processing.
  825. Default is 1. Allowed range is from 1 to 64.
  826. @item knee
  827. Curve the sharp knee around the threshold to enter gain reduction more softly.
  828. Default is 2.828427125. Allowed range is from 1 to 8.
  829. @item detection
  830. Choose if exact signal should be taken for detection or an RMS like one.
  831. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  832. @item link
  833. Choose if the average level between all channels or the louder channel affects
  834. the reduction.
  835. Default is @code{average}. Can be @code{average} or @code{maximum}.
  836. @end table
  837. @section aiir
  838. Apply an arbitrary Infinite Impulse Response filter.
  839. It accepts the following parameters:
  840. @table @option
  841. @item z
  842. Set numerator/zeros coefficients.
  843. @item p
  844. Set denominator/poles coefficients.
  845. @item k
  846. Set channels gains.
  847. @item dry_gain
  848. Set input gain.
  849. @item wet_gain
  850. Set output gain.
  851. @item f
  852. Set coefficients format.
  853. @table @samp
  854. @item tf
  855. transfer function
  856. @item zp
  857. Z-plane zeros/poles, cartesian (default)
  858. @item pr
  859. Z-plane zeros/poles, polar radians
  860. @item pd
  861. Z-plane zeros/poles, polar degrees
  862. @end table
  863. @item r
  864. Set kind of processing.
  865. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  866. @item e
  867. Set filtering precision.
  868. @table @samp
  869. @item dbl
  870. double-precision floating-point (default)
  871. @item flt
  872. single-precision floating-point
  873. @item i32
  874. 32-bit integers
  875. @item i16
  876. 16-bit integers
  877. @end table
  878. @end table
  879. Coefficients in @code{tf} format are separated by spaces and are in ascending
  880. order.
  881. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  882. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  883. imaginary unit.
  884. Different coefficients and gains can be provided for every channel, in such case
  885. use '|' to separate coefficients or gains. Last provided coefficients will be
  886. used for all remaining channels.
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  891. @example
  892. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  893. @end example
  894. @item
  895. Same as above but in @code{zp} format:
  896. @example
  897. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  898. @end example
  899. @end itemize
  900. @section alimiter
  901. The limiter prevents an input signal from rising over a desired threshold.
  902. This limiter uses lookahead technology to prevent your signal from distorting.
  903. It means that there is a small delay after the signal is processed. Keep in mind
  904. that the delay it produces is the attack time you set.
  905. The filter accepts the following options:
  906. @table @option
  907. @item level_in
  908. Set input gain. Default is 1.
  909. @item level_out
  910. Set output gain. Default is 1.
  911. @item limit
  912. Don't let signals above this level pass the limiter. Default is 1.
  913. @item attack
  914. The limiter will reach its attenuation level in this amount of time in
  915. milliseconds. Default is 5 milliseconds.
  916. @item release
  917. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  918. Default is 50 milliseconds.
  919. @item asc
  920. When gain reduction is always needed ASC takes care of releasing to an
  921. average reduction level rather than reaching a reduction of 0 in the release
  922. time.
  923. @item asc_level
  924. Select how much the release time is affected by ASC, 0 means nearly no changes
  925. in release time while 1 produces higher release times.
  926. @item level
  927. Auto level output signal. Default is enabled.
  928. This normalizes audio back to 0dB if enabled.
  929. @end table
  930. Depending on picked setting it is recommended to upsample input 2x or 4x times
  931. with @ref{aresample} before applying this filter.
  932. @section allpass
  933. Apply a two-pole all-pass filter with central frequency (in Hz)
  934. @var{frequency}, and filter-width @var{width}.
  935. An all-pass filter changes the audio's frequency to phase relationship
  936. without changing its frequency to amplitude relationship.
  937. The filter accepts the following options:
  938. @table @option
  939. @item frequency, f
  940. Set frequency in Hz.
  941. @item width_type, t
  942. Set method to specify band-width of filter.
  943. @table @option
  944. @item h
  945. Hz
  946. @item q
  947. Q-Factor
  948. @item o
  949. octave
  950. @item s
  951. slope
  952. @item k
  953. kHz
  954. @end table
  955. @item width, w
  956. Specify the band-width of a filter in width_type units.
  957. @item channels, c
  958. Specify which channels to filter, by default all available are filtered.
  959. @end table
  960. @subsection Commands
  961. This filter supports the following commands:
  962. @table @option
  963. @item frequency, f
  964. Change allpass frequency.
  965. Syntax for the command is : "@var{frequency}"
  966. @item width_type, t
  967. Change allpass width_type.
  968. Syntax for the command is : "@var{width_type}"
  969. @item width, w
  970. Change allpass width.
  971. Syntax for the command is : "@var{width}"
  972. @end table
  973. @section aloop
  974. Loop audio samples.
  975. The filter accepts the following options:
  976. @table @option
  977. @item loop
  978. Set the number of loops. Setting this value to -1 will result in infinite loops.
  979. Default is 0.
  980. @item size
  981. Set maximal number of samples. Default is 0.
  982. @item start
  983. Set first sample of loop. Default is 0.
  984. @end table
  985. @anchor{amerge}
  986. @section amerge
  987. Merge two or more audio streams into a single multi-channel stream.
  988. The filter accepts the following options:
  989. @table @option
  990. @item inputs
  991. Set the number of inputs. Default is 2.
  992. @end table
  993. If the channel layouts of the inputs are disjoint, and therefore compatible,
  994. the channel layout of the output will be set accordingly and the channels
  995. will be reordered as necessary. If the channel layouts of the inputs are not
  996. disjoint, the output will have all the channels of the first input then all
  997. the channels of the second input, in that order, and the channel layout of
  998. the output will be the default value corresponding to the total number of
  999. channels.
  1000. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1001. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1002. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1003. first input, b1 is the first channel of the second input).
  1004. On the other hand, if both input are in stereo, the output channels will be
  1005. in the default order: a1, a2, b1, b2, and the channel layout will be
  1006. arbitrarily set to 4.0, which may or may not be the expected value.
  1007. All inputs must have the same sample rate, and format.
  1008. If inputs do not have the same duration, the output will stop with the
  1009. shortest.
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Merge two mono files into a stereo stream:
  1014. @example
  1015. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1016. @end example
  1017. @item
  1018. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1019. @example
  1020. 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
  1021. @end example
  1022. @end itemize
  1023. @section amix
  1024. Mixes multiple audio inputs into a single output.
  1025. Note that this filter only supports float samples (the @var{amerge}
  1026. and @var{pan} audio filters support many formats). If the @var{amix}
  1027. input has integer samples then @ref{aresample} will be automatically
  1028. inserted to perform the conversion to float samples.
  1029. For example
  1030. @example
  1031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1032. @end example
  1033. will mix 3 input audio streams to a single output with the same duration as the
  1034. first input and a dropout transition time of 3 seconds.
  1035. It accepts the following parameters:
  1036. @table @option
  1037. @item inputs
  1038. The number of inputs. If unspecified, it defaults to 2.
  1039. @item duration
  1040. How to determine the end-of-stream.
  1041. @table @option
  1042. @item longest
  1043. The duration of the longest input. (default)
  1044. @item shortest
  1045. The duration of the shortest input.
  1046. @item first
  1047. The duration of the first input.
  1048. @end table
  1049. @item dropout_transition
  1050. The transition time, in seconds, for volume renormalization when an input
  1051. stream ends. The default value is 2 seconds.
  1052. @item weights
  1053. Specify weight of each input audio stream as sequence.
  1054. Each weight is separated by space. By default all inputs have same weight.
  1055. @end table
  1056. @section anequalizer
  1057. High-order parametric multiband equalizer for each channel.
  1058. It accepts the following parameters:
  1059. @table @option
  1060. @item params
  1061. This option string is in format:
  1062. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1063. Each equalizer band is separated by '|'.
  1064. @table @option
  1065. @item chn
  1066. Set channel number to which equalization will be applied.
  1067. If input doesn't have that channel the entry is ignored.
  1068. @item f
  1069. Set central frequency for band.
  1070. If input doesn't have that frequency the entry is ignored.
  1071. @item w
  1072. Set band width in hertz.
  1073. @item g
  1074. Set band gain in dB.
  1075. @item t
  1076. Set filter type for band, optional, can be:
  1077. @table @samp
  1078. @item 0
  1079. Butterworth, this is default.
  1080. @item 1
  1081. Chebyshev type 1.
  1082. @item 2
  1083. Chebyshev type 2.
  1084. @end table
  1085. @end table
  1086. @item curves
  1087. With this option activated frequency response of anequalizer is displayed
  1088. in video stream.
  1089. @item size
  1090. Set video stream size. Only useful if curves option is activated.
  1091. @item mgain
  1092. Set max gain that will be displayed. Only useful if curves option is activated.
  1093. Setting this to a reasonable value makes it possible to display gain which is derived from
  1094. neighbour bands which are too close to each other and thus produce higher gain
  1095. when both are activated.
  1096. @item fscale
  1097. Set frequency scale used to draw frequency response in video output.
  1098. Can be linear or logarithmic. Default is logarithmic.
  1099. @item colors
  1100. Set color for each channel curve which is going to be displayed in video stream.
  1101. This is list of color names separated by space or by '|'.
  1102. Unrecognised or missing colors will be replaced by white color.
  1103. @end table
  1104. @subsection Examples
  1105. @itemize
  1106. @item
  1107. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1108. for first 2 channels using Chebyshev type 1 filter:
  1109. @example
  1110. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1111. @end example
  1112. @end itemize
  1113. @subsection Commands
  1114. This filter supports the following commands:
  1115. @table @option
  1116. @item change
  1117. Alter existing filter parameters.
  1118. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1119. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1120. error is returned.
  1121. @var{freq} set new frequency parameter.
  1122. @var{width} set new width parameter in herz.
  1123. @var{gain} set new gain parameter in dB.
  1124. Full filter invocation with asendcmd may look like this:
  1125. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1126. @end table
  1127. @section anull
  1128. Pass the audio source unchanged to the output.
  1129. @section apad
  1130. Pad the end of an audio stream with silence.
  1131. This can be used together with @command{ffmpeg} @option{-shortest} to
  1132. extend audio streams to the same length as the video stream.
  1133. A description of the accepted options follows.
  1134. @table @option
  1135. @item packet_size
  1136. Set silence packet size. Default value is 4096.
  1137. @item pad_len
  1138. Set the number of samples of silence to add to the end. After the
  1139. value is reached, the stream is terminated. This option is mutually
  1140. exclusive with @option{whole_len}.
  1141. @item whole_len
  1142. Set the minimum total number of samples in the output audio stream. If
  1143. the value is longer than the input audio length, silence is added to
  1144. the end, until the value is reached. This option is mutually exclusive
  1145. with @option{pad_len}.
  1146. @end table
  1147. If neither the @option{pad_len} nor the @option{whole_len} option is
  1148. set, the filter will add silence to the end of the input stream
  1149. indefinitely.
  1150. @subsection Examples
  1151. @itemize
  1152. @item
  1153. Add 1024 samples of silence to the end of the input:
  1154. @example
  1155. apad=pad_len=1024
  1156. @end example
  1157. @item
  1158. Make sure the audio output will contain at least 10000 samples, pad
  1159. the input with silence if required:
  1160. @example
  1161. apad=whole_len=10000
  1162. @end example
  1163. @item
  1164. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1165. video stream will always result the shortest and will be converted
  1166. until the end in the output file when using the @option{shortest}
  1167. option:
  1168. @example
  1169. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1170. @end example
  1171. @end itemize
  1172. @section aphaser
  1173. Add a phasing effect to the input audio.
  1174. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1175. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1176. A description of the accepted parameters follows.
  1177. @table @option
  1178. @item in_gain
  1179. Set input gain. Default is 0.4.
  1180. @item out_gain
  1181. Set output gain. Default is 0.74
  1182. @item delay
  1183. Set delay in milliseconds. Default is 3.0.
  1184. @item decay
  1185. Set decay. Default is 0.4.
  1186. @item speed
  1187. Set modulation speed in Hz. Default is 0.5.
  1188. @item type
  1189. Set modulation type. Default is triangular.
  1190. It accepts the following values:
  1191. @table @samp
  1192. @item triangular, t
  1193. @item sinusoidal, s
  1194. @end table
  1195. @end table
  1196. @section apulsator
  1197. Audio pulsator is something between an autopanner and a tremolo.
  1198. But it can produce funny stereo effects as well. Pulsator changes the volume
  1199. of the left and right channel based on a LFO (low frequency oscillator) with
  1200. different waveforms and shifted phases.
  1201. This filter have the ability to define an offset between left and right
  1202. channel. An offset of 0 means that both LFO shapes match each other.
  1203. The left and right channel are altered equally - a conventional tremolo.
  1204. An offset of 50% means that the shape of the right channel is exactly shifted
  1205. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1206. an autopanner. At 1 both curves match again. Every setting in between moves the
  1207. phase shift gapless between all stages and produces some "bypassing" sounds with
  1208. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1209. the 0.5) the faster the signal passes from the left to the right speaker.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item level_in
  1213. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1214. @item level_out
  1215. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1216. @item mode
  1217. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1218. sawup or sawdown. Default is sine.
  1219. @item amount
  1220. Set modulation. Define how much of original signal is affected by the LFO.
  1221. @item offset_l
  1222. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1223. @item offset_r
  1224. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1225. @item width
  1226. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1227. @item timing
  1228. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1229. @item bpm
  1230. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1231. is set to bpm.
  1232. @item ms
  1233. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1234. is set to ms.
  1235. @item hz
  1236. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1237. if timing is set to hz.
  1238. @end table
  1239. @anchor{aresample}
  1240. @section aresample
  1241. Resample the input audio to the specified parameters, using the
  1242. libswresample library. If none are specified then the filter will
  1243. automatically convert between its input and output.
  1244. This filter is also able to stretch/squeeze the audio data to make it match
  1245. the timestamps or to inject silence / cut out audio to make it match the
  1246. timestamps, do a combination of both or do neither.
  1247. The filter accepts the syntax
  1248. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1249. expresses a sample rate and @var{resampler_options} is a list of
  1250. @var{key}=@var{value} pairs, separated by ":". See the
  1251. @ref{Resampler Options,,"Resampler Options" section in the
  1252. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1253. for the complete list of supported options.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Resample the input audio to 44100Hz:
  1258. @example
  1259. aresample=44100
  1260. @end example
  1261. @item
  1262. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1263. samples per second compensation:
  1264. @example
  1265. aresample=async=1000
  1266. @end example
  1267. @end itemize
  1268. @section areverse
  1269. Reverse an audio clip.
  1270. Warning: This filter requires memory to buffer the entire clip, so trimming
  1271. is suggested.
  1272. @subsection Examples
  1273. @itemize
  1274. @item
  1275. Take the first 5 seconds of a clip, and reverse it.
  1276. @example
  1277. atrim=end=5,areverse
  1278. @end example
  1279. @end itemize
  1280. @section asetnsamples
  1281. Set the number of samples per each output audio frame.
  1282. The last output packet may contain a different number of samples, as
  1283. the filter will flush all the remaining samples when the input audio
  1284. signals its end.
  1285. The filter accepts the following options:
  1286. @table @option
  1287. @item nb_out_samples, n
  1288. Set the number of frames per each output audio frame. The number is
  1289. intended as the number of samples @emph{per each channel}.
  1290. Default value is 1024.
  1291. @item pad, p
  1292. If set to 1, the filter will pad the last audio frame with zeroes, so
  1293. that the last frame will contain the same number of samples as the
  1294. previous ones. Default value is 1.
  1295. @end table
  1296. For example, to set the number of per-frame samples to 1234 and
  1297. disable padding for the last frame, use:
  1298. @example
  1299. asetnsamples=n=1234:p=0
  1300. @end example
  1301. @section asetrate
  1302. Set the sample rate without altering the PCM data.
  1303. This will result in a change of speed and pitch.
  1304. The filter accepts the following options:
  1305. @table @option
  1306. @item sample_rate, r
  1307. Set the output sample rate. Default is 44100 Hz.
  1308. @end table
  1309. @section ashowinfo
  1310. Show a line containing various information for each input audio frame.
  1311. The input audio is not modified.
  1312. The shown line contains a sequence of key/value pairs of the form
  1313. @var{key}:@var{value}.
  1314. The following values are shown in the output:
  1315. @table @option
  1316. @item n
  1317. The (sequential) number of the input frame, starting from 0.
  1318. @item pts
  1319. The presentation timestamp of the input frame, in time base units; the time base
  1320. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1321. @item pts_time
  1322. The presentation timestamp of the input frame in seconds.
  1323. @item pos
  1324. position of the frame in the input stream, -1 if this information in
  1325. unavailable and/or meaningless (for example in case of synthetic audio)
  1326. @item fmt
  1327. The sample format.
  1328. @item chlayout
  1329. The channel layout.
  1330. @item rate
  1331. The sample rate for the audio frame.
  1332. @item nb_samples
  1333. The number of samples (per channel) in the frame.
  1334. @item checksum
  1335. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1336. audio, the data is treated as if all the planes were concatenated.
  1337. @item plane_checksums
  1338. A list of Adler-32 checksums for each data plane.
  1339. @end table
  1340. @anchor{astats}
  1341. @section astats
  1342. Display time domain statistical information about the audio channels.
  1343. Statistics are calculated and displayed for each audio channel and,
  1344. where applicable, an overall figure is also given.
  1345. It accepts the following option:
  1346. @table @option
  1347. @item length
  1348. Short window length in seconds, used for peak and trough RMS measurement.
  1349. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1350. @item metadata
  1351. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1352. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1353. disabled.
  1354. Available keys for each channel are:
  1355. DC_offset
  1356. Min_level
  1357. Max_level
  1358. Min_difference
  1359. Max_difference
  1360. Mean_difference
  1361. RMS_difference
  1362. Peak_level
  1363. RMS_peak
  1364. RMS_trough
  1365. Crest_factor
  1366. Flat_factor
  1367. Peak_count
  1368. Bit_depth
  1369. Dynamic_range
  1370. and for Overall:
  1371. DC_offset
  1372. Min_level
  1373. Max_level
  1374. Min_difference
  1375. Max_difference
  1376. Mean_difference
  1377. RMS_difference
  1378. Peak_level
  1379. RMS_level
  1380. RMS_peak
  1381. RMS_trough
  1382. Flat_factor
  1383. Peak_count
  1384. Bit_depth
  1385. Number_of_samples
  1386. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1387. this @code{lavfi.astats.Overall.Peak_count}.
  1388. For description what each key means read below.
  1389. @item reset
  1390. Set number of frame after which stats are going to be recalculated.
  1391. Default is disabled.
  1392. @end table
  1393. A description of each shown parameter follows:
  1394. @table @option
  1395. @item DC offset
  1396. Mean amplitude displacement from zero.
  1397. @item Min level
  1398. Minimal sample level.
  1399. @item Max level
  1400. Maximal sample level.
  1401. @item Min difference
  1402. Minimal difference between two consecutive samples.
  1403. @item Max difference
  1404. Maximal difference between two consecutive samples.
  1405. @item Mean difference
  1406. Mean difference between two consecutive samples.
  1407. The average of each difference between two consecutive samples.
  1408. @item RMS difference
  1409. Root Mean Square difference between two consecutive samples.
  1410. @item Peak level dB
  1411. @item RMS level dB
  1412. Standard peak and RMS level measured in dBFS.
  1413. @item RMS peak dB
  1414. @item RMS trough dB
  1415. Peak and trough values for RMS level measured over a short window.
  1416. @item Crest factor
  1417. Standard ratio of peak to RMS level (note: not in dB).
  1418. @item Flat factor
  1419. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1420. (i.e. either @var{Min level} or @var{Max level}).
  1421. @item Peak count
  1422. Number of occasions (not the number of samples) that the signal attained either
  1423. @var{Min level} or @var{Max level}.
  1424. @item Bit depth
  1425. Overall bit depth of audio. Number of bits used for each sample.
  1426. @item Dynamic range
  1427. Measured dynamic range of audio in dB.
  1428. @end table
  1429. @section atempo
  1430. Adjust audio tempo.
  1431. The filter accepts exactly one parameter, the audio tempo. If not
  1432. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1433. be in the [0.5, 2.0] range.
  1434. @subsection Examples
  1435. @itemize
  1436. @item
  1437. Slow down audio to 80% tempo:
  1438. @example
  1439. atempo=0.8
  1440. @end example
  1441. @item
  1442. To speed up audio to 125% tempo:
  1443. @example
  1444. atempo=1.25
  1445. @end example
  1446. @end itemize
  1447. @section atrim
  1448. Trim the input so that the output contains one continuous subpart of the input.
  1449. It accepts the following parameters:
  1450. @table @option
  1451. @item start
  1452. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1453. sample with the timestamp @var{start} will be the first sample in the output.
  1454. @item end
  1455. Specify time of the first audio sample that will be dropped, i.e. the
  1456. audio sample immediately preceding the one with the timestamp @var{end} will be
  1457. the last sample in the output.
  1458. @item start_pts
  1459. Same as @var{start}, except this option sets the start timestamp in samples
  1460. instead of seconds.
  1461. @item end_pts
  1462. Same as @var{end}, except this option sets the end timestamp in samples instead
  1463. of seconds.
  1464. @item duration
  1465. The maximum duration of the output in seconds.
  1466. @item start_sample
  1467. The number of the first sample that should be output.
  1468. @item end_sample
  1469. The number of the first sample that should be dropped.
  1470. @end table
  1471. @option{start}, @option{end}, and @option{duration} are expressed as time
  1472. duration specifications; see
  1473. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1474. Note that the first two sets of the start/end options and the @option{duration}
  1475. option look at the frame timestamp, while the _sample options simply count the
  1476. samples that pass through the filter. So start/end_pts and start/end_sample will
  1477. give different results when the timestamps are wrong, inexact or do not start at
  1478. zero. Also note that this filter does not modify the timestamps. If you wish
  1479. to have the output timestamps start at zero, insert the asetpts filter after the
  1480. atrim filter.
  1481. If multiple start or end options are set, this filter tries to be greedy and
  1482. keep all samples that match at least one of the specified constraints. To keep
  1483. only the part that matches all the constraints at once, chain multiple atrim
  1484. filters.
  1485. The defaults are such that all the input is kept. So it is possible to set e.g.
  1486. just the end values to keep everything before the specified time.
  1487. Examples:
  1488. @itemize
  1489. @item
  1490. Drop everything except the second minute of input:
  1491. @example
  1492. ffmpeg -i INPUT -af atrim=60:120
  1493. @end example
  1494. @item
  1495. Keep only the first 1000 samples:
  1496. @example
  1497. ffmpeg -i INPUT -af atrim=end_sample=1000
  1498. @end example
  1499. @end itemize
  1500. @section bandpass
  1501. Apply a two-pole Butterworth band-pass filter with central
  1502. frequency @var{frequency}, and (3dB-point) band-width width.
  1503. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1504. instead of the default: constant 0dB peak gain.
  1505. The filter roll off at 6dB per octave (20dB per decade).
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item frequency, f
  1509. Set the filter's central frequency. Default is @code{3000}.
  1510. @item csg
  1511. Constant skirt gain if set to 1. Defaults to 0.
  1512. @item width_type, t
  1513. Set method to specify band-width of filter.
  1514. @table @option
  1515. @item h
  1516. Hz
  1517. @item q
  1518. Q-Factor
  1519. @item o
  1520. octave
  1521. @item s
  1522. slope
  1523. @item k
  1524. kHz
  1525. @end table
  1526. @item width, w
  1527. Specify the band-width of a filter in width_type units.
  1528. @item channels, c
  1529. Specify which channels to filter, by default all available are filtered.
  1530. @end table
  1531. @subsection Commands
  1532. This filter supports the following commands:
  1533. @table @option
  1534. @item frequency, f
  1535. Change bandpass frequency.
  1536. Syntax for the command is : "@var{frequency}"
  1537. @item width_type, t
  1538. Change bandpass width_type.
  1539. Syntax for the command is : "@var{width_type}"
  1540. @item width, w
  1541. Change bandpass width.
  1542. Syntax for the command is : "@var{width}"
  1543. @end table
  1544. @section bandreject
  1545. Apply a two-pole Butterworth band-reject filter with central
  1546. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1547. The filter roll off at 6dB per octave (20dB per decade).
  1548. The filter accepts the following options:
  1549. @table @option
  1550. @item frequency, f
  1551. Set the filter's central frequency. Default is @code{3000}.
  1552. @item width_type, t
  1553. Set method to specify band-width of filter.
  1554. @table @option
  1555. @item h
  1556. Hz
  1557. @item q
  1558. Q-Factor
  1559. @item o
  1560. octave
  1561. @item s
  1562. slope
  1563. @item k
  1564. kHz
  1565. @end table
  1566. @item width, w
  1567. Specify the band-width of a filter in width_type units.
  1568. @item channels, c
  1569. Specify which channels to filter, by default all available are filtered.
  1570. @end table
  1571. @subsection Commands
  1572. This filter supports the following commands:
  1573. @table @option
  1574. @item frequency, f
  1575. Change bandreject frequency.
  1576. Syntax for the command is : "@var{frequency}"
  1577. @item width_type, t
  1578. Change bandreject width_type.
  1579. Syntax for the command is : "@var{width_type}"
  1580. @item width, w
  1581. Change bandreject width.
  1582. Syntax for the command is : "@var{width}"
  1583. @end table
  1584. @section bass, lowshelf
  1585. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1586. shelving filter with a response similar to that of a standard
  1587. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1588. The filter accepts the following options:
  1589. @table @option
  1590. @item gain, g
  1591. Give the gain at 0 Hz. Its useful range is about -20
  1592. (for a large cut) to +20 (for a large boost).
  1593. Beware of clipping when using a positive gain.
  1594. @item frequency, f
  1595. Set the filter's central frequency and so can be used
  1596. to extend or reduce the frequency range to be boosted or cut.
  1597. The default value is @code{100} Hz.
  1598. @item width_type, t
  1599. Set method to specify band-width of filter.
  1600. @table @option
  1601. @item h
  1602. Hz
  1603. @item q
  1604. Q-Factor
  1605. @item o
  1606. octave
  1607. @item s
  1608. slope
  1609. @item k
  1610. kHz
  1611. @end table
  1612. @item width, w
  1613. Determine how steep is the filter's shelf transition.
  1614. @item channels, c
  1615. Specify which channels to filter, by default all available are filtered.
  1616. @end table
  1617. @subsection Commands
  1618. This filter supports the following commands:
  1619. @table @option
  1620. @item frequency, f
  1621. Change bass frequency.
  1622. Syntax for the command is : "@var{frequency}"
  1623. @item width_type, t
  1624. Change bass width_type.
  1625. Syntax for the command is : "@var{width_type}"
  1626. @item width, w
  1627. Change bass width.
  1628. Syntax for the command is : "@var{width}"
  1629. @item gain, g
  1630. Change bass gain.
  1631. Syntax for the command is : "@var{gain}"
  1632. @end table
  1633. @section biquad
  1634. Apply a biquad IIR filter with the given coefficients.
  1635. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1636. are the numerator and denominator coefficients respectively.
  1637. and @var{channels}, @var{c} specify which channels to filter, by default all
  1638. available are filtered.
  1639. @subsection Commands
  1640. This filter supports the following commands:
  1641. @table @option
  1642. @item a0
  1643. @item a1
  1644. @item a2
  1645. @item b0
  1646. @item b1
  1647. @item b2
  1648. Change biquad parameter.
  1649. Syntax for the command is : "@var{value}"
  1650. @end table
  1651. @section bs2b
  1652. Bauer stereo to binaural transformation, which improves headphone listening of
  1653. stereo audio records.
  1654. To enable compilation of this filter you need to configure FFmpeg with
  1655. @code{--enable-libbs2b}.
  1656. It accepts the following parameters:
  1657. @table @option
  1658. @item profile
  1659. Pre-defined crossfeed level.
  1660. @table @option
  1661. @item default
  1662. Default level (fcut=700, feed=50).
  1663. @item cmoy
  1664. Chu Moy circuit (fcut=700, feed=60).
  1665. @item jmeier
  1666. Jan Meier circuit (fcut=650, feed=95).
  1667. @end table
  1668. @item fcut
  1669. Cut frequency (in Hz).
  1670. @item feed
  1671. Feed level (in Hz).
  1672. @end table
  1673. @section channelmap
  1674. Remap input channels to new locations.
  1675. It accepts the following parameters:
  1676. @table @option
  1677. @item map
  1678. Map channels from input to output. The argument is a '|'-separated list of
  1679. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1680. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1681. channel (e.g. FL for front left) or its index in the input channel layout.
  1682. @var{out_channel} is the name of the output channel or its index in the output
  1683. channel layout. If @var{out_channel} is not given then it is implicitly an
  1684. index, starting with zero and increasing by one for each mapping.
  1685. @item channel_layout
  1686. The channel layout of the output stream.
  1687. @end table
  1688. If no mapping is present, the filter will implicitly map input channels to
  1689. output channels, preserving indices.
  1690. @subsection Examples
  1691. @itemize
  1692. @item
  1693. For example, assuming a 5.1+downmix input MOV file,
  1694. @example
  1695. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1696. @end example
  1697. will create an output WAV file tagged as stereo from the downmix channels of
  1698. the input.
  1699. @item
  1700. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1701. @example
  1702. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1703. @end example
  1704. @end itemize
  1705. @section channelsplit
  1706. Split each channel from an input audio stream into a separate output stream.
  1707. It accepts the following parameters:
  1708. @table @option
  1709. @item channel_layout
  1710. The channel layout of the input stream. The default is "stereo".
  1711. @item channels
  1712. A channel layout describing the channels to be extracted as separate output streams
  1713. or "all" to extract each input channel as a separate stream. The default is "all".
  1714. Choosing channels not present in channel layout in the input will result in an error.
  1715. @end table
  1716. @subsection Examples
  1717. @itemize
  1718. @item
  1719. For example, assuming a stereo input MP3 file,
  1720. @example
  1721. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1722. @end example
  1723. will create an output Matroska file with two audio streams, one containing only
  1724. the left channel and the other the right channel.
  1725. @item
  1726. Split a 5.1 WAV file into per-channel files:
  1727. @example
  1728. ffmpeg -i in.wav -filter_complex
  1729. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1730. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1731. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1732. side_right.wav
  1733. @end example
  1734. @item
  1735. Extract only LFE from a 5.1 WAV file:
  1736. @example
  1737. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1738. -map '[LFE]' lfe.wav
  1739. @end example
  1740. @end itemize
  1741. @section chorus
  1742. Add a chorus effect to the audio.
  1743. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1744. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1745. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1746. The modulation depth defines the range the modulated delay is played before or after
  1747. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1748. sound tuned around the original one, like in a chorus where some vocals are slightly
  1749. off key.
  1750. It accepts the following parameters:
  1751. @table @option
  1752. @item in_gain
  1753. Set input gain. Default is 0.4.
  1754. @item out_gain
  1755. Set output gain. Default is 0.4.
  1756. @item delays
  1757. Set delays. A typical delay is around 40ms to 60ms.
  1758. @item decays
  1759. Set decays.
  1760. @item speeds
  1761. Set speeds.
  1762. @item depths
  1763. Set depths.
  1764. @end table
  1765. @subsection Examples
  1766. @itemize
  1767. @item
  1768. A single delay:
  1769. @example
  1770. chorus=0.7:0.9:55:0.4:0.25:2
  1771. @end example
  1772. @item
  1773. Two delays:
  1774. @example
  1775. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1776. @end example
  1777. @item
  1778. Fuller sounding chorus with three delays:
  1779. @example
  1780. 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
  1781. @end example
  1782. @end itemize
  1783. @section compand
  1784. Compress or expand the audio's dynamic range.
  1785. It accepts the following parameters:
  1786. @table @option
  1787. @item attacks
  1788. @item decays
  1789. A list of times in seconds for each channel over which the instantaneous level
  1790. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1791. increase of volume and @var{decays} refers to decrease of volume. For most
  1792. situations, the attack time (response to the audio getting louder) should be
  1793. shorter than the decay time, because the human ear is more sensitive to sudden
  1794. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1795. a typical value for decay is 0.8 seconds.
  1796. If specified number of attacks & decays is lower than number of channels, the last
  1797. set attack/decay will be used for all remaining channels.
  1798. @item points
  1799. A list of points for the transfer function, specified in dB relative to the
  1800. maximum possible signal amplitude. Each key points list must be defined using
  1801. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1802. @code{x0/y0 x1/y1 x2/y2 ....}
  1803. The input values must be in strictly increasing order but the transfer function
  1804. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1805. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1806. function are @code{-70/-70|-60/-20|1/0}.
  1807. @item soft-knee
  1808. Set the curve radius in dB for all joints. It defaults to 0.01.
  1809. @item gain
  1810. Set the additional gain in dB to be applied at all points on the transfer
  1811. function. This allows for easy adjustment of the overall gain.
  1812. It defaults to 0.
  1813. @item volume
  1814. Set an initial volume, in dB, to be assumed for each channel when filtering
  1815. starts. This permits the user to supply a nominal level initially, so that, for
  1816. example, a very large gain is not applied to initial signal levels before the
  1817. companding has begun to operate. A typical value for audio which is initially
  1818. quiet is -90 dB. It defaults to 0.
  1819. @item delay
  1820. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1821. delayed before being fed to the volume adjuster. Specifying a delay
  1822. approximately equal to the attack/decay times allows the filter to effectively
  1823. operate in predictive rather than reactive mode. It defaults to 0.
  1824. @end table
  1825. @subsection Examples
  1826. @itemize
  1827. @item
  1828. Make music with both quiet and loud passages suitable for listening to in a
  1829. noisy environment:
  1830. @example
  1831. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1832. @end example
  1833. Another example for audio with whisper and explosion parts:
  1834. @example
  1835. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1836. @end example
  1837. @item
  1838. A noise gate for when the noise is at a lower level than the signal:
  1839. @example
  1840. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1841. @end example
  1842. @item
  1843. Here is another noise gate, this time for when the noise is at a higher level
  1844. than the signal (making it, in some ways, similar to squelch):
  1845. @example
  1846. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1847. @end example
  1848. @item
  1849. 2:1 compression starting at -6dB:
  1850. @example
  1851. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1852. @end example
  1853. @item
  1854. 2:1 compression starting at -9dB:
  1855. @example
  1856. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1857. @end example
  1858. @item
  1859. 2:1 compression starting at -12dB:
  1860. @example
  1861. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1862. @end example
  1863. @item
  1864. 2:1 compression starting at -18dB:
  1865. @example
  1866. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1867. @end example
  1868. @item
  1869. 3:1 compression starting at -15dB:
  1870. @example
  1871. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1872. @end example
  1873. @item
  1874. Compressor/Gate:
  1875. @example
  1876. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1877. @end example
  1878. @item
  1879. Expander:
  1880. @example
  1881. 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
  1882. @end example
  1883. @item
  1884. Hard limiter at -6dB:
  1885. @example
  1886. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1887. @end example
  1888. @item
  1889. Hard limiter at -12dB:
  1890. @example
  1891. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1892. @end example
  1893. @item
  1894. Hard noise gate at -35 dB:
  1895. @example
  1896. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1897. @end example
  1898. @item
  1899. Soft limiter:
  1900. @example
  1901. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1902. @end example
  1903. @end itemize
  1904. @section compensationdelay
  1905. Compensation Delay Line is a metric based delay to compensate differing
  1906. positions of microphones or speakers.
  1907. For example, you have recorded guitar with two microphones placed in
  1908. different location. Because the front of sound wave has fixed speed in
  1909. normal conditions, the phasing of microphones can vary and depends on
  1910. their location and interposition. The best sound mix can be achieved when
  1911. these microphones are in phase (synchronized). Note that distance of
  1912. ~30 cm between microphones makes one microphone to capture signal in
  1913. antiphase to another microphone. That makes the final mix sounding moody.
  1914. This filter helps to solve phasing problems by adding different delays
  1915. to each microphone track and make them synchronized.
  1916. The best result can be reached when you take one track as base and
  1917. synchronize other tracks one by one with it.
  1918. Remember that synchronization/delay tolerance depends on sample rate, too.
  1919. Higher sample rates will give more tolerance.
  1920. It accepts the following parameters:
  1921. @table @option
  1922. @item mm
  1923. Set millimeters distance. This is compensation distance for fine tuning.
  1924. Default is 0.
  1925. @item cm
  1926. Set cm distance. This is compensation distance for tightening distance setup.
  1927. Default is 0.
  1928. @item m
  1929. Set meters distance. This is compensation distance for hard distance setup.
  1930. Default is 0.
  1931. @item dry
  1932. Set dry amount. Amount of unprocessed (dry) signal.
  1933. Default is 0.
  1934. @item wet
  1935. Set wet amount. Amount of processed (wet) signal.
  1936. Default is 1.
  1937. @item temp
  1938. Set temperature degree in Celsius. This is the temperature of the environment.
  1939. Default is 20.
  1940. @end table
  1941. @section crossfeed
  1942. Apply headphone crossfeed filter.
  1943. Crossfeed is the process of blending the left and right channels of stereo
  1944. audio recording.
  1945. It is mainly used to reduce extreme stereo separation of low frequencies.
  1946. The intent is to produce more speaker like sound to the listener.
  1947. The filter accepts the following options:
  1948. @table @option
  1949. @item strength
  1950. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1951. This sets gain of low shelf filter for side part of stereo image.
  1952. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1953. @item range
  1954. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1955. This sets cut off frequency of low shelf filter. Default is cut off near
  1956. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1957. @item level_in
  1958. Set input gain. Default is 0.9.
  1959. @item level_out
  1960. Set output gain. Default is 1.
  1961. @end table
  1962. @section crystalizer
  1963. Simple algorithm to expand audio dynamic range.
  1964. The filter accepts the following options:
  1965. @table @option
  1966. @item i
  1967. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1968. (unchanged sound) to 10.0 (maximum effect).
  1969. @item c
  1970. Enable clipping. By default is enabled.
  1971. @end table
  1972. @section dcshift
  1973. Apply a DC shift to the audio.
  1974. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1975. in the recording chain) from the audio. The effect of a DC offset is reduced
  1976. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1977. a signal has a DC offset.
  1978. @table @option
  1979. @item shift
  1980. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1981. the audio.
  1982. @item limitergain
  1983. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1984. used to prevent clipping.
  1985. @end table
  1986. @section drmeter
  1987. Measure audio dynamic range.
  1988. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1989. is found in transition material. And anything less that 8 have very poor dynamics
  1990. and is very compressed.
  1991. The filter accepts the following options:
  1992. @table @option
  1993. @item length
  1994. Set window length in seconds used to split audio into segments of equal length.
  1995. Default is 3 seconds.
  1996. @end table
  1997. @section dynaudnorm
  1998. Dynamic Audio Normalizer.
  1999. This filter applies a certain amount of gain to the input audio in order
  2000. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2001. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2002. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2003. This allows for applying extra gain to the "quiet" sections of the audio
  2004. while avoiding distortions or clipping the "loud" sections. In other words:
  2005. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2006. sections, in the sense that the volume of each section is brought to the
  2007. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2008. this goal *without* applying "dynamic range compressing". It will retain 100%
  2009. of the dynamic range *within* each section of the audio file.
  2010. @table @option
  2011. @item f
  2012. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2013. Default is 500 milliseconds.
  2014. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2015. referred to as frames. This is required, because a peak magnitude has no
  2016. meaning for just a single sample value. Instead, we need to determine the
  2017. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2018. normalizer would simply use the peak magnitude of the complete file, the
  2019. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2020. frame. The length of a frame is specified in milliseconds. By default, the
  2021. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2022. been found to give good results with most files.
  2023. Note that the exact frame length, in number of samples, will be determined
  2024. automatically, based on the sampling rate of the individual input audio file.
  2025. @item g
  2026. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2027. number. Default is 31.
  2028. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2029. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2030. is specified in frames, centered around the current frame. For the sake of
  2031. simplicity, this must be an odd number. Consequently, the default value of 31
  2032. takes into account the current frame, as well as the 15 preceding frames and
  2033. the 15 subsequent frames. Using a larger window results in a stronger
  2034. smoothing effect and thus in less gain variation, i.e. slower gain
  2035. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2036. effect and thus in more gain variation, i.e. faster gain adaptation.
  2037. In other words, the more you increase this value, the more the Dynamic Audio
  2038. Normalizer will behave like a "traditional" normalization filter. On the
  2039. contrary, the more you decrease this value, the more the Dynamic Audio
  2040. Normalizer will behave like a dynamic range compressor.
  2041. @item p
  2042. Set the target peak value. This specifies the highest permissible magnitude
  2043. level for the normalized audio input. This filter will try to approach the
  2044. target peak magnitude as closely as possible, but at the same time it also
  2045. makes sure that the normalized signal will never exceed the peak magnitude.
  2046. A frame's maximum local gain factor is imposed directly by the target peak
  2047. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2048. It is not recommended to go above this value.
  2049. @item m
  2050. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2051. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2052. factor for each input frame, i.e. the maximum gain factor that does not
  2053. result in clipping or distortion. The maximum gain factor is determined by
  2054. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2055. additionally bounds the frame's maximum gain factor by a predetermined
  2056. (global) maximum gain factor. This is done in order to avoid excessive gain
  2057. factors in "silent" or almost silent frames. By default, the maximum gain
  2058. factor is 10.0, For most inputs the default value should be sufficient and
  2059. it usually is not recommended to increase this value. Though, for input
  2060. with an extremely low overall volume level, it may be necessary to allow even
  2061. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2062. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2063. Instead, a "sigmoid" threshold function will be applied. This way, the
  2064. gain factors will smoothly approach the threshold value, but never exceed that
  2065. value.
  2066. @item r
  2067. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2068. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2069. This means that the maximum local gain factor for each frame is defined
  2070. (only) by the frame's highest magnitude sample. This way, the samples can
  2071. be amplified as much as possible without exceeding the maximum signal
  2072. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2073. Normalizer can also take into account the frame's root mean square,
  2074. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2075. determine the power of a time-varying signal. It is therefore considered
  2076. that the RMS is a better approximation of the "perceived loudness" than
  2077. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2078. frames to a constant RMS value, a uniform "perceived loudness" can be
  2079. established. If a target RMS value has been specified, a frame's local gain
  2080. factor is defined as the factor that would result in exactly that RMS value.
  2081. Note, however, that the maximum local gain factor is still restricted by the
  2082. frame's highest magnitude sample, in order to prevent clipping.
  2083. @item n
  2084. Enable channels coupling. By default is enabled.
  2085. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2086. amount. This means the same gain factor will be applied to all channels, i.e.
  2087. the maximum possible gain factor is determined by the "loudest" channel.
  2088. However, in some recordings, it may happen that the volume of the different
  2089. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2090. In this case, this option can be used to disable the channel coupling. This way,
  2091. the gain factor will be determined independently for each channel, depending
  2092. only on the individual channel's highest magnitude sample. This allows for
  2093. harmonizing the volume of the different channels.
  2094. @item c
  2095. Enable DC bias correction. By default is disabled.
  2096. An audio signal (in the time domain) is a sequence of sample values.
  2097. In the Dynamic Audio Normalizer these sample values are represented in the
  2098. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2099. audio signal, or "waveform", should be centered around the zero point.
  2100. That means if we calculate the mean value of all samples in a file, or in a
  2101. single frame, then the result should be 0.0 or at least very close to that
  2102. value. If, however, there is a significant deviation of the mean value from
  2103. 0.0, in either positive or negative direction, this is referred to as a
  2104. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2105. Audio Normalizer provides optional DC bias correction.
  2106. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2107. the mean value, or "DC correction" offset, of each input frame and subtract
  2108. that value from all of the frame's sample values which ensures those samples
  2109. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2110. boundaries, the DC correction offset values will be interpolated smoothly
  2111. between neighbouring frames.
  2112. @item b
  2113. Enable alternative boundary mode. By default is disabled.
  2114. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2115. around each frame. This includes the preceding frames as well as the
  2116. subsequent frames. However, for the "boundary" frames, located at the very
  2117. beginning and at the very end of the audio file, not all neighbouring
  2118. frames are available. In particular, for the first few frames in the audio
  2119. file, the preceding frames are not known. And, similarly, for the last few
  2120. frames in the audio file, the subsequent frames are not known. Thus, the
  2121. question arises which gain factors should be assumed for the missing frames
  2122. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2123. to deal with this situation. The default boundary mode assumes a gain factor
  2124. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2125. "fade out" at the beginning and at the end of the input, respectively.
  2126. @item s
  2127. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2128. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2129. compression. This means that signal peaks will not be pruned and thus the
  2130. full dynamic range will be retained within each local neighbourhood. However,
  2131. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2132. normalization algorithm with a more "traditional" compression.
  2133. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2134. (thresholding) function. If (and only if) the compression feature is enabled,
  2135. all input frames will be processed by a soft knee thresholding function prior
  2136. to the actual normalization process. Put simply, the thresholding function is
  2137. going to prune all samples whose magnitude exceeds a certain threshold value.
  2138. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2139. value. Instead, the threshold value will be adjusted for each individual
  2140. frame.
  2141. In general, smaller parameters result in stronger compression, and vice versa.
  2142. Values below 3.0 are not recommended, because audible distortion may appear.
  2143. @end table
  2144. @section earwax
  2145. Make audio easier to listen to on headphones.
  2146. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2147. so that when listened to on headphones the stereo image is moved from
  2148. inside your head (standard for headphones) to outside and in front of
  2149. the listener (standard for speakers).
  2150. Ported from SoX.
  2151. @section equalizer
  2152. Apply a two-pole peaking equalisation (EQ) filter. With this
  2153. filter, the signal-level at and around a selected frequency can
  2154. be increased or decreased, whilst (unlike bandpass and bandreject
  2155. filters) that at all other frequencies is unchanged.
  2156. In order to produce complex equalisation curves, this filter can
  2157. be given several times, each with a different central frequency.
  2158. The filter accepts the following options:
  2159. @table @option
  2160. @item frequency, f
  2161. Set the filter's central frequency in Hz.
  2162. @item width_type, t
  2163. Set method to specify band-width of filter.
  2164. @table @option
  2165. @item h
  2166. Hz
  2167. @item q
  2168. Q-Factor
  2169. @item o
  2170. octave
  2171. @item s
  2172. slope
  2173. @item k
  2174. kHz
  2175. @end table
  2176. @item width, w
  2177. Specify the band-width of a filter in width_type units.
  2178. @item gain, g
  2179. Set the required gain or attenuation in dB.
  2180. Beware of clipping when using a positive gain.
  2181. @item channels, c
  2182. Specify which channels to filter, by default all available are filtered.
  2183. @end table
  2184. @subsection Examples
  2185. @itemize
  2186. @item
  2187. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2188. @example
  2189. equalizer=f=1000:t=h:width=200:g=-10
  2190. @end example
  2191. @item
  2192. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2193. @example
  2194. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2195. @end example
  2196. @end itemize
  2197. @subsection Commands
  2198. This filter supports the following commands:
  2199. @table @option
  2200. @item frequency, f
  2201. Change equalizer frequency.
  2202. Syntax for the command is : "@var{frequency}"
  2203. @item width_type, t
  2204. Change equalizer width_type.
  2205. Syntax for the command is : "@var{width_type}"
  2206. @item width, w
  2207. Change equalizer width.
  2208. Syntax for the command is : "@var{width}"
  2209. @item gain, g
  2210. Change equalizer gain.
  2211. Syntax for the command is : "@var{gain}"
  2212. @end table
  2213. @section extrastereo
  2214. Linearly increases the difference between left and right channels which
  2215. adds some sort of "live" effect to playback.
  2216. The filter accepts the following options:
  2217. @table @option
  2218. @item m
  2219. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2220. (average of both channels), with 1.0 sound will be unchanged, with
  2221. -1.0 left and right channels will be swapped.
  2222. @item c
  2223. Enable clipping. By default is enabled.
  2224. @end table
  2225. @section firequalizer
  2226. Apply FIR Equalization using arbitrary frequency response.
  2227. The filter accepts the following option:
  2228. @table @option
  2229. @item gain
  2230. Set gain curve equation (in dB). The expression can contain variables:
  2231. @table @option
  2232. @item f
  2233. the evaluated frequency
  2234. @item sr
  2235. sample rate
  2236. @item ch
  2237. channel number, set to 0 when multichannels evaluation is disabled
  2238. @item chid
  2239. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2240. multichannels evaluation is disabled
  2241. @item chs
  2242. number of channels
  2243. @item chlayout
  2244. channel_layout, see libavutil/channel_layout.h
  2245. @end table
  2246. and functions:
  2247. @table @option
  2248. @item gain_interpolate(f)
  2249. interpolate gain on frequency f based on gain_entry
  2250. @item cubic_interpolate(f)
  2251. same as gain_interpolate, but smoother
  2252. @end table
  2253. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2254. @item gain_entry
  2255. Set gain entry for gain_interpolate function. The expression can
  2256. contain functions:
  2257. @table @option
  2258. @item entry(f, g)
  2259. store gain entry at frequency f with value g
  2260. @end table
  2261. This option is also available as command.
  2262. @item delay
  2263. Set filter delay in seconds. Higher value means more accurate.
  2264. Default is @code{0.01}.
  2265. @item accuracy
  2266. Set filter accuracy in Hz. Lower value means more accurate.
  2267. Default is @code{5}.
  2268. @item wfunc
  2269. Set window function. Acceptable values are:
  2270. @table @option
  2271. @item rectangular
  2272. rectangular window, useful when gain curve is already smooth
  2273. @item hann
  2274. hann window (default)
  2275. @item hamming
  2276. hamming window
  2277. @item blackman
  2278. blackman window
  2279. @item nuttall3
  2280. 3-terms continuous 1st derivative nuttall window
  2281. @item mnuttall3
  2282. minimum 3-terms discontinuous nuttall window
  2283. @item nuttall
  2284. 4-terms continuous 1st derivative nuttall window
  2285. @item bnuttall
  2286. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2287. @item bharris
  2288. blackman-harris window
  2289. @item tukey
  2290. tukey window
  2291. @end table
  2292. @item fixed
  2293. If enabled, use fixed number of audio samples. This improves speed when
  2294. filtering with large delay. Default is disabled.
  2295. @item multi
  2296. Enable multichannels evaluation on gain. Default is disabled.
  2297. @item zero_phase
  2298. Enable zero phase mode by subtracting timestamp to compensate delay.
  2299. Default is disabled.
  2300. @item scale
  2301. Set scale used by gain. Acceptable values are:
  2302. @table @option
  2303. @item linlin
  2304. linear frequency, linear gain
  2305. @item linlog
  2306. linear frequency, logarithmic (in dB) gain (default)
  2307. @item loglin
  2308. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2309. @item loglog
  2310. logarithmic frequency, logarithmic gain
  2311. @end table
  2312. @item dumpfile
  2313. Set file for dumping, suitable for gnuplot.
  2314. @item dumpscale
  2315. Set scale for dumpfile. Acceptable values are same with scale option.
  2316. Default is linlog.
  2317. @item fft2
  2318. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2319. Default is disabled.
  2320. @item min_phase
  2321. Enable minimum phase impulse response. Default is disabled.
  2322. @end table
  2323. @subsection Examples
  2324. @itemize
  2325. @item
  2326. lowpass at 1000 Hz:
  2327. @example
  2328. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2329. @end example
  2330. @item
  2331. lowpass at 1000 Hz with gain_entry:
  2332. @example
  2333. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2334. @end example
  2335. @item
  2336. custom equalization:
  2337. @example
  2338. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2339. @end example
  2340. @item
  2341. higher delay with zero phase to compensate delay:
  2342. @example
  2343. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2344. @end example
  2345. @item
  2346. lowpass on left channel, highpass on right channel:
  2347. @example
  2348. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2349. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2350. @end example
  2351. @end itemize
  2352. @section flanger
  2353. Apply a flanging effect to the audio.
  2354. The filter accepts the following options:
  2355. @table @option
  2356. @item delay
  2357. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2358. @item depth
  2359. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2360. @item regen
  2361. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2362. Default value is 0.
  2363. @item width
  2364. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2365. Default value is 71.
  2366. @item speed
  2367. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2368. @item shape
  2369. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2370. Default value is @var{sinusoidal}.
  2371. @item phase
  2372. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2373. Default value is 25.
  2374. @item interp
  2375. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2376. Default is @var{linear}.
  2377. @end table
  2378. @section haas
  2379. Apply Haas effect to audio.
  2380. Note that this makes most sense to apply on mono signals.
  2381. With this filter applied to mono signals it give some directionality and
  2382. stretches its stereo image.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item level_in
  2386. Set input level. By default is @var{1}, or 0dB
  2387. @item level_out
  2388. Set output level. By default is @var{1}, or 0dB.
  2389. @item side_gain
  2390. Set gain applied to side part of signal. By default is @var{1}.
  2391. @item middle_source
  2392. Set kind of middle source. Can be one of the following:
  2393. @table @samp
  2394. @item left
  2395. Pick left channel.
  2396. @item right
  2397. Pick right channel.
  2398. @item mid
  2399. Pick middle part signal of stereo image.
  2400. @item side
  2401. Pick side part signal of stereo image.
  2402. @end table
  2403. @item middle_phase
  2404. Change middle phase. By default is disabled.
  2405. @item left_delay
  2406. Set left channel delay. By default is @var{2.05} milliseconds.
  2407. @item left_balance
  2408. Set left channel balance. By default is @var{-1}.
  2409. @item left_gain
  2410. Set left channel gain. By default is @var{1}.
  2411. @item left_phase
  2412. Change left phase. By default is disabled.
  2413. @item right_delay
  2414. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2415. @item right_balance
  2416. Set right channel balance. By default is @var{1}.
  2417. @item right_gain
  2418. Set right channel gain. By default is @var{1}.
  2419. @item right_phase
  2420. Change right phase. By default is enabled.
  2421. @end table
  2422. @section hdcd
  2423. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2424. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2425. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2426. of HDCD, and detects the Transient Filter flag.
  2427. @example
  2428. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2429. @end example
  2430. When using the filter with wav, note the default encoding for wav is 16-bit,
  2431. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2432. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2433. @example
  2434. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2435. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2436. @end example
  2437. The filter accepts the following options:
  2438. @table @option
  2439. @item disable_autoconvert
  2440. Disable any automatic format conversion or resampling in the filter graph.
  2441. @item process_stereo
  2442. Process the stereo channels together. If target_gain does not match between
  2443. channels, consider it invalid and use the last valid target_gain.
  2444. @item cdt_ms
  2445. Set the code detect timer period in ms.
  2446. @item force_pe
  2447. Always extend peaks above -3dBFS even if PE isn't signaled.
  2448. @item analyze_mode
  2449. Replace audio with a solid tone and adjust the amplitude to signal some
  2450. specific aspect of the decoding process. The output file can be loaded in
  2451. an audio editor alongside the original to aid analysis.
  2452. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2453. Modes are:
  2454. @table @samp
  2455. @item 0, off
  2456. Disabled
  2457. @item 1, lle
  2458. Gain adjustment level at each sample
  2459. @item 2, pe
  2460. Samples where peak extend occurs
  2461. @item 3, cdt
  2462. Samples where the code detect timer is active
  2463. @item 4, tgm
  2464. Samples where the target gain does not match between channels
  2465. @end table
  2466. @end table
  2467. @section headphone
  2468. Apply head-related transfer functions (HRTFs) to create virtual
  2469. loudspeakers around the user for binaural listening via headphones.
  2470. The HRIRs are provided via additional streams, for each channel
  2471. one stereo input stream is needed.
  2472. The filter accepts the following options:
  2473. @table @option
  2474. @item map
  2475. Set mapping of input streams for convolution.
  2476. The argument is a '|'-separated list of channel names in order as they
  2477. are given as additional stream inputs for filter.
  2478. This also specify number of input streams. Number of input streams
  2479. must be not less than number of channels in first stream plus one.
  2480. @item gain
  2481. Set gain applied to audio. Value is in dB. Default is 0.
  2482. @item type
  2483. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2484. processing audio in time domain which is slow.
  2485. @var{freq} is processing audio in frequency domain which is fast.
  2486. Default is @var{freq}.
  2487. @item lfe
  2488. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2489. @item size
  2490. Set size of frame in number of samples which will be processed at once.
  2491. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2492. @item hrir
  2493. Set format of hrir stream.
  2494. Default value is @var{stereo}. Alternative value is @var{multich}.
  2495. If value is set to @var{stereo}, number of additional streams should
  2496. be greater or equal to number of input channels in first input stream.
  2497. Also each additional stream should have stereo number of channels.
  2498. If value is set to @var{multich}, number of additional streams should
  2499. be exactly one. Also number of input channels of additional stream
  2500. should be equal or greater than twice number of channels of first input
  2501. stream.
  2502. @end table
  2503. @subsection Examples
  2504. @itemize
  2505. @item
  2506. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2507. each amovie filter use stereo file with IR coefficients as input.
  2508. The files give coefficients for each position of virtual loudspeaker:
  2509. @example
  2510. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2511. output.wav
  2512. @end example
  2513. @item
  2514. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2515. but now in @var{multich} @var{hrir} format.
  2516. @example
  2517. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2518. output.wav
  2519. @end example
  2520. @end itemize
  2521. @section highpass
  2522. Apply a high-pass filter with 3dB point frequency.
  2523. The filter can be either single-pole, or double-pole (the default).
  2524. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item frequency, f
  2528. Set frequency in Hz. Default is 3000.
  2529. @item poles, p
  2530. Set number of poles. Default is 2.
  2531. @item width_type, t
  2532. Set method to specify band-width of filter.
  2533. @table @option
  2534. @item h
  2535. Hz
  2536. @item q
  2537. Q-Factor
  2538. @item o
  2539. octave
  2540. @item s
  2541. slope
  2542. @item k
  2543. kHz
  2544. @end table
  2545. @item width, w
  2546. Specify the band-width of a filter in width_type units.
  2547. Applies only to double-pole filter.
  2548. The default is 0.707q and gives a Butterworth response.
  2549. @item channels, c
  2550. Specify which channels to filter, by default all available are filtered.
  2551. @end table
  2552. @subsection Commands
  2553. This filter supports the following commands:
  2554. @table @option
  2555. @item frequency, f
  2556. Change highpass frequency.
  2557. Syntax for the command is : "@var{frequency}"
  2558. @item width_type, t
  2559. Change highpass width_type.
  2560. Syntax for the command is : "@var{width_type}"
  2561. @item width, w
  2562. Change highpass width.
  2563. Syntax for the command is : "@var{width}"
  2564. @end table
  2565. @section join
  2566. Join multiple input streams into one multi-channel stream.
  2567. It accepts the following parameters:
  2568. @table @option
  2569. @item inputs
  2570. The number of input streams. It defaults to 2.
  2571. @item channel_layout
  2572. The desired output channel layout. It defaults to stereo.
  2573. @item map
  2574. Map channels from inputs to output. The argument is a '|'-separated list of
  2575. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2576. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2577. can be either the name of the input channel (e.g. FL for front left) or its
  2578. index in the specified input stream. @var{out_channel} is the name of the output
  2579. channel.
  2580. @end table
  2581. The filter will attempt to guess the mappings when they are not specified
  2582. explicitly. It does so by first trying to find an unused matching input channel
  2583. and if that fails it picks the first unused input channel.
  2584. Join 3 inputs (with properly set channel layouts):
  2585. @example
  2586. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2587. @end example
  2588. Build a 5.1 output from 6 single-channel streams:
  2589. @example
  2590. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2591. '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'
  2592. out
  2593. @end example
  2594. @section ladspa
  2595. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2596. To enable compilation of this filter you need to configure FFmpeg with
  2597. @code{--enable-ladspa}.
  2598. @table @option
  2599. @item file, f
  2600. Specifies the name of LADSPA plugin library to load. If the environment
  2601. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2602. each one of the directories specified by the colon separated list in
  2603. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2604. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2605. @file{/usr/lib/ladspa/}.
  2606. @item plugin, p
  2607. Specifies the plugin within the library. Some libraries contain only
  2608. one plugin, but others contain many of them. If this is not set filter
  2609. will list all available plugins within the specified library.
  2610. @item controls, c
  2611. Set the '|' separated list of controls which are zero or more floating point
  2612. values that determine the behavior of the loaded plugin (for example delay,
  2613. threshold or gain).
  2614. Controls need to be defined using the following syntax:
  2615. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2616. @var{valuei} is the value set on the @var{i}-th control.
  2617. Alternatively they can be also defined using the following syntax:
  2618. @var{value0}|@var{value1}|@var{value2}|..., where
  2619. @var{valuei} is the value set on the @var{i}-th control.
  2620. If @option{controls} is set to @code{help}, all available controls and
  2621. their valid ranges are printed.
  2622. @item sample_rate, s
  2623. Specify the sample rate, default to 44100. Only used if plugin have
  2624. zero inputs.
  2625. @item nb_samples, n
  2626. Set the number of samples per channel per each output frame, default
  2627. is 1024. Only used if plugin have zero inputs.
  2628. @item duration, d
  2629. Set the minimum duration of the sourced audio. See
  2630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2631. for the accepted syntax.
  2632. Note that the resulting duration may be greater than the specified duration,
  2633. as the generated audio is always cut at the end of a complete frame.
  2634. If not specified, or the expressed duration is negative, the audio is
  2635. supposed to be generated forever.
  2636. Only used if plugin have zero inputs.
  2637. @end table
  2638. @subsection Examples
  2639. @itemize
  2640. @item
  2641. List all available plugins within amp (LADSPA example plugin) library:
  2642. @example
  2643. ladspa=file=amp
  2644. @end example
  2645. @item
  2646. List all available controls and their valid ranges for @code{vcf_notch}
  2647. plugin from @code{VCF} library:
  2648. @example
  2649. ladspa=f=vcf:p=vcf_notch:c=help
  2650. @end example
  2651. @item
  2652. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2653. plugin library:
  2654. @example
  2655. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2656. @end example
  2657. @item
  2658. Add reverberation to the audio using TAP-plugins
  2659. (Tom's Audio Processing plugins):
  2660. @example
  2661. ladspa=file=tap_reverb:tap_reverb
  2662. @end example
  2663. @item
  2664. Generate white noise, with 0.2 amplitude:
  2665. @example
  2666. ladspa=file=cmt:noise_source_white:c=c0=.2
  2667. @end example
  2668. @item
  2669. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2670. @code{C* Audio Plugin Suite} (CAPS) library:
  2671. @example
  2672. ladspa=file=caps:Click:c=c1=20'
  2673. @end example
  2674. @item
  2675. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2676. @example
  2677. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2678. @end example
  2679. @item
  2680. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2681. @code{SWH Plugins} collection:
  2682. @example
  2683. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2684. @end example
  2685. @item
  2686. Attenuate low frequencies using Multiband EQ from Steve Harris
  2687. @code{SWH Plugins} collection:
  2688. @example
  2689. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2690. @end example
  2691. @item
  2692. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2693. (CAPS) library:
  2694. @example
  2695. ladspa=caps:Narrower
  2696. @end example
  2697. @item
  2698. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2699. @example
  2700. ladspa=caps:White:.2
  2701. @end example
  2702. @item
  2703. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2704. @example
  2705. ladspa=caps:Fractal:c=c1=1
  2706. @end example
  2707. @item
  2708. Dynamic volume normalization using @code{VLevel} plugin:
  2709. @example
  2710. ladspa=vlevel-ladspa:vlevel_mono
  2711. @end example
  2712. @end itemize
  2713. @subsection Commands
  2714. This filter supports the following commands:
  2715. @table @option
  2716. @item cN
  2717. Modify the @var{N}-th control value.
  2718. If the specified value is not valid, it is ignored and prior one is kept.
  2719. @end table
  2720. @section loudnorm
  2721. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2722. Support for both single pass (livestreams, files) and double pass (files) modes.
  2723. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2724. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2725. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item I, i
  2729. Set integrated loudness target.
  2730. Range is -70.0 - -5.0. Default value is -24.0.
  2731. @item LRA, lra
  2732. Set loudness range target.
  2733. Range is 1.0 - 20.0. Default value is 7.0.
  2734. @item TP, tp
  2735. Set maximum true peak.
  2736. Range is -9.0 - +0.0. Default value is -2.0.
  2737. @item measured_I, measured_i
  2738. Measured IL of input file.
  2739. Range is -99.0 - +0.0.
  2740. @item measured_LRA, measured_lra
  2741. Measured LRA of input file.
  2742. Range is 0.0 - 99.0.
  2743. @item measured_TP, measured_tp
  2744. Measured true peak of input file.
  2745. Range is -99.0 - +99.0.
  2746. @item measured_thresh
  2747. Measured threshold of input file.
  2748. Range is -99.0 - +0.0.
  2749. @item offset
  2750. Set offset gain. Gain is applied before the true-peak limiter.
  2751. Range is -99.0 - +99.0. Default is +0.0.
  2752. @item linear
  2753. Normalize linearly if possible.
  2754. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2755. to be specified in order to use this mode.
  2756. Options are true or false. Default is true.
  2757. @item dual_mono
  2758. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2759. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2760. If set to @code{true}, this option will compensate for this effect.
  2761. Multi-channel input files are not affected by this option.
  2762. Options are true or false. Default is false.
  2763. @item print_format
  2764. Set print format for stats. Options are summary, json, or none.
  2765. Default value is none.
  2766. @end table
  2767. @section lowpass
  2768. Apply a low-pass filter with 3dB point frequency.
  2769. The filter can be either single-pole or double-pole (the default).
  2770. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2771. The filter accepts the following options:
  2772. @table @option
  2773. @item frequency, f
  2774. Set frequency in Hz. Default is 500.
  2775. @item poles, p
  2776. Set number of poles. Default is 2.
  2777. @item width_type, t
  2778. Set method to specify band-width of filter.
  2779. @table @option
  2780. @item h
  2781. Hz
  2782. @item q
  2783. Q-Factor
  2784. @item o
  2785. octave
  2786. @item s
  2787. slope
  2788. @item k
  2789. kHz
  2790. @end table
  2791. @item width, w
  2792. Specify the band-width of a filter in width_type units.
  2793. Applies only to double-pole filter.
  2794. The default is 0.707q and gives a Butterworth response.
  2795. @item channels, c
  2796. Specify which channels to filter, by default all available are filtered.
  2797. @end table
  2798. @subsection Examples
  2799. @itemize
  2800. @item
  2801. Lowpass only LFE channel, it LFE is not present it does nothing:
  2802. @example
  2803. lowpass=c=LFE
  2804. @end example
  2805. @end itemize
  2806. @subsection Commands
  2807. This filter supports the following commands:
  2808. @table @option
  2809. @item frequency, f
  2810. Change lowpass frequency.
  2811. Syntax for the command is : "@var{frequency}"
  2812. @item width_type, t
  2813. Change lowpass width_type.
  2814. Syntax for the command is : "@var{width_type}"
  2815. @item width, w
  2816. Change lowpass width.
  2817. Syntax for the command is : "@var{width}"
  2818. @end table
  2819. @section lv2
  2820. Load a LV2 (LADSPA Version 2) plugin.
  2821. To enable compilation of this filter you need to configure FFmpeg with
  2822. @code{--enable-lv2}.
  2823. @table @option
  2824. @item plugin, p
  2825. Specifies the plugin URI. You may need to escape ':'.
  2826. @item controls, c
  2827. Set the '|' separated list of controls which are zero or more floating point
  2828. values that determine the behavior of the loaded plugin (for example delay,
  2829. threshold or gain).
  2830. If @option{controls} is set to @code{help}, all available controls and
  2831. their valid ranges are printed.
  2832. @item sample_rate, s
  2833. Specify the sample rate, default to 44100. Only used if plugin have
  2834. zero inputs.
  2835. @item nb_samples, n
  2836. Set the number of samples per channel per each output frame, default
  2837. is 1024. Only used if plugin have zero inputs.
  2838. @item duration, d
  2839. Set the minimum duration of the sourced audio. See
  2840. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2841. for the accepted syntax.
  2842. Note that the resulting duration may be greater than the specified duration,
  2843. as the generated audio is always cut at the end of a complete frame.
  2844. If not specified, or the expressed duration is negative, the audio is
  2845. supposed to be generated forever.
  2846. Only used if plugin have zero inputs.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. Apply bass enhancer plugin from Calf:
  2852. @example
  2853. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2854. @end example
  2855. @item
  2856. Apply vinyl plugin from Calf:
  2857. @example
  2858. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2859. @end example
  2860. @item
  2861. Apply bit crusher plugin from ArtyFX:
  2862. @example
  2863. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2864. @end example
  2865. @end itemize
  2866. @section mcompand
  2867. Multiband Compress or expand the audio's dynamic range.
  2868. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2869. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2870. response when absent compander action.
  2871. It accepts the following parameters:
  2872. @table @option
  2873. @item args
  2874. This option syntax is:
  2875. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2876. For explanation of each item refer to compand filter documentation.
  2877. @end table
  2878. @anchor{pan}
  2879. @section pan
  2880. Mix channels with specific gain levels. The filter accepts the output
  2881. channel layout followed by a set of channels definitions.
  2882. This filter is also designed to efficiently remap the channels of an audio
  2883. stream.
  2884. The filter accepts parameters of the form:
  2885. "@var{l}|@var{outdef}|@var{outdef}|..."
  2886. @table @option
  2887. @item l
  2888. output channel layout or number of channels
  2889. @item outdef
  2890. output channel specification, of the form:
  2891. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2892. @item out_name
  2893. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2894. number (c0, c1, etc.)
  2895. @item gain
  2896. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2897. @item in_name
  2898. input channel to use, see out_name for details; it is not possible to mix
  2899. named and numbered input channels
  2900. @end table
  2901. If the `=' in a channel specification is replaced by `<', then the gains for
  2902. that specification will be renormalized so that the total is 1, thus
  2903. avoiding clipping noise.
  2904. @subsection Mixing examples
  2905. For example, if you want to down-mix from stereo to mono, but with a bigger
  2906. factor for the left channel:
  2907. @example
  2908. pan=1c|c0=0.9*c0+0.1*c1
  2909. @end example
  2910. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2911. 7-channels surround:
  2912. @example
  2913. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2914. @end example
  2915. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2916. that should be preferred (see "-ac" option) unless you have very specific
  2917. needs.
  2918. @subsection Remapping examples
  2919. The channel remapping will be effective if, and only if:
  2920. @itemize
  2921. @item gain coefficients are zeroes or ones,
  2922. @item only one input per channel output,
  2923. @end itemize
  2924. If all these conditions are satisfied, the filter will notify the user ("Pure
  2925. channel mapping detected"), and use an optimized and lossless method to do the
  2926. remapping.
  2927. For example, if you have a 5.1 source and want a stereo audio stream by
  2928. dropping the extra channels:
  2929. @example
  2930. pan="stereo| c0=FL | c1=FR"
  2931. @end example
  2932. Given the same source, you can also switch front left and front right channels
  2933. and keep the input channel layout:
  2934. @example
  2935. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2936. @end example
  2937. If the input is a stereo audio stream, you can mute the front left channel (and
  2938. still keep the stereo channel layout) with:
  2939. @example
  2940. pan="stereo|c1=c1"
  2941. @end example
  2942. Still with a stereo audio stream input, you can copy the right channel in both
  2943. front left and right:
  2944. @example
  2945. pan="stereo| c0=FR | c1=FR"
  2946. @end example
  2947. @section replaygain
  2948. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2949. outputs it unchanged.
  2950. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2951. @section resample
  2952. Convert the audio sample format, sample rate and channel layout. It is
  2953. not meant to be used directly.
  2954. @section rubberband
  2955. Apply time-stretching and pitch-shifting with librubberband.
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item tempo
  2959. Set tempo scale factor.
  2960. @item pitch
  2961. Set pitch scale factor.
  2962. @item transients
  2963. Set transients detector.
  2964. Possible values are:
  2965. @table @var
  2966. @item crisp
  2967. @item mixed
  2968. @item smooth
  2969. @end table
  2970. @item detector
  2971. Set detector.
  2972. Possible values are:
  2973. @table @var
  2974. @item compound
  2975. @item percussive
  2976. @item soft
  2977. @end table
  2978. @item phase
  2979. Set phase.
  2980. Possible values are:
  2981. @table @var
  2982. @item laminar
  2983. @item independent
  2984. @end table
  2985. @item window
  2986. Set processing window size.
  2987. Possible values are:
  2988. @table @var
  2989. @item standard
  2990. @item short
  2991. @item long
  2992. @end table
  2993. @item smoothing
  2994. Set smoothing.
  2995. Possible values are:
  2996. @table @var
  2997. @item off
  2998. @item on
  2999. @end table
  3000. @item formant
  3001. Enable formant preservation when shift pitching.
  3002. Possible values are:
  3003. @table @var
  3004. @item shifted
  3005. @item preserved
  3006. @end table
  3007. @item pitchq
  3008. Set pitch quality.
  3009. Possible values are:
  3010. @table @var
  3011. @item quality
  3012. @item speed
  3013. @item consistency
  3014. @end table
  3015. @item channels
  3016. Set channels.
  3017. Possible values are:
  3018. @table @var
  3019. @item apart
  3020. @item together
  3021. @end table
  3022. @end table
  3023. @section sidechaincompress
  3024. This filter acts like normal compressor but has the ability to compress
  3025. detected signal using second input signal.
  3026. It needs two input streams and returns one output stream.
  3027. First input stream will be processed depending on second stream signal.
  3028. The filtered signal then can be filtered with other filters in later stages of
  3029. processing. See @ref{pan} and @ref{amerge} filter.
  3030. The filter accepts the following options:
  3031. @table @option
  3032. @item level_in
  3033. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3034. @item threshold
  3035. If a signal of second stream raises above this level it will affect the gain
  3036. reduction of first stream.
  3037. By default is 0.125. Range is between 0.00097563 and 1.
  3038. @item ratio
  3039. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3040. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3041. Default is 2. Range is between 1 and 20.
  3042. @item attack
  3043. Amount of milliseconds the signal has to rise above the threshold before gain
  3044. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3045. @item release
  3046. Amount of milliseconds the signal has to fall below the threshold before
  3047. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3048. @item makeup
  3049. Set the amount by how much signal will be amplified after processing.
  3050. Default is 1. Range is from 1 to 64.
  3051. @item knee
  3052. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3053. Default is 2.82843. Range is between 1 and 8.
  3054. @item link
  3055. Choose if the @code{average} level between all channels of side-chain stream
  3056. or the louder(@code{maximum}) channel of side-chain stream affects the
  3057. reduction. Default is @code{average}.
  3058. @item detection
  3059. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3060. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3061. @item level_sc
  3062. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3063. @item mix
  3064. How much to use compressed signal in output. Default is 1.
  3065. Range is between 0 and 1.
  3066. @end table
  3067. @subsection Examples
  3068. @itemize
  3069. @item
  3070. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3071. depending on the signal of 2nd input and later compressed signal to be
  3072. merged with 2nd input:
  3073. @example
  3074. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3075. @end example
  3076. @end itemize
  3077. @section sidechaingate
  3078. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3079. filter the detected signal before sending it to the gain reduction stage.
  3080. Normally a gate uses the full range signal to detect a level above the
  3081. threshold.
  3082. For example: If you cut all lower frequencies from your sidechain signal
  3083. the gate will decrease the volume of your track only if not enough highs
  3084. appear. With this technique you are able to reduce the resonation of a
  3085. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3086. guitar.
  3087. It needs two input streams and returns one output stream.
  3088. First input stream will be processed depending on second stream signal.
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item level_in
  3092. Set input level before filtering.
  3093. Default is 1. Allowed range is from 0.015625 to 64.
  3094. @item range
  3095. Set the level of gain reduction when the signal is below the threshold.
  3096. Default is 0.06125. Allowed range is from 0 to 1.
  3097. @item threshold
  3098. If a signal rises above this level the gain reduction is released.
  3099. Default is 0.125. Allowed range is from 0 to 1.
  3100. @item ratio
  3101. Set a ratio about which the signal is reduced.
  3102. Default is 2. Allowed range is from 1 to 9000.
  3103. @item attack
  3104. Amount of milliseconds the signal has to rise above the threshold before gain
  3105. reduction stops.
  3106. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3107. @item release
  3108. Amount of milliseconds the signal has to fall below the threshold before the
  3109. reduction is increased again. Default is 250 milliseconds.
  3110. Allowed range is from 0.01 to 9000.
  3111. @item makeup
  3112. Set amount of amplification of signal after processing.
  3113. Default is 1. Allowed range is from 1 to 64.
  3114. @item knee
  3115. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3116. Default is 2.828427125. Allowed range is from 1 to 8.
  3117. @item detection
  3118. Choose if exact signal should be taken for detection or an RMS like one.
  3119. Default is rms. Can be peak or rms.
  3120. @item link
  3121. Choose if the average level between all channels or the louder channel affects
  3122. the reduction.
  3123. Default is average. Can be average or maximum.
  3124. @item level_sc
  3125. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3126. @end table
  3127. @section silencedetect
  3128. Detect silence in an audio stream.
  3129. This filter logs a message when it detects that the input audio volume is less
  3130. or equal to a noise tolerance value for a duration greater or equal to the
  3131. minimum detected noise duration.
  3132. The printed times and duration are expressed in seconds.
  3133. The filter accepts the following options:
  3134. @table @option
  3135. @item duration, d
  3136. Set silence duration until notification (default is 2 seconds).
  3137. @item noise, n
  3138. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3139. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3140. @end table
  3141. @subsection Examples
  3142. @itemize
  3143. @item
  3144. Detect 5 seconds of silence with -50dB noise tolerance:
  3145. @example
  3146. silencedetect=n=-50dB:d=5
  3147. @end example
  3148. @item
  3149. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3150. tolerance in @file{silence.mp3}:
  3151. @example
  3152. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3153. @end example
  3154. @end itemize
  3155. @section silenceremove
  3156. Remove silence from the beginning, middle or end of the audio.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item start_periods
  3160. This value is used to indicate if audio should be trimmed at beginning of
  3161. the audio. A value of zero indicates no silence should be trimmed from the
  3162. beginning. When specifying a non-zero value, it trims audio up until it
  3163. finds non-silence. Normally, when trimming silence from beginning of audio
  3164. the @var{start_periods} will be @code{1} but it can be increased to higher
  3165. values to trim all audio up to specific count of non-silence periods.
  3166. Default value is @code{0}.
  3167. @item start_duration
  3168. Specify the amount of time that non-silence must be detected before it stops
  3169. trimming audio. By increasing the duration, bursts of noises can be treated
  3170. as silence and trimmed off. Default value is @code{0}.
  3171. @item start_threshold
  3172. This indicates what sample value should be treated as silence. For digital
  3173. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3174. you may wish to increase the value to account for background noise.
  3175. Can be specified in dB (in case "dB" is appended to the specified value)
  3176. or amplitude ratio. Default value is @code{0}.
  3177. @item stop_periods
  3178. Set the count for trimming silence from the end of audio.
  3179. To remove silence from the middle of a file, specify a @var{stop_periods}
  3180. that is negative. This value is then treated as a positive value and is
  3181. used to indicate the effect should restart processing as specified by
  3182. @var{start_periods}, making it suitable for removing periods of silence
  3183. in the middle of the audio.
  3184. Default value is @code{0}.
  3185. @item stop_duration
  3186. Specify a duration of silence that must exist before audio is not copied any
  3187. more. By specifying a higher duration, silence that is wanted can be left in
  3188. the audio.
  3189. Default value is @code{0}.
  3190. @item stop_threshold
  3191. This is the same as @option{start_threshold} but for trimming silence from
  3192. the end of audio.
  3193. Can be specified in dB (in case "dB" is appended to the specified value)
  3194. or amplitude ratio. Default value is @code{0}.
  3195. @item leave_silence
  3196. This indicates that @var{stop_duration} length of audio should be left intact
  3197. at the beginning of each period of silence.
  3198. For example, if you want to remove long pauses between words but do not want
  3199. to remove the pauses completely. Default value is @code{0}.
  3200. @item detection
  3201. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3202. and works better with digital silence which is exactly 0.
  3203. Default value is @code{rms}.
  3204. @item window
  3205. Set ratio used to calculate size of window for detecting silence.
  3206. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3207. @end table
  3208. @subsection Examples
  3209. @itemize
  3210. @item
  3211. The following example shows how this filter can be used to start a recording
  3212. that does not contain the delay at the start which usually occurs between
  3213. pressing the record button and the start of the performance:
  3214. @example
  3215. silenceremove=1:5:0.02
  3216. @end example
  3217. @item
  3218. Trim all silence encountered from beginning to end where there is more than 1
  3219. second of silence in audio:
  3220. @example
  3221. silenceremove=0:0:0:-1:1:-90dB
  3222. @end example
  3223. @end itemize
  3224. @section sofalizer
  3225. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3226. loudspeakers around the user for binaural listening via headphones (audio
  3227. formats up to 9 channels supported).
  3228. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3229. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3230. Austrian Academy of Sciences.
  3231. To enable compilation of this filter you need to configure FFmpeg with
  3232. @code{--enable-libmysofa}.
  3233. The filter accepts the following options:
  3234. @table @option
  3235. @item sofa
  3236. Set the SOFA file used for rendering.
  3237. @item gain
  3238. Set gain applied to audio. Value is in dB. Default is 0.
  3239. @item rotation
  3240. Set rotation of virtual loudspeakers in deg. Default is 0.
  3241. @item elevation
  3242. Set elevation of virtual speakers in deg. Default is 0.
  3243. @item radius
  3244. Set distance in meters between loudspeakers and the listener with near-field
  3245. HRTFs. Default is 1.
  3246. @item type
  3247. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3248. processing audio in time domain which is slow.
  3249. @var{freq} is processing audio in frequency domain which is fast.
  3250. Default is @var{freq}.
  3251. @item speakers
  3252. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3253. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3254. Each virtual loudspeaker is described with short channel name following with
  3255. azimuth and elevation in degrees.
  3256. Each virtual loudspeaker description is separated by '|'.
  3257. For example to override front left and front right channel positions use:
  3258. 'speakers=FL 45 15|FR 345 15'.
  3259. Descriptions with unrecognised channel names are ignored.
  3260. @item lfegain
  3261. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3262. @end table
  3263. @subsection Examples
  3264. @itemize
  3265. @item
  3266. Using ClubFritz6 sofa file:
  3267. @example
  3268. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3269. @end example
  3270. @item
  3271. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3272. @example
  3273. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3274. @end example
  3275. @item
  3276. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3277. and also with custom gain:
  3278. @example
  3279. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3280. @end example
  3281. @end itemize
  3282. @section stereotools
  3283. This filter has some handy utilities to manage stereo signals, for converting
  3284. M/S stereo recordings to L/R signal while having control over the parameters
  3285. or spreading the stereo image of master track.
  3286. The filter accepts the following options:
  3287. @table @option
  3288. @item level_in
  3289. Set input level before filtering for both channels. Defaults is 1.
  3290. Allowed range is from 0.015625 to 64.
  3291. @item level_out
  3292. Set output level after filtering for both channels. Defaults is 1.
  3293. Allowed range is from 0.015625 to 64.
  3294. @item balance_in
  3295. Set input balance between both channels. Default is 0.
  3296. Allowed range is from -1 to 1.
  3297. @item balance_out
  3298. Set output balance between both channels. Default is 0.
  3299. Allowed range is from -1 to 1.
  3300. @item softclip
  3301. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3302. clipping. Disabled by default.
  3303. @item mutel
  3304. Mute the left channel. Disabled by default.
  3305. @item muter
  3306. Mute the right channel. Disabled by default.
  3307. @item phasel
  3308. Change the phase of the left channel. Disabled by default.
  3309. @item phaser
  3310. Change the phase of the right channel. Disabled by default.
  3311. @item mode
  3312. Set stereo mode. Available values are:
  3313. @table @samp
  3314. @item lr>lr
  3315. Left/Right to Left/Right, this is default.
  3316. @item lr>ms
  3317. Left/Right to Mid/Side.
  3318. @item ms>lr
  3319. Mid/Side to Left/Right.
  3320. @item lr>ll
  3321. Left/Right to Left/Left.
  3322. @item lr>rr
  3323. Left/Right to Right/Right.
  3324. @item lr>l+r
  3325. Left/Right to Left + Right.
  3326. @item lr>rl
  3327. Left/Right to Right/Left.
  3328. @item ms>ll
  3329. Mid/Side to Left/Left.
  3330. @item ms>rr
  3331. Mid/Side to Right/Right.
  3332. @end table
  3333. @item slev
  3334. Set level of side signal. Default is 1.
  3335. Allowed range is from 0.015625 to 64.
  3336. @item sbal
  3337. Set balance of side signal. Default is 0.
  3338. Allowed range is from -1 to 1.
  3339. @item mlev
  3340. Set level of the middle signal. Default is 1.
  3341. Allowed range is from 0.015625 to 64.
  3342. @item mpan
  3343. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3344. @item base
  3345. Set stereo base between mono and inversed channels. Default is 0.
  3346. Allowed range is from -1 to 1.
  3347. @item delay
  3348. Set delay in milliseconds how much to delay left from right channel and
  3349. vice versa. Default is 0. Allowed range is from -20 to 20.
  3350. @item sclevel
  3351. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3352. @item phase
  3353. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3354. @item bmode_in, bmode_out
  3355. Set balance mode for balance_in/balance_out option.
  3356. Can be one of the following:
  3357. @table @samp
  3358. @item balance
  3359. Classic balance mode. Attenuate one channel at time.
  3360. Gain is raised up to 1.
  3361. @item amplitude
  3362. Similar as classic mode above but gain is raised up to 2.
  3363. @item power
  3364. Equal power distribution, from -6dB to +6dB range.
  3365. @end table
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Apply karaoke like effect:
  3371. @example
  3372. stereotools=mlev=0.015625
  3373. @end example
  3374. @item
  3375. Convert M/S signal to L/R:
  3376. @example
  3377. "stereotools=mode=ms>lr"
  3378. @end example
  3379. @end itemize
  3380. @section stereowiden
  3381. This filter enhance the stereo effect by suppressing signal common to both
  3382. channels and by delaying the signal of left into right and vice versa,
  3383. thereby widening the stereo effect.
  3384. The filter accepts the following options:
  3385. @table @option
  3386. @item delay
  3387. Time in milliseconds of the delay of left signal into right and vice versa.
  3388. Default is 20 milliseconds.
  3389. @item feedback
  3390. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3391. effect of left signal in right output and vice versa which gives widening
  3392. effect. Default is 0.3.
  3393. @item crossfeed
  3394. Cross feed of left into right with inverted phase. This helps in suppressing
  3395. the mono. If the value is 1 it will cancel all the signal common to both
  3396. channels. Default is 0.3.
  3397. @item drymix
  3398. Set level of input signal of original channel. Default is 0.8.
  3399. @end table
  3400. @section superequalizer
  3401. Apply 18 band equalizer.
  3402. The filter accepts the following options:
  3403. @table @option
  3404. @item 1b
  3405. Set 65Hz band gain.
  3406. @item 2b
  3407. Set 92Hz band gain.
  3408. @item 3b
  3409. Set 131Hz band gain.
  3410. @item 4b
  3411. Set 185Hz band gain.
  3412. @item 5b
  3413. Set 262Hz band gain.
  3414. @item 6b
  3415. Set 370Hz band gain.
  3416. @item 7b
  3417. Set 523Hz band gain.
  3418. @item 8b
  3419. Set 740Hz band gain.
  3420. @item 9b
  3421. Set 1047Hz band gain.
  3422. @item 10b
  3423. Set 1480Hz band gain.
  3424. @item 11b
  3425. Set 2093Hz band gain.
  3426. @item 12b
  3427. Set 2960Hz band gain.
  3428. @item 13b
  3429. Set 4186Hz band gain.
  3430. @item 14b
  3431. Set 5920Hz band gain.
  3432. @item 15b
  3433. Set 8372Hz band gain.
  3434. @item 16b
  3435. Set 11840Hz band gain.
  3436. @item 17b
  3437. Set 16744Hz band gain.
  3438. @item 18b
  3439. Set 20000Hz band gain.
  3440. @end table
  3441. @section surround
  3442. Apply audio surround upmix filter.
  3443. This filter allows to produce multichannel output from audio stream.
  3444. The filter accepts the following options:
  3445. @table @option
  3446. @item chl_out
  3447. Set output channel layout. By default, this is @var{5.1}.
  3448. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3449. for the required syntax.
  3450. @item chl_in
  3451. Set input channel layout. By default, this is @var{stereo}.
  3452. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3453. for the required syntax.
  3454. @item level_in
  3455. Set input volume level. By default, this is @var{1}.
  3456. @item level_out
  3457. Set output volume level. By default, this is @var{1}.
  3458. @item lfe
  3459. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3460. @item lfe_low
  3461. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3462. @item lfe_high
  3463. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3464. @item fc_in
  3465. Set front center input volume. By default, this is @var{1}.
  3466. @item fc_out
  3467. Set front center output volume. By default, this is @var{1}.
  3468. @item lfe_in
  3469. Set LFE input volume. By default, this is @var{1}.
  3470. @item lfe_out
  3471. Set LFE output volume. By default, this is @var{1}.
  3472. @end table
  3473. @section treble, highshelf
  3474. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3475. shelving filter with a response similar to that of a standard
  3476. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item gain, g
  3480. Give the gain at whichever is the lower of ~22 kHz and the
  3481. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3482. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3483. @item frequency, f
  3484. Set the filter's central frequency and so can be used
  3485. to extend or reduce the frequency range to be boosted or cut.
  3486. The default value is @code{3000} Hz.
  3487. @item width_type, t
  3488. Set method to specify band-width of filter.
  3489. @table @option
  3490. @item h
  3491. Hz
  3492. @item q
  3493. Q-Factor
  3494. @item o
  3495. octave
  3496. @item s
  3497. slope
  3498. @item k
  3499. kHz
  3500. @end table
  3501. @item width, w
  3502. Determine how steep is the filter's shelf transition.
  3503. @item channels, c
  3504. Specify which channels to filter, by default all available are filtered.
  3505. @end table
  3506. @subsection Commands
  3507. This filter supports the following commands:
  3508. @table @option
  3509. @item frequency, f
  3510. Change treble frequency.
  3511. Syntax for the command is : "@var{frequency}"
  3512. @item width_type, t
  3513. Change treble width_type.
  3514. Syntax for the command is : "@var{width_type}"
  3515. @item width, w
  3516. Change treble width.
  3517. Syntax for the command is : "@var{width}"
  3518. @item gain, g
  3519. Change treble gain.
  3520. Syntax for the command is : "@var{gain}"
  3521. @end table
  3522. @section tremolo
  3523. Sinusoidal amplitude modulation.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item f
  3527. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3528. (20 Hz or lower) will result in a tremolo effect.
  3529. This filter may also be used as a ring modulator by specifying
  3530. a modulation frequency higher than 20 Hz.
  3531. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3532. @item d
  3533. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3534. Default value is 0.5.
  3535. @end table
  3536. @section vibrato
  3537. Sinusoidal phase modulation.
  3538. The filter accepts the following options:
  3539. @table @option
  3540. @item f
  3541. Modulation frequency in Hertz.
  3542. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3543. @item d
  3544. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3545. Default value is 0.5.
  3546. @end table
  3547. @section volume
  3548. Adjust the input audio volume.
  3549. It accepts the following parameters:
  3550. @table @option
  3551. @item volume
  3552. Set audio volume expression.
  3553. Output values are clipped to the maximum value.
  3554. The output audio volume is given by the relation:
  3555. @example
  3556. @var{output_volume} = @var{volume} * @var{input_volume}
  3557. @end example
  3558. The default value for @var{volume} is "1.0".
  3559. @item precision
  3560. This parameter represents the mathematical precision.
  3561. It determines which input sample formats will be allowed, which affects the
  3562. precision of the volume scaling.
  3563. @table @option
  3564. @item fixed
  3565. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3566. @item float
  3567. 32-bit floating-point; this limits input sample format to FLT. (default)
  3568. @item double
  3569. 64-bit floating-point; this limits input sample format to DBL.
  3570. @end table
  3571. @item replaygain
  3572. Choose the behaviour on encountering ReplayGain side data in input frames.
  3573. @table @option
  3574. @item drop
  3575. Remove ReplayGain side data, ignoring its contents (the default).
  3576. @item ignore
  3577. Ignore ReplayGain side data, but leave it in the frame.
  3578. @item track
  3579. Prefer the track gain, if present.
  3580. @item album
  3581. Prefer the album gain, if present.
  3582. @end table
  3583. @item replaygain_preamp
  3584. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3585. Default value for @var{replaygain_preamp} is 0.0.
  3586. @item eval
  3587. Set when the volume expression is evaluated.
  3588. It accepts the following values:
  3589. @table @samp
  3590. @item once
  3591. only evaluate expression once during the filter initialization, or
  3592. when the @samp{volume} command is sent
  3593. @item frame
  3594. evaluate expression for each incoming frame
  3595. @end table
  3596. Default value is @samp{once}.
  3597. @end table
  3598. The volume expression can contain the following parameters.
  3599. @table @option
  3600. @item n
  3601. frame number (starting at zero)
  3602. @item nb_channels
  3603. number of channels
  3604. @item nb_consumed_samples
  3605. number of samples consumed by the filter
  3606. @item nb_samples
  3607. number of samples in the current frame
  3608. @item pos
  3609. original frame position in the file
  3610. @item pts
  3611. frame PTS
  3612. @item sample_rate
  3613. sample rate
  3614. @item startpts
  3615. PTS at start of stream
  3616. @item startt
  3617. time at start of stream
  3618. @item t
  3619. frame time
  3620. @item tb
  3621. timestamp timebase
  3622. @item volume
  3623. last set volume value
  3624. @end table
  3625. Note that when @option{eval} is set to @samp{once} only the
  3626. @var{sample_rate} and @var{tb} variables are available, all other
  3627. variables will evaluate to NAN.
  3628. @subsection Commands
  3629. This filter supports the following commands:
  3630. @table @option
  3631. @item volume
  3632. Modify the volume expression.
  3633. The command accepts the same syntax of the corresponding option.
  3634. If the specified expression is not valid, it is kept at its current
  3635. value.
  3636. @item replaygain_noclip
  3637. Prevent clipping by limiting the gain applied.
  3638. Default value for @var{replaygain_noclip} is 1.
  3639. @end table
  3640. @subsection Examples
  3641. @itemize
  3642. @item
  3643. Halve the input audio volume:
  3644. @example
  3645. volume=volume=0.5
  3646. volume=volume=1/2
  3647. volume=volume=-6.0206dB
  3648. @end example
  3649. In all the above example the named key for @option{volume} can be
  3650. omitted, for example like in:
  3651. @example
  3652. volume=0.5
  3653. @end example
  3654. @item
  3655. Increase input audio power by 6 decibels using fixed-point precision:
  3656. @example
  3657. volume=volume=6dB:precision=fixed
  3658. @end example
  3659. @item
  3660. Fade volume after time 10 with an annihilation period of 5 seconds:
  3661. @example
  3662. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3663. @end example
  3664. @end itemize
  3665. @section volumedetect
  3666. Detect the volume of the input video.
  3667. The filter has no parameters. The input is not modified. Statistics about
  3668. the volume will be printed in the log when the input stream end is reached.
  3669. In particular it will show the mean volume (root mean square), maximum
  3670. volume (on a per-sample basis), and the beginning of a histogram of the
  3671. registered volume values (from the maximum value to a cumulated 1/1000 of
  3672. the samples).
  3673. All volumes are in decibels relative to the maximum PCM value.
  3674. @subsection Examples
  3675. Here is an excerpt of the output:
  3676. @example
  3677. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3678. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3679. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3680. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3681. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3682. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3683. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3684. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3685. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3686. @end example
  3687. It means that:
  3688. @itemize
  3689. @item
  3690. The mean square energy is approximately -27 dB, or 10^-2.7.
  3691. @item
  3692. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3693. @item
  3694. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3695. @end itemize
  3696. In other words, raising the volume by +4 dB does not cause any clipping,
  3697. raising it by +5 dB causes clipping for 6 samples, etc.
  3698. @c man end AUDIO FILTERS
  3699. @chapter Audio Sources
  3700. @c man begin AUDIO SOURCES
  3701. Below is a description of the currently available audio sources.
  3702. @section abuffer
  3703. Buffer audio frames, and make them available to the filter chain.
  3704. This source is mainly intended for a programmatic use, in particular
  3705. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3706. It accepts the following parameters:
  3707. @table @option
  3708. @item time_base
  3709. The timebase which will be used for timestamps of submitted frames. It must be
  3710. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3711. @item sample_rate
  3712. The sample rate of the incoming audio buffers.
  3713. @item sample_fmt
  3714. The sample format of the incoming audio buffers.
  3715. Either a sample format name or its corresponding integer representation from
  3716. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3717. @item channel_layout
  3718. The channel layout of the incoming audio buffers.
  3719. Either a channel layout name from channel_layout_map in
  3720. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3721. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3722. @item channels
  3723. The number of channels of the incoming audio buffers.
  3724. If both @var{channels} and @var{channel_layout} are specified, then they
  3725. must be consistent.
  3726. @end table
  3727. @subsection Examples
  3728. @example
  3729. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3730. @end example
  3731. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3732. Since the sample format with name "s16p" corresponds to the number
  3733. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3734. equivalent to:
  3735. @example
  3736. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3737. @end example
  3738. @section aevalsrc
  3739. Generate an audio signal specified by an expression.
  3740. This source accepts in input one or more expressions (one for each
  3741. channel), which are evaluated and used to generate a corresponding
  3742. audio signal.
  3743. This source accepts the following options:
  3744. @table @option
  3745. @item exprs
  3746. Set the '|'-separated expressions list for each separate channel. In case the
  3747. @option{channel_layout} option is not specified, the selected channel layout
  3748. depends on the number of provided expressions. Otherwise the last
  3749. specified expression is applied to the remaining output channels.
  3750. @item channel_layout, c
  3751. Set the channel layout. The number of channels in the specified layout
  3752. must be equal to the number of specified expressions.
  3753. @item duration, d
  3754. Set the minimum duration of the sourced audio. See
  3755. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3756. for the accepted syntax.
  3757. Note that the resulting duration may be greater than the specified
  3758. duration, as the generated audio is always cut at the end of a
  3759. complete frame.
  3760. If not specified, or the expressed duration is negative, the audio is
  3761. supposed to be generated forever.
  3762. @item nb_samples, n
  3763. Set the number of samples per channel per each output frame,
  3764. default to 1024.
  3765. @item sample_rate, s
  3766. Specify the sample rate, default to 44100.
  3767. @end table
  3768. Each expression in @var{exprs} can contain the following constants:
  3769. @table @option
  3770. @item n
  3771. number of the evaluated sample, starting from 0
  3772. @item t
  3773. time of the evaluated sample expressed in seconds, starting from 0
  3774. @item s
  3775. sample rate
  3776. @end table
  3777. @subsection Examples
  3778. @itemize
  3779. @item
  3780. Generate silence:
  3781. @example
  3782. aevalsrc=0
  3783. @end example
  3784. @item
  3785. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3786. 8000 Hz:
  3787. @example
  3788. aevalsrc="sin(440*2*PI*t):s=8000"
  3789. @end example
  3790. @item
  3791. Generate a two channels signal, specify the channel layout (Front
  3792. Center + Back Center) explicitly:
  3793. @example
  3794. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3795. @end example
  3796. @item
  3797. Generate white noise:
  3798. @example
  3799. aevalsrc="-2+random(0)"
  3800. @end example
  3801. @item
  3802. Generate an amplitude modulated signal:
  3803. @example
  3804. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3805. @end example
  3806. @item
  3807. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3808. @example
  3809. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3810. @end example
  3811. @end itemize
  3812. @section anullsrc
  3813. The null audio source, return unprocessed audio frames. It is mainly useful
  3814. as a template and to be employed in analysis / debugging tools, or as
  3815. the source for filters which ignore the input data (for example the sox
  3816. synth filter).
  3817. This source accepts the following options:
  3818. @table @option
  3819. @item channel_layout, cl
  3820. Specifies the channel layout, and can be either an integer or a string
  3821. representing a channel layout. The default value of @var{channel_layout}
  3822. is "stereo".
  3823. Check the channel_layout_map definition in
  3824. @file{libavutil/channel_layout.c} for the mapping between strings and
  3825. channel layout values.
  3826. @item sample_rate, r
  3827. Specifies the sample rate, and defaults to 44100.
  3828. @item nb_samples, n
  3829. Set the number of samples per requested frames.
  3830. @end table
  3831. @subsection Examples
  3832. @itemize
  3833. @item
  3834. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3835. @example
  3836. anullsrc=r=48000:cl=4
  3837. @end example
  3838. @item
  3839. Do the same operation with a more obvious syntax:
  3840. @example
  3841. anullsrc=r=48000:cl=mono
  3842. @end example
  3843. @end itemize
  3844. All the parameters need to be explicitly defined.
  3845. @section flite
  3846. Synthesize a voice utterance using the libflite library.
  3847. To enable compilation of this filter you need to configure FFmpeg with
  3848. @code{--enable-libflite}.
  3849. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3850. The filter accepts the following options:
  3851. @table @option
  3852. @item list_voices
  3853. If set to 1, list the names of the available voices and exit
  3854. immediately. Default value is 0.
  3855. @item nb_samples, n
  3856. Set the maximum number of samples per frame. Default value is 512.
  3857. @item textfile
  3858. Set the filename containing the text to speak.
  3859. @item text
  3860. Set the text to speak.
  3861. @item voice, v
  3862. Set the voice to use for the speech synthesis. Default value is
  3863. @code{kal}. See also the @var{list_voices} option.
  3864. @end table
  3865. @subsection Examples
  3866. @itemize
  3867. @item
  3868. Read from file @file{speech.txt}, and synthesize the text using the
  3869. standard flite voice:
  3870. @example
  3871. flite=textfile=speech.txt
  3872. @end example
  3873. @item
  3874. Read the specified text selecting the @code{slt} voice:
  3875. @example
  3876. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3877. @end example
  3878. @item
  3879. Input text to ffmpeg:
  3880. @example
  3881. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3882. @end example
  3883. @item
  3884. Make @file{ffplay} speak the specified text, using @code{flite} and
  3885. the @code{lavfi} device:
  3886. @example
  3887. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3888. @end example
  3889. @end itemize
  3890. For more information about libflite, check:
  3891. @url{http://www.festvox.org/flite/}
  3892. @section anoisesrc
  3893. Generate a noise audio signal.
  3894. The filter accepts the following options:
  3895. @table @option
  3896. @item sample_rate, r
  3897. Specify the sample rate. Default value is 48000 Hz.
  3898. @item amplitude, a
  3899. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3900. is 1.0.
  3901. @item duration, d
  3902. Specify the duration of the generated audio stream. Not specifying this option
  3903. results in noise with an infinite length.
  3904. @item color, colour, c
  3905. Specify the color of noise. Available noise colors are white, pink, brown,
  3906. blue and violet. Default color is white.
  3907. @item seed, s
  3908. Specify a value used to seed the PRNG.
  3909. @item nb_samples, n
  3910. Set the number of samples per each output frame, default is 1024.
  3911. @end table
  3912. @subsection Examples
  3913. @itemize
  3914. @item
  3915. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3916. @example
  3917. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3918. @end example
  3919. @end itemize
  3920. @section hilbert
  3921. Generate odd-tap Hilbert transform FIR coefficients.
  3922. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3923. the signal by 90 degrees.
  3924. This is used in many matrix coding schemes and for analytic signal generation.
  3925. The process is often written as a multiplication by i (or j), the imaginary unit.
  3926. The filter accepts the following options:
  3927. @table @option
  3928. @item sample_rate, s
  3929. Set sample rate, default is 44100.
  3930. @item taps, t
  3931. Set length of FIR filter, default is 22051.
  3932. @item nb_samples, n
  3933. Set number of samples per each frame.
  3934. @item win_func, w
  3935. Set window function to be used when generating FIR coefficients.
  3936. @end table
  3937. @section sine
  3938. Generate an audio signal made of a sine wave with amplitude 1/8.
  3939. The audio signal is bit-exact.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item frequency, f
  3943. Set the carrier frequency. Default is 440 Hz.
  3944. @item beep_factor, b
  3945. Enable a periodic beep every second with frequency @var{beep_factor} times
  3946. the carrier frequency. Default is 0, meaning the beep is disabled.
  3947. @item sample_rate, r
  3948. Specify the sample rate, default is 44100.
  3949. @item duration, d
  3950. Specify the duration of the generated audio stream.
  3951. @item samples_per_frame
  3952. Set the number of samples per output frame.
  3953. The expression can contain the following constants:
  3954. @table @option
  3955. @item n
  3956. The (sequential) number of the output audio frame, starting from 0.
  3957. @item pts
  3958. The PTS (Presentation TimeStamp) of the output audio frame,
  3959. expressed in @var{TB} units.
  3960. @item t
  3961. The PTS of the output audio frame, expressed in seconds.
  3962. @item TB
  3963. The timebase of the output audio frames.
  3964. @end table
  3965. Default is @code{1024}.
  3966. @end table
  3967. @subsection Examples
  3968. @itemize
  3969. @item
  3970. Generate a simple 440 Hz sine wave:
  3971. @example
  3972. sine
  3973. @end example
  3974. @item
  3975. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3976. @example
  3977. sine=220:4:d=5
  3978. sine=f=220:b=4:d=5
  3979. sine=frequency=220:beep_factor=4:duration=5
  3980. @end example
  3981. @item
  3982. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3983. pattern:
  3984. @example
  3985. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3986. @end example
  3987. @end itemize
  3988. @c man end AUDIO SOURCES
  3989. @chapter Audio Sinks
  3990. @c man begin AUDIO SINKS
  3991. Below is a description of the currently available audio sinks.
  3992. @section abuffersink
  3993. Buffer audio frames, and make them available to the end of filter chain.
  3994. This sink is mainly intended for programmatic use, in particular
  3995. through the interface defined in @file{libavfilter/buffersink.h}
  3996. or the options system.
  3997. It accepts a pointer to an AVABufferSinkContext structure, which
  3998. defines the incoming buffers' formats, to be passed as the opaque
  3999. parameter to @code{avfilter_init_filter} for initialization.
  4000. @section anullsink
  4001. Null audio sink; do absolutely nothing with the input audio. It is
  4002. mainly useful as a template and for use in analysis / debugging
  4003. tools.
  4004. @c man end AUDIO SINKS
  4005. @chapter Video Filters
  4006. @c man begin VIDEO FILTERS
  4007. When you configure your FFmpeg build, you can disable any of the
  4008. existing filters using @code{--disable-filters}.
  4009. The configure output will show the video filters included in your
  4010. build.
  4011. Below is a description of the currently available video filters.
  4012. @section alphaextract
  4013. Extract the alpha component from the input as a grayscale video. This
  4014. is especially useful with the @var{alphamerge} filter.
  4015. @section alphamerge
  4016. Add or replace the alpha component of the primary input with the
  4017. grayscale value of a second input. This is intended for use with
  4018. @var{alphaextract} to allow the transmission or storage of frame
  4019. sequences that have alpha in a format that doesn't support an alpha
  4020. channel.
  4021. For example, to reconstruct full frames from a normal YUV-encoded video
  4022. and a separate video created with @var{alphaextract}, you might use:
  4023. @example
  4024. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4025. @end example
  4026. Since this filter is designed for reconstruction, it operates on frame
  4027. sequences without considering timestamps, and terminates when either
  4028. input reaches end of stream. This will cause problems if your encoding
  4029. pipeline drops frames. If you're trying to apply an image as an
  4030. overlay to a video stream, consider the @var{overlay} filter instead.
  4031. @section ass
  4032. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4033. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4034. Substation Alpha) subtitles files.
  4035. This filter accepts the following option in addition to the common options from
  4036. the @ref{subtitles} filter:
  4037. @table @option
  4038. @item shaping
  4039. Set the shaping engine
  4040. Available values are:
  4041. @table @samp
  4042. @item auto
  4043. The default libass shaping engine, which is the best available.
  4044. @item simple
  4045. Fast, font-agnostic shaper that can do only substitutions
  4046. @item complex
  4047. Slower shaper using OpenType for substitutions and positioning
  4048. @end table
  4049. The default is @code{auto}.
  4050. @end table
  4051. @section atadenoise
  4052. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4053. The filter accepts the following options:
  4054. @table @option
  4055. @item 0a
  4056. Set threshold A for 1st plane. Default is 0.02.
  4057. Valid range is 0 to 0.3.
  4058. @item 0b
  4059. Set threshold B for 1st plane. Default is 0.04.
  4060. Valid range is 0 to 5.
  4061. @item 1a
  4062. Set threshold A for 2nd plane. Default is 0.02.
  4063. Valid range is 0 to 0.3.
  4064. @item 1b
  4065. Set threshold B for 2nd plane. Default is 0.04.
  4066. Valid range is 0 to 5.
  4067. @item 2a
  4068. Set threshold A for 3rd plane. Default is 0.02.
  4069. Valid range is 0 to 0.3.
  4070. @item 2b
  4071. Set threshold B for 3rd plane. Default is 0.04.
  4072. Valid range is 0 to 5.
  4073. Threshold A is designed to react on abrupt changes in the input signal and
  4074. threshold B is designed to react on continuous changes in the input signal.
  4075. @item s
  4076. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4077. number in range [5, 129].
  4078. @item p
  4079. Set what planes of frame filter will use for averaging. Default is all.
  4080. @end table
  4081. @section avgblur
  4082. Apply average blur filter.
  4083. The filter accepts the following options:
  4084. @table @option
  4085. @item sizeX
  4086. Set horizontal kernel size.
  4087. @item planes
  4088. Set which planes to filter. By default all planes are filtered.
  4089. @item sizeY
  4090. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4091. Default is @code{0}.
  4092. @end table
  4093. @section bbox
  4094. Compute the bounding box for the non-black pixels in the input frame
  4095. luminance plane.
  4096. This filter computes the bounding box containing all the pixels with a
  4097. luminance value greater than the minimum allowed value.
  4098. The parameters describing the bounding box are printed on the filter
  4099. log.
  4100. The filter accepts the following option:
  4101. @table @option
  4102. @item min_val
  4103. Set the minimal luminance value. Default is @code{16}.
  4104. @end table
  4105. @section bitplanenoise
  4106. Show and measure bit plane noise.
  4107. The filter accepts the following options:
  4108. @table @option
  4109. @item bitplane
  4110. Set which plane to analyze. Default is @code{1}.
  4111. @item filter
  4112. Filter out noisy pixels from @code{bitplane} set above.
  4113. Default is disabled.
  4114. @end table
  4115. @section blackdetect
  4116. Detect video intervals that are (almost) completely black. Can be
  4117. useful to detect chapter transitions, commercials, or invalid
  4118. recordings. Output lines contains the time for the start, end and
  4119. duration of the detected black interval expressed in seconds.
  4120. In order to display the output lines, you need to set the loglevel at
  4121. least to the AV_LOG_INFO value.
  4122. The filter accepts the following options:
  4123. @table @option
  4124. @item black_min_duration, d
  4125. Set the minimum detected black duration expressed in seconds. It must
  4126. be a non-negative floating point number.
  4127. Default value is 2.0.
  4128. @item picture_black_ratio_th, pic_th
  4129. Set the threshold for considering a picture "black".
  4130. Express the minimum value for the ratio:
  4131. @example
  4132. @var{nb_black_pixels} / @var{nb_pixels}
  4133. @end example
  4134. for which a picture is considered black.
  4135. Default value is 0.98.
  4136. @item pixel_black_th, pix_th
  4137. Set the threshold for considering a pixel "black".
  4138. The threshold expresses the maximum pixel luminance value for which a
  4139. pixel is considered "black". The provided value is scaled according to
  4140. the following equation:
  4141. @example
  4142. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4143. @end example
  4144. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4145. the input video format, the range is [0-255] for YUV full-range
  4146. formats and [16-235] for YUV non full-range formats.
  4147. Default value is 0.10.
  4148. @end table
  4149. The following example sets the maximum pixel threshold to the minimum
  4150. value, and detects only black intervals of 2 or more seconds:
  4151. @example
  4152. blackdetect=d=2:pix_th=0.00
  4153. @end example
  4154. @section blackframe
  4155. Detect frames that are (almost) completely black. Can be useful to
  4156. detect chapter transitions or commercials. Output lines consist of
  4157. the frame number of the detected frame, the percentage of blackness,
  4158. the position in the file if known or -1 and the timestamp in seconds.
  4159. In order to display the output lines, you need to set the loglevel at
  4160. least to the AV_LOG_INFO value.
  4161. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4162. The value represents the percentage of pixels in the picture that
  4163. are below the threshold value.
  4164. It accepts the following parameters:
  4165. @table @option
  4166. @item amount
  4167. The percentage of the pixels that have to be below the threshold; it defaults to
  4168. @code{98}.
  4169. @item threshold, thresh
  4170. The threshold below which a pixel value is considered black; it defaults to
  4171. @code{32}.
  4172. @end table
  4173. @section blend, tblend
  4174. Blend two video frames into each other.
  4175. The @code{blend} filter takes two input streams and outputs one
  4176. stream, the first input is the "top" layer and second input is
  4177. "bottom" layer. By default, the output terminates when the longest input terminates.
  4178. The @code{tblend} (time blend) filter takes two consecutive frames
  4179. from one single stream, and outputs the result obtained by blending
  4180. the new frame on top of the old frame.
  4181. A description of the accepted options follows.
  4182. @table @option
  4183. @item c0_mode
  4184. @item c1_mode
  4185. @item c2_mode
  4186. @item c3_mode
  4187. @item all_mode
  4188. Set blend mode for specific pixel component or all pixel components in case
  4189. of @var{all_mode}. Default value is @code{normal}.
  4190. Available values for component modes are:
  4191. @table @samp
  4192. @item addition
  4193. @item grainmerge
  4194. @item and
  4195. @item average
  4196. @item burn
  4197. @item darken
  4198. @item difference
  4199. @item grainextract
  4200. @item divide
  4201. @item dodge
  4202. @item freeze
  4203. @item exclusion
  4204. @item extremity
  4205. @item glow
  4206. @item hardlight
  4207. @item hardmix
  4208. @item heat
  4209. @item lighten
  4210. @item linearlight
  4211. @item multiply
  4212. @item multiply128
  4213. @item negation
  4214. @item normal
  4215. @item or
  4216. @item overlay
  4217. @item phoenix
  4218. @item pinlight
  4219. @item reflect
  4220. @item screen
  4221. @item softlight
  4222. @item subtract
  4223. @item vividlight
  4224. @item xor
  4225. @end table
  4226. @item c0_opacity
  4227. @item c1_opacity
  4228. @item c2_opacity
  4229. @item c3_opacity
  4230. @item all_opacity
  4231. Set blend opacity for specific pixel component or all pixel components in case
  4232. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4233. @item c0_expr
  4234. @item c1_expr
  4235. @item c2_expr
  4236. @item c3_expr
  4237. @item all_expr
  4238. Set blend expression for specific pixel component or all pixel components in case
  4239. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4240. The expressions can use the following variables:
  4241. @table @option
  4242. @item N
  4243. The sequential number of the filtered frame, starting from @code{0}.
  4244. @item X
  4245. @item Y
  4246. the coordinates of the current sample
  4247. @item W
  4248. @item H
  4249. the width and height of currently filtered plane
  4250. @item SW
  4251. @item SH
  4252. Width and height scale depending on the currently filtered plane. It is the
  4253. ratio between the corresponding luma plane number of pixels and the current
  4254. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4255. @code{0.5,0.5} for chroma planes.
  4256. @item T
  4257. Time of the current frame, expressed in seconds.
  4258. @item TOP, A
  4259. Value of pixel component at current location for first video frame (top layer).
  4260. @item BOTTOM, B
  4261. Value of pixel component at current location for second video frame (bottom layer).
  4262. @end table
  4263. @end table
  4264. The @code{blend} filter also supports the @ref{framesync} options.
  4265. @subsection Examples
  4266. @itemize
  4267. @item
  4268. Apply transition from bottom layer to top layer in first 10 seconds:
  4269. @example
  4270. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4271. @end example
  4272. @item
  4273. Apply linear horizontal transition from top layer to bottom layer:
  4274. @example
  4275. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4276. @end example
  4277. @item
  4278. Apply 1x1 checkerboard effect:
  4279. @example
  4280. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4281. @end example
  4282. @item
  4283. Apply uncover left effect:
  4284. @example
  4285. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4286. @end example
  4287. @item
  4288. Apply uncover down effect:
  4289. @example
  4290. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4291. @end example
  4292. @item
  4293. Apply uncover up-left effect:
  4294. @example
  4295. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4296. @end example
  4297. @item
  4298. Split diagonally video and shows top and bottom layer on each side:
  4299. @example
  4300. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4301. @end example
  4302. @item
  4303. Display differences between the current and the previous frame:
  4304. @example
  4305. tblend=all_mode=grainextract
  4306. @end example
  4307. @end itemize
  4308. @section boxblur
  4309. Apply a boxblur algorithm to the input video.
  4310. It accepts the following parameters:
  4311. @table @option
  4312. @item luma_radius, lr
  4313. @item luma_power, lp
  4314. @item chroma_radius, cr
  4315. @item chroma_power, cp
  4316. @item alpha_radius, ar
  4317. @item alpha_power, ap
  4318. @end table
  4319. A description of the accepted options follows.
  4320. @table @option
  4321. @item luma_radius, lr
  4322. @item chroma_radius, cr
  4323. @item alpha_radius, ar
  4324. Set an expression for the box radius in pixels used for blurring the
  4325. corresponding input plane.
  4326. The radius value must be a non-negative number, and must not be
  4327. greater than the value of the expression @code{min(w,h)/2} for the
  4328. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4329. planes.
  4330. Default value for @option{luma_radius} is "2". If not specified,
  4331. @option{chroma_radius} and @option{alpha_radius} default to the
  4332. corresponding value set for @option{luma_radius}.
  4333. The expressions can contain the following constants:
  4334. @table @option
  4335. @item w
  4336. @item h
  4337. The input width and height in pixels.
  4338. @item cw
  4339. @item ch
  4340. The input chroma image width and height in pixels.
  4341. @item hsub
  4342. @item vsub
  4343. The horizontal and vertical chroma subsample values. For example, for the
  4344. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4345. @end table
  4346. @item luma_power, lp
  4347. @item chroma_power, cp
  4348. @item alpha_power, ap
  4349. Specify how many times the boxblur filter is applied to the
  4350. corresponding plane.
  4351. Default value for @option{luma_power} is 2. If not specified,
  4352. @option{chroma_power} and @option{alpha_power} default to the
  4353. corresponding value set for @option{luma_power}.
  4354. A value of 0 will disable the effect.
  4355. @end table
  4356. @subsection Examples
  4357. @itemize
  4358. @item
  4359. Apply a boxblur filter with the luma, chroma, and alpha radii
  4360. set to 2:
  4361. @example
  4362. boxblur=luma_radius=2:luma_power=1
  4363. boxblur=2:1
  4364. @end example
  4365. @item
  4366. Set the luma radius to 2, and alpha and chroma radius to 0:
  4367. @example
  4368. boxblur=2:1:cr=0:ar=0
  4369. @end example
  4370. @item
  4371. Set the luma and chroma radii to a fraction of the video dimension:
  4372. @example
  4373. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4374. @end example
  4375. @end itemize
  4376. @section bwdif
  4377. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4378. Deinterlacing Filter").
  4379. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4380. interpolation algorithms.
  4381. It accepts the following parameters:
  4382. @table @option
  4383. @item mode
  4384. The interlacing mode to adopt. It accepts one of the following values:
  4385. @table @option
  4386. @item 0, send_frame
  4387. Output one frame for each frame.
  4388. @item 1, send_field
  4389. Output one frame for each field.
  4390. @end table
  4391. The default value is @code{send_field}.
  4392. @item parity
  4393. The picture field parity assumed for the input interlaced video. It accepts one
  4394. of the following values:
  4395. @table @option
  4396. @item 0, tff
  4397. Assume the top field is first.
  4398. @item 1, bff
  4399. Assume the bottom field is first.
  4400. @item -1, auto
  4401. Enable automatic detection of field parity.
  4402. @end table
  4403. The default value is @code{auto}.
  4404. If the interlacing is unknown or the decoder does not export this information,
  4405. top field first will be assumed.
  4406. @item deint
  4407. Specify which frames to deinterlace. Accept one of the following
  4408. values:
  4409. @table @option
  4410. @item 0, all
  4411. Deinterlace all frames.
  4412. @item 1, interlaced
  4413. Only deinterlace frames marked as interlaced.
  4414. @end table
  4415. The default value is @code{all}.
  4416. @end table
  4417. @section chromakey
  4418. YUV colorspace color/chroma keying.
  4419. The filter accepts the following options:
  4420. @table @option
  4421. @item color
  4422. The color which will be replaced with transparency.
  4423. @item similarity
  4424. Similarity percentage with the key color.
  4425. 0.01 matches only the exact key color, while 1.0 matches everything.
  4426. @item blend
  4427. Blend percentage.
  4428. 0.0 makes pixels either fully transparent, or not transparent at all.
  4429. Higher values result in semi-transparent pixels, with a higher transparency
  4430. the more similar the pixels color is to the key color.
  4431. @item yuv
  4432. Signals that the color passed is already in YUV instead of RGB.
  4433. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4434. This can be used to pass exact YUV values as hexadecimal numbers.
  4435. @end table
  4436. @subsection Examples
  4437. @itemize
  4438. @item
  4439. Make every green pixel in the input image transparent:
  4440. @example
  4441. ffmpeg -i input.png -vf chromakey=green out.png
  4442. @end example
  4443. @item
  4444. Overlay a greenscreen-video on top of a static black background.
  4445. @example
  4446. 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
  4447. @end example
  4448. @end itemize
  4449. @section ciescope
  4450. Display CIE color diagram with pixels overlaid onto it.
  4451. The filter accepts the following options:
  4452. @table @option
  4453. @item system
  4454. Set color system.
  4455. @table @samp
  4456. @item ntsc, 470m
  4457. @item ebu, 470bg
  4458. @item smpte
  4459. @item 240m
  4460. @item apple
  4461. @item widergb
  4462. @item cie1931
  4463. @item rec709, hdtv
  4464. @item uhdtv, rec2020
  4465. @end table
  4466. @item cie
  4467. Set CIE system.
  4468. @table @samp
  4469. @item xyy
  4470. @item ucs
  4471. @item luv
  4472. @end table
  4473. @item gamuts
  4474. Set what gamuts to draw.
  4475. See @code{system} option for available values.
  4476. @item size, s
  4477. Set ciescope size, by default set to 512.
  4478. @item intensity, i
  4479. Set intensity used to map input pixel values to CIE diagram.
  4480. @item contrast
  4481. Set contrast used to draw tongue colors that are out of active color system gamut.
  4482. @item corrgamma
  4483. Correct gamma displayed on scope, by default enabled.
  4484. @item showwhite
  4485. Show white point on CIE diagram, by default disabled.
  4486. @item gamma
  4487. Set input gamma. Used only with XYZ input color space.
  4488. @end table
  4489. @section codecview
  4490. Visualize information exported by some codecs.
  4491. Some codecs can export information through frames using side-data or other
  4492. means. For example, some MPEG based codecs export motion vectors through the
  4493. @var{export_mvs} flag in the codec @option{flags2} option.
  4494. The filter accepts the following option:
  4495. @table @option
  4496. @item mv
  4497. Set motion vectors to visualize.
  4498. Available flags for @var{mv} are:
  4499. @table @samp
  4500. @item pf
  4501. forward predicted MVs of P-frames
  4502. @item bf
  4503. forward predicted MVs of B-frames
  4504. @item bb
  4505. backward predicted MVs of B-frames
  4506. @end table
  4507. @item qp
  4508. Display quantization parameters using the chroma planes.
  4509. @item mv_type, mvt
  4510. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4511. Available flags for @var{mv_type} are:
  4512. @table @samp
  4513. @item fp
  4514. forward predicted MVs
  4515. @item bp
  4516. backward predicted MVs
  4517. @end table
  4518. @item frame_type, ft
  4519. Set frame type to visualize motion vectors of.
  4520. Available flags for @var{frame_type} are:
  4521. @table @samp
  4522. @item if
  4523. intra-coded frames (I-frames)
  4524. @item pf
  4525. predicted frames (P-frames)
  4526. @item bf
  4527. bi-directionally predicted frames (B-frames)
  4528. @end table
  4529. @end table
  4530. @subsection Examples
  4531. @itemize
  4532. @item
  4533. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4534. @example
  4535. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4536. @end example
  4537. @item
  4538. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4539. @example
  4540. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4541. @end example
  4542. @end itemize
  4543. @section colorbalance
  4544. Modify intensity of primary colors (red, green and blue) of input frames.
  4545. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4546. regions for the red-cyan, green-magenta or blue-yellow balance.
  4547. A positive adjustment value shifts the balance towards the primary color, a negative
  4548. value towards the complementary color.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item rs
  4552. @item gs
  4553. @item bs
  4554. Adjust red, green and blue shadows (darkest pixels).
  4555. @item rm
  4556. @item gm
  4557. @item bm
  4558. Adjust red, green and blue midtones (medium pixels).
  4559. @item rh
  4560. @item gh
  4561. @item bh
  4562. Adjust red, green and blue highlights (brightest pixels).
  4563. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4564. @end table
  4565. @subsection Examples
  4566. @itemize
  4567. @item
  4568. Add red color cast to shadows:
  4569. @example
  4570. colorbalance=rs=.3
  4571. @end example
  4572. @end itemize
  4573. @section colorkey
  4574. RGB colorspace color keying.
  4575. The filter accepts the following options:
  4576. @table @option
  4577. @item color
  4578. The color which will be replaced with transparency.
  4579. @item similarity
  4580. Similarity percentage with the key color.
  4581. 0.01 matches only the exact key color, while 1.0 matches everything.
  4582. @item blend
  4583. Blend percentage.
  4584. 0.0 makes pixels either fully transparent, or not transparent at all.
  4585. Higher values result in semi-transparent pixels, with a higher transparency
  4586. the more similar the pixels color is to the key color.
  4587. @end table
  4588. @subsection Examples
  4589. @itemize
  4590. @item
  4591. Make every green pixel in the input image transparent:
  4592. @example
  4593. ffmpeg -i input.png -vf colorkey=green out.png
  4594. @end example
  4595. @item
  4596. Overlay a greenscreen-video on top of a static background image.
  4597. @example
  4598. 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
  4599. @end example
  4600. @end itemize
  4601. @section colorlevels
  4602. Adjust video input frames using levels.
  4603. The filter accepts the following options:
  4604. @table @option
  4605. @item rimin
  4606. @item gimin
  4607. @item bimin
  4608. @item aimin
  4609. Adjust red, green, blue and alpha input black point.
  4610. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4611. @item rimax
  4612. @item gimax
  4613. @item bimax
  4614. @item aimax
  4615. Adjust red, green, blue and alpha input white point.
  4616. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4617. Input levels are used to lighten highlights (bright tones), darken shadows
  4618. (dark tones), change the balance of bright and dark tones.
  4619. @item romin
  4620. @item gomin
  4621. @item bomin
  4622. @item aomin
  4623. Adjust red, green, blue and alpha output black point.
  4624. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4625. @item romax
  4626. @item gomax
  4627. @item bomax
  4628. @item aomax
  4629. Adjust red, green, blue and alpha output white point.
  4630. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4631. Output levels allows manual selection of a constrained output level range.
  4632. @end table
  4633. @subsection Examples
  4634. @itemize
  4635. @item
  4636. Make video output darker:
  4637. @example
  4638. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4639. @end example
  4640. @item
  4641. Increase contrast:
  4642. @example
  4643. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4644. @end example
  4645. @item
  4646. Make video output lighter:
  4647. @example
  4648. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4649. @end example
  4650. @item
  4651. Increase brightness:
  4652. @example
  4653. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4654. @end example
  4655. @end itemize
  4656. @section colorchannelmixer
  4657. Adjust video input frames by re-mixing color channels.
  4658. This filter modifies a color channel by adding the values associated to
  4659. the other channels of the same pixels. For example if the value to
  4660. modify is red, the output value will be:
  4661. @example
  4662. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4663. @end example
  4664. The filter accepts the following options:
  4665. @table @option
  4666. @item rr
  4667. @item rg
  4668. @item rb
  4669. @item ra
  4670. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4671. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4672. @item gr
  4673. @item gg
  4674. @item gb
  4675. @item ga
  4676. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4677. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4678. @item br
  4679. @item bg
  4680. @item bb
  4681. @item ba
  4682. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4683. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4684. @item ar
  4685. @item ag
  4686. @item ab
  4687. @item aa
  4688. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4689. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4690. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4691. @end table
  4692. @subsection Examples
  4693. @itemize
  4694. @item
  4695. Convert source to grayscale:
  4696. @example
  4697. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4698. @end example
  4699. @item
  4700. Simulate sepia tones:
  4701. @example
  4702. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4703. @end example
  4704. @end itemize
  4705. @section colormatrix
  4706. Convert color matrix.
  4707. The filter accepts the following options:
  4708. @table @option
  4709. @item src
  4710. @item dst
  4711. Specify the source and destination color matrix. Both values must be
  4712. specified.
  4713. The accepted values are:
  4714. @table @samp
  4715. @item bt709
  4716. BT.709
  4717. @item fcc
  4718. FCC
  4719. @item bt601
  4720. BT.601
  4721. @item bt470
  4722. BT.470
  4723. @item bt470bg
  4724. BT.470BG
  4725. @item smpte170m
  4726. SMPTE-170M
  4727. @item smpte240m
  4728. SMPTE-240M
  4729. @item bt2020
  4730. BT.2020
  4731. @end table
  4732. @end table
  4733. For example to convert from BT.601 to SMPTE-240M, use the command:
  4734. @example
  4735. colormatrix=bt601:smpte240m
  4736. @end example
  4737. @section colorspace
  4738. Convert colorspace, transfer characteristics or color primaries.
  4739. Input video needs to have an even size.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @anchor{all}
  4743. @item all
  4744. Specify all color properties at once.
  4745. The accepted values are:
  4746. @table @samp
  4747. @item bt470m
  4748. BT.470M
  4749. @item bt470bg
  4750. BT.470BG
  4751. @item bt601-6-525
  4752. BT.601-6 525
  4753. @item bt601-6-625
  4754. BT.601-6 625
  4755. @item bt709
  4756. BT.709
  4757. @item smpte170m
  4758. SMPTE-170M
  4759. @item smpte240m
  4760. SMPTE-240M
  4761. @item bt2020
  4762. BT.2020
  4763. @end table
  4764. @anchor{space}
  4765. @item space
  4766. Specify output colorspace.
  4767. The accepted values are:
  4768. @table @samp
  4769. @item bt709
  4770. BT.709
  4771. @item fcc
  4772. FCC
  4773. @item bt470bg
  4774. BT.470BG or BT.601-6 625
  4775. @item smpte170m
  4776. SMPTE-170M or BT.601-6 525
  4777. @item smpte240m
  4778. SMPTE-240M
  4779. @item ycgco
  4780. YCgCo
  4781. @item bt2020ncl
  4782. BT.2020 with non-constant luminance
  4783. @end table
  4784. @anchor{trc}
  4785. @item trc
  4786. Specify output transfer characteristics.
  4787. The accepted values are:
  4788. @table @samp
  4789. @item bt709
  4790. BT.709
  4791. @item bt470m
  4792. BT.470M
  4793. @item bt470bg
  4794. BT.470BG
  4795. @item gamma22
  4796. Constant gamma of 2.2
  4797. @item gamma28
  4798. Constant gamma of 2.8
  4799. @item smpte170m
  4800. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4801. @item smpte240m
  4802. SMPTE-240M
  4803. @item srgb
  4804. SRGB
  4805. @item iec61966-2-1
  4806. iec61966-2-1
  4807. @item iec61966-2-4
  4808. iec61966-2-4
  4809. @item xvycc
  4810. xvycc
  4811. @item bt2020-10
  4812. BT.2020 for 10-bits content
  4813. @item bt2020-12
  4814. BT.2020 for 12-bits content
  4815. @end table
  4816. @anchor{primaries}
  4817. @item primaries
  4818. Specify output color primaries.
  4819. The accepted values are:
  4820. @table @samp
  4821. @item bt709
  4822. BT.709
  4823. @item bt470m
  4824. BT.470M
  4825. @item bt470bg
  4826. BT.470BG or BT.601-6 625
  4827. @item smpte170m
  4828. SMPTE-170M or BT.601-6 525
  4829. @item smpte240m
  4830. SMPTE-240M
  4831. @item film
  4832. film
  4833. @item smpte431
  4834. SMPTE-431
  4835. @item smpte432
  4836. SMPTE-432
  4837. @item bt2020
  4838. BT.2020
  4839. @item jedec-p22
  4840. JEDEC P22 phosphors
  4841. @end table
  4842. @anchor{range}
  4843. @item range
  4844. Specify output color range.
  4845. The accepted values are:
  4846. @table @samp
  4847. @item tv
  4848. TV (restricted) range
  4849. @item mpeg
  4850. MPEG (restricted) range
  4851. @item pc
  4852. PC (full) range
  4853. @item jpeg
  4854. JPEG (full) range
  4855. @end table
  4856. @item format
  4857. Specify output color format.
  4858. The accepted values are:
  4859. @table @samp
  4860. @item yuv420p
  4861. YUV 4:2:0 planar 8-bits
  4862. @item yuv420p10
  4863. YUV 4:2:0 planar 10-bits
  4864. @item yuv420p12
  4865. YUV 4:2:0 planar 12-bits
  4866. @item yuv422p
  4867. YUV 4:2:2 planar 8-bits
  4868. @item yuv422p10
  4869. YUV 4:2:2 planar 10-bits
  4870. @item yuv422p12
  4871. YUV 4:2:2 planar 12-bits
  4872. @item yuv444p
  4873. YUV 4:4:4 planar 8-bits
  4874. @item yuv444p10
  4875. YUV 4:4:4 planar 10-bits
  4876. @item yuv444p12
  4877. YUV 4:4:4 planar 12-bits
  4878. @end table
  4879. @item fast
  4880. Do a fast conversion, which skips gamma/primary correction. This will take
  4881. significantly less CPU, but will be mathematically incorrect. To get output
  4882. compatible with that produced by the colormatrix filter, use fast=1.
  4883. @item dither
  4884. Specify dithering mode.
  4885. The accepted values are:
  4886. @table @samp
  4887. @item none
  4888. No dithering
  4889. @item fsb
  4890. Floyd-Steinberg dithering
  4891. @end table
  4892. @item wpadapt
  4893. Whitepoint adaptation mode.
  4894. The accepted values are:
  4895. @table @samp
  4896. @item bradford
  4897. Bradford whitepoint adaptation
  4898. @item vonkries
  4899. von Kries whitepoint adaptation
  4900. @item identity
  4901. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4902. @end table
  4903. @item iall
  4904. Override all input properties at once. Same accepted values as @ref{all}.
  4905. @item ispace
  4906. Override input colorspace. Same accepted values as @ref{space}.
  4907. @item iprimaries
  4908. Override input color primaries. Same accepted values as @ref{primaries}.
  4909. @item itrc
  4910. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4911. @item irange
  4912. Override input color range. Same accepted values as @ref{range}.
  4913. @end table
  4914. The filter converts the transfer characteristics, color space and color
  4915. primaries to the specified user values. The output value, if not specified,
  4916. is set to a default value based on the "all" property. If that property is
  4917. also not specified, the filter will log an error. The output color range and
  4918. format default to the same value as the input color range and format. The
  4919. input transfer characteristics, color space, color primaries and color range
  4920. should be set on the input data. If any of these are missing, the filter will
  4921. log an error and no conversion will take place.
  4922. For example to convert the input to SMPTE-240M, use the command:
  4923. @example
  4924. colorspace=smpte240m
  4925. @end example
  4926. @section convolution
  4927. Apply convolution 3x3, 5x5 or 7x7 filter.
  4928. The filter accepts the following options:
  4929. @table @option
  4930. @item 0m
  4931. @item 1m
  4932. @item 2m
  4933. @item 3m
  4934. Set matrix for each plane.
  4935. Matrix is sequence of 9, 25 or 49 signed integers.
  4936. @item 0rdiv
  4937. @item 1rdiv
  4938. @item 2rdiv
  4939. @item 3rdiv
  4940. Set multiplier for calculated value for each plane.
  4941. @item 0bias
  4942. @item 1bias
  4943. @item 2bias
  4944. @item 3bias
  4945. Set bias for each plane. This value is added to the result of the multiplication.
  4946. Useful for making the overall image brighter or darker. Default is 0.0.
  4947. @end table
  4948. @subsection Examples
  4949. @itemize
  4950. @item
  4951. Apply sharpen:
  4952. @example
  4953. 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"
  4954. @end example
  4955. @item
  4956. Apply blur:
  4957. @example
  4958. 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"
  4959. @end example
  4960. @item
  4961. Apply edge enhance:
  4962. @example
  4963. 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"
  4964. @end example
  4965. @item
  4966. Apply edge detect:
  4967. @example
  4968. 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"
  4969. @end example
  4970. @item
  4971. Apply laplacian edge detector which includes diagonals:
  4972. @example
  4973. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4974. @end example
  4975. @item
  4976. Apply emboss:
  4977. @example
  4978. 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"
  4979. @end example
  4980. @end itemize
  4981. @section convolve
  4982. Apply 2D convolution of video stream in frequency domain using second stream
  4983. as impulse.
  4984. The filter accepts the following options:
  4985. @table @option
  4986. @item planes
  4987. Set which planes to process.
  4988. @item impulse
  4989. Set which impulse video frames will be processed, can be @var{first}
  4990. or @var{all}. Default is @var{all}.
  4991. @end table
  4992. The @code{convolve} filter also supports the @ref{framesync} options.
  4993. @section copy
  4994. Copy the input video source unchanged to the output. This is mainly useful for
  4995. testing purposes.
  4996. @anchor{coreimage}
  4997. @section coreimage
  4998. Video filtering on GPU using Apple's CoreImage API on OSX.
  4999. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5000. processed by video hardware. However, software-based OpenGL implementations
  5001. exist which means there is no guarantee for hardware processing. It depends on
  5002. the respective OSX.
  5003. There are many filters and image generators provided by Apple that come with a
  5004. large variety of options. The filter has to be referenced by its name along
  5005. with its options.
  5006. The coreimage filter accepts the following options:
  5007. @table @option
  5008. @item list_filters
  5009. List all available filters and generators along with all their respective
  5010. options as well as possible minimum and maximum values along with the default
  5011. values.
  5012. @example
  5013. list_filters=true
  5014. @end example
  5015. @item filter
  5016. Specify all filters by their respective name and options.
  5017. Use @var{list_filters} to determine all valid filter names and options.
  5018. Numerical options are specified by a float value and are automatically clamped
  5019. to their respective value range. Vector and color options have to be specified
  5020. by a list of space separated float values. Character escaping has to be done.
  5021. A special option name @code{default} is available to use default options for a
  5022. filter.
  5023. It is required to specify either @code{default} or at least one of the filter options.
  5024. All omitted options are used with their default values.
  5025. The syntax of the filter string is as follows:
  5026. @example
  5027. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5028. @end example
  5029. @item output_rect
  5030. Specify a rectangle where the output of the filter chain is copied into the
  5031. input image. It is given by a list of space separated float values:
  5032. @example
  5033. output_rect=x\ y\ width\ height
  5034. @end example
  5035. If not given, the output rectangle equals the dimensions of the input image.
  5036. The output rectangle is automatically cropped at the borders of the input
  5037. image. Negative values are valid for each component.
  5038. @example
  5039. output_rect=25\ 25\ 100\ 100
  5040. @end example
  5041. @end table
  5042. Several filters can be chained for successive processing without GPU-HOST
  5043. transfers allowing for fast processing of complex filter chains.
  5044. Currently, only filters with zero (generators) or exactly one (filters) input
  5045. image and one output image are supported. Also, transition filters are not yet
  5046. usable as intended.
  5047. Some filters generate output images with additional padding depending on the
  5048. respective filter kernel. The padding is automatically removed to ensure the
  5049. filter output has the same size as the input image.
  5050. For image generators, the size of the output image is determined by the
  5051. previous output image of the filter chain or the input image of the whole
  5052. filterchain, respectively. The generators do not use the pixel information of
  5053. this image to generate their output. However, the generated output is
  5054. blended onto this image, resulting in partial or complete coverage of the
  5055. output image.
  5056. The @ref{coreimagesrc} video source can be used for generating input images
  5057. which are directly fed into the filter chain. By using it, providing input
  5058. images by another video source or an input video is not required.
  5059. @subsection Examples
  5060. @itemize
  5061. @item
  5062. List all filters available:
  5063. @example
  5064. coreimage=list_filters=true
  5065. @end example
  5066. @item
  5067. Use the CIBoxBlur filter with default options to blur an image:
  5068. @example
  5069. coreimage=filter=CIBoxBlur@@default
  5070. @end example
  5071. @item
  5072. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5073. its center at 100x100 and a radius of 50 pixels:
  5074. @example
  5075. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5076. @end example
  5077. @item
  5078. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5079. given as complete and escaped command-line for Apple's standard bash shell:
  5080. @example
  5081. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5082. @end example
  5083. @end itemize
  5084. @section crop
  5085. Crop the input video to given dimensions.
  5086. It accepts the following parameters:
  5087. @table @option
  5088. @item w, out_w
  5089. The width of the output video. It defaults to @code{iw}.
  5090. This expression is evaluated only once during the filter
  5091. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5092. @item h, out_h
  5093. The height of the output video. It defaults to @code{ih}.
  5094. This expression is evaluated only once during the filter
  5095. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5096. @item x
  5097. The horizontal position, in the input video, of the left edge of the output
  5098. video. It defaults to @code{(in_w-out_w)/2}.
  5099. This expression is evaluated per-frame.
  5100. @item y
  5101. The vertical position, in the input video, of the top edge of the output video.
  5102. It defaults to @code{(in_h-out_h)/2}.
  5103. This expression is evaluated per-frame.
  5104. @item keep_aspect
  5105. If set to 1 will force the output display aspect ratio
  5106. to be the same of the input, by changing the output sample aspect
  5107. ratio. It defaults to 0.
  5108. @item exact
  5109. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5110. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5111. It defaults to 0.
  5112. @end table
  5113. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5114. expressions containing the following constants:
  5115. @table @option
  5116. @item x
  5117. @item y
  5118. The computed values for @var{x} and @var{y}. They are evaluated for
  5119. each new frame.
  5120. @item in_w
  5121. @item in_h
  5122. The input width and height.
  5123. @item iw
  5124. @item ih
  5125. These are the same as @var{in_w} and @var{in_h}.
  5126. @item out_w
  5127. @item out_h
  5128. The output (cropped) width and height.
  5129. @item ow
  5130. @item oh
  5131. These are the same as @var{out_w} and @var{out_h}.
  5132. @item a
  5133. same as @var{iw} / @var{ih}
  5134. @item sar
  5135. input sample aspect ratio
  5136. @item dar
  5137. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5138. @item hsub
  5139. @item vsub
  5140. horizontal and vertical chroma subsample values. For example for the
  5141. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5142. @item n
  5143. The number of the input frame, starting from 0.
  5144. @item pos
  5145. the position in the file of the input frame, NAN if unknown
  5146. @item t
  5147. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5148. @end table
  5149. The expression for @var{out_w} may depend on the value of @var{out_h},
  5150. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5151. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5152. evaluated after @var{out_w} and @var{out_h}.
  5153. The @var{x} and @var{y} parameters specify the expressions for the
  5154. position of the top-left corner of the output (non-cropped) area. They
  5155. are evaluated for each frame. If the evaluated value is not valid, it
  5156. is approximated to the nearest valid value.
  5157. The expression for @var{x} may depend on @var{y}, and the expression
  5158. for @var{y} may depend on @var{x}.
  5159. @subsection Examples
  5160. @itemize
  5161. @item
  5162. Crop area with size 100x100 at position (12,34).
  5163. @example
  5164. crop=100:100:12:34
  5165. @end example
  5166. Using named options, the example above becomes:
  5167. @example
  5168. crop=w=100:h=100:x=12:y=34
  5169. @end example
  5170. @item
  5171. Crop the central input area with size 100x100:
  5172. @example
  5173. crop=100:100
  5174. @end example
  5175. @item
  5176. Crop the central input area with size 2/3 of the input video:
  5177. @example
  5178. crop=2/3*in_w:2/3*in_h
  5179. @end example
  5180. @item
  5181. Crop the input video central square:
  5182. @example
  5183. crop=out_w=in_h
  5184. crop=in_h
  5185. @end example
  5186. @item
  5187. Delimit the rectangle with the top-left corner placed at position
  5188. 100:100 and the right-bottom corner corresponding to the right-bottom
  5189. corner of the input image.
  5190. @example
  5191. crop=in_w-100:in_h-100:100:100
  5192. @end example
  5193. @item
  5194. Crop 10 pixels from the left and right borders, and 20 pixels from
  5195. the top and bottom borders
  5196. @example
  5197. crop=in_w-2*10:in_h-2*20
  5198. @end example
  5199. @item
  5200. Keep only the bottom right quarter of the input image:
  5201. @example
  5202. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5203. @end example
  5204. @item
  5205. Crop height for getting Greek harmony:
  5206. @example
  5207. crop=in_w:1/PHI*in_w
  5208. @end example
  5209. @item
  5210. Apply trembling effect:
  5211. @example
  5212. 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)
  5213. @end example
  5214. @item
  5215. Apply erratic camera effect depending on timestamp:
  5216. @example
  5217. 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)"
  5218. @end example
  5219. @item
  5220. Set x depending on the value of y:
  5221. @example
  5222. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5223. @end example
  5224. @end itemize
  5225. @subsection Commands
  5226. This filter supports the following commands:
  5227. @table @option
  5228. @item w, out_w
  5229. @item h, out_h
  5230. @item x
  5231. @item y
  5232. Set width/height of the output video and the horizontal/vertical position
  5233. in the input video.
  5234. The command accepts the same syntax of the corresponding option.
  5235. If the specified expression is not valid, it is kept at its current
  5236. value.
  5237. @end table
  5238. @section cropdetect
  5239. Auto-detect the crop size.
  5240. It calculates the necessary cropping parameters and prints the
  5241. recommended parameters via the logging system. The detected dimensions
  5242. correspond to the non-black area of the input video.
  5243. It accepts the following parameters:
  5244. @table @option
  5245. @item limit
  5246. Set higher black value threshold, which can be optionally specified
  5247. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5248. value greater to the set value is considered non-black. It defaults to 24.
  5249. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5250. on the bitdepth of the pixel format.
  5251. @item round
  5252. The value which the width/height should be divisible by. It defaults to
  5253. 16. The offset is automatically adjusted to center the video. Use 2 to
  5254. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5255. encoding to most video codecs.
  5256. @item reset_count, reset
  5257. Set the counter that determines after how many frames cropdetect will
  5258. reset the previously detected largest video area and start over to
  5259. detect the current optimal crop area. Default value is 0.
  5260. This can be useful when channel logos distort the video area. 0
  5261. indicates 'never reset', and returns the largest area encountered during
  5262. playback.
  5263. @end table
  5264. @anchor{curves}
  5265. @section curves
  5266. Apply color adjustments using curves.
  5267. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5268. component (red, green and blue) has its values defined by @var{N} key points
  5269. tied from each other using a smooth curve. The x-axis represents the pixel
  5270. values from the input frame, and the y-axis the new pixel values to be set for
  5271. the output frame.
  5272. By default, a component curve is defined by the two points @var{(0;0)} and
  5273. @var{(1;1)}. This creates a straight line where each original pixel value is
  5274. "adjusted" to its own value, which means no change to the image.
  5275. The filter allows you to redefine these two points and add some more. A new
  5276. curve (using a natural cubic spline interpolation) will be define to pass
  5277. smoothly through all these new coordinates. The new defined points needs to be
  5278. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5279. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5280. the vector spaces, the values will be clipped accordingly.
  5281. The filter accepts the following options:
  5282. @table @option
  5283. @item preset
  5284. Select one of the available color presets. This option can be used in addition
  5285. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5286. options takes priority on the preset values.
  5287. Available presets are:
  5288. @table @samp
  5289. @item none
  5290. @item color_negative
  5291. @item cross_process
  5292. @item darker
  5293. @item increase_contrast
  5294. @item lighter
  5295. @item linear_contrast
  5296. @item medium_contrast
  5297. @item negative
  5298. @item strong_contrast
  5299. @item vintage
  5300. @end table
  5301. Default is @code{none}.
  5302. @item master, m
  5303. Set the master key points. These points will define a second pass mapping. It
  5304. is sometimes called a "luminance" or "value" mapping. It can be used with
  5305. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5306. post-processing LUT.
  5307. @item red, r
  5308. Set the key points for the red component.
  5309. @item green, g
  5310. Set the key points for the green component.
  5311. @item blue, b
  5312. Set the key points for the blue component.
  5313. @item all
  5314. Set the key points for all components (not including master).
  5315. Can be used in addition to the other key points component
  5316. options. In this case, the unset component(s) will fallback on this
  5317. @option{all} setting.
  5318. @item psfile
  5319. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5320. @item plot
  5321. Save Gnuplot script of the curves in specified file.
  5322. @end table
  5323. To avoid some filtergraph syntax conflicts, each key points list need to be
  5324. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5325. @subsection Examples
  5326. @itemize
  5327. @item
  5328. Increase slightly the middle level of blue:
  5329. @example
  5330. curves=blue='0/0 0.5/0.58 1/1'
  5331. @end example
  5332. @item
  5333. Vintage effect:
  5334. @example
  5335. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  5336. @end example
  5337. Here we obtain the following coordinates for each components:
  5338. @table @var
  5339. @item red
  5340. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5341. @item green
  5342. @code{(0;0) (0.50;0.48) (1;1)}
  5343. @item blue
  5344. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5345. @end table
  5346. @item
  5347. The previous example can also be achieved with the associated built-in preset:
  5348. @example
  5349. curves=preset=vintage
  5350. @end example
  5351. @item
  5352. Or simply:
  5353. @example
  5354. curves=vintage
  5355. @end example
  5356. @item
  5357. Use a Photoshop preset and redefine the points of the green component:
  5358. @example
  5359. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5360. @end example
  5361. @item
  5362. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5363. and @command{gnuplot}:
  5364. @example
  5365. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5366. gnuplot -p /tmp/curves.plt
  5367. @end example
  5368. @end itemize
  5369. @section datascope
  5370. Video data analysis filter.
  5371. This filter shows hexadecimal pixel values of part of video.
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @item size, s
  5375. Set output video size.
  5376. @item x
  5377. Set x offset from where to pick pixels.
  5378. @item y
  5379. Set y offset from where to pick pixels.
  5380. @item mode
  5381. Set scope mode, can be one of the following:
  5382. @table @samp
  5383. @item mono
  5384. Draw hexadecimal pixel values with white color on black background.
  5385. @item color
  5386. Draw hexadecimal pixel values with input video pixel color on black
  5387. background.
  5388. @item color2
  5389. Draw hexadecimal pixel values on color background picked from input video,
  5390. the text color is picked in such way so its always visible.
  5391. @end table
  5392. @item axis
  5393. Draw rows and columns numbers on left and top of video.
  5394. @item opacity
  5395. Set background opacity.
  5396. @end table
  5397. @section dctdnoiz
  5398. Denoise frames using 2D DCT (frequency domain filtering).
  5399. This filter is not designed for real time.
  5400. The filter accepts the following options:
  5401. @table @option
  5402. @item sigma, s
  5403. Set the noise sigma constant.
  5404. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5405. coefficient (absolute value) below this threshold with be dropped.
  5406. If you need a more advanced filtering, see @option{expr}.
  5407. Default is @code{0}.
  5408. @item overlap
  5409. Set number overlapping pixels for each block. Since the filter can be slow, you
  5410. may want to reduce this value, at the cost of a less effective filter and the
  5411. risk of various artefacts.
  5412. If the overlapping value doesn't permit processing the whole input width or
  5413. height, a warning will be displayed and according borders won't be denoised.
  5414. Default value is @var{blocksize}-1, which is the best possible setting.
  5415. @item expr, e
  5416. Set the coefficient factor expression.
  5417. For each coefficient of a DCT block, this expression will be evaluated as a
  5418. multiplier value for the coefficient.
  5419. If this is option is set, the @option{sigma} option will be ignored.
  5420. The absolute value of the coefficient can be accessed through the @var{c}
  5421. variable.
  5422. @item n
  5423. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5424. @var{blocksize}, which is the width and height of the processed blocks.
  5425. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5426. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5427. on the speed processing. Also, a larger block size does not necessarily means a
  5428. better de-noising.
  5429. @end table
  5430. @subsection Examples
  5431. Apply a denoise with a @option{sigma} of @code{4.5}:
  5432. @example
  5433. dctdnoiz=4.5
  5434. @end example
  5435. The same operation can be achieved using the expression system:
  5436. @example
  5437. dctdnoiz=e='gte(c, 4.5*3)'
  5438. @end example
  5439. Violent denoise using a block size of @code{16x16}:
  5440. @example
  5441. dctdnoiz=15:n=4
  5442. @end example
  5443. @section deband
  5444. Remove banding artifacts from input video.
  5445. It works by replacing banded pixels with average value of referenced pixels.
  5446. The filter accepts the following options:
  5447. @table @option
  5448. @item 1thr
  5449. @item 2thr
  5450. @item 3thr
  5451. @item 4thr
  5452. Set banding detection threshold for each plane. Default is 0.02.
  5453. Valid range is 0.00003 to 0.5.
  5454. If difference between current pixel and reference pixel is less than threshold,
  5455. it will be considered as banded.
  5456. @item range, r
  5457. Banding detection range in pixels. Default is 16. If positive, random number
  5458. in range 0 to set value will be used. If negative, exact absolute value
  5459. will be used.
  5460. The range defines square of four pixels around current pixel.
  5461. @item direction, d
  5462. Set direction in radians from which four pixel will be compared. If positive,
  5463. random direction from 0 to set direction will be picked. If negative, exact of
  5464. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5465. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5466. column.
  5467. @item blur, b
  5468. If enabled, current pixel is compared with average value of all four
  5469. surrounding pixels. The default is enabled. If disabled current pixel is
  5470. compared with all four surrounding pixels. The pixel is considered banded
  5471. if only all four differences with surrounding pixels are less than threshold.
  5472. @item coupling, c
  5473. If enabled, current pixel is changed if and only if all pixel components are banded,
  5474. e.g. banding detection threshold is triggered for all color components.
  5475. The default is disabled.
  5476. @end table
  5477. @anchor{decimate}
  5478. @section decimate
  5479. Drop duplicated frames at regular intervals.
  5480. The filter accepts the following options:
  5481. @table @option
  5482. @item cycle
  5483. Set the number of frames from which one will be dropped. Setting this to
  5484. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5485. Default is @code{5}.
  5486. @item dupthresh
  5487. Set the threshold for duplicate detection. If the difference metric for a frame
  5488. is less than or equal to this value, then it is declared as duplicate. Default
  5489. is @code{1.1}
  5490. @item scthresh
  5491. Set scene change threshold. Default is @code{15}.
  5492. @item blockx
  5493. @item blocky
  5494. Set the size of the x and y-axis blocks used during metric calculations.
  5495. Larger blocks give better noise suppression, but also give worse detection of
  5496. small movements. Must be a power of two. Default is @code{32}.
  5497. @item ppsrc
  5498. Mark main input as a pre-processed input and activate clean source input
  5499. stream. This allows the input to be pre-processed with various filters to help
  5500. the metrics calculation while keeping the frame selection lossless. When set to
  5501. @code{1}, the first stream is for the pre-processed input, and the second
  5502. stream is the clean source from where the kept frames are chosen. Default is
  5503. @code{0}.
  5504. @item chroma
  5505. Set whether or not chroma is considered in the metric calculations. Default is
  5506. @code{1}.
  5507. @end table
  5508. @section deconvolve
  5509. Apply 2D deconvolution of video stream in frequency domain using second stream
  5510. as impulse.
  5511. The filter accepts the following options:
  5512. @table @option
  5513. @item planes
  5514. Set which planes to process.
  5515. @item impulse
  5516. Set which impulse video frames will be processed, can be @var{first}
  5517. or @var{all}. Default is @var{all}.
  5518. @item noise
  5519. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5520. and height are not same and not power of 2 or if stream prior to convolving
  5521. had noise.
  5522. @end table
  5523. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5524. @section deflate
  5525. Apply deflate effect to the video.
  5526. This filter replaces the pixel by the local(3x3) average by taking into account
  5527. only values lower than the pixel.
  5528. It accepts the following options:
  5529. @table @option
  5530. @item threshold0
  5531. @item threshold1
  5532. @item threshold2
  5533. @item threshold3
  5534. Limit the maximum change for each plane, default is 65535.
  5535. If 0, plane will remain unchanged.
  5536. @end table
  5537. @section deflicker
  5538. Remove temporal frame luminance variations.
  5539. It accepts the following options:
  5540. @table @option
  5541. @item size, s
  5542. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5543. @item mode, m
  5544. Set averaging mode to smooth temporal luminance variations.
  5545. Available values are:
  5546. @table @samp
  5547. @item am
  5548. Arithmetic mean
  5549. @item gm
  5550. Geometric mean
  5551. @item hm
  5552. Harmonic mean
  5553. @item qm
  5554. Quadratic mean
  5555. @item cm
  5556. Cubic mean
  5557. @item pm
  5558. Power mean
  5559. @item median
  5560. Median
  5561. @end table
  5562. @item bypass
  5563. Do not actually modify frame. Useful when one only wants metadata.
  5564. @end table
  5565. @section dejudder
  5566. Remove judder produced by partially interlaced telecined content.
  5567. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5568. source was partially telecined content then the output of @code{pullup,dejudder}
  5569. will have a variable frame rate. May change the recorded frame rate of the
  5570. container. Aside from that change, this filter will not affect constant frame
  5571. rate video.
  5572. The option available in this filter is:
  5573. @table @option
  5574. @item cycle
  5575. Specify the length of the window over which the judder repeats.
  5576. Accepts any integer greater than 1. Useful values are:
  5577. @table @samp
  5578. @item 4
  5579. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5580. @item 5
  5581. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5582. @item 20
  5583. If a mixture of the two.
  5584. @end table
  5585. The default is @samp{4}.
  5586. @end table
  5587. @section delogo
  5588. Suppress a TV station logo by a simple interpolation of the surrounding
  5589. pixels. Just set a rectangle covering the logo and watch it disappear
  5590. (and sometimes something even uglier appear - your mileage may vary).
  5591. It accepts the following parameters:
  5592. @table @option
  5593. @item x
  5594. @item y
  5595. Specify the top left corner coordinates of the logo. They must be
  5596. specified.
  5597. @item w
  5598. @item h
  5599. Specify the width and height of the logo to clear. They must be
  5600. specified.
  5601. @item band, t
  5602. Specify the thickness of the fuzzy edge of the rectangle (added to
  5603. @var{w} and @var{h}). The default value is 1. This option is
  5604. deprecated, setting higher values should no longer be necessary and
  5605. is not recommended.
  5606. @item show
  5607. When set to 1, a green rectangle is drawn on the screen to simplify
  5608. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5609. The default value is 0.
  5610. The rectangle is drawn on the outermost pixels which will be (partly)
  5611. replaced with interpolated values. The values of the next pixels
  5612. immediately outside this rectangle in each direction will be used to
  5613. compute the interpolated pixel values inside the rectangle.
  5614. @end table
  5615. @subsection Examples
  5616. @itemize
  5617. @item
  5618. Set a rectangle covering the area with top left corner coordinates 0,0
  5619. and size 100x77, and a band of size 10:
  5620. @example
  5621. delogo=x=0:y=0:w=100:h=77:band=10
  5622. @end example
  5623. @end itemize
  5624. @section deshake
  5625. Attempt to fix small changes in horizontal and/or vertical shift. This
  5626. filter helps remove camera shake from hand-holding a camera, bumping a
  5627. tripod, moving on a vehicle, etc.
  5628. The filter accepts the following options:
  5629. @table @option
  5630. @item x
  5631. @item y
  5632. @item w
  5633. @item h
  5634. Specify a rectangular area where to limit the search for motion
  5635. vectors.
  5636. If desired the search for motion vectors can be limited to a
  5637. rectangular area of the frame defined by its top left corner, width
  5638. and height. These parameters have the same meaning as the drawbox
  5639. filter which can be used to visualise the position of the bounding
  5640. box.
  5641. This is useful when simultaneous movement of subjects within the frame
  5642. might be confused for camera motion by the motion vector search.
  5643. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5644. then the full frame is used. This allows later options to be set
  5645. without specifying the bounding box for the motion vector search.
  5646. Default - search the whole frame.
  5647. @item rx
  5648. @item ry
  5649. Specify the maximum extent of movement in x and y directions in the
  5650. range 0-64 pixels. Default 16.
  5651. @item edge
  5652. Specify how to generate pixels to fill blanks at the edge of the
  5653. frame. Available values are:
  5654. @table @samp
  5655. @item blank, 0
  5656. Fill zeroes at blank locations
  5657. @item original, 1
  5658. Original image at blank locations
  5659. @item clamp, 2
  5660. Extruded edge value at blank locations
  5661. @item mirror, 3
  5662. Mirrored edge at blank locations
  5663. @end table
  5664. Default value is @samp{mirror}.
  5665. @item blocksize
  5666. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5667. default 8.
  5668. @item contrast
  5669. Specify the contrast threshold for blocks. Only blocks with more than
  5670. the specified contrast (difference between darkest and lightest
  5671. pixels) will be considered. Range 1-255, default 125.
  5672. @item search
  5673. Specify the search strategy. Available values are:
  5674. @table @samp
  5675. @item exhaustive, 0
  5676. Set exhaustive search
  5677. @item less, 1
  5678. Set less exhaustive search.
  5679. @end table
  5680. Default value is @samp{exhaustive}.
  5681. @item filename
  5682. If set then a detailed log of the motion search is written to the
  5683. specified file.
  5684. @end table
  5685. @section despill
  5686. Remove unwanted contamination of foreground colors, caused by reflected color of
  5687. greenscreen or bluescreen.
  5688. This filter accepts the following options:
  5689. @table @option
  5690. @item type
  5691. Set what type of despill to use.
  5692. @item mix
  5693. Set how spillmap will be generated.
  5694. @item expand
  5695. Set how much to get rid of still remaining spill.
  5696. @item red
  5697. Controls amount of red in spill area.
  5698. @item green
  5699. Controls amount of green in spill area.
  5700. Should be -1 for greenscreen.
  5701. @item blue
  5702. Controls amount of blue in spill area.
  5703. Should be -1 for bluescreen.
  5704. @item brightness
  5705. Controls brightness of spill area, preserving colors.
  5706. @item alpha
  5707. Modify alpha from generated spillmap.
  5708. @end table
  5709. @section detelecine
  5710. Apply an exact inverse of the telecine operation. It requires a predefined
  5711. pattern specified using the pattern option which must be the same as that passed
  5712. to the telecine filter.
  5713. This filter accepts the following options:
  5714. @table @option
  5715. @item first_field
  5716. @table @samp
  5717. @item top, t
  5718. top field first
  5719. @item bottom, b
  5720. bottom field first
  5721. The default value is @code{top}.
  5722. @end table
  5723. @item pattern
  5724. A string of numbers representing the pulldown pattern you wish to apply.
  5725. The default value is @code{23}.
  5726. @item start_frame
  5727. A number representing position of the first frame with respect to the telecine
  5728. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5729. @end table
  5730. @section dilation
  5731. Apply dilation effect to the video.
  5732. This filter replaces the pixel by the local(3x3) maximum.
  5733. It accepts the following options:
  5734. @table @option
  5735. @item threshold0
  5736. @item threshold1
  5737. @item threshold2
  5738. @item threshold3
  5739. Limit the maximum change for each plane, default is 65535.
  5740. If 0, plane will remain unchanged.
  5741. @item coordinates
  5742. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5743. pixels are used.
  5744. Flags to local 3x3 coordinates maps like this:
  5745. 1 2 3
  5746. 4 5
  5747. 6 7 8
  5748. @end table
  5749. @section displace
  5750. Displace pixels as indicated by second and third input stream.
  5751. It takes three input streams and outputs one stream, the first input is the
  5752. source, and second and third input are displacement maps.
  5753. The second input specifies how much to displace pixels along the
  5754. x-axis, while the third input specifies how much to displace pixels
  5755. along the y-axis.
  5756. If one of displacement map streams terminates, last frame from that
  5757. displacement map will be used.
  5758. Note that once generated, displacements maps can be reused over and over again.
  5759. A description of the accepted options follows.
  5760. @table @option
  5761. @item edge
  5762. Set displace behavior for pixels that are out of range.
  5763. Available values are:
  5764. @table @samp
  5765. @item blank
  5766. Missing pixels are replaced by black pixels.
  5767. @item smear
  5768. Adjacent pixels will spread out to replace missing pixels.
  5769. @item wrap
  5770. Out of range pixels are wrapped so they point to pixels of other side.
  5771. @item mirror
  5772. Out of range pixels will be replaced with mirrored pixels.
  5773. @end table
  5774. Default is @samp{smear}.
  5775. @end table
  5776. @subsection Examples
  5777. @itemize
  5778. @item
  5779. Add ripple effect to rgb input of video size hd720:
  5780. @example
  5781. 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
  5782. @end example
  5783. @item
  5784. Add wave effect to rgb input of video size hd720:
  5785. @example
  5786. 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
  5787. @end example
  5788. @end itemize
  5789. @section drawbox
  5790. Draw a colored box on the input image.
  5791. It accepts the following parameters:
  5792. @table @option
  5793. @item x
  5794. @item y
  5795. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5796. @item width, w
  5797. @item height, h
  5798. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5799. the input width and height. It defaults to 0.
  5800. @item color, c
  5801. Specify the color of the box to write. For the general syntax of this option,
  5802. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5803. value @code{invert} is used, the box edge color is the same as the
  5804. video with inverted luma.
  5805. @item thickness, t
  5806. The expression which sets the thickness of the box edge.
  5807. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5808. See below for the list of accepted constants.
  5809. @item replace
  5810. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5811. will overwrite the video's color and alpha pixels.
  5812. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5813. @end table
  5814. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5815. following constants:
  5816. @table @option
  5817. @item dar
  5818. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5819. @item hsub
  5820. @item vsub
  5821. horizontal and vertical chroma subsample values. For example for the
  5822. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5823. @item in_h, ih
  5824. @item in_w, iw
  5825. The input width and height.
  5826. @item sar
  5827. The input sample aspect ratio.
  5828. @item x
  5829. @item y
  5830. The x and y offset coordinates where the box is drawn.
  5831. @item w
  5832. @item h
  5833. The width and height of the drawn box.
  5834. @item t
  5835. The thickness of the drawn box.
  5836. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5837. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5838. @end table
  5839. @subsection Examples
  5840. @itemize
  5841. @item
  5842. Draw a black box around the edge of the input image:
  5843. @example
  5844. drawbox
  5845. @end example
  5846. @item
  5847. Draw a box with color red and an opacity of 50%:
  5848. @example
  5849. drawbox=10:20:200:60:red@@0.5
  5850. @end example
  5851. The previous example can be specified as:
  5852. @example
  5853. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5854. @end example
  5855. @item
  5856. Fill the box with pink color:
  5857. @example
  5858. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5859. @end example
  5860. @item
  5861. Draw a 2-pixel red 2.40:1 mask:
  5862. @example
  5863. 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
  5864. @end example
  5865. @end itemize
  5866. @section drawgrid
  5867. Draw a grid on the input image.
  5868. It accepts the following parameters:
  5869. @table @option
  5870. @item x
  5871. @item y
  5872. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5873. @item width, w
  5874. @item height, h
  5875. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5876. input width and height, respectively, minus @code{thickness}, so image gets
  5877. framed. Default to 0.
  5878. @item color, c
  5879. Specify the color of the grid. For the general syntax of this option,
  5880. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5881. value @code{invert} is used, the grid color is the same as the
  5882. video with inverted luma.
  5883. @item thickness, t
  5884. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5885. See below for the list of accepted constants.
  5886. @item replace
  5887. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5888. will overwrite the video's color and alpha pixels.
  5889. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5890. @end table
  5891. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5892. following constants:
  5893. @table @option
  5894. @item dar
  5895. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5896. @item hsub
  5897. @item vsub
  5898. horizontal and vertical chroma subsample values. For example for the
  5899. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5900. @item in_h, ih
  5901. @item in_w, iw
  5902. The input grid cell width and height.
  5903. @item sar
  5904. The input sample aspect ratio.
  5905. @item x
  5906. @item y
  5907. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5908. @item w
  5909. @item h
  5910. The width and height of the drawn cell.
  5911. @item t
  5912. The thickness of the drawn cell.
  5913. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5914. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5915. @end table
  5916. @subsection Examples
  5917. @itemize
  5918. @item
  5919. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5920. @example
  5921. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5922. @end example
  5923. @item
  5924. Draw a white 3x3 grid with an opacity of 50%:
  5925. @example
  5926. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5927. @end example
  5928. @end itemize
  5929. @anchor{drawtext}
  5930. @section drawtext
  5931. Draw a text string or text from a specified file on top of a video, using the
  5932. libfreetype library.
  5933. To enable compilation of this filter, you need to configure FFmpeg with
  5934. @code{--enable-libfreetype}.
  5935. To enable default font fallback and the @var{font} option you need to
  5936. configure FFmpeg with @code{--enable-libfontconfig}.
  5937. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5938. @code{--enable-libfribidi}.
  5939. @subsection Syntax
  5940. It accepts the following parameters:
  5941. @table @option
  5942. @item box
  5943. Used to draw a box around text using the background color.
  5944. The value must be either 1 (enable) or 0 (disable).
  5945. The default value of @var{box} is 0.
  5946. @item boxborderw
  5947. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5948. The default value of @var{boxborderw} is 0.
  5949. @item boxcolor
  5950. The color to be used for drawing box around text. For the syntax of this
  5951. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5952. The default value of @var{boxcolor} is "white".
  5953. @item line_spacing
  5954. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5955. The default value of @var{line_spacing} is 0.
  5956. @item borderw
  5957. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5958. The default value of @var{borderw} is 0.
  5959. @item bordercolor
  5960. Set the color to be used for drawing border around text. For the syntax of this
  5961. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5962. The default value of @var{bordercolor} is "black".
  5963. @item expansion
  5964. Select how the @var{text} is expanded. Can be either @code{none},
  5965. @code{strftime} (deprecated) or
  5966. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5967. below for details.
  5968. @item basetime
  5969. Set a start time for the count. Value is in microseconds. Only applied
  5970. in the deprecated strftime expansion mode. To emulate in normal expansion
  5971. mode use the @code{pts} function, supplying the start time (in seconds)
  5972. as the second argument.
  5973. @item fix_bounds
  5974. If true, check and fix text coords to avoid clipping.
  5975. @item fontcolor
  5976. The color to be used for drawing fonts. For the syntax of this option, check
  5977. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5978. The default value of @var{fontcolor} is "black".
  5979. @item fontcolor_expr
  5980. String which is expanded the same way as @var{text} to obtain dynamic
  5981. @var{fontcolor} value. By default this option has empty value and is not
  5982. processed. When this option is set, it overrides @var{fontcolor} option.
  5983. @item font
  5984. The font family to be used for drawing text. By default Sans.
  5985. @item fontfile
  5986. The font file to be used for drawing text. The path must be included.
  5987. This parameter is mandatory if the fontconfig support is disabled.
  5988. @item alpha
  5989. Draw the text applying alpha blending. The value can
  5990. be a number between 0.0 and 1.0.
  5991. The expression accepts the same variables @var{x, y} as well.
  5992. The default value is 1.
  5993. Please see @var{fontcolor_expr}.
  5994. @item fontsize
  5995. The font size to be used for drawing text.
  5996. The default value of @var{fontsize} is 16.
  5997. @item text_shaping
  5998. If set to 1, attempt to shape the text (for example, reverse the order of
  5999. right-to-left text and join Arabic characters) before drawing it.
  6000. Otherwise, just draw the text exactly as given.
  6001. By default 1 (if supported).
  6002. @item ft_load_flags
  6003. The flags to be used for loading the fonts.
  6004. The flags map the corresponding flags supported by libfreetype, and are
  6005. a combination of the following values:
  6006. @table @var
  6007. @item default
  6008. @item no_scale
  6009. @item no_hinting
  6010. @item render
  6011. @item no_bitmap
  6012. @item vertical_layout
  6013. @item force_autohint
  6014. @item crop_bitmap
  6015. @item pedantic
  6016. @item ignore_global_advance_width
  6017. @item no_recurse
  6018. @item ignore_transform
  6019. @item monochrome
  6020. @item linear_design
  6021. @item no_autohint
  6022. @end table
  6023. Default value is "default".
  6024. For more information consult the documentation for the FT_LOAD_*
  6025. libfreetype flags.
  6026. @item shadowcolor
  6027. The color to be used for drawing a shadow behind the drawn text. For the
  6028. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6029. ffmpeg-utils manual,ffmpeg-utils}.
  6030. The default value of @var{shadowcolor} is "black".
  6031. @item shadowx
  6032. @item shadowy
  6033. The x and y offsets for the text shadow position with respect to the
  6034. position of the text. They can be either positive or negative
  6035. values. The default value for both is "0".
  6036. @item start_number
  6037. The starting frame number for the n/frame_num variable. The default value
  6038. is "0".
  6039. @item tabsize
  6040. The size in number of spaces to use for rendering the tab.
  6041. Default value is 4.
  6042. @item timecode
  6043. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6044. format. It can be used with or without text parameter. @var{timecode_rate}
  6045. option must be specified.
  6046. @item timecode_rate, rate, r
  6047. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6048. integer. Minimum value is "1".
  6049. Drop-frame timecode is supported for frame rates 30 & 60.
  6050. @item tc24hmax
  6051. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6052. Default is 0 (disabled).
  6053. @item text
  6054. The text string to be drawn. The text must be a sequence of UTF-8
  6055. encoded characters.
  6056. This parameter is mandatory if no file is specified with the parameter
  6057. @var{textfile}.
  6058. @item textfile
  6059. A text file containing text to be drawn. The text must be a sequence
  6060. of UTF-8 encoded characters.
  6061. This parameter is mandatory if no text string is specified with the
  6062. parameter @var{text}.
  6063. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6064. @item reload
  6065. If set to 1, the @var{textfile} will be reloaded before each frame.
  6066. Be sure to update it atomically, or it may be read partially, or even fail.
  6067. @item x
  6068. @item y
  6069. The expressions which specify the offsets where text will be drawn
  6070. within the video frame. They are relative to the top/left border of the
  6071. output image.
  6072. The default value of @var{x} and @var{y} is "0".
  6073. See below for the list of accepted constants and functions.
  6074. @end table
  6075. The parameters for @var{x} and @var{y} are expressions containing the
  6076. following constants and functions:
  6077. @table @option
  6078. @item dar
  6079. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6080. @item hsub
  6081. @item vsub
  6082. horizontal and vertical chroma subsample values. For example for the
  6083. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6084. @item line_h, lh
  6085. the height of each text line
  6086. @item main_h, h, H
  6087. the input height
  6088. @item main_w, w, W
  6089. the input width
  6090. @item max_glyph_a, ascent
  6091. the maximum distance from the baseline to the highest/upper grid
  6092. coordinate used to place a glyph outline point, for all the rendered
  6093. glyphs.
  6094. It is a positive value, due to the grid's orientation with the Y axis
  6095. upwards.
  6096. @item max_glyph_d, descent
  6097. the maximum distance from the baseline to the lowest grid coordinate
  6098. used to place a glyph outline point, for all the rendered glyphs.
  6099. This is a negative value, due to the grid's orientation, with the Y axis
  6100. upwards.
  6101. @item max_glyph_h
  6102. maximum glyph height, that is the maximum height for all the glyphs
  6103. contained in the rendered text, it is equivalent to @var{ascent} -
  6104. @var{descent}.
  6105. @item max_glyph_w
  6106. maximum glyph width, that is the maximum width for all the glyphs
  6107. contained in the rendered text
  6108. @item n
  6109. the number of input frame, starting from 0
  6110. @item rand(min, max)
  6111. return a random number included between @var{min} and @var{max}
  6112. @item sar
  6113. The input sample aspect ratio.
  6114. @item t
  6115. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6116. @item text_h, th
  6117. the height of the rendered text
  6118. @item text_w, tw
  6119. the width of the rendered text
  6120. @item x
  6121. @item y
  6122. the x and y offset coordinates where the text is drawn.
  6123. These parameters allow the @var{x} and @var{y} expressions to refer
  6124. each other, so you can for example specify @code{y=x/dar}.
  6125. @end table
  6126. @anchor{drawtext_expansion}
  6127. @subsection Text expansion
  6128. If @option{expansion} is set to @code{strftime},
  6129. the filter recognizes strftime() sequences in the provided text and
  6130. expands them accordingly. Check the documentation of strftime(). This
  6131. feature is deprecated.
  6132. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6133. If @option{expansion} is set to @code{normal} (which is the default),
  6134. the following expansion mechanism is used.
  6135. The backslash character @samp{\}, followed by any character, always expands to
  6136. the second character.
  6137. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6138. braces is a function name, possibly followed by arguments separated by ':'.
  6139. If the arguments contain special characters or delimiters (':' or '@}'),
  6140. they should be escaped.
  6141. Note that they probably must also be escaped as the value for the
  6142. @option{text} option in the filter argument string and as the filter
  6143. argument in the filtergraph description, and possibly also for the shell,
  6144. that makes up to four levels of escaping; using a text file avoids these
  6145. problems.
  6146. The following functions are available:
  6147. @table @command
  6148. @item expr, e
  6149. The expression evaluation result.
  6150. It must take one argument specifying the expression to be evaluated,
  6151. which accepts the same constants and functions as the @var{x} and
  6152. @var{y} values. Note that not all constants should be used, for
  6153. example the text size is not known when evaluating the expression, so
  6154. the constants @var{text_w} and @var{text_h} will have an undefined
  6155. value.
  6156. @item expr_int_format, eif
  6157. Evaluate the expression's value and output as formatted integer.
  6158. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6159. The second argument specifies the output format. Allowed values are @samp{x},
  6160. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6161. @code{printf} function.
  6162. The third parameter is optional and sets the number of positions taken by the output.
  6163. It can be used to add padding with zeros from the left.
  6164. @item gmtime
  6165. The time at which the filter is running, expressed in UTC.
  6166. It can accept an argument: a strftime() format string.
  6167. @item localtime
  6168. The time at which the filter is running, expressed in the local time zone.
  6169. It can accept an argument: a strftime() format string.
  6170. @item metadata
  6171. Frame metadata. Takes one or two arguments.
  6172. The first argument is mandatory and specifies the metadata key.
  6173. The second argument is optional and specifies a default value, used when the
  6174. metadata key is not found or empty.
  6175. @item n, frame_num
  6176. The frame number, starting from 0.
  6177. @item pict_type
  6178. A 1 character description of the current picture type.
  6179. @item pts
  6180. The timestamp of the current frame.
  6181. It can take up to three arguments.
  6182. The first argument is the format of the timestamp; it defaults to @code{flt}
  6183. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6184. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6185. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6186. @code{localtime} stands for the timestamp of the frame formatted as
  6187. local time zone time.
  6188. The second argument is an offset added to the timestamp.
  6189. If the format is set to @code{localtime} or @code{gmtime},
  6190. a third argument may be supplied: a strftime() format string.
  6191. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6192. @end table
  6193. @subsection Examples
  6194. @itemize
  6195. @item
  6196. Draw "Test Text" with font FreeSerif, using the default values for the
  6197. optional parameters.
  6198. @example
  6199. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6200. @end example
  6201. @item
  6202. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6203. and y=50 (counting from the top-left corner of the screen), text is
  6204. yellow with a red box around it. Both the text and the box have an
  6205. opacity of 20%.
  6206. @example
  6207. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6208. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6209. @end example
  6210. Note that the double quotes are not necessary if spaces are not used
  6211. within the parameter list.
  6212. @item
  6213. Show the text at the center of the video frame:
  6214. @example
  6215. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6216. @end example
  6217. @item
  6218. Show the text at a random position, switching to a new position every 30 seconds:
  6219. @example
  6220. 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)"
  6221. @end example
  6222. @item
  6223. Show a text line sliding from right to left in the last row of the video
  6224. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6225. with no newlines.
  6226. @example
  6227. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6228. @end example
  6229. @item
  6230. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6231. @example
  6232. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6233. @end example
  6234. @item
  6235. Draw a single green letter "g", at the center of the input video.
  6236. The glyph baseline is placed at half screen height.
  6237. @example
  6238. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6239. @end example
  6240. @item
  6241. Show text for 1 second every 3 seconds:
  6242. @example
  6243. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6244. @end example
  6245. @item
  6246. Use fontconfig to set the font. Note that the colons need to be escaped.
  6247. @example
  6248. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6249. @end example
  6250. @item
  6251. Print the date of a real-time encoding (see strftime(3)):
  6252. @example
  6253. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6254. @end example
  6255. @item
  6256. Show text fading in and out (appearing/disappearing):
  6257. @example
  6258. #!/bin/sh
  6259. DS=1.0 # display start
  6260. DE=10.0 # display end
  6261. FID=1.5 # fade in duration
  6262. FOD=5 # fade out duration
  6263. 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 @}"
  6264. @end example
  6265. @item
  6266. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6267. and the @option{fontsize} value are included in the @option{y} offset.
  6268. @example
  6269. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6270. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6271. @end example
  6272. @end itemize
  6273. For more information about libfreetype, check:
  6274. @url{http://www.freetype.org/}.
  6275. For more information about fontconfig, check:
  6276. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6277. For more information about libfribidi, check:
  6278. @url{http://fribidi.org/}.
  6279. @section edgedetect
  6280. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6281. The filter accepts the following options:
  6282. @table @option
  6283. @item low
  6284. @item high
  6285. Set low and high threshold values used by the Canny thresholding
  6286. algorithm.
  6287. The high threshold selects the "strong" edge pixels, which are then
  6288. connected through 8-connectivity with the "weak" edge pixels selected
  6289. by the low threshold.
  6290. @var{low} and @var{high} threshold values must be chosen in the range
  6291. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6292. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6293. is @code{50/255}.
  6294. @item mode
  6295. Define the drawing mode.
  6296. @table @samp
  6297. @item wires
  6298. Draw white/gray wires on black background.
  6299. @item colormix
  6300. Mix the colors to create a paint/cartoon effect.
  6301. @end table
  6302. Default value is @var{wires}.
  6303. @end table
  6304. @subsection Examples
  6305. @itemize
  6306. @item
  6307. Standard edge detection with custom values for the hysteresis thresholding:
  6308. @example
  6309. edgedetect=low=0.1:high=0.4
  6310. @end example
  6311. @item
  6312. Painting effect without thresholding:
  6313. @example
  6314. edgedetect=mode=colormix:high=0
  6315. @end example
  6316. @end itemize
  6317. @section eq
  6318. Set brightness, contrast, saturation and approximate gamma adjustment.
  6319. The filter accepts the following options:
  6320. @table @option
  6321. @item contrast
  6322. Set the contrast expression. The value must be a float value in range
  6323. @code{-2.0} to @code{2.0}. The default value is "1".
  6324. @item brightness
  6325. Set the brightness expression. The value must be a float value in
  6326. range @code{-1.0} to @code{1.0}. The default value is "0".
  6327. @item saturation
  6328. Set the saturation expression. The value must be a float in
  6329. range @code{0.0} to @code{3.0}. The default value is "1".
  6330. @item gamma
  6331. Set the gamma expression. The value must be a float in range
  6332. @code{0.1} to @code{10.0}. The default value is "1".
  6333. @item gamma_r
  6334. Set the gamma expression for red. The value must be a float in
  6335. range @code{0.1} to @code{10.0}. The default value is "1".
  6336. @item gamma_g
  6337. Set the gamma expression for green. The value must be a float in range
  6338. @code{0.1} to @code{10.0}. The default value is "1".
  6339. @item gamma_b
  6340. Set the gamma expression for blue. The value must be a float in range
  6341. @code{0.1} to @code{10.0}. The default value is "1".
  6342. @item gamma_weight
  6343. Set the gamma weight expression. It can be used to reduce the effect
  6344. of a high gamma value on bright image areas, e.g. keep them from
  6345. getting overamplified and just plain white. The value must be a float
  6346. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6347. gamma correction all the way down while @code{1.0} leaves it at its
  6348. full strength. Default is "1".
  6349. @item eval
  6350. Set when the expressions for brightness, contrast, saturation and
  6351. gamma expressions are evaluated.
  6352. It accepts the following values:
  6353. @table @samp
  6354. @item init
  6355. only evaluate expressions once during the filter initialization or
  6356. when a command is processed
  6357. @item frame
  6358. evaluate expressions for each incoming frame
  6359. @end table
  6360. Default value is @samp{init}.
  6361. @end table
  6362. The expressions accept the following parameters:
  6363. @table @option
  6364. @item n
  6365. frame count of the input frame starting from 0
  6366. @item pos
  6367. byte position of the corresponding packet in the input file, NAN if
  6368. unspecified
  6369. @item r
  6370. frame rate of the input video, NAN if the input frame rate is unknown
  6371. @item t
  6372. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6373. @end table
  6374. @subsection Commands
  6375. The filter supports the following commands:
  6376. @table @option
  6377. @item contrast
  6378. Set the contrast expression.
  6379. @item brightness
  6380. Set the brightness expression.
  6381. @item saturation
  6382. Set the saturation expression.
  6383. @item gamma
  6384. Set the gamma expression.
  6385. @item gamma_r
  6386. Set the gamma_r expression.
  6387. @item gamma_g
  6388. Set gamma_g expression.
  6389. @item gamma_b
  6390. Set gamma_b expression.
  6391. @item gamma_weight
  6392. Set gamma_weight expression.
  6393. The command accepts the same syntax of the corresponding option.
  6394. If the specified expression is not valid, it is kept at its current
  6395. value.
  6396. @end table
  6397. @section erosion
  6398. Apply erosion effect to the video.
  6399. This filter replaces the pixel by the local(3x3) minimum.
  6400. It accepts the following options:
  6401. @table @option
  6402. @item threshold0
  6403. @item threshold1
  6404. @item threshold2
  6405. @item threshold3
  6406. Limit the maximum change for each plane, default is 65535.
  6407. If 0, plane will remain unchanged.
  6408. @item coordinates
  6409. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6410. pixels are used.
  6411. Flags to local 3x3 coordinates maps like this:
  6412. 1 2 3
  6413. 4 5
  6414. 6 7 8
  6415. @end table
  6416. @section extractplanes
  6417. Extract color channel components from input video stream into
  6418. separate grayscale video streams.
  6419. The filter accepts the following option:
  6420. @table @option
  6421. @item planes
  6422. Set plane(s) to extract.
  6423. Available values for planes are:
  6424. @table @samp
  6425. @item y
  6426. @item u
  6427. @item v
  6428. @item a
  6429. @item r
  6430. @item g
  6431. @item b
  6432. @end table
  6433. Choosing planes not available in the input will result in an error.
  6434. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6435. with @code{y}, @code{u}, @code{v} planes at same time.
  6436. @end table
  6437. @subsection Examples
  6438. @itemize
  6439. @item
  6440. Extract luma, u and v color channel component from input video frame
  6441. into 3 grayscale outputs:
  6442. @example
  6443. 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
  6444. @end example
  6445. @end itemize
  6446. @section elbg
  6447. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6448. For each input image, the filter will compute the optimal mapping from
  6449. the input to the output given the codebook length, that is the number
  6450. of distinct output colors.
  6451. This filter accepts the following options.
  6452. @table @option
  6453. @item codebook_length, l
  6454. Set codebook length. The value must be a positive integer, and
  6455. represents the number of distinct output colors. Default value is 256.
  6456. @item nb_steps, n
  6457. Set the maximum number of iterations to apply for computing the optimal
  6458. mapping. The higher the value the better the result and the higher the
  6459. computation time. Default value is 1.
  6460. @item seed, s
  6461. Set a random seed, must be an integer included between 0 and
  6462. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6463. will try to use a good random seed on a best effort basis.
  6464. @item pal8
  6465. Set pal8 output pixel format. This option does not work with codebook
  6466. length greater than 256.
  6467. @end table
  6468. @section entropy
  6469. Measure graylevel entropy in histogram of color channels of video frames.
  6470. It accepts the following parameters:
  6471. @table @option
  6472. @item mode
  6473. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6474. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6475. between neighbour histogram values.
  6476. @end table
  6477. @section fade
  6478. Apply a fade-in/out effect to the input video.
  6479. It accepts the following parameters:
  6480. @table @option
  6481. @item type, t
  6482. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6483. effect.
  6484. Default is @code{in}.
  6485. @item start_frame, s
  6486. Specify the number of the frame to start applying the fade
  6487. effect at. Default is 0.
  6488. @item nb_frames, n
  6489. The number of frames that the fade effect lasts. At the end of the
  6490. fade-in effect, the output video will have the same intensity as the input video.
  6491. At the end of the fade-out transition, the output video will be filled with the
  6492. selected @option{color}.
  6493. Default is 25.
  6494. @item alpha
  6495. If set to 1, fade only alpha channel, if one exists on the input.
  6496. Default value is 0.
  6497. @item start_time, st
  6498. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6499. effect. If both start_frame and start_time are specified, the fade will start at
  6500. whichever comes last. Default is 0.
  6501. @item duration, d
  6502. The number of seconds for which the fade effect has to last. At the end of the
  6503. fade-in effect the output video will have the same intensity as the input video,
  6504. at the end of the fade-out transition the output video will be filled with the
  6505. selected @option{color}.
  6506. If both duration and nb_frames are specified, duration is used. Default is 0
  6507. (nb_frames is used by default).
  6508. @item color, c
  6509. Specify the color of the fade. Default is "black".
  6510. @end table
  6511. @subsection Examples
  6512. @itemize
  6513. @item
  6514. Fade in the first 30 frames of video:
  6515. @example
  6516. fade=in:0:30
  6517. @end example
  6518. The command above is equivalent to:
  6519. @example
  6520. fade=t=in:s=0:n=30
  6521. @end example
  6522. @item
  6523. Fade out the last 45 frames of a 200-frame video:
  6524. @example
  6525. fade=out:155:45
  6526. fade=type=out:start_frame=155:nb_frames=45
  6527. @end example
  6528. @item
  6529. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6530. @example
  6531. fade=in:0:25, fade=out:975:25
  6532. @end example
  6533. @item
  6534. Make the first 5 frames yellow, then fade in from frame 5-24:
  6535. @example
  6536. fade=in:5:20:color=yellow
  6537. @end example
  6538. @item
  6539. Fade in alpha over first 25 frames of video:
  6540. @example
  6541. fade=in:0:25:alpha=1
  6542. @end example
  6543. @item
  6544. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6545. @example
  6546. fade=t=in:st=5.5:d=0.5
  6547. @end example
  6548. @end itemize
  6549. @section fftfilt
  6550. Apply arbitrary expressions to samples in frequency domain
  6551. @table @option
  6552. @item dc_Y
  6553. Adjust the dc value (gain) of the luma plane of the image. The filter
  6554. accepts an integer value in range @code{0} to @code{1000}. The default
  6555. value is set to @code{0}.
  6556. @item dc_U
  6557. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6558. filter accepts an integer value in range @code{0} to @code{1000}. The
  6559. default value is set to @code{0}.
  6560. @item dc_V
  6561. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6562. filter accepts an integer value in range @code{0} to @code{1000}. The
  6563. default value is set to @code{0}.
  6564. @item weight_Y
  6565. Set the frequency domain weight expression for the luma plane.
  6566. @item weight_U
  6567. Set the frequency domain weight expression for the 1st chroma plane.
  6568. @item weight_V
  6569. Set the frequency domain weight expression for the 2nd chroma plane.
  6570. @item eval
  6571. Set when the expressions are evaluated.
  6572. It accepts the following values:
  6573. @table @samp
  6574. @item init
  6575. Only evaluate expressions once during the filter initialization.
  6576. @item frame
  6577. Evaluate expressions for each incoming frame.
  6578. @end table
  6579. Default value is @samp{init}.
  6580. The filter accepts the following variables:
  6581. @item X
  6582. @item Y
  6583. The coordinates of the current sample.
  6584. @item W
  6585. @item H
  6586. The width and height of the image.
  6587. @item N
  6588. The number of input frame, starting from 0.
  6589. @end table
  6590. @subsection Examples
  6591. @itemize
  6592. @item
  6593. High-pass:
  6594. @example
  6595. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6596. @end example
  6597. @item
  6598. Low-pass:
  6599. @example
  6600. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6601. @end example
  6602. @item
  6603. Sharpen:
  6604. @example
  6605. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6606. @end example
  6607. @item
  6608. Blur:
  6609. @example
  6610. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6611. @end example
  6612. @end itemize
  6613. @section field
  6614. Extract a single field from an interlaced image using stride
  6615. arithmetic to avoid wasting CPU time. The output frames are marked as
  6616. non-interlaced.
  6617. The filter accepts the following options:
  6618. @table @option
  6619. @item type
  6620. Specify whether to extract the top (if the value is @code{0} or
  6621. @code{top}) or the bottom field (if the value is @code{1} or
  6622. @code{bottom}).
  6623. @end table
  6624. @section fieldhint
  6625. Create new frames by copying the top and bottom fields from surrounding frames
  6626. supplied as numbers by the hint file.
  6627. @table @option
  6628. @item hint
  6629. Set file containing hints: absolute/relative frame numbers.
  6630. There must be one line for each frame in a clip. Each line must contain two
  6631. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6632. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6633. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6634. for @code{relative} mode. First number tells from which frame to pick up top
  6635. field and second number tells from which frame to pick up bottom field.
  6636. If optionally followed by @code{+} output frame will be marked as interlaced,
  6637. else if followed by @code{-} output frame will be marked as progressive, else
  6638. it will be marked same as input frame.
  6639. If line starts with @code{#} or @code{;} that line is skipped.
  6640. @item mode
  6641. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6642. @end table
  6643. Example of first several lines of @code{hint} file for @code{relative} mode:
  6644. @example
  6645. 0,0 - # first frame
  6646. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6647. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6648. 1,0 -
  6649. 0,0 -
  6650. 0,0 -
  6651. 1,0 -
  6652. 1,0 -
  6653. 1,0 -
  6654. 0,0 -
  6655. 0,0 -
  6656. 1,0 -
  6657. 1,0 -
  6658. 1,0 -
  6659. 0,0 -
  6660. @end example
  6661. @section fieldmatch
  6662. Field matching filter for inverse telecine. It is meant to reconstruct the
  6663. progressive frames from a telecined stream. The filter does not drop duplicated
  6664. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6665. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6666. The separation of the field matching and the decimation is notably motivated by
  6667. the possibility of inserting a de-interlacing filter fallback between the two.
  6668. If the source has mixed telecined and real interlaced content,
  6669. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6670. But these remaining combed frames will be marked as interlaced, and thus can be
  6671. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6672. In addition to the various configuration options, @code{fieldmatch} can take an
  6673. optional second stream, activated through the @option{ppsrc} option. If
  6674. enabled, the frames reconstruction will be based on the fields and frames from
  6675. this second stream. This allows the first input to be pre-processed in order to
  6676. help the various algorithms of the filter, while keeping the output lossless
  6677. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6678. or brightness/contrast adjustments can help.
  6679. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6680. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6681. which @code{fieldmatch} is based on. While the semantic and usage are very
  6682. close, some behaviour and options names can differ.
  6683. The @ref{decimate} filter currently only works for constant frame rate input.
  6684. If your input has mixed telecined (30fps) and progressive content with a lower
  6685. framerate like 24fps use the following filterchain to produce the necessary cfr
  6686. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6687. The filter accepts the following options:
  6688. @table @option
  6689. @item order
  6690. Specify the assumed field order of the input stream. Available values are:
  6691. @table @samp
  6692. @item auto
  6693. Auto detect parity (use FFmpeg's internal parity value).
  6694. @item bff
  6695. Assume bottom field first.
  6696. @item tff
  6697. Assume top field first.
  6698. @end table
  6699. Note that it is sometimes recommended not to trust the parity announced by the
  6700. stream.
  6701. Default value is @var{auto}.
  6702. @item mode
  6703. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6704. sense that it won't risk creating jerkiness due to duplicate frames when
  6705. possible, but if there are bad edits or blended fields it will end up
  6706. outputting combed frames when a good match might actually exist. On the other
  6707. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6708. but will almost always find a good frame if there is one. The other values are
  6709. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6710. jerkiness and creating duplicate frames versus finding good matches in sections
  6711. with bad edits, orphaned fields, blended fields, etc.
  6712. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6713. Available values are:
  6714. @table @samp
  6715. @item pc
  6716. 2-way matching (p/c)
  6717. @item pc_n
  6718. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6719. @item pc_u
  6720. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6721. @item pc_n_ub
  6722. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6723. still combed (p/c + n + u/b)
  6724. @item pcn
  6725. 3-way matching (p/c/n)
  6726. @item pcn_ub
  6727. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6728. detected as combed (p/c/n + u/b)
  6729. @end table
  6730. The parenthesis at the end indicate the matches that would be used for that
  6731. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6732. @var{top}).
  6733. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6734. the slowest.
  6735. Default value is @var{pc_n}.
  6736. @item ppsrc
  6737. Mark the main input stream as a pre-processed input, and enable the secondary
  6738. input stream as the clean source to pick the fields from. See the filter
  6739. introduction for more details. It is similar to the @option{clip2} feature from
  6740. VFM/TFM.
  6741. Default value is @code{0} (disabled).
  6742. @item field
  6743. Set the field to match from. It is recommended to set this to the same value as
  6744. @option{order} unless you experience matching failures with that setting. In
  6745. certain circumstances changing the field that is used to match from can have a
  6746. large impact on matching performance. Available values are:
  6747. @table @samp
  6748. @item auto
  6749. Automatic (same value as @option{order}).
  6750. @item bottom
  6751. Match from the bottom field.
  6752. @item top
  6753. Match from the top field.
  6754. @end table
  6755. Default value is @var{auto}.
  6756. @item mchroma
  6757. Set whether or not chroma is included during the match comparisons. In most
  6758. cases it is recommended to leave this enabled. You should set this to @code{0}
  6759. only if your clip has bad chroma problems such as heavy rainbowing or other
  6760. artifacts. Setting this to @code{0} could also be used to speed things up at
  6761. the cost of some accuracy.
  6762. Default value is @code{1}.
  6763. @item y0
  6764. @item y1
  6765. These define an exclusion band which excludes the lines between @option{y0} and
  6766. @option{y1} from being included in the field matching decision. An exclusion
  6767. band can be used to ignore subtitles, a logo, or other things that may
  6768. interfere with the matching. @option{y0} sets the starting scan line and
  6769. @option{y1} sets the ending line; all lines in between @option{y0} and
  6770. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6771. @option{y0} and @option{y1} to the same value will disable the feature.
  6772. @option{y0} and @option{y1} defaults to @code{0}.
  6773. @item scthresh
  6774. Set the scene change detection threshold as a percentage of maximum change on
  6775. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6776. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6777. @option{scthresh} is @code{[0.0, 100.0]}.
  6778. Default value is @code{12.0}.
  6779. @item combmatch
  6780. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6781. account the combed scores of matches when deciding what match to use as the
  6782. final match. Available values are:
  6783. @table @samp
  6784. @item none
  6785. No final matching based on combed scores.
  6786. @item sc
  6787. Combed scores are only used when a scene change is detected.
  6788. @item full
  6789. Use combed scores all the time.
  6790. @end table
  6791. Default is @var{sc}.
  6792. @item combdbg
  6793. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6794. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6795. Available values are:
  6796. @table @samp
  6797. @item none
  6798. No forced calculation.
  6799. @item pcn
  6800. Force p/c/n calculations.
  6801. @item pcnub
  6802. Force p/c/n/u/b calculations.
  6803. @end table
  6804. Default value is @var{none}.
  6805. @item cthresh
  6806. This is the area combing threshold used for combed frame detection. This
  6807. essentially controls how "strong" or "visible" combing must be to be detected.
  6808. Larger values mean combing must be more visible and smaller values mean combing
  6809. can be less visible or strong and still be detected. Valid settings are from
  6810. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6811. be detected as combed). This is basically a pixel difference value. A good
  6812. range is @code{[8, 12]}.
  6813. Default value is @code{9}.
  6814. @item chroma
  6815. Sets whether or not chroma is considered in the combed frame decision. Only
  6816. disable this if your source has chroma problems (rainbowing, etc.) that are
  6817. causing problems for the combed frame detection with chroma enabled. Actually,
  6818. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6819. where there is chroma only combing in the source.
  6820. Default value is @code{0}.
  6821. @item blockx
  6822. @item blocky
  6823. Respectively set the x-axis and y-axis size of the window used during combed
  6824. frame detection. This has to do with the size of the area in which
  6825. @option{combpel} pixels are required to be detected as combed for a frame to be
  6826. declared combed. See the @option{combpel} parameter description for more info.
  6827. Possible values are any number that is a power of 2 starting at 4 and going up
  6828. to 512.
  6829. Default value is @code{16}.
  6830. @item combpel
  6831. The number of combed pixels inside any of the @option{blocky} by
  6832. @option{blockx} size blocks on the frame for the frame to be detected as
  6833. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6834. setting controls "how much" combing there must be in any localized area (a
  6835. window defined by the @option{blockx} and @option{blocky} settings) on the
  6836. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6837. which point no frames will ever be detected as combed). This setting is known
  6838. as @option{MI} in TFM/VFM vocabulary.
  6839. Default value is @code{80}.
  6840. @end table
  6841. @anchor{p/c/n/u/b meaning}
  6842. @subsection p/c/n/u/b meaning
  6843. @subsubsection p/c/n
  6844. We assume the following telecined stream:
  6845. @example
  6846. Top fields: 1 2 2 3 4
  6847. Bottom fields: 1 2 3 4 4
  6848. @end example
  6849. The numbers correspond to the progressive frame the fields relate to. Here, the
  6850. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6851. When @code{fieldmatch} is configured to run a matching from bottom
  6852. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6853. @example
  6854. Input stream:
  6855. T 1 2 2 3 4
  6856. B 1 2 3 4 4 <-- matching reference
  6857. Matches: c c n n c
  6858. Output stream:
  6859. T 1 2 3 4 4
  6860. B 1 2 3 4 4
  6861. @end example
  6862. As a result of the field matching, we can see that some frames get duplicated.
  6863. To perform a complete inverse telecine, you need to rely on a decimation filter
  6864. after this operation. See for instance the @ref{decimate} filter.
  6865. The same operation now matching from top fields (@option{field}=@var{top})
  6866. looks like this:
  6867. @example
  6868. Input stream:
  6869. T 1 2 2 3 4 <-- matching reference
  6870. B 1 2 3 4 4
  6871. Matches: c c p p c
  6872. Output stream:
  6873. T 1 2 2 3 4
  6874. B 1 2 2 3 4
  6875. @end example
  6876. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6877. basically, they refer to the frame and field of the opposite parity:
  6878. @itemize
  6879. @item @var{p} matches the field of the opposite parity in the previous frame
  6880. @item @var{c} matches the field of the opposite parity in the current frame
  6881. @item @var{n} matches the field of the opposite parity in the next frame
  6882. @end itemize
  6883. @subsubsection u/b
  6884. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6885. from the opposite parity flag. In the following examples, we assume that we are
  6886. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6887. 'x' is placed above and below each matched fields.
  6888. With bottom matching (@option{field}=@var{bottom}):
  6889. @example
  6890. Match: c p n b u
  6891. x x x x x
  6892. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6893. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6894. x x x x x
  6895. Output frames:
  6896. 2 1 2 2 2
  6897. 2 2 2 1 3
  6898. @end example
  6899. With top matching (@option{field}=@var{top}):
  6900. @example
  6901. Match: c p n b u
  6902. x x x x x
  6903. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6904. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6905. x x x x x
  6906. Output frames:
  6907. 2 2 2 1 2
  6908. 2 1 3 2 2
  6909. @end example
  6910. @subsection Examples
  6911. Simple IVTC of a top field first telecined stream:
  6912. @example
  6913. fieldmatch=order=tff:combmatch=none, decimate
  6914. @end example
  6915. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6916. @example
  6917. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6918. @end example
  6919. @section fieldorder
  6920. Transform the field order of the input video.
  6921. It accepts the following parameters:
  6922. @table @option
  6923. @item order
  6924. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6925. for bottom field first.
  6926. @end table
  6927. The default value is @samp{tff}.
  6928. The transformation is done by shifting the picture content up or down
  6929. by one line, and filling the remaining line with appropriate picture content.
  6930. This method is consistent with most broadcast field order converters.
  6931. If the input video is not flagged as being interlaced, or it is already
  6932. flagged as being of the required output field order, then this filter does
  6933. not alter the incoming video.
  6934. It is very useful when converting to or from PAL DV material,
  6935. which is bottom field first.
  6936. For example:
  6937. @example
  6938. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6939. @end example
  6940. @section fifo, afifo
  6941. Buffer input images and send them when they are requested.
  6942. It is mainly useful when auto-inserted by the libavfilter
  6943. framework.
  6944. It does not take parameters.
  6945. @section fillborders
  6946. Fill borders of the input video, without changing video stream dimensions.
  6947. Sometimes video can have garbage at the four edges and you may not want to
  6948. crop video input to keep size multiple of some number.
  6949. This filter accepts the following options:
  6950. @table @option
  6951. @item left
  6952. Number of pixels to fill from left border.
  6953. @item right
  6954. Number of pixels to fill from right border.
  6955. @item top
  6956. Number of pixels to fill from top border.
  6957. @item bottom
  6958. Number of pixels to fill from bottom border.
  6959. @item mode
  6960. Set fill mode.
  6961. It accepts the following values:
  6962. @table @samp
  6963. @item smear
  6964. fill pixels using outermost pixels
  6965. @item mirror
  6966. fill pixels using mirroring
  6967. @item fixed
  6968. fill pixels with constant value
  6969. @end table
  6970. Default is @var{smear}.
  6971. @item color
  6972. Set color for pixels in fixed mode. Default is @var{black}.
  6973. @end table
  6974. @section find_rect
  6975. Find a rectangular object
  6976. It accepts the following options:
  6977. @table @option
  6978. @item object
  6979. Filepath of the object image, needs to be in gray8.
  6980. @item threshold
  6981. Detection threshold, default is 0.5.
  6982. @item mipmaps
  6983. Number of mipmaps, default is 3.
  6984. @item xmin, ymin, xmax, ymax
  6985. Specifies the rectangle in which to search.
  6986. @end table
  6987. @subsection Examples
  6988. @itemize
  6989. @item
  6990. Generate a representative palette of a given video using @command{ffmpeg}:
  6991. @example
  6992. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6993. @end example
  6994. @end itemize
  6995. @section cover_rect
  6996. Cover a rectangular object
  6997. It accepts the following options:
  6998. @table @option
  6999. @item cover
  7000. Filepath of the optional cover image, needs to be in yuv420.
  7001. @item mode
  7002. Set covering mode.
  7003. It accepts the following values:
  7004. @table @samp
  7005. @item cover
  7006. cover it by the supplied image
  7007. @item blur
  7008. cover it by interpolating the surrounding pixels
  7009. @end table
  7010. Default value is @var{blur}.
  7011. @end table
  7012. @subsection Examples
  7013. @itemize
  7014. @item
  7015. Generate a representative palette of a given video using @command{ffmpeg}:
  7016. @example
  7017. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7018. @end example
  7019. @end itemize
  7020. @section floodfill
  7021. Flood area with values of same pixel components with another values.
  7022. It accepts the following options:
  7023. @table @option
  7024. @item x
  7025. Set pixel x coordinate.
  7026. @item y
  7027. Set pixel y coordinate.
  7028. @item s0
  7029. Set source #0 component value.
  7030. @item s1
  7031. Set source #1 component value.
  7032. @item s2
  7033. Set source #2 component value.
  7034. @item s3
  7035. Set source #3 component value.
  7036. @item d0
  7037. Set destination #0 component value.
  7038. @item d1
  7039. Set destination #1 component value.
  7040. @item d2
  7041. Set destination #2 component value.
  7042. @item d3
  7043. Set destination #3 component value.
  7044. @end table
  7045. @anchor{format}
  7046. @section format
  7047. Convert the input video to one of the specified pixel formats.
  7048. Libavfilter will try to pick one that is suitable as input to
  7049. the next filter.
  7050. It accepts the following parameters:
  7051. @table @option
  7052. @item pix_fmts
  7053. A '|'-separated list of pixel format names, such as
  7054. "pix_fmts=yuv420p|monow|rgb24".
  7055. @end table
  7056. @subsection Examples
  7057. @itemize
  7058. @item
  7059. Convert the input video to the @var{yuv420p} format
  7060. @example
  7061. format=pix_fmts=yuv420p
  7062. @end example
  7063. Convert the input video to any of the formats in the list
  7064. @example
  7065. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7066. @end example
  7067. @end itemize
  7068. @anchor{fps}
  7069. @section fps
  7070. Convert the video to specified constant frame rate by duplicating or dropping
  7071. frames as necessary.
  7072. It accepts the following parameters:
  7073. @table @option
  7074. @item fps
  7075. The desired output frame rate. The default is @code{25}.
  7076. @item start_time
  7077. Assume the first PTS should be the given value, in seconds. This allows for
  7078. padding/trimming at the start of stream. By default, no assumption is made
  7079. about the first frame's expected PTS, so no padding or trimming is done.
  7080. For example, this could be set to 0 to pad the beginning with duplicates of
  7081. the first frame if a video stream starts after the audio stream or to trim any
  7082. frames with a negative PTS.
  7083. @item round
  7084. Timestamp (PTS) rounding method.
  7085. Possible values are:
  7086. @table @option
  7087. @item zero
  7088. round towards 0
  7089. @item inf
  7090. round away from 0
  7091. @item down
  7092. round towards -infinity
  7093. @item up
  7094. round towards +infinity
  7095. @item near
  7096. round to nearest
  7097. @end table
  7098. The default is @code{near}.
  7099. @item eof_action
  7100. Action performed when reading the last frame.
  7101. Possible values are:
  7102. @table @option
  7103. @item round
  7104. Use same timestamp rounding method as used for other frames.
  7105. @item pass
  7106. Pass through last frame if input duration has not been reached yet.
  7107. @end table
  7108. The default is @code{round}.
  7109. @end table
  7110. Alternatively, the options can be specified as a flat string:
  7111. @var{fps}[:@var{start_time}[:@var{round}]].
  7112. See also the @ref{setpts} filter.
  7113. @subsection Examples
  7114. @itemize
  7115. @item
  7116. A typical usage in order to set the fps to 25:
  7117. @example
  7118. fps=fps=25
  7119. @end example
  7120. @item
  7121. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7122. @example
  7123. fps=fps=film:round=near
  7124. @end example
  7125. @end itemize
  7126. @section framepack
  7127. Pack two different video streams into a stereoscopic video, setting proper
  7128. metadata on supported codecs. The two views should have the same size and
  7129. framerate and processing will stop when the shorter video ends. Please note
  7130. that you may conveniently adjust view properties with the @ref{scale} and
  7131. @ref{fps} filters.
  7132. It accepts the following parameters:
  7133. @table @option
  7134. @item format
  7135. The desired packing format. Supported values are:
  7136. @table @option
  7137. @item sbs
  7138. The views are next to each other (default).
  7139. @item tab
  7140. The views are on top of each other.
  7141. @item lines
  7142. The views are packed by line.
  7143. @item columns
  7144. The views are packed by column.
  7145. @item frameseq
  7146. The views are temporally interleaved.
  7147. @end table
  7148. @end table
  7149. Some examples:
  7150. @example
  7151. # Convert left and right views into a frame-sequential video
  7152. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7153. # Convert views into a side-by-side video with the same output resolution as the input
  7154. 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
  7155. @end example
  7156. @section framerate
  7157. Change the frame rate by interpolating new video output frames from the source
  7158. frames.
  7159. This filter is not designed to function correctly with interlaced media. If
  7160. you wish to change the frame rate of interlaced media then you are required
  7161. to deinterlace before this filter and re-interlace after this filter.
  7162. A description of the accepted options follows.
  7163. @table @option
  7164. @item fps
  7165. Specify the output frames per second. This option can also be specified
  7166. as a value alone. The default is @code{50}.
  7167. @item interp_start
  7168. Specify the start of a range where the output frame will be created as a
  7169. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7170. the default is @code{15}.
  7171. @item interp_end
  7172. Specify the end of a range where the output frame will be created as a
  7173. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7174. the default is @code{240}.
  7175. @item scene
  7176. Specify the level at which a scene change is detected as a value between
  7177. 0 and 100 to indicate a new scene; a low value reflects a low
  7178. probability for the current frame to introduce a new scene, while a higher
  7179. value means the current frame is more likely to be one.
  7180. The default is @code{8.2}.
  7181. @item flags
  7182. Specify flags influencing the filter process.
  7183. Available value for @var{flags} is:
  7184. @table @option
  7185. @item scene_change_detect, scd
  7186. Enable scene change detection using the value of the option @var{scene}.
  7187. This flag is enabled by default.
  7188. @end table
  7189. @end table
  7190. @section framestep
  7191. Select one frame every N-th frame.
  7192. This filter accepts the following option:
  7193. @table @option
  7194. @item step
  7195. Select frame after every @code{step} frames.
  7196. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7197. @end table
  7198. @anchor{frei0r}
  7199. @section frei0r
  7200. Apply a frei0r effect to the input video.
  7201. To enable the compilation of this filter, you need to install the frei0r
  7202. header and configure FFmpeg with @code{--enable-frei0r}.
  7203. It accepts the following parameters:
  7204. @table @option
  7205. @item filter_name
  7206. The name of the frei0r effect to load. If the environment variable
  7207. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7208. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7209. Otherwise, the standard frei0r paths are searched, in this order:
  7210. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7211. @file{/usr/lib/frei0r-1/}.
  7212. @item filter_params
  7213. A '|'-separated list of parameters to pass to the frei0r effect.
  7214. @end table
  7215. A frei0r effect parameter can be a boolean (its value is either
  7216. "y" or "n"), a double, a color (specified as
  7217. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7218. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7219. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7220. a position (specified as @var{X}/@var{Y}, where
  7221. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7222. The number and types of parameters depend on the loaded effect. If an
  7223. effect parameter is not specified, the default value is set.
  7224. @subsection Examples
  7225. @itemize
  7226. @item
  7227. Apply the distort0r effect, setting the first two double parameters:
  7228. @example
  7229. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7230. @end example
  7231. @item
  7232. Apply the colordistance effect, taking a color as the first parameter:
  7233. @example
  7234. frei0r=colordistance:0.2/0.3/0.4
  7235. frei0r=colordistance:violet
  7236. frei0r=colordistance:0x112233
  7237. @end example
  7238. @item
  7239. Apply the perspective effect, specifying the top left and top right image
  7240. positions:
  7241. @example
  7242. frei0r=perspective:0.2/0.2|0.8/0.2
  7243. @end example
  7244. @end itemize
  7245. For more information, see
  7246. @url{http://frei0r.dyne.org}
  7247. @section fspp
  7248. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7249. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7250. processing filter, one of them is performed once per block, not per pixel.
  7251. This allows for much higher speed.
  7252. The filter accepts the following options:
  7253. @table @option
  7254. @item quality
  7255. Set quality. This option defines the number of levels for averaging. It accepts
  7256. an integer in the range 4-5. Default value is @code{4}.
  7257. @item qp
  7258. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7259. If not set, the filter will use the QP from the video stream (if available).
  7260. @item strength
  7261. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7262. more details but also more artifacts, while higher values make the image smoother
  7263. but also blurrier. Default value is @code{0} − PSNR optimal.
  7264. @item use_bframe_qp
  7265. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7266. option may cause flicker since the B-Frames have often larger QP. Default is
  7267. @code{0} (not enabled).
  7268. @end table
  7269. @section gblur
  7270. Apply Gaussian blur filter.
  7271. The filter accepts the following options:
  7272. @table @option
  7273. @item sigma
  7274. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7275. @item steps
  7276. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7277. @item planes
  7278. Set which planes to filter. By default all planes are filtered.
  7279. @item sigmaV
  7280. Set vertical sigma, if negative it will be same as @code{sigma}.
  7281. Default is @code{-1}.
  7282. @end table
  7283. @section geq
  7284. The filter accepts the following options:
  7285. @table @option
  7286. @item lum_expr, lum
  7287. Set the luminance expression.
  7288. @item cb_expr, cb
  7289. Set the chrominance blue expression.
  7290. @item cr_expr, cr
  7291. Set the chrominance red expression.
  7292. @item alpha_expr, a
  7293. Set the alpha expression.
  7294. @item red_expr, r
  7295. Set the red expression.
  7296. @item green_expr, g
  7297. Set the green expression.
  7298. @item blue_expr, b
  7299. Set the blue expression.
  7300. @end table
  7301. The colorspace is selected according to the specified options. If one
  7302. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7303. options is specified, the filter will automatically select a YCbCr
  7304. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7305. @option{blue_expr} options is specified, it will select an RGB
  7306. colorspace.
  7307. If one of the chrominance expression is not defined, it falls back on the other
  7308. one. If no alpha expression is specified it will evaluate to opaque value.
  7309. If none of chrominance expressions are specified, they will evaluate
  7310. to the luminance expression.
  7311. The expressions can use the following variables and functions:
  7312. @table @option
  7313. @item N
  7314. The sequential number of the filtered frame, starting from @code{0}.
  7315. @item X
  7316. @item Y
  7317. The coordinates of the current sample.
  7318. @item W
  7319. @item H
  7320. The width and height of the image.
  7321. @item SW
  7322. @item SH
  7323. Width and height scale depending on the currently filtered plane. It is the
  7324. ratio between the corresponding luma plane number of pixels and the current
  7325. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7326. @code{0.5,0.5} for chroma planes.
  7327. @item T
  7328. Time of the current frame, expressed in seconds.
  7329. @item p(x, y)
  7330. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7331. plane.
  7332. @item lum(x, y)
  7333. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7334. plane.
  7335. @item cb(x, y)
  7336. Return the value of the pixel at location (@var{x},@var{y}) of the
  7337. blue-difference chroma plane. Return 0 if there is no such plane.
  7338. @item cr(x, y)
  7339. Return the value of the pixel at location (@var{x},@var{y}) of the
  7340. red-difference chroma plane. Return 0 if there is no such plane.
  7341. @item r(x, y)
  7342. @item g(x, y)
  7343. @item b(x, y)
  7344. Return the value of the pixel at location (@var{x},@var{y}) of the
  7345. red/green/blue component. Return 0 if there is no such component.
  7346. @item alpha(x, y)
  7347. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7348. plane. Return 0 if there is no such plane.
  7349. @end table
  7350. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7351. automatically clipped to the closer edge.
  7352. @subsection Examples
  7353. @itemize
  7354. @item
  7355. Flip the image horizontally:
  7356. @example
  7357. geq=p(W-X\,Y)
  7358. @end example
  7359. @item
  7360. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7361. wavelength of 100 pixels:
  7362. @example
  7363. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7364. @end example
  7365. @item
  7366. Generate a fancy enigmatic moving light:
  7367. @example
  7368. 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
  7369. @end example
  7370. @item
  7371. Generate a quick emboss effect:
  7372. @example
  7373. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7374. @end example
  7375. @item
  7376. Modify RGB components depending on pixel position:
  7377. @example
  7378. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7379. @end example
  7380. @item
  7381. Create a radial gradient that is the same size as the input (also see
  7382. the @ref{vignette} filter):
  7383. @example
  7384. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7385. @end example
  7386. @end itemize
  7387. @section gradfun
  7388. Fix the banding artifacts that are sometimes introduced into nearly flat
  7389. regions by truncation to 8-bit color depth.
  7390. Interpolate the gradients that should go where the bands are, and
  7391. dither them.
  7392. It is designed for playback only. Do not use it prior to
  7393. lossy compression, because compression tends to lose the dither and
  7394. bring back the bands.
  7395. It accepts the following parameters:
  7396. @table @option
  7397. @item strength
  7398. The maximum amount by which the filter will change any one pixel. This is also
  7399. the threshold for detecting nearly flat regions. Acceptable values range from
  7400. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7401. valid range.
  7402. @item radius
  7403. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7404. gradients, but also prevents the filter from modifying the pixels near detailed
  7405. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7406. values will be clipped to the valid range.
  7407. @end table
  7408. Alternatively, the options can be specified as a flat string:
  7409. @var{strength}[:@var{radius}]
  7410. @subsection Examples
  7411. @itemize
  7412. @item
  7413. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7414. @example
  7415. gradfun=3.5:8
  7416. @end example
  7417. @item
  7418. Specify radius, omitting the strength (which will fall-back to the default
  7419. value):
  7420. @example
  7421. gradfun=radius=8
  7422. @end example
  7423. @end itemize
  7424. @anchor{haldclut}
  7425. @section haldclut
  7426. Apply a Hald CLUT to a video stream.
  7427. First input is the video stream to process, and second one is the Hald CLUT.
  7428. The Hald CLUT input can be a simple picture or a complete video stream.
  7429. The filter accepts the following options:
  7430. @table @option
  7431. @item shortest
  7432. Force termination when the shortest input terminates. Default is @code{0}.
  7433. @item repeatlast
  7434. Continue applying the last CLUT after the end of the stream. A value of
  7435. @code{0} disable the filter after the last frame of the CLUT is reached.
  7436. Default is @code{1}.
  7437. @end table
  7438. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7439. filters share the same internals).
  7440. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7441. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7442. @subsection Workflow examples
  7443. @subsubsection Hald CLUT video stream
  7444. Generate an identity Hald CLUT stream altered with various effects:
  7445. @example
  7446. 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
  7447. @end example
  7448. Note: make sure you use a lossless codec.
  7449. Then use it with @code{haldclut} to apply it on some random stream:
  7450. @example
  7451. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7452. @end example
  7453. The Hald CLUT will be applied to the 10 first seconds (duration of
  7454. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7455. to the remaining frames of the @code{mandelbrot} stream.
  7456. @subsubsection Hald CLUT with preview
  7457. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7458. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7459. biggest possible square starting at the top left of the picture. The remaining
  7460. padding pixels (bottom or right) will be ignored. This area can be used to add
  7461. a preview of the Hald CLUT.
  7462. Typically, the following generated Hald CLUT will be supported by the
  7463. @code{haldclut} filter:
  7464. @example
  7465. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7466. pad=iw+320 [padded_clut];
  7467. smptebars=s=320x256, split [a][b];
  7468. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7469. [main][b] overlay=W-320" -frames:v 1 clut.png
  7470. @end example
  7471. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7472. bars are displayed on the right-top, and below the same color bars processed by
  7473. the color changes.
  7474. Then, the effect of this Hald CLUT can be visualized with:
  7475. @example
  7476. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7477. @end example
  7478. @section hflip
  7479. Flip the input video horizontally.
  7480. For example, to horizontally flip the input video with @command{ffmpeg}:
  7481. @example
  7482. ffmpeg -i in.avi -vf "hflip" out.avi
  7483. @end example
  7484. @section histeq
  7485. This filter applies a global color histogram equalization on a
  7486. per-frame basis.
  7487. It can be used to correct video that has a compressed range of pixel
  7488. intensities. The filter redistributes the pixel intensities to
  7489. equalize their distribution across the intensity range. It may be
  7490. viewed as an "automatically adjusting contrast filter". This filter is
  7491. useful only for correcting degraded or poorly captured source
  7492. video.
  7493. The filter accepts the following options:
  7494. @table @option
  7495. @item strength
  7496. Determine the amount of equalization to be applied. As the strength
  7497. is reduced, the distribution of pixel intensities more-and-more
  7498. approaches that of the input frame. The value must be a float number
  7499. in the range [0,1] and defaults to 0.200.
  7500. @item intensity
  7501. Set the maximum intensity that can generated and scale the output
  7502. values appropriately. The strength should be set as desired and then
  7503. the intensity can be limited if needed to avoid washing-out. The value
  7504. must be a float number in the range [0,1] and defaults to 0.210.
  7505. @item antibanding
  7506. Set the antibanding level. If enabled the filter will randomly vary
  7507. the luminance of output pixels by a small amount to avoid banding of
  7508. the histogram. Possible values are @code{none}, @code{weak} or
  7509. @code{strong}. It defaults to @code{none}.
  7510. @end table
  7511. @section histogram
  7512. Compute and draw a color distribution histogram for the input video.
  7513. The computed histogram is a representation of the color component
  7514. distribution in an image.
  7515. Standard histogram displays the color components distribution in an image.
  7516. Displays color graph for each color component. Shows distribution of
  7517. the Y, U, V, A or R, G, B components, depending on input format, in the
  7518. current frame. Below each graph a color component scale meter is shown.
  7519. The filter accepts the following options:
  7520. @table @option
  7521. @item level_height
  7522. Set height of level. Default value is @code{200}.
  7523. Allowed range is [50, 2048].
  7524. @item scale_height
  7525. Set height of color scale. Default value is @code{12}.
  7526. Allowed range is [0, 40].
  7527. @item display_mode
  7528. Set display mode.
  7529. It accepts the following values:
  7530. @table @samp
  7531. @item stack
  7532. Per color component graphs are placed below each other.
  7533. @item parade
  7534. Per color component graphs are placed side by side.
  7535. @item overlay
  7536. Presents information identical to that in the @code{parade}, except
  7537. that the graphs representing color components are superimposed directly
  7538. over one another.
  7539. @end table
  7540. Default is @code{stack}.
  7541. @item levels_mode
  7542. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7543. Default is @code{linear}.
  7544. @item components
  7545. Set what color components to display.
  7546. Default is @code{7}.
  7547. @item fgopacity
  7548. Set foreground opacity. Default is @code{0.7}.
  7549. @item bgopacity
  7550. Set background opacity. Default is @code{0.5}.
  7551. @end table
  7552. @subsection Examples
  7553. @itemize
  7554. @item
  7555. Calculate and draw histogram:
  7556. @example
  7557. ffplay -i input -vf histogram
  7558. @end example
  7559. @end itemize
  7560. @anchor{hqdn3d}
  7561. @section hqdn3d
  7562. This is a high precision/quality 3d denoise filter. It aims to reduce
  7563. image noise, producing smooth images and making still images really
  7564. still. It should enhance compressibility.
  7565. It accepts the following optional parameters:
  7566. @table @option
  7567. @item luma_spatial
  7568. A non-negative floating point number which specifies spatial luma strength.
  7569. It defaults to 4.0.
  7570. @item chroma_spatial
  7571. A non-negative floating point number which specifies spatial chroma strength.
  7572. It defaults to 3.0*@var{luma_spatial}/4.0.
  7573. @item luma_tmp
  7574. A floating point number which specifies luma temporal strength. It defaults to
  7575. 6.0*@var{luma_spatial}/4.0.
  7576. @item chroma_tmp
  7577. A floating point number which specifies chroma temporal strength. It defaults to
  7578. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7579. @end table
  7580. @section hwdownload
  7581. Download hardware frames to system memory.
  7582. The input must be in hardware frames, and the output a non-hardware format.
  7583. Not all formats will be supported on the output - it may be necessary to insert
  7584. an additional @option{format} filter immediately following in the graph to get
  7585. the output in a supported format.
  7586. @section hwmap
  7587. Map hardware frames to system memory or to another device.
  7588. This filter has several different modes of operation; which one is used depends
  7589. on the input and output formats:
  7590. @itemize
  7591. @item
  7592. Hardware frame input, normal frame output
  7593. Map the input frames to system memory and pass them to the output. If the
  7594. original hardware frame is later required (for example, after overlaying
  7595. something else on part of it), the @option{hwmap} filter can be used again
  7596. in the next mode to retrieve it.
  7597. @item
  7598. Normal frame input, hardware frame output
  7599. If the input is actually a software-mapped hardware frame, then unmap it -
  7600. that is, return the original hardware frame.
  7601. Otherwise, a device must be provided. Create new hardware surfaces on that
  7602. device for the output, then map them back to the software format at the input
  7603. and give those frames to the preceding filter. This will then act like the
  7604. @option{hwupload} filter, but may be able to avoid an additional copy when
  7605. the input is already in a compatible format.
  7606. @item
  7607. Hardware frame input and output
  7608. A device must be supplied for the output, either directly or with the
  7609. @option{derive_device} option. The input and output devices must be of
  7610. different types and compatible - the exact meaning of this is
  7611. system-dependent, but typically it means that they must refer to the same
  7612. underlying hardware context (for example, refer to the same graphics card).
  7613. If the input frames were originally created on the output device, then unmap
  7614. to retrieve the original frames.
  7615. Otherwise, map the frames to the output device - create new hardware frames
  7616. on the output corresponding to the frames on the input.
  7617. @end itemize
  7618. The following additional parameters are accepted:
  7619. @table @option
  7620. @item mode
  7621. Set the frame mapping mode. Some combination of:
  7622. @table @var
  7623. @item read
  7624. The mapped frame should be readable.
  7625. @item write
  7626. The mapped frame should be writeable.
  7627. @item overwrite
  7628. The mapping will always overwrite the entire frame.
  7629. This may improve performance in some cases, as the original contents of the
  7630. frame need not be loaded.
  7631. @item direct
  7632. The mapping must not involve any copying.
  7633. Indirect mappings to copies of frames are created in some cases where either
  7634. direct mapping is not possible or it would have unexpected properties.
  7635. Setting this flag ensures that the mapping is direct and will fail if that is
  7636. not possible.
  7637. @end table
  7638. Defaults to @var{read+write} if not specified.
  7639. @item derive_device @var{type}
  7640. Rather than using the device supplied at initialisation, instead derive a new
  7641. device of type @var{type} from the device the input frames exist on.
  7642. @item reverse
  7643. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7644. and map them back to the source. This may be necessary in some cases where
  7645. a mapping in one direction is required but only the opposite direction is
  7646. supported by the devices being used.
  7647. This option is dangerous - it may break the preceding filter in undefined
  7648. ways if there are any additional constraints on that filter's output.
  7649. Do not use it without fully understanding the implications of its use.
  7650. @end table
  7651. @section hwupload
  7652. Upload system memory frames to hardware surfaces.
  7653. The device to upload to must be supplied when the filter is initialised. If
  7654. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7655. option.
  7656. @anchor{hwupload_cuda}
  7657. @section hwupload_cuda
  7658. Upload system memory frames to a CUDA device.
  7659. It accepts the following optional parameters:
  7660. @table @option
  7661. @item device
  7662. The number of the CUDA device to use
  7663. @end table
  7664. @section hqx
  7665. Apply a high-quality magnification filter designed for pixel art. This filter
  7666. was originally created by Maxim Stepin.
  7667. It accepts the following option:
  7668. @table @option
  7669. @item n
  7670. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7671. @code{hq3x} and @code{4} for @code{hq4x}.
  7672. Default is @code{3}.
  7673. @end table
  7674. @section hstack
  7675. Stack input videos horizontally.
  7676. All streams must be of same pixel format and of same height.
  7677. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7678. to create same output.
  7679. The filter accept the following option:
  7680. @table @option
  7681. @item inputs
  7682. Set number of input streams. Default is 2.
  7683. @item shortest
  7684. If set to 1, force the output to terminate when the shortest input
  7685. terminates. Default value is 0.
  7686. @end table
  7687. @section hue
  7688. Modify the hue and/or the saturation of the input.
  7689. It accepts the following parameters:
  7690. @table @option
  7691. @item h
  7692. Specify the hue angle as a number of degrees. It accepts an expression,
  7693. and defaults to "0".
  7694. @item s
  7695. Specify the saturation in the [-10,10] range. It accepts an expression and
  7696. defaults to "1".
  7697. @item H
  7698. Specify the hue angle as a number of radians. It accepts an
  7699. expression, and defaults to "0".
  7700. @item b
  7701. Specify the brightness in the [-10,10] range. It accepts an expression and
  7702. defaults to "0".
  7703. @end table
  7704. @option{h} and @option{H} are mutually exclusive, and can't be
  7705. specified at the same time.
  7706. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7707. expressions containing the following constants:
  7708. @table @option
  7709. @item n
  7710. frame count of the input frame starting from 0
  7711. @item pts
  7712. presentation timestamp of the input frame expressed in time base units
  7713. @item r
  7714. frame rate of the input video, NAN if the input frame rate is unknown
  7715. @item t
  7716. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7717. @item tb
  7718. time base of the input video
  7719. @end table
  7720. @subsection Examples
  7721. @itemize
  7722. @item
  7723. Set the hue to 90 degrees and the saturation to 1.0:
  7724. @example
  7725. hue=h=90:s=1
  7726. @end example
  7727. @item
  7728. Same command but expressing the hue in radians:
  7729. @example
  7730. hue=H=PI/2:s=1
  7731. @end example
  7732. @item
  7733. Rotate hue and make the saturation swing between 0
  7734. and 2 over a period of 1 second:
  7735. @example
  7736. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7737. @end example
  7738. @item
  7739. Apply a 3 seconds saturation fade-in effect starting at 0:
  7740. @example
  7741. hue="s=min(t/3\,1)"
  7742. @end example
  7743. The general fade-in expression can be written as:
  7744. @example
  7745. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7746. @end example
  7747. @item
  7748. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7749. @example
  7750. hue="s=max(0\, min(1\, (8-t)/3))"
  7751. @end example
  7752. The general fade-out expression can be written as:
  7753. @example
  7754. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7755. @end example
  7756. @end itemize
  7757. @subsection Commands
  7758. This filter supports the following commands:
  7759. @table @option
  7760. @item b
  7761. @item s
  7762. @item h
  7763. @item H
  7764. Modify the hue and/or the saturation and/or brightness of the input video.
  7765. The command accepts the same syntax of the corresponding option.
  7766. If the specified expression is not valid, it is kept at its current
  7767. value.
  7768. @end table
  7769. @section hysteresis
  7770. Grow first stream into second stream by connecting components.
  7771. This makes it possible to build more robust edge masks.
  7772. This filter accepts the following options:
  7773. @table @option
  7774. @item planes
  7775. Set which planes will be processed as bitmap, unprocessed planes will be
  7776. copied from first stream.
  7777. By default value 0xf, all planes will be processed.
  7778. @item threshold
  7779. Set threshold which is used in filtering. If pixel component value is higher than
  7780. this value filter algorithm for connecting components is activated.
  7781. By default value is 0.
  7782. @end table
  7783. @section idet
  7784. Detect video interlacing type.
  7785. This filter tries to detect if the input frames are interlaced, progressive,
  7786. top or bottom field first. It will also try to detect fields that are
  7787. repeated between adjacent frames (a sign of telecine).
  7788. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7789. Multiple frame detection incorporates the classification history of previous frames.
  7790. The filter will log these metadata values:
  7791. @table @option
  7792. @item single.current_frame
  7793. Detected type of current frame using single-frame detection. One of:
  7794. ``tff'' (top field first), ``bff'' (bottom field first),
  7795. ``progressive'', or ``undetermined''
  7796. @item single.tff
  7797. Cumulative number of frames detected as top field first using single-frame detection.
  7798. @item multiple.tff
  7799. Cumulative number of frames detected as top field first using multiple-frame detection.
  7800. @item single.bff
  7801. Cumulative number of frames detected as bottom field first using single-frame detection.
  7802. @item multiple.current_frame
  7803. Detected type of current frame using multiple-frame detection. One of:
  7804. ``tff'' (top field first), ``bff'' (bottom field first),
  7805. ``progressive'', or ``undetermined''
  7806. @item multiple.bff
  7807. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7808. @item single.progressive
  7809. Cumulative number of frames detected as progressive using single-frame detection.
  7810. @item multiple.progressive
  7811. Cumulative number of frames detected as progressive using multiple-frame detection.
  7812. @item single.undetermined
  7813. Cumulative number of frames that could not be classified using single-frame detection.
  7814. @item multiple.undetermined
  7815. Cumulative number of frames that could not be classified using multiple-frame detection.
  7816. @item repeated.current_frame
  7817. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7818. @item repeated.neither
  7819. Cumulative number of frames with no repeated field.
  7820. @item repeated.top
  7821. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7822. @item repeated.bottom
  7823. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7824. @end table
  7825. The filter accepts the following options:
  7826. @table @option
  7827. @item intl_thres
  7828. Set interlacing threshold.
  7829. @item prog_thres
  7830. Set progressive threshold.
  7831. @item rep_thres
  7832. Threshold for repeated field detection.
  7833. @item half_life
  7834. Number of frames after which a given frame's contribution to the
  7835. statistics is halved (i.e., it contributes only 0.5 to its
  7836. classification). The default of 0 means that all frames seen are given
  7837. full weight of 1.0 forever.
  7838. @item analyze_interlaced_flag
  7839. When this is not 0 then idet will use the specified number of frames to determine
  7840. if the interlaced flag is accurate, it will not count undetermined frames.
  7841. If the flag is found to be accurate it will be used without any further
  7842. computations, if it is found to be inaccurate it will be cleared without any
  7843. further computations. This allows inserting the idet filter as a low computational
  7844. method to clean up the interlaced flag
  7845. @end table
  7846. @section il
  7847. Deinterleave or interleave fields.
  7848. This filter allows one to process interlaced images fields without
  7849. deinterlacing them. Deinterleaving splits the input frame into 2
  7850. fields (so called half pictures). Odd lines are moved to the top
  7851. half of the output image, even lines to the bottom half.
  7852. You can process (filter) them independently and then re-interleave them.
  7853. The filter accepts the following options:
  7854. @table @option
  7855. @item luma_mode, l
  7856. @item chroma_mode, c
  7857. @item alpha_mode, a
  7858. Available values for @var{luma_mode}, @var{chroma_mode} and
  7859. @var{alpha_mode} are:
  7860. @table @samp
  7861. @item none
  7862. Do nothing.
  7863. @item deinterleave, d
  7864. Deinterleave fields, placing one above the other.
  7865. @item interleave, i
  7866. Interleave fields. Reverse the effect of deinterleaving.
  7867. @end table
  7868. Default value is @code{none}.
  7869. @item luma_swap, ls
  7870. @item chroma_swap, cs
  7871. @item alpha_swap, as
  7872. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7873. @end table
  7874. @section inflate
  7875. Apply inflate effect to the video.
  7876. This filter replaces the pixel by the local(3x3) average by taking into account
  7877. only values higher than the pixel.
  7878. It accepts the following options:
  7879. @table @option
  7880. @item threshold0
  7881. @item threshold1
  7882. @item threshold2
  7883. @item threshold3
  7884. Limit the maximum change for each plane, default is 65535.
  7885. If 0, plane will remain unchanged.
  7886. @end table
  7887. @section interlace
  7888. Simple interlacing filter from progressive contents. This interleaves upper (or
  7889. lower) lines from odd frames with lower (or upper) lines from even frames,
  7890. halving the frame rate and preserving image height.
  7891. @example
  7892. Original Original New Frame
  7893. Frame 'j' Frame 'j+1' (tff)
  7894. ========== =========== ==================
  7895. Line 0 --------------------> Frame 'j' Line 0
  7896. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7897. Line 2 ---------------------> Frame 'j' Line 2
  7898. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7899. ... ... ...
  7900. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7901. @end example
  7902. It accepts the following optional parameters:
  7903. @table @option
  7904. @item scan
  7905. This determines whether the interlaced frame is taken from the even
  7906. (tff - default) or odd (bff) lines of the progressive frame.
  7907. @item lowpass
  7908. Vertical lowpass filter to avoid twitter interlacing and
  7909. reduce moire patterns.
  7910. @table @samp
  7911. @item 0, off
  7912. Disable vertical lowpass filter
  7913. @item 1, linear
  7914. Enable linear filter (default)
  7915. @item 2, complex
  7916. Enable complex filter. This will slightly less reduce twitter and moire
  7917. but better retain detail and subjective sharpness impression.
  7918. @end table
  7919. @end table
  7920. @section kerndeint
  7921. Deinterlace input video by applying Donald Graft's adaptive kernel
  7922. deinterling. Work on interlaced parts of a video to produce
  7923. progressive frames.
  7924. The description of the accepted parameters follows.
  7925. @table @option
  7926. @item thresh
  7927. Set the threshold which affects the filter's tolerance when
  7928. determining if a pixel line must be processed. It must be an integer
  7929. in the range [0,255] and defaults to 10. A value of 0 will result in
  7930. applying the process on every pixels.
  7931. @item map
  7932. Paint pixels exceeding the threshold value to white if set to 1.
  7933. Default is 0.
  7934. @item order
  7935. Set the fields order. Swap fields if set to 1, leave fields alone if
  7936. 0. Default is 0.
  7937. @item sharp
  7938. Enable additional sharpening if set to 1. Default is 0.
  7939. @item twoway
  7940. Enable twoway sharpening if set to 1. Default is 0.
  7941. @end table
  7942. @subsection Examples
  7943. @itemize
  7944. @item
  7945. Apply default values:
  7946. @example
  7947. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7948. @end example
  7949. @item
  7950. Enable additional sharpening:
  7951. @example
  7952. kerndeint=sharp=1
  7953. @end example
  7954. @item
  7955. Paint processed pixels in white:
  7956. @example
  7957. kerndeint=map=1
  7958. @end example
  7959. @end itemize
  7960. @section lenscorrection
  7961. Correct radial lens distortion
  7962. This filter can be used to correct for radial distortion as can result from the use
  7963. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7964. one can use tools available for example as part of opencv or simply trial-and-error.
  7965. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7966. and extract the k1 and k2 coefficients from the resulting matrix.
  7967. Note that effectively the same filter is available in the open-source tools Krita and
  7968. Digikam from the KDE project.
  7969. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7970. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7971. brightness distribution, so you may want to use both filters together in certain
  7972. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7973. be applied before or after lens correction.
  7974. @subsection Options
  7975. The filter accepts the following options:
  7976. @table @option
  7977. @item cx
  7978. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7979. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7980. width. Default is 0.5.
  7981. @item cy
  7982. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7983. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7984. height. Default is 0.5.
  7985. @item k1
  7986. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  7987. no correction. Default is 0.
  7988. @item k2
  7989. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  7990. 0 means no correction. Default is 0.
  7991. @end table
  7992. The formula that generates the correction is:
  7993. @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)
  7994. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7995. distances from the focal point in the source and target images, respectively.
  7996. @section libvmaf
  7997. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7998. score between two input videos.
  7999. The obtained VMAF score is printed through the logging system.
  8000. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8001. After installing the library it can be enabled using:
  8002. @code{./configure --enable-libvmaf}.
  8003. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8004. The filter has following options:
  8005. @table @option
  8006. @item model_path
  8007. Set the model path which is to be used for SVM.
  8008. Default value: @code{"vmaf_v0.6.1.pkl"}
  8009. @item log_path
  8010. Set the file path to be used to store logs.
  8011. @item log_fmt
  8012. Set the format of the log file (xml or json).
  8013. @item enable_transform
  8014. Enables transform for computing vmaf.
  8015. @item phone_model
  8016. Invokes the phone model which will generate VMAF scores higher than in the
  8017. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8018. @item psnr
  8019. Enables computing psnr along with vmaf.
  8020. @item ssim
  8021. Enables computing ssim along with vmaf.
  8022. @item ms_ssim
  8023. Enables computing ms_ssim along with vmaf.
  8024. @item pool
  8025. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8026. @end table
  8027. This filter also supports the @ref{framesync} options.
  8028. On the below examples the input file @file{main.mpg} being processed is
  8029. compared with the reference file @file{ref.mpg}.
  8030. @example
  8031. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8032. @end example
  8033. Example with options:
  8034. @example
  8035. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8036. @end example
  8037. @section limiter
  8038. Limits the pixel components values to the specified range [min, max].
  8039. The filter accepts the following options:
  8040. @table @option
  8041. @item min
  8042. Lower bound. Defaults to the lowest allowed value for the input.
  8043. @item max
  8044. Upper bound. Defaults to the highest allowed value for the input.
  8045. @item planes
  8046. Specify which planes will be processed. Defaults to all available.
  8047. @end table
  8048. @section loop
  8049. Loop video frames.
  8050. The filter accepts the following options:
  8051. @table @option
  8052. @item loop
  8053. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8054. Default is 0.
  8055. @item size
  8056. Set maximal size in number of frames. Default is 0.
  8057. @item start
  8058. Set first frame of loop. Default is 0.
  8059. @end table
  8060. @anchor{lut3d}
  8061. @section lut3d
  8062. Apply a 3D LUT to an input video.
  8063. The filter accepts the following options:
  8064. @table @option
  8065. @item file
  8066. Set the 3D LUT file name.
  8067. Currently supported formats:
  8068. @table @samp
  8069. @item 3dl
  8070. AfterEffects
  8071. @item cube
  8072. Iridas
  8073. @item dat
  8074. DaVinci
  8075. @item m3d
  8076. Pandora
  8077. @end table
  8078. @item interp
  8079. Select interpolation mode.
  8080. Available values are:
  8081. @table @samp
  8082. @item nearest
  8083. Use values from the nearest defined point.
  8084. @item trilinear
  8085. Interpolate values using the 8 points defining a cube.
  8086. @item tetrahedral
  8087. Interpolate values using a tetrahedron.
  8088. @end table
  8089. @end table
  8090. This filter also supports the @ref{framesync} options.
  8091. @section lumakey
  8092. Turn certain luma values into transparency.
  8093. The filter accepts the following options:
  8094. @table @option
  8095. @item threshold
  8096. Set the luma which will be used as base for transparency.
  8097. Default value is @code{0}.
  8098. @item tolerance
  8099. Set the range of luma values to be keyed out.
  8100. Default value is @code{0}.
  8101. @item softness
  8102. Set the range of softness. Default value is @code{0}.
  8103. Use this to control gradual transition from zero to full transparency.
  8104. @end table
  8105. @section lut, lutrgb, lutyuv
  8106. Compute a look-up table for binding each pixel component input value
  8107. to an output value, and apply it to the input video.
  8108. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8109. to an RGB input video.
  8110. These filters accept the following parameters:
  8111. @table @option
  8112. @item c0
  8113. set first pixel component expression
  8114. @item c1
  8115. set second pixel component expression
  8116. @item c2
  8117. set third pixel component expression
  8118. @item c3
  8119. set fourth pixel component expression, corresponds to the alpha component
  8120. @item r
  8121. set red component expression
  8122. @item g
  8123. set green component expression
  8124. @item b
  8125. set blue component expression
  8126. @item a
  8127. alpha component expression
  8128. @item y
  8129. set Y/luminance component expression
  8130. @item u
  8131. set U/Cb component expression
  8132. @item v
  8133. set V/Cr component expression
  8134. @end table
  8135. Each of them specifies the expression to use for computing the lookup table for
  8136. the corresponding pixel component values.
  8137. The exact component associated to each of the @var{c*} options depends on the
  8138. format in input.
  8139. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8140. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8141. The expressions can contain the following constants and functions:
  8142. @table @option
  8143. @item w
  8144. @item h
  8145. The input width and height.
  8146. @item val
  8147. The input value for the pixel component.
  8148. @item clipval
  8149. The input value, clipped to the @var{minval}-@var{maxval} range.
  8150. @item maxval
  8151. The maximum value for the pixel component.
  8152. @item minval
  8153. The minimum value for the pixel component.
  8154. @item negval
  8155. The negated value for the pixel component value, clipped to the
  8156. @var{minval}-@var{maxval} range; it corresponds to the expression
  8157. "maxval-clipval+minval".
  8158. @item clip(val)
  8159. The computed value in @var{val}, clipped to the
  8160. @var{minval}-@var{maxval} range.
  8161. @item gammaval(gamma)
  8162. The computed gamma correction value of the pixel component value,
  8163. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8164. expression
  8165. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8166. @end table
  8167. All expressions default to "val".
  8168. @subsection Examples
  8169. @itemize
  8170. @item
  8171. Negate input video:
  8172. @example
  8173. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8174. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8175. @end example
  8176. The above is the same as:
  8177. @example
  8178. lutrgb="r=negval:g=negval:b=negval"
  8179. lutyuv="y=negval:u=negval:v=negval"
  8180. @end example
  8181. @item
  8182. Negate luminance:
  8183. @example
  8184. lutyuv=y=negval
  8185. @end example
  8186. @item
  8187. Remove chroma components, turning the video into a graytone image:
  8188. @example
  8189. lutyuv="u=128:v=128"
  8190. @end example
  8191. @item
  8192. Apply a luma burning effect:
  8193. @example
  8194. lutyuv="y=2*val"
  8195. @end example
  8196. @item
  8197. Remove green and blue components:
  8198. @example
  8199. lutrgb="g=0:b=0"
  8200. @end example
  8201. @item
  8202. Set a constant alpha channel value on input:
  8203. @example
  8204. format=rgba,lutrgb=a="maxval-minval/2"
  8205. @end example
  8206. @item
  8207. Correct luminance gamma by a factor of 0.5:
  8208. @example
  8209. lutyuv=y=gammaval(0.5)
  8210. @end example
  8211. @item
  8212. Discard least significant bits of luma:
  8213. @example
  8214. lutyuv=y='bitand(val, 128+64+32)'
  8215. @end example
  8216. @item
  8217. Technicolor like effect:
  8218. @example
  8219. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8220. @end example
  8221. @end itemize
  8222. @section lut2, tlut2
  8223. The @code{lut2} filter takes two input streams and outputs one
  8224. stream.
  8225. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8226. from one single stream.
  8227. This filter accepts the following parameters:
  8228. @table @option
  8229. @item c0
  8230. set first pixel component expression
  8231. @item c1
  8232. set second pixel component expression
  8233. @item c2
  8234. set third pixel component expression
  8235. @item c3
  8236. set fourth pixel component expression, corresponds to the alpha component
  8237. @end table
  8238. Each of them specifies the expression to use for computing the lookup table for
  8239. the corresponding pixel component values.
  8240. The exact component associated to each of the @var{c*} options depends on the
  8241. format in inputs.
  8242. The expressions can contain the following constants:
  8243. @table @option
  8244. @item w
  8245. @item h
  8246. The input width and height.
  8247. @item x
  8248. The first input value for the pixel component.
  8249. @item y
  8250. The second input value for the pixel component.
  8251. @item bdx
  8252. The first input video bit depth.
  8253. @item bdy
  8254. The second input video bit depth.
  8255. @end table
  8256. All expressions default to "x".
  8257. @subsection Examples
  8258. @itemize
  8259. @item
  8260. Highlight differences between two RGB video streams:
  8261. @example
  8262. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  8263. @end example
  8264. @item
  8265. Highlight differences between two YUV video streams:
  8266. @example
  8267. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  8268. @end example
  8269. @item
  8270. Show max difference between two video streams:
  8271. @example
  8272. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  8273. @end example
  8274. @end itemize
  8275. @section maskedclamp
  8276. Clamp the first input stream with the second input and third input stream.
  8277. Returns the value of first stream to be between second input
  8278. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8279. This filter accepts the following options:
  8280. @table @option
  8281. @item undershoot
  8282. Default value is @code{0}.
  8283. @item overshoot
  8284. Default value is @code{0}.
  8285. @item planes
  8286. Set which planes will be processed as bitmap, unprocessed planes will be
  8287. copied from first stream.
  8288. By default value 0xf, all planes will be processed.
  8289. @end table
  8290. @section maskedmerge
  8291. Merge the first input stream with the second input stream using per pixel
  8292. weights in the third input stream.
  8293. A value of 0 in the third stream pixel component means that pixel component
  8294. from first stream is returned unchanged, while maximum value (eg. 255 for
  8295. 8-bit videos) means that pixel component from second stream is returned
  8296. unchanged. Intermediate values define the amount of merging between both
  8297. input stream's pixel components.
  8298. This filter accepts the following options:
  8299. @table @option
  8300. @item planes
  8301. Set which planes will be processed as bitmap, unprocessed planes will be
  8302. copied from first stream.
  8303. By default value 0xf, all planes will be processed.
  8304. @end table
  8305. @section mcdeint
  8306. Apply motion-compensation deinterlacing.
  8307. It needs one field per frame as input and must thus be used together
  8308. with yadif=1/3 or equivalent.
  8309. This filter accepts the following options:
  8310. @table @option
  8311. @item mode
  8312. Set the deinterlacing mode.
  8313. It accepts one of the following values:
  8314. @table @samp
  8315. @item fast
  8316. @item medium
  8317. @item slow
  8318. use iterative motion estimation
  8319. @item extra_slow
  8320. like @samp{slow}, but use multiple reference frames.
  8321. @end table
  8322. Default value is @samp{fast}.
  8323. @item parity
  8324. Set the picture field parity assumed for the input video. It must be
  8325. one of the following values:
  8326. @table @samp
  8327. @item 0, tff
  8328. assume top field first
  8329. @item 1, bff
  8330. assume bottom field first
  8331. @end table
  8332. Default value is @samp{bff}.
  8333. @item qp
  8334. Set per-block quantization parameter (QP) used by the internal
  8335. encoder.
  8336. Higher values should result in a smoother motion vector field but less
  8337. optimal individual vectors. Default value is 1.
  8338. @end table
  8339. @section mergeplanes
  8340. Merge color channel components from several video streams.
  8341. The filter accepts up to 4 input streams, and merge selected input
  8342. planes to the output video.
  8343. This filter accepts the following options:
  8344. @table @option
  8345. @item mapping
  8346. Set input to output plane mapping. Default is @code{0}.
  8347. The mappings is specified as a bitmap. It should be specified as a
  8348. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8349. mapping for the first plane of the output stream. 'A' sets the number of
  8350. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8351. corresponding input to use (from 0 to 3). The rest of the mappings is
  8352. similar, 'Bb' describes the mapping for the output stream second
  8353. plane, 'Cc' describes the mapping for the output stream third plane and
  8354. 'Dd' describes the mapping for the output stream fourth plane.
  8355. @item format
  8356. Set output pixel format. Default is @code{yuva444p}.
  8357. @end table
  8358. @subsection Examples
  8359. @itemize
  8360. @item
  8361. Merge three gray video streams of same width and height into single video stream:
  8362. @example
  8363. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8364. @end example
  8365. @item
  8366. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8367. @example
  8368. [a0][a1]mergeplanes=0x00010210:yuva444p
  8369. @end example
  8370. @item
  8371. Swap Y and A plane in yuva444p stream:
  8372. @example
  8373. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8374. @end example
  8375. @item
  8376. Swap U and V plane in yuv420p stream:
  8377. @example
  8378. format=yuv420p,mergeplanes=0x000201:yuv420p
  8379. @end example
  8380. @item
  8381. Cast a rgb24 clip to yuv444p:
  8382. @example
  8383. format=rgb24,mergeplanes=0x000102:yuv444p
  8384. @end example
  8385. @end itemize
  8386. @section mestimate
  8387. Estimate and export motion vectors using block matching algorithms.
  8388. Motion vectors are stored in frame side data to be used by other filters.
  8389. This filter accepts the following options:
  8390. @table @option
  8391. @item method
  8392. Specify the motion estimation method. Accepts one of the following values:
  8393. @table @samp
  8394. @item esa
  8395. Exhaustive search algorithm.
  8396. @item tss
  8397. Three step search algorithm.
  8398. @item tdls
  8399. Two dimensional logarithmic search algorithm.
  8400. @item ntss
  8401. New three step search algorithm.
  8402. @item fss
  8403. Four step search algorithm.
  8404. @item ds
  8405. Diamond search algorithm.
  8406. @item hexbs
  8407. Hexagon-based search algorithm.
  8408. @item epzs
  8409. Enhanced predictive zonal search algorithm.
  8410. @item umh
  8411. Uneven multi-hexagon search algorithm.
  8412. @end table
  8413. Default value is @samp{esa}.
  8414. @item mb_size
  8415. Macroblock size. Default @code{16}.
  8416. @item search_param
  8417. Search parameter. Default @code{7}.
  8418. @end table
  8419. @section midequalizer
  8420. Apply Midway Image Equalization effect using two video streams.
  8421. Midway Image Equalization adjusts a pair of images to have the same
  8422. histogram, while maintaining their dynamics as much as possible. It's
  8423. useful for e.g. matching exposures from a pair of stereo cameras.
  8424. This filter has two inputs and one output, which must be of same pixel format, but
  8425. may be of different sizes. The output of filter is first input adjusted with
  8426. midway histogram of both inputs.
  8427. This filter accepts the following option:
  8428. @table @option
  8429. @item planes
  8430. Set which planes to process. Default is @code{15}, which is all available planes.
  8431. @end table
  8432. @section minterpolate
  8433. Convert the video to specified frame rate using motion interpolation.
  8434. This filter accepts the following options:
  8435. @table @option
  8436. @item fps
  8437. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  8438. @item mi_mode
  8439. Motion interpolation mode. Following values are accepted:
  8440. @table @samp
  8441. @item dup
  8442. Duplicate previous or next frame for interpolating new ones.
  8443. @item blend
  8444. Blend source frames. Interpolated frame is mean of previous and next frames.
  8445. @item mci
  8446. Motion compensated interpolation. Following options are effective when this mode is selected:
  8447. @table @samp
  8448. @item mc_mode
  8449. Motion compensation mode. Following values are accepted:
  8450. @table @samp
  8451. @item obmc
  8452. Overlapped block motion compensation.
  8453. @item aobmc
  8454. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8455. @end table
  8456. Default mode is @samp{obmc}.
  8457. @item me_mode
  8458. Motion estimation mode. Following values are accepted:
  8459. @table @samp
  8460. @item bidir
  8461. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8462. @item bilat
  8463. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8464. @end table
  8465. Default mode is @samp{bilat}.
  8466. @item me
  8467. The algorithm to be used for motion estimation. Following values are accepted:
  8468. @table @samp
  8469. @item esa
  8470. Exhaustive search algorithm.
  8471. @item tss
  8472. Three step search algorithm.
  8473. @item tdls
  8474. Two dimensional logarithmic search algorithm.
  8475. @item ntss
  8476. New three step search algorithm.
  8477. @item fss
  8478. Four step search algorithm.
  8479. @item ds
  8480. Diamond search algorithm.
  8481. @item hexbs
  8482. Hexagon-based search algorithm.
  8483. @item epzs
  8484. Enhanced predictive zonal search algorithm.
  8485. @item umh
  8486. Uneven multi-hexagon search algorithm.
  8487. @end table
  8488. Default algorithm is @samp{epzs}.
  8489. @item mb_size
  8490. Macroblock size. Default @code{16}.
  8491. @item search_param
  8492. Motion estimation search parameter. Default @code{32}.
  8493. @item vsbmc
  8494. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  8495. @end table
  8496. @end table
  8497. @item scd
  8498. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  8499. @table @samp
  8500. @item none
  8501. Disable scene change detection.
  8502. @item fdiff
  8503. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8504. @end table
  8505. Default method is @samp{fdiff}.
  8506. @item scd_threshold
  8507. Scene change detection threshold. Default is @code{5.0}.
  8508. @end table
  8509. @section mix
  8510. Mix several video input streams into one video stream.
  8511. A description of the accepted options follows.
  8512. @table @option
  8513. @item nb_inputs
  8514. The number of inputs. If unspecified, it defaults to 2.
  8515. @item weights
  8516. Specify weight of each input video stream as sequence.
  8517. Each weight is separated by space.
  8518. @item duration
  8519. Specify how end of stream is determined.
  8520. @table @samp
  8521. @item longest
  8522. The duration of the longest input. (default)
  8523. @item shortest
  8524. The duration of the shortest input.
  8525. @item first
  8526. The duration of the first input.
  8527. @end table
  8528. @end table
  8529. @section mpdecimate
  8530. Drop frames that do not differ greatly from the previous frame in
  8531. order to reduce frame rate.
  8532. The main use of this filter is for very-low-bitrate encoding
  8533. (e.g. streaming over dialup modem), but it could in theory be used for
  8534. fixing movies that were inverse-telecined incorrectly.
  8535. A description of the accepted options follows.
  8536. @table @option
  8537. @item max
  8538. Set the maximum number of consecutive frames which can be dropped (if
  8539. positive), or the minimum interval between dropped frames (if
  8540. negative). If the value is 0, the frame is dropped disregarding the
  8541. number of previous sequentially dropped frames.
  8542. Default value is 0.
  8543. @item hi
  8544. @item lo
  8545. @item frac
  8546. Set the dropping threshold values.
  8547. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8548. represent actual pixel value differences, so a threshold of 64
  8549. corresponds to 1 unit of difference for each pixel, or the same spread
  8550. out differently over the block.
  8551. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8552. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8553. meaning the whole image) differ by more than a threshold of @option{lo}.
  8554. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8555. 64*5, and default value for @option{frac} is 0.33.
  8556. @end table
  8557. @section negate
  8558. Negate input video.
  8559. It accepts an integer in input; if non-zero it negates the
  8560. alpha component (if available). The default value in input is 0.
  8561. @section nlmeans
  8562. Denoise frames using Non-Local Means algorithm.
  8563. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8564. context similarity is defined by comparing their surrounding patches of size
  8565. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8566. around the pixel.
  8567. Note that the research area defines centers for patches, which means some
  8568. patches will be made of pixels outside that research area.
  8569. The filter accepts the following options.
  8570. @table @option
  8571. @item s
  8572. Set denoising strength.
  8573. @item p
  8574. Set patch size.
  8575. @item pc
  8576. Same as @option{p} but for chroma planes.
  8577. The default value is @var{0} and means automatic.
  8578. @item r
  8579. Set research size.
  8580. @item rc
  8581. Same as @option{r} but for chroma planes.
  8582. The default value is @var{0} and means automatic.
  8583. @end table
  8584. @section nnedi
  8585. Deinterlace video using neural network edge directed interpolation.
  8586. This filter accepts the following options:
  8587. @table @option
  8588. @item weights
  8589. Mandatory option, without binary file filter can not work.
  8590. Currently file can be found here:
  8591. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8592. @item deint
  8593. Set which frames to deinterlace, by default it is @code{all}.
  8594. Can be @code{all} or @code{interlaced}.
  8595. @item field
  8596. Set mode of operation.
  8597. Can be one of the following:
  8598. @table @samp
  8599. @item af
  8600. Use frame flags, both fields.
  8601. @item a
  8602. Use frame flags, single field.
  8603. @item t
  8604. Use top field only.
  8605. @item b
  8606. Use bottom field only.
  8607. @item tf
  8608. Use both fields, top first.
  8609. @item bf
  8610. Use both fields, bottom first.
  8611. @end table
  8612. @item planes
  8613. Set which planes to process, by default filter process all frames.
  8614. @item nsize
  8615. Set size of local neighborhood around each pixel, used by the predictor neural
  8616. network.
  8617. Can be one of the following:
  8618. @table @samp
  8619. @item s8x6
  8620. @item s16x6
  8621. @item s32x6
  8622. @item s48x6
  8623. @item s8x4
  8624. @item s16x4
  8625. @item s32x4
  8626. @end table
  8627. @item nns
  8628. Set the number of neurons in predictor neural network.
  8629. Can be one of the following:
  8630. @table @samp
  8631. @item n16
  8632. @item n32
  8633. @item n64
  8634. @item n128
  8635. @item n256
  8636. @end table
  8637. @item qual
  8638. Controls the number of different neural network predictions that are blended
  8639. together to compute the final output value. Can be @code{fast}, default or
  8640. @code{slow}.
  8641. @item etype
  8642. Set which set of weights to use in the predictor.
  8643. Can be one of the following:
  8644. @table @samp
  8645. @item a
  8646. weights trained to minimize absolute error
  8647. @item s
  8648. weights trained to minimize squared error
  8649. @end table
  8650. @item pscrn
  8651. Controls whether or not the prescreener neural network is used to decide
  8652. which pixels should be processed by the predictor neural network and which
  8653. can be handled by simple cubic interpolation.
  8654. The prescreener is trained to know whether cubic interpolation will be
  8655. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8656. The computational complexity of the prescreener nn is much less than that of
  8657. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8658. using the prescreener generally results in much faster processing.
  8659. The prescreener is pretty accurate, so the difference between using it and not
  8660. using it is almost always unnoticeable.
  8661. Can be one of the following:
  8662. @table @samp
  8663. @item none
  8664. @item original
  8665. @item new
  8666. @end table
  8667. Default is @code{new}.
  8668. @item fapprox
  8669. Set various debugging flags.
  8670. @end table
  8671. @section noformat
  8672. Force libavfilter not to use any of the specified pixel formats for the
  8673. input to the next filter.
  8674. It accepts the following parameters:
  8675. @table @option
  8676. @item pix_fmts
  8677. A '|'-separated list of pixel format names, such as
  8678. pix_fmts=yuv420p|monow|rgb24".
  8679. @end table
  8680. @subsection Examples
  8681. @itemize
  8682. @item
  8683. Force libavfilter to use a format different from @var{yuv420p} for the
  8684. input to the vflip filter:
  8685. @example
  8686. noformat=pix_fmts=yuv420p,vflip
  8687. @end example
  8688. @item
  8689. Convert the input video to any of the formats not contained in the list:
  8690. @example
  8691. noformat=yuv420p|yuv444p|yuv410p
  8692. @end example
  8693. @end itemize
  8694. @section noise
  8695. Add noise on video input frame.
  8696. The filter accepts the following options:
  8697. @table @option
  8698. @item all_seed
  8699. @item c0_seed
  8700. @item c1_seed
  8701. @item c2_seed
  8702. @item c3_seed
  8703. Set noise seed for specific pixel component or all pixel components in case
  8704. of @var{all_seed}. Default value is @code{123457}.
  8705. @item all_strength, alls
  8706. @item c0_strength, c0s
  8707. @item c1_strength, c1s
  8708. @item c2_strength, c2s
  8709. @item c3_strength, c3s
  8710. Set noise strength for specific pixel component or all pixel components in case
  8711. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8712. @item all_flags, allf
  8713. @item c0_flags, c0f
  8714. @item c1_flags, c1f
  8715. @item c2_flags, c2f
  8716. @item c3_flags, c3f
  8717. Set pixel component flags or set flags for all components if @var{all_flags}.
  8718. Available values for component flags are:
  8719. @table @samp
  8720. @item a
  8721. averaged temporal noise (smoother)
  8722. @item p
  8723. mix random noise with a (semi)regular pattern
  8724. @item t
  8725. temporal noise (noise pattern changes between frames)
  8726. @item u
  8727. uniform noise (gaussian otherwise)
  8728. @end table
  8729. @end table
  8730. @subsection Examples
  8731. Add temporal and uniform noise to input video:
  8732. @example
  8733. noise=alls=20:allf=t+u
  8734. @end example
  8735. @section normalize
  8736. Normalize RGB video (aka histogram stretching, contrast stretching).
  8737. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8738. For each channel of each frame, the filter computes the input range and maps
  8739. it linearly to the user-specified output range. The output range defaults
  8740. to the full dynamic range from pure black to pure white.
  8741. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8742. changes in brightness) caused when small dark or bright objects enter or leave
  8743. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8744. video camera, and, like a video camera, it may cause a period of over- or
  8745. under-exposure of the video.
  8746. The R,G,B channels can be normalized independently, which may cause some
  8747. color shifting, or linked together as a single channel, which prevents
  8748. color shifting. Linked normalization preserves hue. Independent normalization
  8749. does not, so it can be used to remove some color casts. Independent and linked
  8750. normalization can be combined in any ratio.
  8751. The normalize filter accepts the following options:
  8752. @table @option
  8753. @item blackpt
  8754. @item whitept
  8755. Colors which define the output range. The minimum input value is mapped to
  8756. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8757. The defaults are black and white respectively. Specifying white for
  8758. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8759. normalized video. Shades of grey can be used to reduce the dynamic range
  8760. (contrast). Specifying saturated colors here can create some interesting
  8761. effects.
  8762. @item smoothing
  8763. The number of previous frames to use for temporal smoothing. The input range
  8764. of each channel is smoothed using a rolling average over the current frame
  8765. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8766. smoothing).
  8767. @item independence
  8768. Controls the ratio of independent (color shifting) channel normalization to
  8769. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8770. independent. Defaults to 1.0 (fully independent).
  8771. @item strength
  8772. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8773. expensive no-op. Defaults to 1.0 (full strength).
  8774. @end table
  8775. @subsection Examples
  8776. Stretch video contrast to use the full dynamic range, with no temporal
  8777. smoothing; may flicker depending on the source content:
  8778. @example
  8779. normalize=blackpt=black:whitept=white:smoothing=0
  8780. @end example
  8781. As above, but with 50 frames of temporal smoothing; flicker should be
  8782. reduced, depending on the source content:
  8783. @example
  8784. normalize=blackpt=black:whitept=white:smoothing=50
  8785. @end example
  8786. As above, but with hue-preserving linked channel normalization:
  8787. @example
  8788. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8789. @end example
  8790. As above, but with half strength:
  8791. @example
  8792. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8793. @end example
  8794. Map the darkest input color to red, the brightest input color to cyan:
  8795. @example
  8796. normalize=blackpt=red:whitept=cyan
  8797. @end example
  8798. @section null
  8799. Pass the video source unchanged to the output.
  8800. @section ocr
  8801. Optical Character Recognition
  8802. This filter uses Tesseract for optical character recognition.
  8803. It accepts the following options:
  8804. @table @option
  8805. @item datapath
  8806. Set datapath to tesseract data. Default is to use whatever was
  8807. set at installation.
  8808. @item language
  8809. Set language, default is "eng".
  8810. @item whitelist
  8811. Set character whitelist.
  8812. @item blacklist
  8813. Set character blacklist.
  8814. @end table
  8815. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8816. @section ocv
  8817. Apply a video transform using libopencv.
  8818. To enable this filter, install the libopencv library and headers and
  8819. configure FFmpeg with @code{--enable-libopencv}.
  8820. It accepts the following parameters:
  8821. @table @option
  8822. @item filter_name
  8823. The name of the libopencv filter to apply.
  8824. @item filter_params
  8825. The parameters to pass to the libopencv filter. If not specified, the default
  8826. values are assumed.
  8827. @end table
  8828. Refer to the official libopencv documentation for more precise
  8829. information:
  8830. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8831. Several libopencv filters are supported; see the following subsections.
  8832. @anchor{dilate}
  8833. @subsection dilate
  8834. Dilate an image by using a specific structuring element.
  8835. It corresponds to the libopencv function @code{cvDilate}.
  8836. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8837. @var{struct_el} represents a structuring element, and has the syntax:
  8838. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8839. @var{cols} and @var{rows} represent the number of columns and rows of
  8840. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8841. point, and @var{shape} the shape for the structuring element. @var{shape}
  8842. must be "rect", "cross", "ellipse", or "custom".
  8843. If the value for @var{shape} is "custom", it must be followed by a
  8844. string of the form "=@var{filename}". The file with name
  8845. @var{filename} is assumed to represent a binary image, with each
  8846. printable character corresponding to a bright pixel. When a custom
  8847. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8848. or columns and rows of the read file are assumed instead.
  8849. The default value for @var{struct_el} is "3x3+0x0/rect".
  8850. @var{nb_iterations} specifies the number of times the transform is
  8851. applied to the image, and defaults to 1.
  8852. Some examples:
  8853. @example
  8854. # Use the default values
  8855. ocv=dilate
  8856. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8857. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8858. # Read the shape from the file diamond.shape, iterating two times.
  8859. # The file diamond.shape may contain a pattern of characters like this
  8860. # *
  8861. # ***
  8862. # *****
  8863. # ***
  8864. # *
  8865. # The specified columns and rows are ignored
  8866. # but the anchor point coordinates are not
  8867. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8868. @end example
  8869. @subsection erode
  8870. Erode an image by using a specific structuring element.
  8871. It corresponds to the libopencv function @code{cvErode}.
  8872. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8873. with the same syntax and semantics as the @ref{dilate} filter.
  8874. @subsection smooth
  8875. Smooth the input video.
  8876. The filter takes the following parameters:
  8877. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8878. @var{type} is the type of smooth filter to apply, and must be one of
  8879. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8880. or "bilateral". The default value is "gaussian".
  8881. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8882. depend on the smooth type. @var{param1} and
  8883. @var{param2} accept integer positive values or 0. @var{param3} and
  8884. @var{param4} accept floating point values.
  8885. The default value for @var{param1} is 3. The default value for the
  8886. other parameters is 0.
  8887. These parameters correspond to the parameters assigned to the
  8888. libopencv function @code{cvSmooth}.
  8889. @section oscilloscope
  8890. 2D Video Oscilloscope.
  8891. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8892. It accepts the following parameters:
  8893. @table @option
  8894. @item x
  8895. Set scope center x position.
  8896. @item y
  8897. Set scope center y position.
  8898. @item s
  8899. Set scope size, relative to frame diagonal.
  8900. @item t
  8901. Set scope tilt/rotation.
  8902. @item o
  8903. Set trace opacity.
  8904. @item tx
  8905. Set trace center x position.
  8906. @item ty
  8907. Set trace center y position.
  8908. @item tw
  8909. Set trace width, relative to width of frame.
  8910. @item th
  8911. Set trace height, relative to height of frame.
  8912. @item c
  8913. Set which components to trace. By default it traces first three components.
  8914. @item g
  8915. Draw trace grid. By default is enabled.
  8916. @item st
  8917. Draw some statistics. By default is enabled.
  8918. @item sc
  8919. Draw scope. By default is enabled.
  8920. @end table
  8921. @subsection Examples
  8922. @itemize
  8923. @item
  8924. Inspect full first row of video frame.
  8925. @example
  8926. oscilloscope=x=0.5:y=0:s=1
  8927. @end example
  8928. @item
  8929. Inspect full last row of video frame.
  8930. @example
  8931. oscilloscope=x=0.5:y=1:s=1
  8932. @end example
  8933. @item
  8934. Inspect full 5th line of video frame of height 1080.
  8935. @example
  8936. oscilloscope=x=0.5:y=5/1080:s=1
  8937. @end example
  8938. @item
  8939. Inspect full last column of video frame.
  8940. @example
  8941. oscilloscope=x=1:y=0.5:s=1:t=1
  8942. @end example
  8943. @end itemize
  8944. @anchor{overlay}
  8945. @section overlay
  8946. Overlay one video on top of another.
  8947. It takes two inputs and has one output. The first input is the "main"
  8948. video on which the second input is overlaid.
  8949. It accepts the following parameters:
  8950. A description of the accepted options follows.
  8951. @table @option
  8952. @item x
  8953. @item y
  8954. Set the expression for the x and y coordinates of the overlaid video
  8955. on the main video. Default value is "0" for both expressions. In case
  8956. the expression is invalid, it is set to a huge value (meaning that the
  8957. overlay will not be displayed within the output visible area).
  8958. @item eof_action
  8959. See @ref{framesync}.
  8960. @item eval
  8961. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8962. It accepts the following values:
  8963. @table @samp
  8964. @item init
  8965. only evaluate expressions once during the filter initialization or
  8966. when a command is processed
  8967. @item frame
  8968. evaluate expressions for each incoming frame
  8969. @end table
  8970. Default value is @samp{frame}.
  8971. @item shortest
  8972. See @ref{framesync}.
  8973. @item format
  8974. Set the format for the output video.
  8975. It accepts the following values:
  8976. @table @samp
  8977. @item yuv420
  8978. force YUV420 output
  8979. @item yuv422
  8980. force YUV422 output
  8981. @item yuv444
  8982. force YUV444 output
  8983. @item rgb
  8984. force packed RGB output
  8985. @item gbrp
  8986. force planar RGB output
  8987. @item auto
  8988. automatically pick format
  8989. @end table
  8990. Default value is @samp{yuv420}.
  8991. @item repeatlast
  8992. See @ref{framesync}.
  8993. @item alpha
  8994. Set format of alpha of the overlaid video, it can be @var{straight} or
  8995. @var{premultiplied}. Default is @var{straight}.
  8996. @end table
  8997. The @option{x}, and @option{y} expressions can contain the following
  8998. parameters.
  8999. @table @option
  9000. @item main_w, W
  9001. @item main_h, H
  9002. The main input width and height.
  9003. @item overlay_w, w
  9004. @item overlay_h, h
  9005. The overlay input width and height.
  9006. @item x
  9007. @item y
  9008. The computed values for @var{x} and @var{y}. They are evaluated for
  9009. each new frame.
  9010. @item hsub
  9011. @item vsub
  9012. horizontal and vertical chroma subsample values of the output
  9013. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9014. @var{vsub} is 1.
  9015. @item n
  9016. the number of input frame, starting from 0
  9017. @item pos
  9018. the position in the file of the input frame, NAN if unknown
  9019. @item t
  9020. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9021. @end table
  9022. This filter also supports the @ref{framesync} options.
  9023. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9024. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9025. when @option{eval} is set to @samp{init}.
  9026. Be aware that frames are taken from each input video in timestamp
  9027. order, hence, if their initial timestamps differ, it is a good idea
  9028. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9029. have them begin in the same zero timestamp, as the example for
  9030. the @var{movie} filter does.
  9031. You can chain together more overlays but you should test the
  9032. efficiency of such approach.
  9033. @subsection Commands
  9034. This filter supports the following commands:
  9035. @table @option
  9036. @item x
  9037. @item y
  9038. Modify the x and y of the overlay input.
  9039. The command accepts the same syntax of the corresponding option.
  9040. If the specified expression is not valid, it is kept at its current
  9041. value.
  9042. @end table
  9043. @subsection Examples
  9044. @itemize
  9045. @item
  9046. Draw the overlay at 10 pixels from the bottom right corner of the main
  9047. video:
  9048. @example
  9049. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9050. @end example
  9051. Using named options the example above becomes:
  9052. @example
  9053. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9054. @end example
  9055. @item
  9056. Insert a transparent PNG logo in the bottom left corner of the input,
  9057. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9058. @example
  9059. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9060. @end example
  9061. @item
  9062. Insert 2 different transparent PNG logos (second logo on bottom
  9063. right corner) using the @command{ffmpeg} tool:
  9064. @example
  9065. 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
  9066. @end example
  9067. @item
  9068. Add a transparent color layer on top of the main video; @code{WxH}
  9069. must specify the size of the main input to the overlay filter:
  9070. @example
  9071. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9072. @end example
  9073. @item
  9074. Play an original video and a filtered version (here with the deshake
  9075. filter) side by side using the @command{ffplay} tool:
  9076. @example
  9077. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9078. @end example
  9079. The above command is the same as:
  9080. @example
  9081. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9082. @end example
  9083. @item
  9084. Make a sliding overlay appearing from the left to the right top part of the
  9085. screen starting since time 2:
  9086. @example
  9087. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9088. @end example
  9089. @item
  9090. Compose output by putting two input videos side to side:
  9091. @example
  9092. ffmpeg -i left.avi -i right.avi -filter_complex "
  9093. nullsrc=size=200x100 [background];
  9094. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9095. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9096. [background][left] overlay=shortest=1 [background+left];
  9097. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9098. "
  9099. @end example
  9100. @item
  9101. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9102. @example
  9103. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9104. -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]'
  9105. masked.avi
  9106. @end example
  9107. @item
  9108. Chain several overlays in cascade:
  9109. @example
  9110. nullsrc=s=200x200 [bg];
  9111. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9112. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9113. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9114. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9115. [in3] null, [mid2] overlay=100:100 [out0]
  9116. @end example
  9117. @end itemize
  9118. @section owdenoise
  9119. Apply Overcomplete Wavelet denoiser.
  9120. The filter accepts the following options:
  9121. @table @option
  9122. @item depth
  9123. Set depth.
  9124. Larger depth values will denoise lower frequency components more, but
  9125. slow down filtering.
  9126. Must be an int in the range 8-16, default is @code{8}.
  9127. @item luma_strength, ls
  9128. Set luma strength.
  9129. Must be a double value in the range 0-1000, default is @code{1.0}.
  9130. @item chroma_strength, cs
  9131. Set chroma strength.
  9132. Must be a double value in the range 0-1000, default is @code{1.0}.
  9133. @end table
  9134. @anchor{pad}
  9135. @section pad
  9136. Add paddings to the input image, and place the original input at the
  9137. provided @var{x}, @var{y} coordinates.
  9138. It accepts the following parameters:
  9139. @table @option
  9140. @item width, w
  9141. @item height, h
  9142. Specify an expression for the size of the output image with the
  9143. paddings added. If the value for @var{width} or @var{height} is 0, the
  9144. corresponding input size is used for the output.
  9145. The @var{width} expression can reference the value set by the
  9146. @var{height} expression, and vice versa.
  9147. The default value of @var{width} and @var{height} is 0.
  9148. @item x
  9149. @item y
  9150. Specify the offsets to place the input image at within the padded area,
  9151. with respect to the top/left border of the output image.
  9152. The @var{x} expression can reference the value set by the @var{y}
  9153. expression, and vice versa.
  9154. The default value of @var{x} and @var{y} is 0.
  9155. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9156. so the input image is centered on the padded area.
  9157. @item color
  9158. Specify the color of the padded area. For the syntax of this option,
  9159. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9160. manual,ffmpeg-utils}.
  9161. The default value of @var{color} is "black".
  9162. @item eval
  9163. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9164. It accepts the following values:
  9165. @table @samp
  9166. @item init
  9167. Only evaluate expressions once during the filter initialization or when
  9168. a command is processed.
  9169. @item frame
  9170. Evaluate expressions for each incoming frame.
  9171. @end table
  9172. Default value is @samp{init}.
  9173. @item aspect
  9174. Pad to aspect instead to a resolution.
  9175. @end table
  9176. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9177. options are expressions containing the following constants:
  9178. @table @option
  9179. @item in_w
  9180. @item in_h
  9181. The input video width and height.
  9182. @item iw
  9183. @item ih
  9184. These are the same as @var{in_w} and @var{in_h}.
  9185. @item out_w
  9186. @item out_h
  9187. The output width and height (the size of the padded area), as
  9188. specified by the @var{width} and @var{height} expressions.
  9189. @item ow
  9190. @item oh
  9191. These are the same as @var{out_w} and @var{out_h}.
  9192. @item x
  9193. @item y
  9194. The x and y offsets as specified by the @var{x} and @var{y}
  9195. expressions, or NAN if not yet specified.
  9196. @item a
  9197. same as @var{iw} / @var{ih}
  9198. @item sar
  9199. input sample aspect ratio
  9200. @item dar
  9201. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9202. @item hsub
  9203. @item vsub
  9204. The horizontal and vertical chroma subsample values. For example for the
  9205. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9206. @end table
  9207. @subsection Examples
  9208. @itemize
  9209. @item
  9210. Add paddings with the color "violet" to the input video. The output video
  9211. size is 640x480, and the top-left corner of the input video is placed at
  9212. column 0, row 40
  9213. @example
  9214. pad=640:480:0:40:violet
  9215. @end example
  9216. The example above is equivalent to the following command:
  9217. @example
  9218. pad=width=640:height=480:x=0:y=40:color=violet
  9219. @end example
  9220. @item
  9221. Pad the input to get an output with dimensions increased by 3/2,
  9222. and put the input video at the center of the padded area:
  9223. @example
  9224. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9225. @end example
  9226. @item
  9227. Pad the input to get a squared output with size equal to the maximum
  9228. value between the input width and height, and put the input video at
  9229. the center of the padded area:
  9230. @example
  9231. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9232. @end example
  9233. @item
  9234. Pad the input to get a final w/h ratio of 16:9:
  9235. @example
  9236. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9237. @end example
  9238. @item
  9239. In case of anamorphic video, in order to set the output display aspect
  9240. correctly, it is necessary to use @var{sar} in the expression,
  9241. according to the relation:
  9242. @example
  9243. (ih * X / ih) * sar = output_dar
  9244. X = output_dar / sar
  9245. @end example
  9246. Thus the previous example needs to be modified to:
  9247. @example
  9248. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9249. @end example
  9250. @item
  9251. Double the output size and put the input video in the bottom-right
  9252. corner of the output padded area:
  9253. @example
  9254. pad="2*iw:2*ih:ow-iw:oh-ih"
  9255. @end example
  9256. @end itemize
  9257. @anchor{palettegen}
  9258. @section palettegen
  9259. Generate one palette for a whole video stream.
  9260. It accepts the following options:
  9261. @table @option
  9262. @item max_colors
  9263. Set the maximum number of colors to quantize in the palette.
  9264. Note: the palette will still contain 256 colors; the unused palette entries
  9265. will be black.
  9266. @item reserve_transparent
  9267. Create a palette of 255 colors maximum and reserve the last one for
  9268. transparency. Reserving the transparency color is useful for GIF optimization.
  9269. If not set, the maximum of colors in the palette will be 256. You probably want
  9270. to disable this option for a standalone image.
  9271. Set by default.
  9272. @item transparency_color
  9273. Set the color that will be used as background for transparency.
  9274. @item stats_mode
  9275. Set statistics mode.
  9276. It accepts the following values:
  9277. @table @samp
  9278. @item full
  9279. Compute full frame histograms.
  9280. @item diff
  9281. Compute histograms only for the part that differs from previous frame. This
  9282. might be relevant to give more importance to the moving part of your input if
  9283. the background is static.
  9284. @item single
  9285. Compute new histogram for each frame.
  9286. @end table
  9287. Default value is @var{full}.
  9288. @end table
  9289. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9290. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9291. color quantization of the palette. This information is also visible at
  9292. @var{info} logging level.
  9293. @subsection Examples
  9294. @itemize
  9295. @item
  9296. Generate a representative palette of a given video using @command{ffmpeg}:
  9297. @example
  9298. ffmpeg -i input.mkv -vf palettegen palette.png
  9299. @end example
  9300. @end itemize
  9301. @section paletteuse
  9302. Use a palette to downsample an input video stream.
  9303. The filter takes two inputs: one video stream and a palette. The palette must
  9304. be a 256 pixels image.
  9305. It accepts the following options:
  9306. @table @option
  9307. @item dither
  9308. Select dithering mode. Available algorithms are:
  9309. @table @samp
  9310. @item bayer
  9311. Ordered 8x8 bayer dithering (deterministic)
  9312. @item heckbert
  9313. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9314. Note: this dithering is sometimes considered "wrong" and is included as a
  9315. reference.
  9316. @item floyd_steinberg
  9317. Floyd and Steingberg dithering (error diffusion)
  9318. @item sierra2
  9319. Frankie Sierra dithering v2 (error diffusion)
  9320. @item sierra2_4a
  9321. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9322. @end table
  9323. Default is @var{sierra2_4a}.
  9324. @item bayer_scale
  9325. When @var{bayer} dithering is selected, this option defines the scale of the
  9326. pattern (how much the crosshatch pattern is visible). A low value means more
  9327. visible pattern for less banding, and higher value means less visible pattern
  9328. at the cost of more banding.
  9329. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9330. @item diff_mode
  9331. If set, define the zone to process
  9332. @table @samp
  9333. @item rectangle
  9334. Only the changing rectangle will be reprocessed. This is similar to GIF
  9335. cropping/offsetting compression mechanism. This option can be useful for speed
  9336. if only a part of the image is changing, and has use cases such as limiting the
  9337. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9338. moving scene (it leads to more deterministic output if the scene doesn't change
  9339. much, and as a result less moving noise and better GIF compression).
  9340. @end table
  9341. Default is @var{none}.
  9342. @item new
  9343. Take new palette for each output frame.
  9344. @item alpha_threshold
  9345. Sets the alpha threshold for transparency. Alpha values above this threshold
  9346. will be treated as completely opaque, and values below this threshold will be
  9347. treated as completely transparent.
  9348. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9349. @end table
  9350. @subsection Examples
  9351. @itemize
  9352. @item
  9353. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9354. using @command{ffmpeg}:
  9355. @example
  9356. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9357. @end example
  9358. @end itemize
  9359. @section perspective
  9360. Correct perspective of video not recorded perpendicular to the screen.
  9361. A description of the accepted parameters follows.
  9362. @table @option
  9363. @item x0
  9364. @item y0
  9365. @item x1
  9366. @item y1
  9367. @item x2
  9368. @item y2
  9369. @item x3
  9370. @item y3
  9371. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9372. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9373. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9374. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9375. then the corners of the source will be sent to the specified coordinates.
  9376. The expressions can use the following variables:
  9377. @table @option
  9378. @item W
  9379. @item H
  9380. the width and height of video frame.
  9381. @item in
  9382. Input frame count.
  9383. @item on
  9384. Output frame count.
  9385. @end table
  9386. @item interpolation
  9387. Set interpolation for perspective correction.
  9388. It accepts the following values:
  9389. @table @samp
  9390. @item linear
  9391. @item cubic
  9392. @end table
  9393. Default value is @samp{linear}.
  9394. @item sense
  9395. Set interpretation of coordinate options.
  9396. It accepts the following values:
  9397. @table @samp
  9398. @item 0, source
  9399. Send point in the source specified by the given coordinates to
  9400. the corners of the destination.
  9401. @item 1, destination
  9402. Send the corners of the source to the point in the destination specified
  9403. by the given coordinates.
  9404. Default value is @samp{source}.
  9405. @end table
  9406. @item eval
  9407. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9408. It accepts the following values:
  9409. @table @samp
  9410. @item init
  9411. only evaluate expressions once during the filter initialization or
  9412. when a command is processed
  9413. @item frame
  9414. evaluate expressions for each incoming frame
  9415. @end table
  9416. Default value is @samp{init}.
  9417. @end table
  9418. @section phase
  9419. Delay interlaced video by one field time so that the field order changes.
  9420. The intended use is to fix PAL movies that have been captured with the
  9421. opposite field order to the film-to-video transfer.
  9422. A description of the accepted parameters follows.
  9423. @table @option
  9424. @item mode
  9425. Set phase mode.
  9426. It accepts the following values:
  9427. @table @samp
  9428. @item t
  9429. Capture field order top-first, transfer bottom-first.
  9430. Filter will delay the bottom field.
  9431. @item b
  9432. Capture field order bottom-first, transfer top-first.
  9433. Filter will delay the top field.
  9434. @item p
  9435. Capture and transfer with the same field order. This mode only exists
  9436. for the documentation of the other options to refer to, but if you
  9437. actually select it, the filter will faithfully do nothing.
  9438. @item a
  9439. Capture field order determined automatically by field flags, transfer
  9440. opposite.
  9441. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9442. basis using field flags. If no field information is available,
  9443. then this works just like @samp{u}.
  9444. @item u
  9445. Capture unknown or varying, transfer opposite.
  9446. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9447. analyzing the images and selecting the alternative that produces best
  9448. match between the fields.
  9449. @item T
  9450. Capture top-first, transfer unknown or varying.
  9451. Filter selects among @samp{t} and @samp{p} using image analysis.
  9452. @item B
  9453. Capture bottom-first, transfer unknown or varying.
  9454. Filter selects among @samp{b} and @samp{p} using image analysis.
  9455. @item A
  9456. Capture determined by field flags, transfer unknown or varying.
  9457. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9458. image analysis. If no field information is available, then this works just
  9459. like @samp{U}. This is the default mode.
  9460. @item U
  9461. Both capture and transfer unknown or varying.
  9462. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9463. @end table
  9464. @end table
  9465. @section pixdesctest
  9466. Pixel format descriptor test filter, mainly useful for internal
  9467. testing. The output video should be equal to the input video.
  9468. For example:
  9469. @example
  9470. format=monow, pixdesctest
  9471. @end example
  9472. can be used to test the monowhite pixel format descriptor definition.
  9473. @section pixscope
  9474. Display sample values of color channels. Mainly useful for checking color
  9475. and levels. Minimum supported resolution is 640x480.
  9476. The filters accept the following options:
  9477. @table @option
  9478. @item x
  9479. Set scope X position, relative offset on X axis.
  9480. @item y
  9481. Set scope Y position, relative offset on Y axis.
  9482. @item w
  9483. Set scope width.
  9484. @item h
  9485. Set scope height.
  9486. @item o
  9487. Set window opacity. This window also holds statistics about pixel area.
  9488. @item wx
  9489. Set window X position, relative offset on X axis.
  9490. @item wy
  9491. Set window Y position, relative offset on Y axis.
  9492. @end table
  9493. @section pp
  9494. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9495. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9496. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9497. Each subfilter and some options have a short and a long name that can be used
  9498. interchangeably, i.e. dr/dering are the same.
  9499. The filters accept the following options:
  9500. @table @option
  9501. @item subfilters
  9502. Set postprocessing subfilters string.
  9503. @end table
  9504. All subfilters share common options to determine their scope:
  9505. @table @option
  9506. @item a/autoq
  9507. Honor the quality commands for this subfilter.
  9508. @item c/chrom
  9509. Do chrominance filtering, too (default).
  9510. @item y/nochrom
  9511. Do luminance filtering only (no chrominance).
  9512. @item n/noluma
  9513. Do chrominance filtering only (no luminance).
  9514. @end table
  9515. These options can be appended after the subfilter name, separated by a '|'.
  9516. Available subfilters are:
  9517. @table @option
  9518. @item hb/hdeblock[|difference[|flatness]]
  9519. Horizontal deblocking filter
  9520. @table @option
  9521. @item difference
  9522. Difference factor where higher values mean more deblocking (default: @code{32}).
  9523. @item flatness
  9524. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9525. @end table
  9526. @item vb/vdeblock[|difference[|flatness]]
  9527. Vertical deblocking filter
  9528. @table @option
  9529. @item difference
  9530. Difference factor where higher values mean more deblocking (default: @code{32}).
  9531. @item flatness
  9532. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9533. @end table
  9534. @item ha/hadeblock[|difference[|flatness]]
  9535. Accurate horizontal deblocking filter
  9536. @table @option
  9537. @item difference
  9538. Difference factor where higher values mean more deblocking (default: @code{32}).
  9539. @item flatness
  9540. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9541. @end table
  9542. @item va/vadeblock[|difference[|flatness]]
  9543. Accurate vertical deblocking filter
  9544. @table @option
  9545. @item difference
  9546. Difference factor where higher values mean more deblocking (default: @code{32}).
  9547. @item flatness
  9548. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9549. @end table
  9550. @end table
  9551. The horizontal and vertical deblocking filters share the difference and
  9552. flatness values so you cannot set different horizontal and vertical
  9553. thresholds.
  9554. @table @option
  9555. @item h1/x1hdeblock
  9556. Experimental horizontal deblocking filter
  9557. @item v1/x1vdeblock
  9558. Experimental vertical deblocking filter
  9559. @item dr/dering
  9560. Deringing filter
  9561. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9562. @table @option
  9563. @item threshold1
  9564. larger -> stronger filtering
  9565. @item threshold2
  9566. larger -> stronger filtering
  9567. @item threshold3
  9568. larger -> stronger filtering
  9569. @end table
  9570. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9571. @table @option
  9572. @item f/fullyrange
  9573. Stretch luminance to @code{0-255}.
  9574. @end table
  9575. @item lb/linblenddeint
  9576. Linear blend deinterlacing filter that deinterlaces the given block by
  9577. filtering all lines with a @code{(1 2 1)} filter.
  9578. @item li/linipoldeint
  9579. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9580. linearly interpolating every second line.
  9581. @item ci/cubicipoldeint
  9582. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9583. cubically interpolating every second line.
  9584. @item md/mediandeint
  9585. Median deinterlacing filter that deinterlaces the given block by applying a
  9586. median filter to every second line.
  9587. @item fd/ffmpegdeint
  9588. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9589. second line with a @code{(-1 4 2 4 -1)} filter.
  9590. @item l5/lowpass5
  9591. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9592. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9593. @item fq/forceQuant[|quantizer]
  9594. Overrides the quantizer table from the input with the constant quantizer you
  9595. specify.
  9596. @table @option
  9597. @item quantizer
  9598. Quantizer to use
  9599. @end table
  9600. @item de/default
  9601. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9602. @item fa/fast
  9603. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9604. @item ac
  9605. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9606. @end table
  9607. @subsection Examples
  9608. @itemize
  9609. @item
  9610. Apply horizontal and vertical deblocking, deringing and automatic
  9611. brightness/contrast:
  9612. @example
  9613. pp=hb/vb/dr/al
  9614. @end example
  9615. @item
  9616. Apply default filters without brightness/contrast correction:
  9617. @example
  9618. pp=de/-al
  9619. @end example
  9620. @item
  9621. Apply default filters and temporal denoiser:
  9622. @example
  9623. pp=default/tmpnoise|1|2|3
  9624. @end example
  9625. @item
  9626. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9627. automatically depending on available CPU time:
  9628. @example
  9629. pp=hb|y/vb|a
  9630. @end example
  9631. @end itemize
  9632. @section pp7
  9633. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9634. similar to spp = 6 with 7 point DCT, where only the center sample is
  9635. used after IDCT.
  9636. The filter accepts the following options:
  9637. @table @option
  9638. @item qp
  9639. Force a constant quantization parameter. It accepts an integer in range
  9640. 0 to 63. If not set, the filter will use the QP from the video stream
  9641. (if available).
  9642. @item mode
  9643. Set thresholding mode. Available modes are:
  9644. @table @samp
  9645. @item hard
  9646. Set hard thresholding.
  9647. @item soft
  9648. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9649. @item medium
  9650. Set medium thresholding (good results, default).
  9651. @end table
  9652. @end table
  9653. @section premultiply
  9654. Apply alpha premultiply effect to input video stream using first plane
  9655. of second stream as alpha.
  9656. Both streams must have same dimensions and same pixel format.
  9657. The filter accepts the following option:
  9658. @table @option
  9659. @item planes
  9660. Set which planes will be processed, unprocessed planes will be copied.
  9661. By default value 0xf, all planes will be processed.
  9662. @item inplace
  9663. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9664. @end table
  9665. @section prewitt
  9666. Apply prewitt operator to input video stream.
  9667. The filter accepts the following option:
  9668. @table @option
  9669. @item planes
  9670. Set which planes will be processed, unprocessed planes will be copied.
  9671. By default value 0xf, all planes will be processed.
  9672. @item scale
  9673. Set value which will be multiplied with filtered result.
  9674. @item delta
  9675. Set value which will be added to filtered result.
  9676. @end table
  9677. @anchor{program_opencl}
  9678. @section program_opencl
  9679. Filter video using an OpenCL program.
  9680. @table @option
  9681. @item source
  9682. OpenCL program source file.
  9683. @item kernel
  9684. Kernel name in program.
  9685. @item inputs
  9686. Number of inputs to the filter. Defaults to 1.
  9687. @item size, s
  9688. Size of output frames. Defaults to the same as the first input.
  9689. @end table
  9690. The program source file must contain a kernel function with the given name,
  9691. which will be run once for each plane of the output. Each run on a plane
  9692. gets enqueued as a separate 2D global NDRange with one work-item for each
  9693. pixel to be generated. The global ID offset for each work-item is therefore
  9694. the coordinates of a pixel in the destination image.
  9695. The kernel function needs to take the following arguments:
  9696. @itemize
  9697. @item
  9698. Destination image, @var{__write_only image2d_t}.
  9699. This image will become the output; the kernel should write all of it.
  9700. @item
  9701. Frame index, @var{unsigned int}.
  9702. This is a counter starting from zero and increasing by one for each frame.
  9703. @item
  9704. Source images, @var{__read_only image2d_t}.
  9705. These are the most recent images on each input. The kernel may read from
  9706. them to generate the output, but they can't be written to.
  9707. @end itemize
  9708. Example programs:
  9709. @itemize
  9710. @item
  9711. Copy the input to the output (output must be the same size as the input).
  9712. @verbatim
  9713. __kernel void copy(__write_only image2d_t destination,
  9714. unsigned int index,
  9715. __read_only image2d_t source)
  9716. {
  9717. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9718. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9719. float4 value = read_imagef(source, sampler, location);
  9720. write_imagef(destination, location, value);
  9721. }
  9722. @end verbatim
  9723. @item
  9724. Apply a simple transformation, rotating the input by an amount increasing
  9725. with the index counter. Pixel values are linearly interpolated by the
  9726. sampler, and the output need not have the same dimensions as the input.
  9727. @verbatim
  9728. __kernel void rotate_image(__write_only image2d_t dst,
  9729. unsigned int index,
  9730. __read_only image2d_t src)
  9731. {
  9732. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9733. CLK_FILTER_LINEAR);
  9734. float angle = (float)index / 100.0f;
  9735. float2 dst_dim = convert_float2(get_image_dim(dst));
  9736. float2 src_dim = convert_float2(get_image_dim(src));
  9737. float2 dst_cen = dst_dim / 2.0f;
  9738. float2 src_cen = src_dim / 2.0f;
  9739. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9740. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9741. float2 src_pos = {
  9742. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9743. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9744. };
  9745. src_pos = src_pos * src_dim / dst_dim;
  9746. float2 src_loc = src_pos + src_cen;
  9747. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9748. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9749. write_imagef(dst, dst_loc, 0.5f);
  9750. else
  9751. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9752. }
  9753. @end verbatim
  9754. @item
  9755. Blend two inputs together, with the amount of each input used varying
  9756. with the index counter.
  9757. @verbatim
  9758. __kernel void blend_images(__write_only image2d_t dst,
  9759. unsigned int index,
  9760. __read_only image2d_t src1,
  9761. __read_only image2d_t src2)
  9762. {
  9763. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9764. CLK_FILTER_LINEAR);
  9765. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9766. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9767. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9768. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9769. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9770. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9771. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9772. }
  9773. @end verbatim
  9774. @end itemize
  9775. @section pseudocolor
  9776. Alter frame colors in video with pseudocolors.
  9777. This filter accept the following options:
  9778. @table @option
  9779. @item c0
  9780. set pixel first component expression
  9781. @item c1
  9782. set pixel second component expression
  9783. @item c2
  9784. set pixel third component expression
  9785. @item c3
  9786. set pixel fourth component expression, corresponds to the alpha component
  9787. @item i
  9788. set component to use as base for altering colors
  9789. @end table
  9790. Each of them specifies the expression to use for computing the lookup table for
  9791. the corresponding pixel component values.
  9792. The expressions can contain the following constants and functions:
  9793. @table @option
  9794. @item w
  9795. @item h
  9796. The input width and height.
  9797. @item val
  9798. The input value for the pixel component.
  9799. @item ymin, umin, vmin, amin
  9800. The minimum allowed component value.
  9801. @item ymax, umax, vmax, amax
  9802. The maximum allowed component value.
  9803. @end table
  9804. All expressions default to "val".
  9805. @subsection Examples
  9806. @itemize
  9807. @item
  9808. Change too high luma values to gradient:
  9809. @example
  9810. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  9811. @end example
  9812. @end itemize
  9813. @section psnr
  9814. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9815. Ratio) between two input videos.
  9816. This filter takes in input two input videos, the first input is
  9817. considered the "main" source and is passed unchanged to the
  9818. output. The second input is used as a "reference" video for computing
  9819. the PSNR.
  9820. Both video inputs must have the same resolution and pixel format for
  9821. this filter to work correctly. Also it assumes that both inputs
  9822. have the same number of frames, which are compared one by one.
  9823. The obtained average PSNR is printed through the logging system.
  9824. The filter stores the accumulated MSE (mean squared error) of each
  9825. frame, and at the end of the processing it is averaged across all frames
  9826. equally, and the following formula is applied to obtain the PSNR:
  9827. @example
  9828. PSNR = 10*log10(MAX^2/MSE)
  9829. @end example
  9830. Where MAX is the average of the maximum values of each component of the
  9831. image.
  9832. The description of the accepted parameters follows.
  9833. @table @option
  9834. @item stats_file, f
  9835. If specified the filter will use the named file to save the PSNR of
  9836. each individual frame. When filename equals "-" the data is sent to
  9837. standard output.
  9838. @item stats_version
  9839. Specifies which version of the stats file format to use. Details of
  9840. each format are written below.
  9841. Default value is 1.
  9842. @item stats_add_max
  9843. Determines whether the max value is output to the stats log.
  9844. Default value is 0.
  9845. Requires stats_version >= 2. If this is set and stats_version < 2,
  9846. the filter will return an error.
  9847. @end table
  9848. This filter also supports the @ref{framesync} options.
  9849. The file printed if @var{stats_file} is selected, contains a sequence of
  9850. key/value pairs of the form @var{key}:@var{value} for each compared
  9851. couple of frames.
  9852. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9853. the list of per-frame-pair stats, with key value pairs following the frame
  9854. format with the following parameters:
  9855. @table @option
  9856. @item psnr_log_version
  9857. The version of the log file format. Will match @var{stats_version}.
  9858. @item fields
  9859. A comma separated list of the per-frame-pair parameters included in
  9860. the log.
  9861. @end table
  9862. A description of each shown per-frame-pair parameter follows:
  9863. @table @option
  9864. @item n
  9865. sequential number of the input frame, starting from 1
  9866. @item mse_avg
  9867. Mean Square Error pixel-by-pixel average difference of the compared
  9868. frames, averaged over all the image components.
  9869. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9870. Mean Square Error pixel-by-pixel average difference of the compared
  9871. frames for the component specified by the suffix.
  9872. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9873. Peak Signal to Noise ratio of the compared frames for the component
  9874. specified by the suffix.
  9875. @item max_avg, max_y, max_u, max_v
  9876. Maximum allowed value for each channel, and average over all
  9877. channels.
  9878. @end table
  9879. For example:
  9880. @example
  9881. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9882. [main][ref] psnr="stats_file=stats.log" [out]
  9883. @end example
  9884. On this example the input file being processed is compared with the
  9885. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9886. is stored in @file{stats.log}.
  9887. @anchor{pullup}
  9888. @section pullup
  9889. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9890. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9891. content.
  9892. The pullup filter is designed to take advantage of future context in making
  9893. its decisions. This filter is stateless in the sense that it does not lock
  9894. onto a pattern to follow, but it instead looks forward to the following
  9895. fields in order to identify matches and rebuild progressive frames.
  9896. To produce content with an even framerate, insert the fps filter after
  9897. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9898. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9899. The filter accepts the following options:
  9900. @table @option
  9901. @item jl
  9902. @item jr
  9903. @item jt
  9904. @item jb
  9905. These options set the amount of "junk" to ignore at the left, right, top, and
  9906. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9907. while top and bottom are in units of 2 lines.
  9908. The default is 8 pixels on each side.
  9909. @item sb
  9910. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9911. filter generating an occasional mismatched frame, but it may also cause an
  9912. excessive number of frames to be dropped during high motion sequences.
  9913. Conversely, setting it to -1 will make filter match fields more easily.
  9914. This may help processing of video where there is slight blurring between
  9915. the fields, but may also cause there to be interlaced frames in the output.
  9916. Default value is @code{0}.
  9917. @item mp
  9918. Set the metric plane to use. It accepts the following values:
  9919. @table @samp
  9920. @item l
  9921. Use luma plane.
  9922. @item u
  9923. Use chroma blue plane.
  9924. @item v
  9925. Use chroma red plane.
  9926. @end table
  9927. This option may be set to use chroma plane instead of the default luma plane
  9928. for doing filter's computations. This may improve accuracy on very clean
  9929. source material, but more likely will decrease accuracy, especially if there
  9930. is chroma noise (rainbow effect) or any grayscale video.
  9931. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9932. load and make pullup usable in realtime on slow machines.
  9933. @end table
  9934. For best results (without duplicated frames in the output file) it is
  9935. necessary to change the output frame rate. For example, to inverse
  9936. telecine NTSC input:
  9937. @example
  9938. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9939. @end example
  9940. @section qp
  9941. Change video quantization parameters (QP).
  9942. The filter accepts the following option:
  9943. @table @option
  9944. @item qp
  9945. Set expression for quantization parameter.
  9946. @end table
  9947. The expression is evaluated through the eval API and can contain, among others,
  9948. the following constants:
  9949. @table @var
  9950. @item known
  9951. 1 if index is not 129, 0 otherwise.
  9952. @item qp
  9953. Sequential index starting from -129 to 128.
  9954. @end table
  9955. @subsection Examples
  9956. @itemize
  9957. @item
  9958. Some equation like:
  9959. @example
  9960. qp=2+2*sin(PI*qp)
  9961. @end example
  9962. @end itemize
  9963. @section random
  9964. Flush video frames from internal cache of frames into a random order.
  9965. No frame is discarded.
  9966. Inspired by @ref{frei0r} nervous filter.
  9967. @table @option
  9968. @item frames
  9969. Set size in number of frames of internal cache, in range from @code{2} to
  9970. @code{512}. Default is @code{30}.
  9971. @item seed
  9972. Set seed for random number generator, must be an integer included between
  9973. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9974. less than @code{0}, the filter will try to use a good random seed on a
  9975. best effort basis.
  9976. @end table
  9977. @section readeia608
  9978. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9979. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9980. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9981. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9982. @table @option
  9983. @item lavfi.readeia608.X.cc
  9984. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9985. @item lavfi.readeia608.X.line
  9986. The number of the line on which the EIA-608 data was identified and read.
  9987. @end table
  9988. This filter accepts the following options:
  9989. @table @option
  9990. @item scan_min
  9991. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9992. @item scan_max
  9993. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9994. @item mac
  9995. Set minimal acceptable amplitude change for sync codes detection.
  9996. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9997. @item spw
  9998. Set the ratio of width reserved for sync code detection.
  9999. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10000. @item mhd
  10001. Set the max peaks height difference for sync code detection.
  10002. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10003. @item mpd
  10004. Set max peaks period difference for sync code detection.
  10005. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10006. @item msd
  10007. Set the first two max start code bits differences.
  10008. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10009. @item bhd
  10010. Set the minimum ratio of bits height compared to 3rd start code bit.
  10011. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10012. @item th_w
  10013. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10014. @item th_b
  10015. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10016. @item chp
  10017. Enable checking the parity bit. In the event of a parity error, the filter will output
  10018. @code{0x00} for that character. Default is false.
  10019. @end table
  10020. @subsection Examples
  10021. @itemize
  10022. @item
  10023. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10024. @example
  10025. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  10026. @end example
  10027. @end itemize
  10028. @section readvitc
  10029. Read vertical interval timecode (VITC) information from the top lines of a
  10030. video frame.
  10031. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10032. timecode value, if a valid timecode has been detected. Further metadata key
  10033. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10034. timecode data has been found or not.
  10035. This filter accepts the following options:
  10036. @table @option
  10037. @item scan_max
  10038. Set the maximum number of lines to scan for VITC data. If the value is set to
  10039. @code{-1} the full video frame is scanned. Default is @code{45}.
  10040. @item thr_b
  10041. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10042. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10043. @item thr_w
  10044. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10045. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10046. @end table
  10047. @subsection Examples
  10048. @itemize
  10049. @item
  10050. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10051. draw @code{--:--:--:--} as a placeholder:
  10052. @example
  10053. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10054. @end example
  10055. @end itemize
  10056. @section remap
  10057. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10058. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10059. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10060. value for pixel will be used for destination pixel.
  10061. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10062. will have Xmap/Ymap video stream dimensions.
  10063. Xmap and Ymap input video streams are 16bit depth, single channel.
  10064. @section removegrain
  10065. The removegrain filter is a spatial denoiser for progressive video.
  10066. @table @option
  10067. @item m0
  10068. Set mode for the first plane.
  10069. @item m1
  10070. Set mode for the second plane.
  10071. @item m2
  10072. Set mode for the third plane.
  10073. @item m3
  10074. Set mode for the fourth plane.
  10075. @end table
  10076. Range of mode is from 0 to 24. Description of each mode follows:
  10077. @table @var
  10078. @item 0
  10079. Leave input plane unchanged. Default.
  10080. @item 1
  10081. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10082. @item 2
  10083. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10084. @item 3
  10085. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10086. @item 4
  10087. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10088. This is equivalent to a median filter.
  10089. @item 5
  10090. Line-sensitive clipping giving the minimal change.
  10091. @item 6
  10092. Line-sensitive clipping, intermediate.
  10093. @item 7
  10094. Line-sensitive clipping, intermediate.
  10095. @item 8
  10096. Line-sensitive clipping, intermediate.
  10097. @item 9
  10098. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10099. @item 10
  10100. Replaces the target pixel with the closest neighbour.
  10101. @item 11
  10102. [1 2 1] horizontal and vertical kernel blur.
  10103. @item 12
  10104. Same as mode 11.
  10105. @item 13
  10106. Bob mode, interpolates top field from the line where the neighbours
  10107. pixels are the closest.
  10108. @item 14
  10109. Bob mode, interpolates bottom field from the line where the neighbours
  10110. pixels are the closest.
  10111. @item 15
  10112. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10113. interpolation formula.
  10114. @item 16
  10115. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10116. interpolation formula.
  10117. @item 17
  10118. Clips the pixel with the minimum and maximum of respectively the maximum and
  10119. minimum of each pair of opposite neighbour pixels.
  10120. @item 18
  10121. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10122. the current pixel is minimal.
  10123. @item 19
  10124. Replaces the pixel with the average of its 8 neighbours.
  10125. @item 20
  10126. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10127. @item 21
  10128. Clips pixels using the averages of opposite neighbour.
  10129. @item 22
  10130. Same as mode 21 but simpler and faster.
  10131. @item 23
  10132. Small edge and halo removal, but reputed useless.
  10133. @item 24
  10134. Similar as 23.
  10135. @end table
  10136. @section removelogo
  10137. Suppress a TV station logo, using an image file to determine which
  10138. pixels comprise the logo. It works by filling in the pixels that
  10139. comprise the logo with neighboring pixels.
  10140. The filter accepts the following options:
  10141. @table @option
  10142. @item filename, f
  10143. Set the filter bitmap file, which can be any image format supported by
  10144. libavformat. The width and height of the image file must match those of the
  10145. video stream being processed.
  10146. @end table
  10147. Pixels in the provided bitmap image with a value of zero are not
  10148. considered part of the logo, non-zero pixels are considered part of
  10149. the logo. If you use white (255) for the logo and black (0) for the
  10150. rest, you will be safe. For making the filter bitmap, it is
  10151. recommended to take a screen capture of a black frame with the logo
  10152. visible, and then using a threshold filter followed by the erode
  10153. filter once or twice.
  10154. If needed, little splotches can be fixed manually. Remember that if
  10155. logo pixels are not covered, the filter quality will be much
  10156. reduced. Marking too many pixels as part of the logo does not hurt as
  10157. much, but it will increase the amount of blurring needed to cover over
  10158. the image and will destroy more information than necessary, and extra
  10159. pixels will slow things down on a large logo.
  10160. @section repeatfields
  10161. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10162. fields based on its value.
  10163. @section reverse
  10164. Reverse a video clip.
  10165. Warning: This filter requires memory to buffer the entire clip, so trimming
  10166. is suggested.
  10167. @subsection Examples
  10168. @itemize
  10169. @item
  10170. Take the first 5 seconds of a clip, and reverse it.
  10171. @example
  10172. trim=end=5,reverse
  10173. @end example
  10174. @end itemize
  10175. @section roberts
  10176. Apply roberts cross operator to input video stream.
  10177. The filter accepts the following option:
  10178. @table @option
  10179. @item planes
  10180. Set which planes will be processed, unprocessed planes will be copied.
  10181. By default value 0xf, all planes will be processed.
  10182. @item scale
  10183. Set value which will be multiplied with filtered result.
  10184. @item delta
  10185. Set value which will be added to filtered result.
  10186. @end table
  10187. @section rotate
  10188. Rotate video by an arbitrary angle expressed in radians.
  10189. The filter accepts the following options:
  10190. A description of the optional parameters follows.
  10191. @table @option
  10192. @item angle, a
  10193. Set an expression for the angle by which to rotate the input video
  10194. clockwise, expressed as a number of radians. A negative value will
  10195. result in a counter-clockwise rotation. By default it is set to "0".
  10196. This expression is evaluated for each frame.
  10197. @item out_w, ow
  10198. Set the output width expression, default value is "iw".
  10199. This expression is evaluated just once during configuration.
  10200. @item out_h, oh
  10201. Set the output height expression, default value is "ih".
  10202. This expression is evaluated just once during configuration.
  10203. @item bilinear
  10204. Enable bilinear interpolation if set to 1, a value of 0 disables
  10205. it. Default value is 1.
  10206. @item fillcolor, c
  10207. Set the color used to fill the output area not covered by the rotated
  10208. image. For the general syntax of this option, check the
  10209. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10210. If the special value "none" is selected then no
  10211. background is printed (useful for example if the background is never shown).
  10212. Default value is "black".
  10213. @end table
  10214. The expressions for the angle and the output size can contain the
  10215. following constants and functions:
  10216. @table @option
  10217. @item n
  10218. sequential number of the input frame, starting from 0. It is always NAN
  10219. before the first frame is filtered.
  10220. @item t
  10221. time in seconds of the input frame, it is set to 0 when the filter is
  10222. configured. It is always NAN before the first frame is filtered.
  10223. @item hsub
  10224. @item vsub
  10225. horizontal and vertical chroma subsample values. For example for the
  10226. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10227. @item in_w, iw
  10228. @item in_h, ih
  10229. the input video width and height
  10230. @item out_w, ow
  10231. @item out_h, oh
  10232. the output width and height, that is the size of the padded area as
  10233. specified by the @var{width} and @var{height} expressions
  10234. @item rotw(a)
  10235. @item roth(a)
  10236. the minimal width/height required for completely containing the input
  10237. video rotated by @var{a} radians.
  10238. These are only available when computing the @option{out_w} and
  10239. @option{out_h} expressions.
  10240. @end table
  10241. @subsection Examples
  10242. @itemize
  10243. @item
  10244. Rotate the input by PI/6 radians clockwise:
  10245. @example
  10246. rotate=PI/6
  10247. @end example
  10248. @item
  10249. Rotate the input by PI/6 radians counter-clockwise:
  10250. @example
  10251. rotate=-PI/6
  10252. @end example
  10253. @item
  10254. Rotate the input by 45 degrees clockwise:
  10255. @example
  10256. rotate=45*PI/180
  10257. @end example
  10258. @item
  10259. Apply a constant rotation with period T, starting from an angle of PI/3:
  10260. @example
  10261. rotate=PI/3+2*PI*t/T
  10262. @end example
  10263. @item
  10264. Make the input video rotation oscillating with a period of T
  10265. seconds and an amplitude of A radians:
  10266. @example
  10267. rotate=A*sin(2*PI/T*t)
  10268. @end example
  10269. @item
  10270. Rotate the video, output size is chosen so that the whole rotating
  10271. input video is always completely contained in the output:
  10272. @example
  10273. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10274. @end example
  10275. @item
  10276. Rotate the video, reduce the output size so that no background is ever
  10277. shown:
  10278. @example
  10279. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10280. @end example
  10281. @end itemize
  10282. @subsection Commands
  10283. The filter supports the following commands:
  10284. @table @option
  10285. @item a, angle
  10286. Set the angle expression.
  10287. The command accepts the same syntax of the corresponding option.
  10288. If the specified expression is not valid, it is kept at its current
  10289. value.
  10290. @end table
  10291. @section sab
  10292. Apply Shape Adaptive Blur.
  10293. The filter accepts the following options:
  10294. @table @option
  10295. @item luma_radius, lr
  10296. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10297. value is 1.0. A greater value will result in a more blurred image, and
  10298. in slower processing.
  10299. @item luma_pre_filter_radius, lpfr
  10300. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10301. value is 1.0.
  10302. @item luma_strength, ls
  10303. Set luma maximum difference between pixels to still be considered, must
  10304. be a value in the 0.1-100.0 range, default value is 1.0.
  10305. @item chroma_radius, cr
  10306. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10307. greater value will result in a more blurred image, and in slower
  10308. processing.
  10309. @item chroma_pre_filter_radius, cpfr
  10310. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10311. @item chroma_strength, cs
  10312. Set chroma maximum difference between pixels to still be considered,
  10313. must be a value in the -0.9-100.0 range.
  10314. @end table
  10315. Each chroma option value, if not explicitly specified, is set to the
  10316. corresponding luma option value.
  10317. @anchor{scale}
  10318. @section scale
  10319. Scale (resize) the input video, using the libswscale library.
  10320. The scale filter forces the output display aspect ratio to be the same
  10321. of the input, by changing the output sample aspect ratio.
  10322. If the input image format is different from the format requested by
  10323. the next filter, the scale filter will convert the input to the
  10324. requested format.
  10325. @subsection Options
  10326. The filter accepts the following options, or any of the options
  10327. supported by the libswscale scaler.
  10328. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10329. the complete list of scaler options.
  10330. @table @option
  10331. @item width, w
  10332. @item height, h
  10333. Set the output video dimension expression. Default value is the input
  10334. dimension.
  10335. If the @var{width} or @var{w} value is 0, the input width is used for
  10336. the output. If the @var{height} or @var{h} value is 0, the input height
  10337. is used for the output.
  10338. If one and only one of the values is -n with n >= 1, the scale filter
  10339. will use a value that maintains the aspect ratio of the input image,
  10340. calculated from the other specified dimension. After that it will,
  10341. however, make sure that the calculated dimension is divisible by n and
  10342. adjust the value if necessary.
  10343. If both values are -n with n >= 1, the behavior will be identical to
  10344. both values being set to 0 as previously detailed.
  10345. See below for the list of accepted constants for use in the dimension
  10346. expression.
  10347. @item eval
  10348. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10349. @table @samp
  10350. @item init
  10351. Only evaluate expressions once during the filter initialization or when a command is processed.
  10352. @item frame
  10353. Evaluate expressions for each incoming frame.
  10354. @end table
  10355. Default value is @samp{init}.
  10356. @item interl
  10357. Set the interlacing mode. It accepts the following values:
  10358. @table @samp
  10359. @item 1
  10360. Force interlaced aware scaling.
  10361. @item 0
  10362. Do not apply interlaced scaling.
  10363. @item -1
  10364. Select interlaced aware scaling depending on whether the source frames
  10365. are flagged as interlaced or not.
  10366. @end table
  10367. Default value is @samp{0}.
  10368. @item flags
  10369. Set libswscale scaling flags. See
  10370. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10371. complete list of values. If not explicitly specified the filter applies
  10372. the default flags.
  10373. @item param0, param1
  10374. Set libswscale input parameters for scaling algorithms that need them. See
  10375. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10376. complete documentation. If not explicitly specified the filter applies
  10377. empty parameters.
  10378. @item size, s
  10379. Set the video size. For the syntax of this option, check the
  10380. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10381. @item in_color_matrix
  10382. @item out_color_matrix
  10383. Set in/output YCbCr color space type.
  10384. This allows the autodetected value to be overridden as well as allows forcing
  10385. a specific value used for the output and encoder.
  10386. If not specified, the color space type depends on the pixel format.
  10387. Possible values:
  10388. @table @samp
  10389. @item auto
  10390. Choose automatically.
  10391. @item bt709
  10392. Format conforming to International Telecommunication Union (ITU)
  10393. Recommendation BT.709.
  10394. @item fcc
  10395. Set color space conforming to the United States Federal Communications
  10396. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10397. @item bt601
  10398. Set color space conforming to:
  10399. @itemize
  10400. @item
  10401. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10402. @item
  10403. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10404. @item
  10405. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10406. @end itemize
  10407. @item smpte240m
  10408. Set color space conforming to SMPTE ST 240:1999.
  10409. @end table
  10410. @item in_range
  10411. @item out_range
  10412. Set in/output YCbCr sample range.
  10413. This allows the autodetected value to be overridden as well as allows forcing
  10414. a specific value used for the output and encoder. If not specified, the
  10415. range depends on the pixel format. Possible values:
  10416. @table @samp
  10417. @item auto/unknown
  10418. Choose automatically.
  10419. @item jpeg/full/pc
  10420. Set full range (0-255 in case of 8-bit luma).
  10421. @item mpeg/limited/tv
  10422. Set "MPEG" range (16-235 in case of 8-bit luma).
  10423. @end table
  10424. @item force_original_aspect_ratio
  10425. Enable decreasing or increasing output video width or height if necessary to
  10426. keep the original aspect ratio. Possible values:
  10427. @table @samp
  10428. @item disable
  10429. Scale the video as specified and disable this feature.
  10430. @item decrease
  10431. The output video dimensions will automatically be decreased if needed.
  10432. @item increase
  10433. The output video dimensions will automatically be increased if needed.
  10434. @end table
  10435. One useful instance of this option is that when you know a specific device's
  10436. maximum allowed resolution, you can use this to limit the output video to
  10437. that, while retaining the aspect ratio. For example, device A allows
  10438. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10439. decrease) and specifying 1280x720 to the command line makes the output
  10440. 1280x533.
  10441. Please note that this is a different thing than specifying -1 for @option{w}
  10442. or @option{h}, you still need to specify the output resolution for this option
  10443. to work.
  10444. @end table
  10445. The values of the @option{w} and @option{h} options are expressions
  10446. containing the following constants:
  10447. @table @var
  10448. @item in_w
  10449. @item in_h
  10450. The input width and height
  10451. @item iw
  10452. @item ih
  10453. These are the same as @var{in_w} and @var{in_h}.
  10454. @item out_w
  10455. @item out_h
  10456. The output (scaled) width and height
  10457. @item ow
  10458. @item oh
  10459. These are the same as @var{out_w} and @var{out_h}
  10460. @item a
  10461. The same as @var{iw} / @var{ih}
  10462. @item sar
  10463. input sample aspect ratio
  10464. @item dar
  10465. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10466. @item hsub
  10467. @item vsub
  10468. horizontal and vertical input chroma subsample values. For example for the
  10469. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10470. @item ohsub
  10471. @item ovsub
  10472. horizontal and vertical output chroma subsample values. For example for the
  10473. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10474. @end table
  10475. @subsection Examples
  10476. @itemize
  10477. @item
  10478. Scale the input video to a size of 200x100
  10479. @example
  10480. scale=w=200:h=100
  10481. @end example
  10482. This is equivalent to:
  10483. @example
  10484. scale=200:100
  10485. @end example
  10486. or:
  10487. @example
  10488. scale=200x100
  10489. @end example
  10490. @item
  10491. Specify a size abbreviation for the output size:
  10492. @example
  10493. scale=qcif
  10494. @end example
  10495. which can also be written as:
  10496. @example
  10497. scale=size=qcif
  10498. @end example
  10499. @item
  10500. Scale the input to 2x:
  10501. @example
  10502. scale=w=2*iw:h=2*ih
  10503. @end example
  10504. @item
  10505. The above is the same as:
  10506. @example
  10507. scale=2*in_w:2*in_h
  10508. @end example
  10509. @item
  10510. Scale the input to 2x with forced interlaced scaling:
  10511. @example
  10512. scale=2*iw:2*ih:interl=1
  10513. @end example
  10514. @item
  10515. Scale the input to half size:
  10516. @example
  10517. scale=w=iw/2:h=ih/2
  10518. @end example
  10519. @item
  10520. Increase the width, and set the height to the same size:
  10521. @example
  10522. scale=3/2*iw:ow
  10523. @end example
  10524. @item
  10525. Seek Greek harmony:
  10526. @example
  10527. scale=iw:1/PHI*iw
  10528. scale=ih*PHI:ih
  10529. @end example
  10530. @item
  10531. Increase the height, and set the width to 3/2 of the height:
  10532. @example
  10533. scale=w=3/2*oh:h=3/5*ih
  10534. @end example
  10535. @item
  10536. Increase the size, making the size a multiple of the chroma
  10537. subsample values:
  10538. @example
  10539. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10540. @end example
  10541. @item
  10542. Increase the width to a maximum of 500 pixels,
  10543. keeping the same aspect ratio as the input:
  10544. @example
  10545. scale=w='min(500\, iw*3/2):h=-1'
  10546. @end example
  10547. @item
  10548. Make pixels square by combining scale and setsar:
  10549. @example
  10550. scale='trunc(ih*dar):ih',setsar=1/1
  10551. @end example
  10552. @item
  10553. Make pixels square by combining scale and setsar,
  10554. making sure the resulting resolution is even (required by some codecs):
  10555. @example
  10556. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10557. @end example
  10558. @end itemize
  10559. @subsection Commands
  10560. This filter supports the following commands:
  10561. @table @option
  10562. @item width, w
  10563. @item height, h
  10564. Set the output video dimension expression.
  10565. The command accepts the same syntax of the corresponding option.
  10566. If the specified expression is not valid, it is kept at its current
  10567. value.
  10568. @end table
  10569. @section scale_npp
  10570. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10571. format conversion on CUDA video frames. Setting the output width and height
  10572. works in the same way as for the @var{scale} filter.
  10573. The following additional options are accepted:
  10574. @table @option
  10575. @item format
  10576. The pixel format of the output CUDA frames. If set to the string "same" (the
  10577. default), the input format will be kept. Note that automatic format negotiation
  10578. and conversion is not yet supported for hardware frames
  10579. @item interp_algo
  10580. The interpolation algorithm used for resizing. One of the following:
  10581. @table @option
  10582. @item nn
  10583. Nearest neighbour.
  10584. @item linear
  10585. @item cubic
  10586. @item cubic2p_bspline
  10587. 2-parameter cubic (B=1, C=0)
  10588. @item cubic2p_catmullrom
  10589. 2-parameter cubic (B=0, C=1/2)
  10590. @item cubic2p_b05c03
  10591. 2-parameter cubic (B=1/2, C=3/10)
  10592. @item super
  10593. Supersampling
  10594. @item lanczos
  10595. @end table
  10596. @end table
  10597. @section scale2ref
  10598. Scale (resize) the input video, based on a reference video.
  10599. See the scale filter for available options, scale2ref supports the same but
  10600. uses the reference video instead of the main input as basis. scale2ref also
  10601. supports the following additional constants for the @option{w} and
  10602. @option{h} options:
  10603. @table @var
  10604. @item main_w
  10605. @item main_h
  10606. The main input video's width and height
  10607. @item main_a
  10608. The same as @var{main_w} / @var{main_h}
  10609. @item main_sar
  10610. The main input video's sample aspect ratio
  10611. @item main_dar, mdar
  10612. The main input video's display aspect ratio. Calculated from
  10613. @code{(main_w / main_h) * main_sar}.
  10614. @item main_hsub
  10615. @item main_vsub
  10616. The main input video's horizontal and vertical chroma subsample values.
  10617. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10618. is 1.
  10619. @end table
  10620. @subsection Examples
  10621. @itemize
  10622. @item
  10623. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10624. @example
  10625. 'scale2ref[b][a];[a][b]overlay'
  10626. @end example
  10627. @end itemize
  10628. @anchor{selectivecolor}
  10629. @section selectivecolor
  10630. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10631. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10632. by the "purity" of the color (that is, how saturated it already is).
  10633. This filter is similar to the Adobe Photoshop Selective Color tool.
  10634. The filter accepts the following options:
  10635. @table @option
  10636. @item correction_method
  10637. Select color correction method.
  10638. Available values are:
  10639. @table @samp
  10640. @item absolute
  10641. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10642. component value).
  10643. @item relative
  10644. Specified adjustments are relative to the original component value.
  10645. @end table
  10646. Default is @code{absolute}.
  10647. @item reds
  10648. Adjustments for red pixels (pixels where the red component is the maximum)
  10649. @item yellows
  10650. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10651. @item greens
  10652. Adjustments for green pixels (pixels where the green component is the maximum)
  10653. @item cyans
  10654. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10655. @item blues
  10656. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10657. @item magentas
  10658. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10659. @item whites
  10660. Adjustments for white pixels (pixels where all components are greater than 128)
  10661. @item neutrals
  10662. Adjustments for all pixels except pure black and pure white
  10663. @item blacks
  10664. Adjustments for black pixels (pixels where all components are lesser than 128)
  10665. @item psfile
  10666. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10667. @end table
  10668. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10669. 4 space separated floating point adjustment values in the [-1,1] range,
  10670. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10671. pixels of its range.
  10672. @subsection Examples
  10673. @itemize
  10674. @item
  10675. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10676. increase magenta by 27% in blue areas:
  10677. @example
  10678. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10679. @end example
  10680. @item
  10681. Use a Photoshop selective color preset:
  10682. @example
  10683. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10684. @end example
  10685. @end itemize
  10686. @anchor{separatefields}
  10687. @section separatefields
  10688. The @code{separatefields} takes a frame-based video input and splits
  10689. each frame into its components fields, producing a new half height clip
  10690. with twice the frame rate and twice the frame count.
  10691. This filter use field-dominance information in frame to decide which
  10692. of each pair of fields to place first in the output.
  10693. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10694. @section setdar, setsar
  10695. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10696. output video.
  10697. This is done by changing the specified Sample (aka Pixel) Aspect
  10698. Ratio, according to the following equation:
  10699. @example
  10700. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10701. @end example
  10702. Keep in mind that the @code{setdar} filter does not modify the pixel
  10703. dimensions of the video frame. Also, the display aspect ratio set by
  10704. this filter may be changed by later filters in the filterchain,
  10705. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10706. applied.
  10707. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10708. the filter output video.
  10709. Note that as a consequence of the application of this filter, the
  10710. output display aspect ratio will change according to the equation
  10711. above.
  10712. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10713. filter may be changed by later filters in the filterchain, e.g. if
  10714. another "setsar" or a "setdar" filter is applied.
  10715. It accepts the following parameters:
  10716. @table @option
  10717. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10718. Set the aspect ratio used by the filter.
  10719. The parameter can be a floating point number string, an expression, or
  10720. a string of the form @var{num}:@var{den}, where @var{num} and
  10721. @var{den} are the numerator and denominator of the aspect ratio. If
  10722. the parameter is not specified, it is assumed the value "0".
  10723. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10724. should be escaped.
  10725. @item max
  10726. Set the maximum integer value to use for expressing numerator and
  10727. denominator when reducing the expressed aspect ratio to a rational.
  10728. Default value is @code{100}.
  10729. @end table
  10730. The parameter @var{sar} is an expression containing
  10731. the following constants:
  10732. @table @option
  10733. @item E, PI, PHI
  10734. These are approximated values for the mathematical constants e
  10735. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10736. @item w, h
  10737. The input width and height.
  10738. @item a
  10739. These are the same as @var{w} / @var{h}.
  10740. @item sar
  10741. The input sample aspect ratio.
  10742. @item dar
  10743. The input display aspect ratio. It is the same as
  10744. (@var{w} / @var{h}) * @var{sar}.
  10745. @item hsub, vsub
  10746. Horizontal and vertical chroma subsample values. For example, for the
  10747. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10748. @end table
  10749. @subsection Examples
  10750. @itemize
  10751. @item
  10752. To change the display aspect ratio to 16:9, specify one of the following:
  10753. @example
  10754. setdar=dar=1.77777
  10755. setdar=dar=16/9
  10756. @end example
  10757. @item
  10758. To change the sample aspect ratio to 10:11, specify:
  10759. @example
  10760. setsar=sar=10/11
  10761. @end example
  10762. @item
  10763. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10764. 1000 in the aspect ratio reduction, use the command:
  10765. @example
  10766. setdar=ratio=16/9:max=1000
  10767. @end example
  10768. @end itemize
  10769. @anchor{setfield}
  10770. @section setfield
  10771. Force field for the output video frame.
  10772. The @code{setfield} filter marks the interlace type field for the
  10773. output frames. It does not change the input frame, but only sets the
  10774. corresponding property, which affects how the frame is treated by
  10775. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10776. The filter accepts the following options:
  10777. @table @option
  10778. @item mode
  10779. Available values are:
  10780. @table @samp
  10781. @item auto
  10782. Keep the same field property.
  10783. @item bff
  10784. Mark the frame as bottom-field-first.
  10785. @item tff
  10786. Mark the frame as top-field-first.
  10787. @item prog
  10788. Mark the frame as progressive.
  10789. @end table
  10790. @end table
  10791. @section showinfo
  10792. Show a line containing various information for each input video frame.
  10793. The input video is not modified.
  10794. The shown line contains a sequence of key/value pairs of the form
  10795. @var{key}:@var{value}.
  10796. The following values are shown in the output:
  10797. @table @option
  10798. @item n
  10799. The (sequential) number of the input frame, starting from 0.
  10800. @item pts
  10801. The Presentation TimeStamp of the input frame, expressed as a number of
  10802. time base units. The time base unit depends on the filter input pad.
  10803. @item pts_time
  10804. The Presentation TimeStamp of the input frame, expressed as a number of
  10805. seconds.
  10806. @item pos
  10807. The position of the frame in the input stream, or -1 if this information is
  10808. unavailable and/or meaningless (for example in case of synthetic video).
  10809. @item fmt
  10810. The pixel format name.
  10811. @item sar
  10812. The sample aspect ratio of the input frame, expressed in the form
  10813. @var{num}/@var{den}.
  10814. @item s
  10815. The size of the input frame. For the syntax of this option, check the
  10816. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10817. @item i
  10818. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10819. for bottom field first).
  10820. @item iskey
  10821. This is 1 if the frame is a key frame, 0 otherwise.
  10822. @item type
  10823. The picture type of the input frame ("I" for an I-frame, "P" for a
  10824. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10825. Also refer to the documentation of the @code{AVPictureType} enum and of
  10826. the @code{av_get_picture_type_char} function defined in
  10827. @file{libavutil/avutil.h}.
  10828. @item checksum
  10829. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10830. @item plane_checksum
  10831. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10832. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10833. @end table
  10834. @section showpalette
  10835. Displays the 256 colors palette of each frame. This filter is only relevant for
  10836. @var{pal8} pixel format frames.
  10837. It accepts the following option:
  10838. @table @option
  10839. @item s
  10840. Set the size of the box used to represent one palette color entry. Default is
  10841. @code{30} (for a @code{30x30} pixel box).
  10842. @end table
  10843. @section shuffleframes
  10844. Reorder and/or duplicate and/or drop video frames.
  10845. It accepts the following parameters:
  10846. @table @option
  10847. @item mapping
  10848. Set the destination indexes of input frames.
  10849. This is space or '|' separated list of indexes that maps input frames to output
  10850. frames. Number of indexes also sets maximal value that each index may have.
  10851. '-1' index have special meaning and that is to drop frame.
  10852. @end table
  10853. The first frame has the index 0. The default is to keep the input unchanged.
  10854. @subsection Examples
  10855. @itemize
  10856. @item
  10857. Swap second and third frame of every three frames of the input:
  10858. @example
  10859. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10860. @end example
  10861. @item
  10862. Swap 10th and 1st frame of every ten frames of the input:
  10863. @example
  10864. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10865. @end example
  10866. @end itemize
  10867. @section shuffleplanes
  10868. Reorder and/or duplicate video planes.
  10869. It accepts the following parameters:
  10870. @table @option
  10871. @item map0
  10872. The index of the input plane to be used as the first output plane.
  10873. @item map1
  10874. The index of the input plane to be used as the second output plane.
  10875. @item map2
  10876. The index of the input plane to be used as the third output plane.
  10877. @item map3
  10878. The index of the input plane to be used as the fourth output plane.
  10879. @end table
  10880. The first plane has the index 0. The default is to keep the input unchanged.
  10881. @subsection Examples
  10882. @itemize
  10883. @item
  10884. Swap the second and third planes of the input:
  10885. @example
  10886. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10887. @end example
  10888. @end itemize
  10889. @anchor{signalstats}
  10890. @section signalstats
  10891. Evaluate various visual metrics that assist in determining issues associated
  10892. with the digitization of analog video media.
  10893. By default the filter will log these metadata values:
  10894. @table @option
  10895. @item YMIN
  10896. Display the minimal Y value contained within the input frame. Expressed in
  10897. range of [0-255].
  10898. @item YLOW
  10899. Display the Y value at the 10% percentile within the input frame. Expressed in
  10900. range of [0-255].
  10901. @item YAVG
  10902. Display the average Y value within the input frame. Expressed in range of
  10903. [0-255].
  10904. @item YHIGH
  10905. Display the Y value at the 90% percentile within the input frame. Expressed in
  10906. range of [0-255].
  10907. @item YMAX
  10908. Display the maximum Y value contained within the input frame. Expressed in
  10909. range of [0-255].
  10910. @item UMIN
  10911. Display the minimal U value contained within the input frame. Expressed in
  10912. range of [0-255].
  10913. @item ULOW
  10914. Display the U value at the 10% percentile within the input frame. Expressed in
  10915. range of [0-255].
  10916. @item UAVG
  10917. Display the average U value within the input frame. Expressed in range of
  10918. [0-255].
  10919. @item UHIGH
  10920. Display the U value at the 90% percentile within the input frame. Expressed in
  10921. range of [0-255].
  10922. @item UMAX
  10923. Display the maximum U value contained within the input frame. Expressed in
  10924. range of [0-255].
  10925. @item VMIN
  10926. Display the minimal V value contained within the input frame. Expressed in
  10927. range of [0-255].
  10928. @item VLOW
  10929. Display the V value at the 10% percentile within the input frame. Expressed in
  10930. range of [0-255].
  10931. @item VAVG
  10932. Display the average V value within the input frame. Expressed in range of
  10933. [0-255].
  10934. @item VHIGH
  10935. Display the V value at the 90% percentile within the input frame. Expressed in
  10936. range of [0-255].
  10937. @item VMAX
  10938. Display the maximum V value contained within the input frame. Expressed in
  10939. range of [0-255].
  10940. @item SATMIN
  10941. Display the minimal saturation value contained within the input frame.
  10942. Expressed in range of [0-~181.02].
  10943. @item SATLOW
  10944. Display the saturation value at the 10% percentile within the input frame.
  10945. Expressed in range of [0-~181.02].
  10946. @item SATAVG
  10947. Display the average saturation value within the input frame. Expressed in range
  10948. of [0-~181.02].
  10949. @item SATHIGH
  10950. Display the saturation value at the 90% percentile within the input frame.
  10951. Expressed in range of [0-~181.02].
  10952. @item SATMAX
  10953. Display the maximum saturation value contained within the input frame.
  10954. Expressed in range of [0-~181.02].
  10955. @item HUEMED
  10956. Display the median value for hue within the input frame. Expressed in range of
  10957. [0-360].
  10958. @item HUEAVG
  10959. Display the average value for hue within the input frame. Expressed in range of
  10960. [0-360].
  10961. @item YDIF
  10962. Display the average of sample value difference between all values of the Y
  10963. plane in the current frame and corresponding values of the previous input frame.
  10964. Expressed in range of [0-255].
  10965. @item UDIF
  10966. Display the average of sample value difference between all values of the U
  10967. plane in the current frame and corresponding values of the previous input frame.
  10968. Expressed in range of [0-255].
  10969. @item VDIF
  10970. Display the average of sample value difference between all values of the V
  10971. plane in the current frame and corresponding values of the previous input frame.
  10972. Expressed in range of [0-255].
  10973. @item YBITDEPTH
  10974. Display bit depth of Y plane in current frame.
  10975. Expressed in range of [0-16].
  10976. @item UBITDEPTH
  10977. Display bit depth of U plane in current frame.
  10978. Expressed in range of [0-16].
  10979. @item VBITDEPTH
  10980. Display bit depth of V plane in current frame.
  10981. Expressed in range of [0-16].
  10982. @end table
  10983. The filter accepts the following options:
  10984. @table @option
  10985. @item stat
  10986. @item out
  10987. @option{stat} specify an additional form of image analysis.
  10988. @option{out} output video with the specified type of pixel highlighted.
  10989. Both options accept the following values:
  10990. @table @samp
  10991. @item tout
  10992. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10993. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10994. include the results of video dropouts, head clogs, or tape tracking issues.
  10995. @item vrep
  10996. Identify @var{vertical line repetition}. Vertical line repetition includes
  10997. similar rows of pixels within a frame. In born-digital video vertical line
  10998. repetition is common, but this pattern is uncommon in video digitized from an
  10999. analog source. When it occurs in video that results from the digitization of an
  11000. analog source it can indicate concealment from a dropout compensator.
  11001. @item brng
  11002. Identify pixels that fall outside of legal broadcast range.
  11003. @end table
  11004. @item color, c
  11005. Set the highlight color for the @option{out} option. The default color is
  11006. yellow.
  11007. @end table
  11008. @subsection Examples
  11009. @itemize
  11010. @item
  11011. Output data of various video metrics:
  11012. @example
  11013. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11014. @end example
  11015. @item
  11016. Output specific data about the minimum and maximum values of the Y plane per frame:
  11017. @example
  11018. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11019. @end example
  11020. @item
  11021. Playback video while highlighting pixels that are outside of broadcast range in red.
  11022. @example
  11023. ffplay example.mov -vf signalstats="out=brng:color=red"
  11024. @end example
  11025. @item
  11026. Playback video with signalstats metadata drawn over the frame.
  11027. @example
  11028. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11029. @end example
  11030. The contents of signalstat_drawtext.txt used in the command are:
  11031. @example
  11032. time %@{pts:hms@}
  11033. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11034. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11035. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11036. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11037. @end example
  11038. @end itemize
  11039. @anchor{signature}
  11040. @section signature
  11041. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11042. input. In this case the matching between the inputs can be calculated additionally.
  11043. The filter always passes through the first input. The signature of each stream can
  11044. be written into a file.
  11045. It accepts the following options:
  11046. @table @option
  11047. @item detectmode
  11048. Enable or disable the matching process.
  11049. Available values are:
  11050. @table @samp
  11051. @item off
  11052. Disable the calculation of a matching (default).
  11053. @item full
  11054. Calculate the matching for the whole video and output whether the whole video
  11055. matches or only parts.
  11056. @item fast
  11057. Calculate only until a matching is found or the video ends. Should be faster in
  11058. some cases.
  11059. @end table
  11060. @item nb_inputs
  11061. Set the number of inputs. The option value must be a non negative integer.
  11062. Default value is 1.
  11063. @item filename
  11064. Set the path to which the output is written. If there is more than one input,
  11065. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11066. integer), that will be replaced with the input number. If no filename is
  11067. specified, no output will be written. This is the default.
  11068. @item format
  11069. Choose the output format.
  11070. Available values are:
  11071. @table @samp
  11072. @item binary
  11073. Use the specified binary representation (default).
  11074. @item xml
  11075. Use the specified xml representation.
  11076. @end table
  11077. @item th_d
  11078. Set threshold to detect one word as similar. The option value must be an integer
  11079. greater than zero. The default value is 9000.
  11080. @item th_dc
  11081. Set threshold to detect all words as similar. The option value must be an integer
  11082. greater than zero. The default value is 60000.
  11083. @item th_xh
  11084. Set threshold to detect frames as similar. The option value must be an integer
  11085. greater than zero. The default value is 116.
  11086. @item th_di
  11087. Set the minimum length of a sequence in frames to recognize it as matching
  11088. sequence. The option value must be a non negative integer value.
  11089. The default value is 0.
  11090. @item th_it
  11091. Set the minimum relation, that matching frames to all frames must have.
  11092. The option value must be a double value between 0 and 1. The default value is 0.5.
  11093. @end table
  11094. @subsection Examples
  11095. @itemize
  11096. @item
  11097. To calculate the signature of an input video and store it in signature.bin:
  11098. @example
  11099. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11100. @end example
  11101. @item
  11102. To detect whether two videos match and store the signatures in XML format in
  11103. signature0.xml and signature1.xml:
  11104. @example
  11105. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  11106. @end example
  11107. @end itemize
  11108. @anchor{smartblur}
  11109. @section smartblur
  11110. Blur the input video without impacting the outlines.
  11111. It accepts the following options:
  11112. @table @option
  11113. @item luma_radius, lr
  11114. Set the luma radius. The option value must be a float number in
  11115. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11116. used to blur the image (slower if larger). Default value is 1.0.
  11117. @item luma_strength, ls
  11118. Set the luma strength. The option value must be a float number
  11119. in the range [-1.0,1.0] that configures the blurring. A value included
  11120. in [0.0,1.0] will blur the image whereas a value included in
  11121. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11122. @item luma_threshold, lt
  11123. Set the luma threshold used as a coefficient to determine
  11124. whether a pixel should be blurred or not. The option value must be an
  11125. integer in the range [-30,30]. A value of 0 will filter all the image,
  11126. a value included in [0,30] will filter flat areas and a value included
  11127. in [-30,0] will filter edges. Default value is 0.
  11128. @item chroma_radius, cr
  11129. Set the chroma radius. The option value must be a float number in
  11130. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11131. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11132. @item chroma_strength, cs
  11133. Set the chroma strength. The option value must be a float number
  11134. in the range [-1.0,1.0] that configures the blurring. A value included
  11135. in [0.0,1.0] will blur the image whereas a value included in
  11136. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11137. @item chroma_threshold, ct
  11138. Set the chroma threshold used as a coefficient to determine
  11139. whether a pixel should be blurred or not. The option value must be an
  11140. integer in the range [-30,30]. A value of 0 will filter all the image,
  11141. a value included in [0,30] will filter flat areas and a value included
  11142. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11143. @end table
  11144. If a chroma option is not explicitly set, the corresponding luma value
  11145. is set.
  11146. @section ssim
  11147. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11148. This filter takes in input two input videos, the first input is
  11149. considered the "main" source and is passed unchanged to the
  11150. output. The second input is used as a "reference" video for computing
  11151. the SSIM.
  11152. Both video inputs must have the same resolution and pixel format for
  11153. this filter to work correctly. Also it assumes that both inputs
  11154. have the same number of frames, which are compared one by one.
  11155. The filter stores the calculated SSIM of each frame.
  11156. The description of the accepted parameters follows.
  11157. @table @option
  11158. @item stats_file, f
  11159. If specified the filter will use the named file to save the SSIM of
  11160. each individual frame. When filename equals "-" the data is sent to
  11161. standard output.
  11162. @end table
  11163. The file printed if @var{stats_file} is selected, contains a sequence of
  11164. key/value pairs of the form @var{key}:@var{value} for each compared
  11165. couple of frames.
  11166. A description of each shown parameter follows:
  11167. @table @option
  11168. @item n
  11169. sequential number of the input frame, starting from 1
  11170. @item Y, U, V, R, G, B
  11171. SSIM of the compared frames for the component specified by the suffix.
  11172. @item All
  11173. SSIM of the compared frames for the whole frame.
  11174. @item dB
  11175. Same as above but in dB representation.
  11176. @end table
  11177. This filter also supports the @ref{framesync} options.
  11178. For example:
  11179. @example
  11180. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11181. [main][ref] ssim="stats_file=stats.log" [out]
  11182. @end example
  11183. On this example the input file being processed is compared with the
  11184. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11185. is stored in @file{stats.log}.
  11186. Another example with both psnr and ssim at same time:
  11187. @example
  11188. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11189. @end example
  11190. @section stereo3d
  11191. Convert between different stereoscopic image formats.
  11192. The filters accept the following options:
  11193. @table @option
  11194. @item in
  11195. Set stereoscopic image format of input.
  11196. Available values for input image formats are:
  11197. @table @samp
  11198. @item sbsl
  11199. side by side parallel (left eye left, right eye right)
  11200. @item sbsr
  11201. side by side crosseye (right eye left, left eye right)
  11202. @item sbs2l
  11203. side by side parallel with half width resolution
  11204. (left eye left, right eye right)
  11205. @item sbs2r
  11206. side by side crosseye with half width resolution
  11207. (right eye left, left eye right)
  11208. @item abl
  11209. above-below (left eye above, right eye below)
  11210. @item abr
  11211. above-below (right eye above, left eye below)
  11212. @item ab2l
  11213. above-below with half height resolution
  11214. (left eye above, right eye below)
  11215. @item ab2r
  11216. above-below with half height resolution
  11217. (right eye above, left eye below)
  11218. @item al
  11219. alternating frames (left eye first, right eye second)
  11220. @item ar
  11221. alternating frames (right eye first, left eye second)
  11222. @item irl
  11223. interleaved rows (left eye has top row, right eye starts on next row)
  11224. @item irr
  11225. interleaved rows (right eye has top row, left eye starts on next row)
  11226. @item icl
  11227. interleaved columns, left eye first
  11228. @item icr
  11229. interleaved columns, right eye first
  11230. Default value is @samp{sbsl}.
  11231. @end table
  11232. @item out
  11233. Set stereoscopic image format of output.
  11234. @table @samp
  11235. @item sbsl
  11236. side by side parallel (left eye left, right eye right)
  11237. @item sbsr
  11238. side by side crosseye (right eye left, left eye right)
  11239. @item sbs2l
  11240. side by side parallel with half width resolution
  11241. (left eye left, right eye right)
  11242. @item sbs2r
  11243. side by side crosseye with half width resolution
  11244. (right eye left, left eye right)
  11245. @item abl
  11246. above-below (left eye above, right eye below)
  11247. @item abr
  11248. above-below (right eye above, left eye below)
  11249. @item ab2l
  11250. above-below with half height resolution
  11251. (left eye above, right eye below)
  11252. @item ab2r
  11253. above-below with half height resolution
  11254. (right eye above, left eye below)
  11255. @item al
  11256. alternating frames (left eye first, right eye second)
  11257. @item ar
  11258. alternating frames (right eye first, left eye second)
  11259. @item irl
  11260. interleaved rows (left eye has top row, right eye starts on next row)
  11261. @item irr
  11262. interleaved rows (right eye has top row, left eye starts on next row)
  11263. @item arbg
  11264. anaglyph red/blue gray
  11265. (red filter on left eye, blue filter on right eye)
  11266. @item argg
  11267. anaglyph red/green gray
  11268. (red filter on left eye, green filter on right eye)
  11269. @item arcg
  11270. anaglyph red/cyan gray
  11271. (red filter on left eye, cyan filter on right eye)
  11272. @item arch
  11273. anaglyph red/cyan half colored
  11274. (red filter on left eye, cyan filter on right eye)
  11275. @item arcc
  11276. anaglyph red/cyan color
  11277. (red filter on left eye, cyan filter on right eye)
  11278. @item arcd
  11279. anaglyph red/cyan color optimized with the least squares projection of dubois
  11280. (red filter on left eye, cyan filter on right eye)
  11281. @item agmg
  11282. anaglyph green/magenta gray
  11283. (green filter on left eye, magenta filter on right eye)
  11284. @item agmh
  11285. anaglyph green/magenta half colored
  11286. (green filter on left eye, magenta filter on right eye)
  11287. @item agmc
  11288. anaglyph green/magenta colored
  11289. (green filter on left eye, magenta filter on right eye)
  11290. @item agmd
  11291. anaglyph green/magenta color optimized with the least squares projection of dubois
  11292. (green filter on left eye, magenta filter on right eye)
  11293. @item aybg
  11294. anaglyph yellow/blue gray
  11295. (yellow filter on left eye, blue filter on right eye)
  11296. @item aybh
  11297. anaglyph yellow/blue half colored
  11298. (yellow filter on left eye, blue filter on right eye)
  11299. @item aybc
  11300. anaglyph yellow/blue colored
  11301. (yellow filter on left eye, blue filter on right eye)
  11302. @item aybd
  11303. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11304. (yellow filter on left eye, blue filter on right eye)
  11305. @item ml
  11306. mono output (left eye only)
  11307. @item mr
  11308. mono output (right eye only)
  11309. @item chl
  11310. checkerboard, left eye first
  11311. @item chr
  11312. checkerboard, right eye first
  11313. @item icl
  11314. interleaved columns, left eye first
  11315. @item icr
  11316. interleaved columns, right eye first
  11317. @item hdmi
  11318. HDMI frame pack
  11319. @end table
  11320. Default value is @samp{arcd}.
  11321. @end table
  11322. @subsection Examples
  11323. @itemize
  11324. @item
  11325. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11326. @example
  11327. stereo3d=sbsl:aybd
  11328. @end example
  11329. @item
  11330. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11331. @example
  11332. stereo3d=abl:sbsr
  11333. @end example
  11334. @end itemize
  11335. @section streamselect, astreamselect
  11336. Select video or audio streams.
  11337. The filter accepts the following options:
  11338. @table @option
  11339. @item inputs
  11340. Set number of inputs. Default is 2.
  11341. @item map
  11342. Set input indexes to remap to outputs.
  11343. @end table
  11344. @subsection Commands
  11345. The @code{streamselect} and @code{astreamselect} filter supports the following
  11346. commands:
  11347. @table @option
  11348. @item map
  11349. Set input indexes to remap to outputs.
  11350. @end table
  11351. @subsection Examples
  11352. @itemize
  11353. @item
  11354. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11355. @example
  11356. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11357. @end example
  11358. @item
  11359. Same as above, but for audio:
  11360. @example
  11361. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11362. @end example
  11363. @end itemize
  11364. @section sobel
  11365. Apply sobel operator to input video stream.
  11366. The filter accepts the following option:
  11367. @table @option
  11368. @item planes
  11369. Set which planes will be processed, unprocessed planes will be copied.
  11370. By default value 0xf, all planes will be processed.
  11371. @item scale
  11372. Set value which will be multiplied with filtered result.
  11373. @item delta
  11374. Set value which will be added to filtered result.
  11375. @end table
  11376. @anchor{spp}
  11377. @section spp
  11378. Apply a simple postprocessing filter that compresses and decompresses the image
  11379. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11380. and average the results.
  11381. The filter accepts the following options:
  11382. @table @option
  11383. @item quality
  11384. Set quality. This option defines the number of levels for averaging. It accepts
  11385. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11386. effect. A value of @code{6} means the higher quality. For each increment of
  11387. that value the speed drops by a factor of approximately 2. Default value is
  11388. @code{3}.
  11389. @item qp
  11390. Force a constant quantization parameter. If not set, the filter will use the QP
  11391. from the video stream (if available).
  11392. @item mode
  11393. Set thresholding mode. Available modes are:
  11394. @table @samp
  11395. @item hard
  11396. Set hard thresholding (default).
  11397. @item soft
  11398. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11399. @end table
  11400. @item use_bframe_qp
  11401. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11402. option may cause flicker since the B-Frames have often larger QP. Default is
  11403. @code{0} (not enabled).
  11404. @end table
  11405. @anchor{subtitles}
  11406. @section subtitles
  11407. Draw subtitles on top of input video using the libass library.
  11408. To enable compilation of this filter you need to configure FFmpeg with
  11409. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11410. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11411. Alpha) subtitles format.
  11412. The filter accepts the following options:
  11413. @table @option
  11414. @item filename, f
  11415. Set the filename of the subtitle file to read. It must be specified.
  11416. @item original_size
  11417. Specify the size of the original video, the video for which the ASS file
  11418. was composed. For the syntax of this option, check the
  11419. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11420. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11421. correctly scale the fonts if the aspect ratio has been changed.
  11422. @item fontsdir
  11423. Set a directory path containing fonts that can be used by the filter.
  11424. These fonts will be used in addition to whatever the font provider uses.
  11425. @item alpha
  11426. Process alpha channel, by default alpha channel is untouched.
  11427. @item charenc
  11428. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11429. useful if not UTF-8.
  11430. @item stream_index, si
  11431. Set subtitles stream index. @code{subtitles} filter only.
  11432. @item force_style
  11433. Override default style or script info parameters of the subtitles. It accepts a
  11434. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11435. @end table
  11436. If the first key is not specified, it is assumed that the first value
  11437. specifies the @option{filename}.
  11438. For example, to render the file @file{sub.srt} on top of the input
  11439. video, use the command:
  11440. @example
  11441. subtitles=sub.srt
  11442. @end example
  11443. which is equivalent to:
  11444. @example
  11445. subtitles=filename=sub.srt
  11446. @end example
  11447. To render the default subtitles stream from file @file{video.mkv}, use:
  11448. @example
  11449. subtitles=video.mkv
  11450. @end example
  11451. To render the second subtitles stream from that file, use:
  11452. @example
  11453. subtitles=video.mkv:si=1
  11454. @end example
  11455. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11456. @code{DejaVu Serif}, use:
  11457. @example
  11458. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11459. @end example
  11460. @section super2xsai
  11461. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11462. Interpolate) pixel art scaling algorithm.
  11463. Useful for enlarging pixel art images without reducing sharpness.
  11464. @section swaprect
  11465. Swap two rectangular objects in video.
  11466. This filter accepts the following options:
  11467. @table @option
  11468. @item w
  11469. Set object width.
  11470. @item h
  11471. Set object height.
  11472. @item x1
  11473. Set 1st rect x coordinate.
  11474. @item y1
  11475. Set 1st rect y coordinate.
  11476. @item x2
  11477. Set 2nd rect x coordinate.
  11478. @item y2
  11479. Set 2nd rect y coordinate.
  11480. All expressions are evaluated once for each frame.
  11481. @end table
  11482. The all options are expressions containing the following constants:
  11483. @table @option
  11484. @item w
  11485. @item h
  11486. The input width and height.
  11487. @item a
  11488. same as @var{w} / @var{h}
  11489. @item sar
  11490. input sample aspect ratio
  11491. @item dar
  11492. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11493. @item n
  11494. The number of the input frame, starting from 0.
  11495. @item t
  11496. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11497. @item pos
  11498. the position in the file of the input frame, NAN if unknown
  11499. @end table
  11500. @section swapuv
  11501. Swap U & V plane.
  11502. @section telecine
  11503. Apply telecine process to the video.
  11504. This filter accepts the following options:
  11505. @table @option
  11506. @item first_field
  11507. @table @samp
  11508. @item top, t
  11509. top field first
  11510. @item bottom, b
  11511. bottom field first
  11512. The default value is @code{top}.
  11513. @end table
  11514. @item pattern
  11515. A string of numbers representing the pulldown pattern you wish to apply.
  11516. The default value is @code{23}.
  11517. @end table
  11518. @example
  11519. Some typical patterns:
  11520. NTSC output (30i):
  11521. 27.5p: 32222
  11522. 24p: 23 (classic)
  11523. 24p: 2332 (preferred)
  11524. 20p: 33
  11525. 18p: 334
  11526. 16p: 3444
  11527. PAL output (25i):
  11528. 27.5p: 12222
  11529. 24p: 222222222223 ("Euro pulldown")
  11530. 16.67p: 33
  11531. 16p: 33333334
  11532. @end example
  11533. @section threshold
  11534. Apply threshold effect to video stream.
  11535. This filter needs four video streams to perform thresholding.
  11536. First stream is stream we are filtering.
  11537. Second stream is holding threshold values, third stream is holding min values,
  11538. and last, fourth stream is holding max values.
  11539. The filter accepts the following option:
  11540. @table @option
  11541. @item planes
  11542. Set which planes will be processed, unprocessed planes will be copied.
  11543. By default value 0xf, all planes will be processed.
  11544. @end table
  11545. For example if first stream pixel's component value is less then threshold value
  11546. of pixel component from 2nd threshold stream, third stream value will picked,
  11547. otherwise fourth stream pixel component value will be picked.
  11548. Using color source filter one can perform various types of thresholding:
  11549. @subsection Examples
  11550. @itemize
  11551. @item
  11552. Binary threshold, using gray color as threshold:
  11553. @example
  11554. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11555. @end example
  11556. @item
  11557. Inverted binary threshold, using gray color as threshold:
  11558. @example
  11559. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11560. @end example
  11561. @item
  11562. Truncate binary threshold, using gray color as threshold:
  11563. @example
  11564. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11565. @end example
  11566. @item
  11567. Threshold to zero, using gray color as threshold:
  11568. @example
  11569. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11570. @end example
  11571. @item
  11572. Inverted threshold to zero, using gray color as threshold:
  11573. @example
  11574. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11575. @end example
  11576. @end itemize
  11577. @section thumbnail
  11578. Select the most representative frame in a given sequence of consecutive frames.
  11579. The filter accepts the following options:
  11580. @table @option
  11581. @item n
  11582. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11583. will pick one of them, and then handle the next batch of @var{n} frames until
  11584. the end. Default is @code{100}.
  11585. @end table
  11586. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11587. value will result in a higher memory usage, so a high value is not recommended.
  11588. @subsection Examples
  11589. @itemize
  11590. @item
  11591. Extract one picture each 50 frames:
  11592. @example
  11593. thumbnail=50
  11594. @end example
  11595. @item
  11596. Complete example of a thumbnail creation with @command{ffmpeg}:
  11597. @example
  11598. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11599. @end example
  11600. @end itemize
  11601. @section tile
  11602. Tile several successive frames together.
  11603. The filter accepts the following options:
  11604. @table @option
  11605. @item layout
  11606. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11607. this option, check the
  11608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11609. @item nb_frames
  11610. Set the maximum number of frames to render in the given area. It must be less
  11611. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11612. the area will be used.
  11613. @item margin
  11614. Set the outer border margin in pixels.
  11615. @item padding
  11616. Set the inner border thickness (i.e. the number of pixels between frames). For
  11617. more advanced padding options (such as having different values for the edges),
  11618. refer to the pad video filter.
  11619. @item color
  11620. Specify the color of the unused area. For the syntax of this option, check the
  11621. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11622. The default value of @var{color} is "black".
  11623. @item overlap
  11624. Set the number of frames to overlap when tiling several successive frames together.
  11625. The value must be between @code{0} and @var{nb_frames - 1}.
  11626. @item init_padding
  11627. Set the number of frames to initially be empty before displaying first output frame.
  11628. This controls how soon will one get first output frame.
  11629. The value must be between @code{0} and @var{nb_frames - 1}.
  11630. @end table
  11631. @subsection Examples
  11632. @itemize
  11633. @item
  11634. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11635. @example
  11636. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11637. @end example
  11638. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11639. duplicating each output frame to accommodate the originally detected frame
  11640. rate.
  11641. @item
  11642. Display @code{5} pictures in an area of @code{3x2} frames,
  11643. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11644. mixed flat and named options:
  11645. @example
  11646. tile=3x2:nb_frames=5:padding=7:margin=2
  11647. @end example
  11648. @end itemize
  11649. @section tinterlace
  11650. Perform various types of temporal field interlacing.
  11651. Frames are counted starting from 1, so the first input frame is
  11652. considered odd.
  11653. The filter accepts the following options:
  11654. @table @option
  11655. @item mode
  11656. Specify the mode of the interlacing. This option can also be specified
  11657. as a value alone. See below for a list of values for this option.
  11658. Available values are:
  11659. @table @samp
  11660. @item merge, 0
  11661. Move odd frames into the upper field, even into the lower field,
  11662. generating a double height frame at half frame rate.
  11663. @example
  11664. ------> time
  11665. Input:
  11666. Frame 1 Frame 2 Frame 3 Frame 4
  11667. 11111 22222 33333 44444
  11668. 11111 22222 33333 44444
  11669. 11111 22222 33333 44444
  11670. 11111 22222 33333 44444
  11671. Output:
  11672. 11111 33333
  11673. 22222 44444
  11674. 11111 33333
  11675. 22222 44444
  11676. 11111 33333
  11677. 22222 44444
  11678. 11111 33333
  11679. 22222 44444
  11680. @end example
  11681. @item drop_even, 1
  11682. Only output odd frames, even frames are dropped, generating a frame with
  11683. unchanged height at half frame rate.
  11684. @example
  11685. ------> time
  11686. Input:
  11687. Frame 1 Frame 2 Frame 3 Frame 4
  11688. 11111 22222 33333 44444
  11689. 11111 22222 33333 44444
  11690. 11111 22222 33333 44444
  11691. 11111 22222 33333 44444
  11692. Output:
  11693. 11111 33333
  11694. 11111 33333
  11695. 11111 33333
  11696. 11111 33333
  11697. @end example
  11698. @item drop_odd, 2
  11699. Only output even frames, odd frames are dropped, generating a frame with
  11700. unchanged height at half frame rate.
  11701. @example
  11702. ------> time
  11703. Input:
  11704. Frame 1 Frame 2 Frame 3 Frame 4
  11705. 11111 22222 33333 44444
  11706. 11111 22222 33333 44444
  11707. 11111 22222 33333 44444
  11708. 11111 22222 33333 44444
  11709. Output:
  11710. 22222 44444
  11711. 22222 44444
  11712. 22222 44444
  11713. 22222 44444
  11714. @end example
  11715. @item pad, 3
  11716. Expand each frame to full height, but pad alternate lines with black,
  11717. generating a frame with double height at the same input frame rate.
  11718. @example
  11719. ------> time
  11720. Input:
  11721. Frame 1 Frame 2 Frame 3 Frame 4
  11722. 11111 22222 33333 44444
  11723. 11111 22222 33333 44444
  11724. 11111 22222 33333 44444
  11725. 11111 22222 33333 44444
  11726. Output:
  11727. 11111 ..... 33333 .....
  11728. ..... 22222 ..... 44444
  11729. 11111 ..... 33333 .....
  11730. ..... 22222 ..... 44444
  11731. 11111 ..... 33333 .....
  11732. ..... 22222 ..... 44444
  11733. 11111 ..... 33333 .....
  11734. ..... 22222 ..... 44444
  11735. @end example
  11736. @item interleave_top, 4
  11737. Interleave the upper field from odd frames with the lower field from
  11738. even frames, generating a frame with unchanged height at half frame rate.
  11739. @example
  11740. ------> time
  11741. Input:
  11742. Frame 1 Frame 2 Frame 3 Frame 4
  11743. 11111<- 22222 33333<- 44444
  11744. 11111 22222<- 33333 44444<-
  11745. 11111<- 22222 33333<- 44444
  11746. 11111 22222<- 33333 44444<-
  11747. Output:
  11748. 11111 33333
  11749. 22222 44444
  11750. 11111 33333
  11751. 22222 44444
  11752. @end example
  11753. @item interleave_bottom, 5
  11754. Interleave the lower field from odd frames with the upper field from
  11755. even frames, generating a frame with unchanged height at half frame rate.
  11756. @example
  11757. ------> time
  11758. Input:
  11759. Frame 1 Frame 2 Frame 3 Frame 4
  11760. 11111 22222<- 33333 44444<-
  11761. 11111<- 22222 33333<- 44444
  11762. 11111 22222<- 33333 44444<-
  11763. 11111<- 22222 33333<- 44444
  11764. Output:
  11765. 22222 44444
  11766. 11111 33333
  11767. 22222 44444
  11768. 11111 33333
  11769. @end example
  11770. @item interlacex2, 6
  11771. Double frame rate with unchanged height. Frames are inserted each
  11772. containing the second temporal field from the previous input frame and
  11773. the first temporal field from the next input frame. This mode relies on
  11774. the top_field_first flag. Useful for interlaced video displays with no
  11775. field synchronisation.
  11776. @example
  11777. ------> time
  11778. Input:
  11779. Frame 1 Frame 2 Frame 3 Frame 4
  11780. 11111 22222 33333 44444
  11781. 11111 22222 33333 44444
  11782. 11111 22222 33333 44444
  11783. 11111 22222 33333 44444
  11784. Output:
  11785. 11111 22222 22222 33333 33333 44444 44444
  11786. 11111 11111 22222 22222 33333 33333 44444
  11787. 11111 22222 22222 33333 33333 44444 44444
  11788. 11111 11111 22222 22222 33333 33333 44444
  11789. @end example
  11790. @item mergex2, 7
  11791. Move odd frames into the upper field, even into the lower field,
  11792. generating a double height frame at same frame rate.
  11793. @example
  11794. ------> time
  11795. Input:
  11796. Frame 1 Frame 2 Frame 3 Frame 4
  11797. 11111 22222 33333 44444
  11798. 11111 22222 33333 44444
  11799. 11111 22222 33333 44444
  11800. 11111 22222 33333 44444
  11801. Output:
  11802. 11111 33333 33333 55555
  11803. 22222 22222 44444 44444
  11804. 11111 33333 33333 55555
  11805. 22222 22222 44444 44444
  11806. 11111 33333 33333 55555
  11807. 22222 22222 44444 44444
  11808. 11111 33333 33333 55555
  11809. 22222 22222 44444 44444
  11810. @end example
  11811. @end table
  11812. Numeric values are deprecated but are accepted for backward
  11813. compatibility reasons.
  11814. Default mode is @code{merge}.
  11815. @item flags
  11816. Specify flags influencing the filter process.
  11817. Available value for @var{flags} is:
  11818. @table @option
  11819. @item low_pass_filter, vlfp
  11820. Enable linear vertical low-pass filtering in the filter.
  11821. Vertical low-pass filtering is required when creating an interlaced
  11822. destination from a progressive source which contains high-frequency
  11823. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11824. patterning.
  11825. @item complex_filter, cvlfp
  11826. Enable complex vertical low-pass filtering.
  11827. This will slightly less reduce interlace 'twitter' and Moire
  11828. patterning but better retain detail and subjective sharpness impression.
  11829. @end table
  11830. Vertical low-pass filtering can only be enabled for @option{mode}
  11831. @var{interleave_top} and @var{interleave_bottom}.
  11832. @end table
  11833. @section tonemap
  11834. Tone map colors from different dynamic ranges.
  11835. This filter expects data in single precision floating point, as it needs to
  11836. operate on (and can output) out-of-range values. Another filter, such as
  11837. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11838. The tonemapping algorithms implemented only work on linear light, so input
  11839. data should be linearized beforehand (and possibly correctly tagged).
  11840. @example
  11841. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11842. @end example
  11843. @subsection Options
  11844. The filter accepts the following options.
  11845. @table @option
  11846. @item tonemap
  11847. Set the tone map algorithm to use.
  11848. Possible values are:
  11849. @table @var
  11850. @item none
  11851. Do not apply any tone map, only desaturate overbright pixels.
  11852. @item clip
  11853. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11854. in-range values, while distorting out-of-range values.
  11855. @item linear
  11856. Stretch the entire reference gamut to a linear multiple of the display.
  11857. @item gamma
  11858. Fit a logarithmic transfer between the tone curves.
  11859. @item reinhard
  11860. Preserve overall image brightness with a simple curve, using nonlinear
  11861. contrast, which results in flattening details and degrading color accuracy.
  11862. @item hable
  11863. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11864. of slightly darkening everything. Use it when detail preservation is more
  11865. important than color and brightness accuracy.
  11866. @item mobius
  11867. Smoothly map out-of-range values, while retaining contrast and colors for
  11868. in-range material as much as possible. Use it when color accuracy is more
  11869. important than detail preservation.
  11870. @end table
  11871. Default is none.
  11872. @item param
  11873. Tune the tone mapping algorithm.
  11874. This affects the following algorithms:
  11875. @table @var
  11876. @item none
  11877. Ignored.
  11878. @item linear
  11879. Specifies the scale factor to use while stretching.
  11880. Default to 1.0.
  11881. @item gamma
  11882. Specifies the exponent of the function.
  11883. Default to 1.8.
  11884. @item clip
  11885. Specify an extra linear coefficient to multiply into the signal before clipping.
  11886. Default to 1.0.
  11887. @item reinhard
  11888. Specify the local contrast coefficient at the display peak.
  11889. Default to 0.5, which means that in-gamut values will be about half as bright
  11890. as when clipping.
  11891. @item hable
  11892. Ignored.
  11893. @item mobius
  11894. Specify the transition point from linear to mobius transform. Every value
  11895. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11896. more accurate the result will be, at the cost of losing bright details.
  11897. Default to 0.3, which due to the steep initial slope still preserves in-range
  11898. colors fairly accurately.
  11899. @end table
  11900. @item desat
  11901. Apply desaturation for highlights that exceed this level of brightness. The
  11902. higher the parameter, the more color information will be preserved. This
  11903. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11904. (smoothly) turning into white instead. This makes images feel more natural,
  11905. at the cost of reducing information about out-of-range colors.
  11906. The default of 2.0 is somewhat conservative and will mostly just apply to
  11907. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11908. This option works only if the input frame has a supported color tag.
  11909. @item peak
  11910. Override signal/nominal/reference peak with this value. Useful when the
  11911. embedded peak information in display metadata is not reliable or when tone
  11912. mapping from a lower range to a higher range.
  11913. @end table
  11914. @section transpose
  11915. Transpose rows with columns in the input video and optionally flip it.
  11916. It accepts the following parameters:
  11917. @table @option
  11918. @item dir
  11919. Specify the transposition direction.
  11920. Can assume the following values:
  11921. @table @samp
  11922. @item 0, 4, cclock_flip
  11923. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11924. @example
  11925. L.R L.l
  11926. . . -> . .
  11927. l.r R.r
  11928. @end example
  11929. @item 1, 5, clock
  11930. Rotate by 90 degrees clockwise, that is:
  11931. @example
  11932. L.R l.L
  11933. . . -> . .
  11934. l.r r.R
  11935. @end example
  11936. @item 2, 6, cclock
  11937. Rotate by 90 degrees counterclockwise, that is:
  11938. @example
  11939. L.R R.r
  11940. . . -> . .
  11941. l.r L.l
  11942. @end example
  11943. @item 3, 7, clock_flip
  11944. Rotate by 90 degrees clockwise and vertically flip, that is:
  11945. @example
  11946. L.R r.R
  11947. . . -> . .
  11948. l.r l.L
  11949. @end example
  11950. @end table
  11951. For values between 4-7, the transposition is only done if the input
  11952. video geometry is portrait and not landscape. These values are
  11953. deprecated, the @code{passthrough} option should be used instead.
  11954. Numerical values are deprecated, and should be dropped in favor of
  11955. symbolic constants.
  11956. @item passthrough
  11957. Do not apply the transposition if the input geometry matches the one
  11958. specified by the specified value. It accepts the following values:
  11959. @table @samp
  11960. @item none
  11961. Always apply transposition.
  11962. @item portrait
  11963. Preserve portrait geometry (when @var{height} >= @var{width}).
  11964. @item landscape
  11965. Preserve landscape geometry (when @var{width} >= @var{height}).
  11966. @end table
  11967. Default value is @code{none}.
  11968. @end table
  11969. For example to rotate by 90 degrees clockwise and preserve portrait
  11970. layout:
  11971. @example
  11972. transpose=dir=1:passthrough=portrait
  11973. @end example
  11974. The command above can also be specified as:
  11975. @example
  11976. transpose=1:portrait
  11977. @end example
  11978. @section trim
  11979. Trim the input so that the output contains one continuous subpart of the input.
  11980. It accepts the following parameters:
  11981. @table @option
  11982. @item start
  11983. Specify the time of the start of the kept section, i.e. the frame with the
  11984. timestamp @var{start} will be the first frame in the output.
  11985. @item end
  11986. Specify the time of the first frame that will be dropped, i.e. the frame
  11987. immediately preceding the one with the timestamp @var{end} will be the last
  11988. frame in the output.
  11989. @item start_pts
  11990. This is the same as @var{start}, except this option sets the start timestamp
  11991. in timebase units instead of seconds.
  11992. @item end_pts
  11993. This is the same as @var{end}, except this option sets the end timestamp
  11994. in timebase units instead of seconds.
  11995. @item duration
  11996. The maximum duration of the output in seconds.
  11997. @item start_frame
  11998. The number of the first frame that should be passed to the output.
  11999. @item end_frame
  12000. The number of the first frame that should be dropped.
  12001. @end table
  12002. @option{start}, @option{end}, and @option{duration} are expressed as time
  12003. duration specifications; see
  12004. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12005. for the accepted syntax.
  12006. Note that the first two sets of the start/end options and the @option{duration}
  12007. option look at the frame timestamp, while the _frame variants simply count the
  12008. frames that pass through the filter. Also note that this filter does not modify
  12009. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12010. setpts filter after the trim filter.
  12011. If multiple start or end options are set, this filter tries to be greedy and
  12012. keep all the frames that match at least one of the specified constraints. To keep
  12013. only the part that matches all the constraints at once, chain multiple trim
  12014. filters.
  12015. The defaults are such that all the input is kept. So it is possible to set e.g.
  12016. just the end values to keep everything before the specified time.
  12017. Examples:
  12018. @itemize
  12019. @item
  12020. Drop everything except the second minute of input:
  12021. @example
  12022. ffmpeg -i INPUT -vf trim=60:120
  12023. @end example
  12024. @item
  12025. Keep only the first second:
  12026. @example
  12027. ffmpeg -i INPUT -vf trim=duration=1
  12028. @end example
  12029. @end itemize
  12030. @section unpremultiply
  12031. Apply alpha unpremultiply effect to input video stream using first plane
  12032. of second stream as alpha.
  12033. Both streams must have same dimensions and same pixel format.
  12034. The filter accepts the following option:
  12035. @table @option
  12036. @item planes
  12037. Set which planes will be processed, unprocessed planes will be copied.
  12038. By default value 0xf, all planes will be processed.
  12039. If the format has 1 or 2 components, then luma is bit 0.
  12040. If the format has 3 or 4 components:
  12041. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12042. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12043. If present, the alpha channel is always the last bit.
  12044. @item inplace
  12045. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12046. @end table
  12047. @anchor{unsharp}
  12048. @section unsharp
  12049. Sharpen or blur the input video.
  12050. It accepts the following parameters:
  12051. @table @option
  12052. @item luma_msize_x, lx
  12053. Set the luma matrix horizontal size. It must be an odd integer between
  12054. 3 and 23. The default value is 5.
  12055. @item luma_msize_y, ly
  12056. Set the luma matrix vertical size. It must be an odd integer between 3
  12057. and 23. The default value is 5.
  12058. @item luma_amount, la
  12059. Set the luma effect strength. It must be a floating point number, reasonable
  12060. values lay between -1.5 and 1.5.
  12061. Negative values will blur the input video, while positive values will
  12062. sharpen it, a value of zero will disable the effect.
  12063. Default value is 1.0.
  12064. @item chroma_msize_x, cx
  12065. Set the chroma matrix horizontal size. It must be an odd integer
  12066. between 3 and 23. The default value is 5.
  12067. @item chroma_msize_y, cy
  12068. Set the chroma matrix vertical size. It must be an odd integer
  12069. between 3 and 23. The default value is 5.
  12070. @item chroma_amount, ca
  12071. Set the chroma effect strength. It must be a floating point number, reasonable
  12072. values lay between -1.5 and 1.5.
  12073. Negative values will blur the input video, while positive values will
  12074. sharpen it, a value of zero will disable the effect.
  12075. Default value is 0.0.
  12076. @end table
  12077. All parameters are optional and default to the equivalent of the
  12078. string '5:5:1.0:5:5:0.0'.
  12079. @subsection Examples
  12080. @itemize
  12081. @item
  12082. Apply strong luma sharpen effect:
  12083. @example
  12084. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12085. @end example
  12086. @item
  12087. Apply a strong blur of both luma and chroma parameters:
  12088. @example
  12089. unsharp=7:7:-2:7:7:-2
  12090. @end example
  12091. @end itemize
  12092. @section uspp
  12093. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12094. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12095. shifts and average the results.
  12096. The way this differs from the behavior of spp is that uspp actually encodes &
  12097. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12098. DCT similar to MJPEG.
  12099. The filter accepts the following options:
  12100. @table @option
  12101. @item quality
  12102. Set quality. This option defines the number of levels for averaging. It accepts
  12103. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12104. effect. A value of @code{8} means the higher quality. For each increment of
  12105. that value the speed drops by a factor of approximately 2. Default value is
  12106. @code{3}.
  12107. @item qp
  12108. Force a constant quantization parameter. If not set, the filter will use the QP
  12109. from the video stream (if available).
  12110. @end table
  12111. @section vaguedenoiser
  12112. Apply a wavelet based denoiser.
  12113. It transforms each frame from the video input into the wavelet domain,
  12114. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12115. the obtained coefficients. It does an inverse wavelet transform after.
  12116. Due to wavelet properties, it should give a nice smoothed result, and
  12117. reduced noise, without blurring picture features.
  12118. This filter accepts the following options:
  12119. @table @option
  12120. @item threshold
  12121. The filtering strength. The higher, the more filtered the video will be.
  12122. Hard thresholding can use a higher threshold than soft thresholding
  12123. before the video looks overfiltered. Default value is 2.
  12124. @item method
  12125. The filtering method the filter will use.
  12126. It accepts the following values:
  12127. @table @samp
  12128. @item hard
  12129. All values under the threshold will be zeroed.
  12130. @item soft
  12131. All values under the threshold will be zeroed. All values above will be
  12132. reduced by the threshold.
  12133. @item garrote
  12134. Scales or nullifies coefficients - intermediary between (more) soft and
  12135. (less) hard thresholding.
  12136. @end table
  12137. Default is garrote.
  12138. @item nsteps
  12139. Number of times, the wavelet will decompose the picture. Picture can't
  12140. be decomposed beyond a particular point (typically, 8 for a 640x480
  12141. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12142. @item percent
  12143. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12144. @item planes
  12145. A list of the planes to process. By default all planes are processed.
  12146. @end table
  12147. @section vectorscope
  12148. Display 2 color component values in the two dimensional graph (which is called
  12149. a vectorscope).
  12150. This filter accepts the following options:
  12151. @table @option
  12152. @item mode, m
  12153. Set vectorscope mode.
  12154. It accepts the following values:
  12155. @table @samp
  12156. @item gray
  12157. Gray values are displayed on graph, higher brightness means more pixels have
  12158. same component color value on location in graph. This is the default mode.
  12159. @item color
  12160. Gray values are displayed on graph. Surrounding pixels values which are not
  12161. present in video frame are drawn in gradient of 2 color components which are
  12162. set by option @code{x} and @code{y}. The 3rd color component is static.
  12163. @item color2
  12164. Actual color components values present in video frame are displayed on graph.
  12165. @item color3
  12166. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12167. on graph increases value of another color component, which is luminance by
  12168. default values of @code{x} and @code{y}.
  12169. @item color4
  12170. Actual colors present in video frame are displayed on graph. If two different
  12171. colors map to same position on graph then color with higher value of component
  12172. not present in graph is picked.
  12173. @item color5
  12174. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12175. component picked from radial gradient.
  12176. @end table
  12177. @item x
  12178. Set which color component will be represented on X-axis. Default is @code{1}.
  12179. @item y
  12180. Set which color component will be represented on Y-axis. Default is @code{2}.
  12181. @item intensity, i
  12182. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12183. of color component which represents frequency of (X, Y) location in graph.
  12184. @item envelope, e
  12185. @table @samp
  12186. @item none
  12187. No envelope, this is default.
  12188. @item instant
  12189. Instant envelope, even darkest single pixel will be clearly highlighted.
  12190. @item peak
  12191. Hold maximum and minimum values presented in graph over time. This way you
  12192. can still spot out of range values without constantly looking at vectorscope.
  12193. @item peak+instant
  12194. Peak and instant envelope combined together.
  12195. @end table
  12196. @item graticule, g
  12197. Set what kind of graticule to draw.
  12198. @table @samp
  12199. @item none
  12200. @item green
  12201. @item color
  12202. @end table
  12203. @item opacity, o
  12204. Set graticule opacity.
  12205. @item flags, f
  12206. Set graticule flags.
  12207. @table @samp
  12208. @item white
  12209. Draw graticule for white point.
  12210. @item black
  12211. Draw graticule for black point.
  12212. @item name
  12213. Draw color points short names.
  12214. @end table
  12215. @item bgopacity, b
  12216. Set background opacity.
  12217. @item lthreshold, l
  12218. Set low threshold for color component not represented on X or Y axis.
  12219. Values lower than this value will be ignored. Default is 0.
  12220. Note this value is multiplied with actual max possible value one pixel component
  12221. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12222. is 0.1 * 255 = 25.
  12223. @item hthreshold, h
  12224. Set high threshold for color component not represented on X or Y axis.
  12225. Values higher than this value will be ignored. Default is 1.
  12226. Note this value is multiplied with actual max possible value one pixel component
  12227. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12228. is 0.9 * 255 = 230.
  12229. @item colorspace, c
  12230. Set what kind of colorspace to use when drawing graticule.
  12231. @table @samp
  12232. @item auto
  12233. @item 601
  12234. @item 709
  12235. @end table
  12236. Default is auto.
  12237. @end table
  12238. @anchor{vidstabdetect}
  12239. @section vidstabdetect
  12240. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12241. @ref{vidstabtransform} for pass 2.
  12242. This filter generates a file with relative translation and rotation
  12243. transform information about subsequent frames, which is then used by
  12244. the @ref{vidstabtransform} filter.
  12245. To enable compilation of this filter you need to configure FFmpeg with
  12246. @code{--enable-libvidstab}.
  12247. This filter accepts the following options:
  12248. @table @option
  12249. @item result
  12250. Set the path to the file used to write the transforms information.
  12251. Default value is @file{transforms.trf}.
  12252. @item shakiness
  12253. Set how shaky the video is and how quick the camera is. It accepts an
  12254. integer in the range 1-10, a value of 1 means little shakiness, a
  12255. value of 10 means strong shakiness. Default value is 5.
  12256. @item accuracy
  12257. Set the accuracy of the detection process. It must be a value in the
  12258. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12259. accuracy. Default value is 15.
  12260. @item stepsize
  12261. Set stepsize of the search process. The region around minimum is
  12262. scanned with 1 pixel resolution. Default value is 6.
  12263. @item mincontrast
  12264. Set minimum contrast. Below this value a local measurement field is
  12265. discarded. Must be a floating point value in the range 0-1. Default
  12266. value is 0.3.
  12267. @item tripod
  12268. Set reference frame number for tripod mode.
  12269. If enabled, the motion of the frames is compared to a reference frame
  12270. in the filtered stream, identified by the specified number. The idea
  12271. is to compensate all movements in a more-or-less static scene and keep
  12272. the camera view absolutely still.
  12273. If set to 0, it is disabled. The frames are counted starting from 1.
  12274. @item show
  12275. Show fields and transforms in the resulting frames. It accepts an
  12276. integer in the range 0-2. Default value is 0, which disables any
  12277. visualization.
  12278. @end table
  12279. @subsection Examples
  12280. @itemize
  12281. @item
  12282. Use default values:
  12283. @example
  12284. vidstabdetect
  12285. @end example
  12286. @item
  12287. Analyze strongly shaky movie and put the results in file
  12288. @file{mytransforms.trf}:
  12289. @example
  12290. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12291. @end example
  12292. @item
  12293. Visualize the result of internal transformations in the resulting
  12294. video:
  12295. @example
  12296. vidstabdetect=show=1
  12297. @end example
  12298. @item
  12299. Analyze a video with medium shakiness using @command{ffmpeg}:
  12300. @example
  12301. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12302. @end example
  12303. @end itemize
  12304. @anchor{vidstabtransform}
  12305. @section vidstabtransform
  12306. Video stabilization/deshaking: pass 2 of 2,
  12307. see @ref{vidstabdetect} for pass 1.
  12308. Read a file with transform information for each frame and
  12309. apply/compensate them. Together with the @ref{vidstabdetect}
  12310. filter this can be used to deshake videos. See also
  12311. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12312. the @ref{unsharp} filter, see below.
  12313. To enable compilation of this filter you need to configure FFmpeg with
  12314. @code{--enable-libvidstab}.
  12315. @subsection Options
  12316. @table @option
  12317. @item input
  12318. Set path to the file used to read the transforms. Default value is
  12319. @file{transforms.trf}.
  12320. @item smoothing
  12321. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12322. camera movements. Default value is 10.
  12323. For example a number of 10 means that 21 frames are used (10 in the
  12324. past and 10 in the future) to smoothen the motion in the video. A
  12325. larger value leads to a smoother video, but limits the acceleration of
  12326. the camera (pan/tilt movements). 0 is a special case where a static
  12327. camera is simulated.
  12328. @item optalgo
  12329. Set the camera path optimization algorithm.
  12330. Accepted values are:
  12331. @table @samp
  12332. @item gauss
  12333. gaussian kernel low-pass filter on camera motion (default)
  12334. @item avg
  12335. averaging on transformations
  12336. @end table
  12337. @item maxshift
  12338. Set maximal number of pixels to translate frames. Default value is -1,
  12339. meaning no limit.
  12340. @item maxangle
  12341. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12342. value is -1, meaning no limit.
  12343. @item crop
  12344. Specify how to deal with borders that may be visible due to movement
  12345. compensation.
  12346. Available values are:
  12347. @table @samp
  12348. @item keep
  12349. keep image information from previous frame (default)
  12350. @item black
  12351. fill the border black
  12352. @end table
  12353. @item invert
  12354. Invert transforms if set to 1. Default value is 0.
  12355. @item relative
  12356. Consider transforms as relative to previous frame if set to 1,
  12357. absolute if set to 0. Default value is 0.
  12358. @item zoom
  12359. Set percentage to zoom. A positive value will result in a zoom-in
  12360. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12361. zoom).
  12362. @item optzoom
  12363. Set optimal zooming to avoid borders.
  12364. Accepted values are:
  12365. @table @samp
  12366. @item 0
  12367. disabled
  12368. @item 1
  12369. optimal static zoom value is determined (only very strong movements
  12370. will lead to visible borders) (default)
  12371. @item 2
  12372. optimal adaptive zoom value is determined (no borders will be
  12373. visible), see @option{zoomspeed}
  12374. @end table
  12375. Note that the value given at zoom is added to the one calculated here.
  12376. @item zoomspeed
  12377. Set percent to zoom maximally each frame (enabled when
  12378. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12379. 0.25.
  12380. @item interpol
  12381. Specify type of interpolation.
  12382. Available values are:
  12383. @table @samp
  12384. @item no
  12385. no interpolation
  12386. @item linear
  12387. linear only horizontal
  12388. @item bilinear
  12389. linear in both directions (default)
  12390. @item bicubic
  12391. cubic in both directions (slow)
  12392. @end table
  12393. @item tripod
  12394. Enable virtual tripod mode if set to 1, which is equivalent to
  12395. @code{relative=0:smoothing=0}. Default value is 0.
  12396. Use also @code{tripod} option of @ref{vidstabdetect}.
  12397. @item debug
  12398. Increase log verbosity if set to 1. Also the detected global motions
  12399. are written to the temporary file @file{global_motions.trf}. Default
  12400. value is 0.
  12401. @end table
  12402. @subsection Examples
  12403. @itemize
  12404. @item
  12405. Use @command{ffmpeg} for a typical stabilization with default values:
  12406. @example
  12407. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12408. @end example
  12409. Note the use of the @ref{unsharp} filter which is always recommended.
  12410. @item
  12411. Zoom in a bit more and load transform data from a given file:
  12412. @example
  12413. vidstabtransform=zoom=5:input="mytransforms.trf"
  12414. @end example
  12415. @item
  12416. Smoothen the video even more:
  12417. @example
  12418. vidstabtransform=smoothing=30
  12419. @end example
  12420. @end itemize
  12421. @section vflip
  12422. Flip the input video vertically.
  12423. For example, to vertically flip a video with @command{ffmpeg}:
  12424. @example
  12425. ffmpeg -i in.avi -vf "vflip" out.avi
  12426. @end example
  12427. @section vfrdet
  12428. Detect variable frame rate video.
  12429. This filter tries to detect if the input is variable or constant frame rate.
  12430. At end it will output number of frames detected as having variable delta pts,
  12431. and ones with constant delta pts.
  12432. If there was frames with variable delta, than it will also show min and max delta
  12433. encountered.
  12434. @anchor{vignette}
  12435. @section vignette
  12436. Make or reverse a natural vignetting effect.
  12437. The filter accepts the following options:
  12438. @table @option
  12439. @item angle, a
  12440. Set lens angle expression as a number of radians.
  12441. The value is clipped in the @code{[0,PI/2]} range.
  12442. Default value: @code{"PI/5"}
  12443. @item x0
  12444. @item y0
  12445. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12446. by default.
  12447. @item mode
  12448. Set forward/backward mode.
  12449. Available modes are:
  12450. @table @samp
  12451. @item forward
  12452. The larger the distance from the central point, the darker the image becomes.
  12453. @item backward
  12454. The larger the distance from the central point, the brighter the image becomes.
  12455. This can be used to reverse a vignette effect, though there is no automatic
  12456. detection to extract the lens @option{angle} and other settings (yet). It can
  12457. also be used to create a burning effect.
  12458. @end table
  12459. Default value is @samp{forward}.
  12460. @item eval
  12461. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12462. It accepts the following values:
  12463. @table @samp
  12464. @item init
  12465. Evaluate expressions only once during the filter initialization.
  12466. @item frame
  12467. Evaluate expressions for each incoming frame. This is way slower than the
  12468. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12469. allows advanced dynamic expressions.
  12470. @end table
  12471. Default value is @samp{init}.
  12472. @item dither
  12473. Set dithering to reduce the circular banding effects. Default is @code{1}
  12474. (enabled).
  12475. @item aspect
  12476. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12477. Setting this value to the SAR of the input will make a rectangular vignetting
  12478. following the dimensions of the video.
  12479. Default is @code{1/1}.
  12480. @end table
  12481. @subsection Expressions
  12482. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12483. following parameters.
  12484. @table @option
  12485. @item w
  12486. @item h
  12487. input width and height
  12488. @item n
  12489. the number of input frame, starting from 0
  12490. @item pts
  12491. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12492. @var{TB} units, NAN if undefined
  12493. @item r
  12494. frame rate of the input video, NAN if the input frame rate is unknown
  12495. @item t
  12496. the PTS (Presentation TimeStamp) of the filtered video frame,
  12497. expressed in seconds, NAN if undefined
  12498. @item tb
  12499. time base of the input video
  12500. @end table
  12501. @subsection Examples
  12502. @itemize
  12503. @item
  12504. Apply simple strong vignetting effect:
  12505. @example
  12506. vignette=PI/4
  12507. @end example
  12508. @item
  12509. Make a flickering vignetting:
  12510. @example
  12511. vignette='PI/4+random(1)*PI/50':eval=frame
  12512. @end example
  12513. @end itemize
  12514. @section vmafmotion
  12515. Obtain the average vmaf motion score of a video.
  12516. It is one of the component filters of VMAF.
  12517. The obtained average motion score is printed through the logging system.
  12518. In the below example the input file @file{ref.mpg} is being processed and score
  12519. is computed.
  12520. @example
  12521. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12522. @end example
  12523. @section vstack
  12524. Stack input videos vertically.
  12525. All streams must be of same pixel format and of same width.
  12526. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12527. to create same output.
  12528. The filter accept the following option:
  12529. @table @option
  12530. @item inputs
  12531. Set number of input streams. Default is 2.
  12532. @item shortest
  12533. If set to 1, force the output to terminate when the shortest input
  12534. terminates. Default value is 0.
  12535. @end table
  12536. @section w3fdif
  12537. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12538. Deinterlacing Filter").
  12539. Based on the process described by Martin Weston for BBC R&D, and
  12540. implemented based on the de-interlace algorithm written by Jim
  12541. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12542. uses filter coefficients calculated by BBC R&D.
  12543. There are two sets of filter coefficients, so called "simple":
  12544. and "complex". Which set of filter coefficients is used can
  12545. be set by passing an optional parameter:
  12546. @table @option
  12547. @item filter
  12548. Set the interlacing filter coefficients. Accepts one of the following values:
  12549. @table @samp
  12550. @item simple
  12551. Simple filter coefficient set.
  12552. @item complex
  12553. More-complex filter coefficient set.
  12554. @end table
  12555. Default value is @samp{complex}.
  12556. @item deint
  12557. Specify which frames to deinterlace. Accept one of the following values:
  12558. @table @samp
  12559. @item all
  12560. Deinterlace all frames,
  12561. @item interlaced
  12562. Only deinterlace frames marked as interlaced.
  12563. @end table
  12564. Default value is @samp{all}.
  12565. @end table
  12566. @section waveform
  12567. Video waveform monitor.
  12568. The waveform monitor plots color component intensity. By default luminance
  12569. only. Each column of the waveform corresponds to a column of pixels in the
  12570. source video.
  12571. It accepts the following options:
  12572. @table @option
  12573. @item mode, m
  12574. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12575. In row mode, the graph on the left side represents color component value 0 and
  12576. the right side represents value = 255. In column mode, the top side represents
  12577. color component value = 0 and bottom side represents value = 255.
  12578. @item intensity, i
  12579. Set intensity. Smaller values are useful to find out how many values of the same
  12580. luminance are distributed across input rows/columns.
  12581. Default value is @code{0.04}. Allowed range is [0, 1].
  12582. @item mirror, r
  12583. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12584. In mirrored mode, higher values will be represented on the left
  12585. side for @code{row} mode and at the top for @code{column} mode. Default is
  12586. @code{1} (mirrored).
  12587. @item display, d
  12588. Set display mode.
  12589. It accepts the following values:
  12590. @table @samp
  12591. @item overlay
  12592. Presents information identical to that in the @code{parade}, except
  12593. that the graphs representing color components are superimposed directly
  12594. over one another.
  12595. This display mode makes it easier to spot relative differences or similarities
  12596. in overlapping areas of the color components that are supposed to be identical,
  12597. such as neutral whites, grays, or blacks.
  12598. @item stack
  12599. Display separate graph for the color components side by side in
  12600. @code{row} mode or one below the other in @code{column} mode.
  12601. @item parade
  12602. Display separate graph for the color components side by side in
  12603. @code{column} mode or one below the other in @code{row} mode.
  12604. Using this display mode makes it easy to spot color casts in the highlights
  12605. and shadows of an image, by comparing the contours of the top and the bottom
  12606. graphs of each waveform. Since whites, grays, and blacks are characterized
  12607. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12608. should display three waveforms of roughly equal width/height. If not, the
  12609. correction is easy to perform by making level adjustments the three waveforms.
  12610. @end table
  12611. Default is @code{stack}.
  12612. @item components, c
  12613. Set which color components to display. Default is 1, which means only luminance
  12614. or red color component if input is in RGB colorspace. If is set for example to
  12615. 7 it will display all 3 (if) available color components.
  12616. @item envelope, e
  12617. @table @samp
  12618. @item none
  12619. No envelope, this is default.
  12620. @item instant
  12621. Instant envelope, minimum and maximum values presented in graph will be easily
  12622. visible even with small @code{step} value.
  12623. @item peak
  12624. Hold minimum and maximum values presented in graph across time. This way you
  12625. can still spot out of range values without constantly looking at waveforms.
  12626. @item peak+instant
  12627. Peak and instant envelope combined together.
  12628. @end table
  12629. @item filter, f
  12630. @table @samp
  12631. @item lowpass
  12632. No filtering, this is default.
  12633. @item flat
  12634. Luma and chroma combined together.
  12635. @item aflat
  12636. Similar as above, but shows difference between blue and red chroma.
  12637. @item xflat
  12638. Similar as above, but use different colors.
  12639. @item chroma
  12640. Displays only chroma.
  12641. @item color
  12642. Displays actual color value on waveform.
  12643. @item acolor
  12644. Similar as above, but with luma showing frequency of chroma values.
  12645. @end table
  12646. @item graticule, g
  12647. Set which graticule to display.
  12648. @table @samp
  12649. @item none
  12650. Do not display graticule.
  12651. @item green
  12652. Display green graticule showing legal broadcast ranges.
  12653. @item orange
  12654. Display orange graticule showing legal broadcast ranges.
  12655. @end table
  12656. @item opacity, o
  12657. Set graticule opacity.
  12658. @item flags, fl
  12659. Set graticule flags.
  12660. @table @samp
  12661. @item numbers
  12662. Draw numbers above lines. By default enabled.
  12663. @item dots
  12664. Draw dots instead of lines.
  12665. @end table
  12666. @item scale, s
  12667. Set scale used for displaying graticule.
  12668. @table @samp
  12669. @item digital
  12670. @item millivolts
  12671. @item ire
  12672. @end table
  12673. Default is digital.
  12674. @item bgopacity, b
  12675. Set background opacity.
  12676. @end table
  12677. @section weave, doubleweave
  12678. The @code{weave} takes a field-based video input and join
  12679. each two sequential fields into single frame, producing a new double
  12680. height clip with half the frame rate and half the frame count.
  12681. The @code{doubleweave} works same as @code{weave} but without
  12682. halving frame rate and frame count.
  12683. It accepts the following option:
  12684. @table @option
  12685. @item first_field
  12686. Set first field. Available values are:
  12687. @table @samp
  12688. @item top, t
  12689. Set the frame as top-field-first.
  12690. @item bottom, b
  12691. Set the frame as bottom-field-first.
  12692. @end table
  12693. @end table
  12694. @subsection Examples
  12695. @itemize
  12696. @item
  12697. Interlace video using @ref{select} and @ref{separatefields} filter:
  12698. @example
  12699. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12700. @end example
  12701. @end itemize
  12702. @section xbr
  12703. Apply the xBR high-quality magnification filter which is designed for pixel
  12704. art. It follows a set of edge-detection rules, see
  12705. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12706. It accepts the following option:
  12707. @table @option
  12708. @item n
  12709. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12710. @code{3xBR} and @code{4} for @code{4xBR}.
  12711. Default is @code{3}.
  12712. @end table
  12713. @anchor{yadif}
  12714. @section yadif
  12715. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12716. filter").
  12717. It accepts the following parameters:
  12718. @table @option
  12719. @item mode
  12720. The interlacing mode to adopt. It accepts one of the following values:
  12721. @table @option
  12722. @item 0, send_frame
  12723. Output one frame for each frame.
  12724. @item 1, send_field
  12725. Output one frame for each field.
  12726. @item 2, send_frame_nospatial
  12727. Like @code{send_frame}, but it skips the spatial interlacing check.
  12728. @item 3, send_field_nospatial
  12729. Like @code{send_field}, but it skips the spatial interlacing check.
  12730. @end table
  12731. The default value is @code{send_frame}.
  12732. @item parity
  12733. The picture field parity assumed for the input interlaced video. It accepts one
  12734. of the following values:
  12735. @table @option
  12736. @item 0, tff
  12737. Assume the top field is first.
  12738. @item 1, bff
  12739. Assume the bottom field is first.
  12740. @item -1, auto
  12741. Enable automatic detection of field parity.
  12742. @end table
  12743. The default value is @code{auto}.
  12744. If the interlacing is unknown or the decoder does not export this information,
  12745. top field first will be assumed.
  12746. @item deint
  12747. Specify which frames to deinterlace. Accept one of the following
  12748. values:
  12749. @table @option
  12750. @item 0, all
  12751. Deinterlace all frames.
  12752. @item 1, interlaced
  12753. Only deinterlace frames marked as interlaced.
  12754. @end table
  12755. The default value is @code{all}.
  12756. @end table
  12757. @section zoompan
  12758. Apply Zoom & Pan effect.
  12759. This filter accepts the following options:
  12760. @table @option
  12761. @item zoom, z
  12762. Set the zoom expression. Default is 1.
  12763. @item x
  12764. @item y
  12765. Set the x and y expression. Default is 0.
  12766. @item d
  12767. Set the duration expression in number of frames.
  12768. This sets for how many number of frames effect will last for
  12769. single input image.
  12770. @item s
  12771. Set the output image size, default is 'hd720'.
  12772. @item fps
  12773. Set the output frame rate, default is '25'.
  12774. @end table
  12775. Each expression can contain the following constants:
  12776. @table @option
  12777. @item in_w, iw
  12778. Input width.
  12779. @item in_h, ih
  12780. Input height.
  12781. @item out_w, ow
  12782. Output width.
  12783. @item out_h, oh
  12784. Output height.
  12785. @item in
  12786. Input frame count.
  12787. @item on
  12788. Output frame count.
  12789. @item x
  12790. @item y
  12791. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12792. for current input frame.
  12793. @item px
  12794. @item py
  12795. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12796. not yet such frame (first input frame).
  12797. @item zoom
  12798. Last calculated zoom from 'z' expression for current input frame.
  12799. @item pzoom
  12800. Last calculated zoom of last output frame of previous input frame.
  12801. @item duration
  12802. Number of output frames for current input frame. Calculated from 'd' expression
  12803. for each input frame.
  12804. @item pduration
  12805. number of output frames created for previous input frame
  12806. @item a
  12807. Rational number: input width / input height
  12808. @item sar
  12809. sample aspect ratio
  12810. @item dar
  12811. display aspect ratio
  12812. @end table
  12813. @subsection Examples
  12814. @itemize
  12815. @item
  12816. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12817. @example
  12818. 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
  12819. @end example
  12820. @item
  12821. Zoom-in up to 1.5 and pan always at center of picture:
  12822. @example
  12823. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12824. @end example
  12825. @item
  12826. Same as above but without pausing:
  12827. @example
  12828. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12829. @end example
  12830. @end itemize
  12831. @anchor{zscale}
  12832. @section zscale
  12833. Scale (resize) the input video, using the z.lib library:
  12834. https://github.com/sekrit-twc/zimg.
  12835. The zscale filter forces the output display aspect ratio to be the same
  12836. as the input, by changing the output sample aspect ratio.
  12837. If the input image format is different from the format requested by
  12838. the next filter, the zscale filter will convert the input to the
  12839. requested format.
  12840. @subsection Options
  12841. The filter accepts the following options.
  12842. @table @option
  12843. @item width, w
  12844. @item height, h
  12845. Set the output video dimension expression. Default value is the input
  12846. dimension.
  12847. If the @var{width} or @var{w} value is 0, the input width is used for
  12848. the output. If the @var{height} or @var{h} value is 0, the input height
  12849. is used for the output.
  12850. If one and only one of the values is -n with n >= 1, the zscale filter
  12851. will use a value that maintains the aspect ratio of the input image,
  12852. calculated from the other specified dimension. After that it will,
  12853. however, make sure that the calculated dimension is divisible by n and
  12854. adjust the value if necessary.
  12855. If both values are -n with n >= 1, the behavior will be identical to
  12856. both values being set to 0 as previously detailed.
  12857. See below for the list of accepted constants for use in the dimension
  12858. expression.
  12859. @item size, s
  12860. Set the video size. For the syntax of this option, check the
  12861. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12862. @item dither, d
  12863. Set the dither type.
  12864. Possible values are:
  12865. @table @var
  12866. @item none
  12867. @item ordered
  12868. @item random
  12869. @item error_diffusion
  12870. @end table
  12871. Default is none.
  12872. @item filter, f
  12873. Set the resize filter type.
  12874. Possible values are:
  12875. @table @var
  12876. @item point
  12877. @item bilinear
  12878. @item bicubic
  12879. @item spline16
  12880. @item spline36
  12881. @item lanczos
  12882. @end table
  12883. Default is bilinear.
  12884. @item range, r
  12885. Set the color range.
  12886. Possible values are:
  12887. @table @var
  12888. @item input
  12889. @item limited
  12890. @item full
  12891. @end table
  12892. Default is same as input.
  12893. @item primaries, p
  12894. Set the color primaries.
  12895. Possible values are:
  12896. @table @var
  12897. @item input
  12898. @item 709
  12899. @item unspecified
  12900. @item 170m
  12901. @item 240m
  12902. @item 2020
  12903. @end table
  12904. Default is same as input.
  12905. @item transfer, t
  12906. Set the transfer characteristics.
  12907. Possible values are:
  12908. @table @var
  12909. @item input
  12910. @item 709
  12911. @item unspecified
  12912. @item 601
  12913. @item linear
  12914. @item 2020_10
  12915. @item 2020_12
  12916. @item smpte2084
  12917. @item iec61966-2-1
  12918. @item arib-std-b67
  12919. @end table
  12920. Default is same as input.
  12921. @item matrix, m
  12922. Set the colorspace matrix.
  12923. Possible value are:
  12924. @table @var
  12925. @item input
  12926. @item 709
  12927. @item unspecified
  12928. @item 470bg
  12929. @item 170m
  12930. @item 2020_ncl
  12931. @item 2020_cl
  12932. @end table
  12933. Default is same as input.
  12934. @item rangein, rin
  12935. Set the input color range.
  12936. Possible values are:
  12937. @table @var
  12938. @item input
  12939. @item limited
  12940. @item full
  12941. @end table
  12942. Default is same as input.
  12943. @item primariesin, pin
  12944. Set the input color primaries.
  12945. Possible values are:
  12946. @table @var
  12947. @item input
  12948. @item 709
  12949. @item unspecified
  12950. @item 170m
  12951. @item 240m
  12952. @item 2020
  12953. @end table
  12954. Default is same as input.
  12955. @item transferin, tin
  12956. Set the input transfer characteristics.
  12957. Possible values are:
  12958. @table @var
  12959. @item input
  12960. @item 709
  12961. @item unspecified
  12962. @item 601
  12963. @item linear
  12964. @item 2020_10
  12965. @item 2020_12
  12966. @end table
  12967. Default is same as input.
  12968. @item matrixin, min
  12969. Set the input colorspace matrix.
  12970. Possible value are:
  12971. @table @var
  12972. @item input
  12973. @item 709
  12974. @item unspecified
  12975. @item 470bg
  12976. @item 170m
  12977. @item 2020_ncl
  12978. @item 2020_cl
  12979. @end table
  12980. @item chromal, c
  12981. Set the output chroma location.
  12982. Possible values are:
  12983. @table @var
  12984. @item input
  12985. @item left
  12986. @item center
  12987. @item topleft
  12988. @item top
  12989. @item bottomleft
  12990. @item bottom
  12991. @end table
  12992. @item chromalin, cin
  12993. Set the input chroma location.
  12994. Possible values are:
  12995. @table @var
  12996. @item input
  12997. @item left
  12998. @item center
  12999. @item topleft
  13000. @item top
  13001. @item bottomleft
  13002. @item bottom
  13003. @end table
  13004. @item npl
  13005. Set the nominal peak luminance.
  13006. @end table
  13007. The values of the @option{w} and @option{h} options are expressions
  13008. containing the following constants:
  13009. @table @var
  13010. @item in_w
  13011. @item in_h
  13012. The input width and height
  13013. @item iw
  13014. @item ih
  13015. These are the same as @var{in_w} and @var{in_h}.
  13016. @item out_w
  13017. @item out_h
  13018. The output (scaled) width and height
  13019. @item ow
  13020. @item oh
  13021. These are the same as @var{out_w} and @var{out_h}
  13022. @item a
  13023. The same as @var{iw} / @var{ih}
  13024. @item sar
  13025. input sample aspect ratio
  13026. @item dar
  13027. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13028. @item hsub
  13029. @item vsub
  13030. horizontal and vertical input chroma subsample values. For example for the
  13031. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13032. @item ohsub
  13033. @item ovsub
  13034. horizontal and vertical output chroma subsample values. For example for the
  13035. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13036. @end table
  13037. @table @option
  13038. @end table
  13039. @c man end VIDEO FILTERS
  13040. @chapter Video Sources
  13041. @c man begin VIDEO SOURCES
  13042. Below is a description of the currently available video sources.
  13043. @section buffer
  13044. Buffer video frames, and make them available to the filter chain.
  13045. This source is mainly intended for a programmatic use, in particular
  13046. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13047. It accepts the following parameters:
  13048. @table @option
  13049. @item video_size
  13050. Specify the size (width and height) of the buffered video frames. For the
  13051. syntax of this option, check the
  13052. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13053. @item width
  13054. The input video width.
  13055. @item height
  13056. The input video height.
  13057. @item pix_fmt
  13058. A string representing the pixel format of the buffered video frames.
  13059. It may be a number corresponding to a pixel format, or a pixel format
  13060. name.
  13061. @item time_base
  13062. Specify the timebase assumed by the timestamps of the buffered frames.
  13063. @item frame_rate
  13064. Specify the frame rate expected for the video stream.
  13065. @item pixel_aspect, sar
  13066. The sample (pixel) aspect ratio of the input video.
  13067. @item sws_param
  13068. Specify the optional parameters to be used for the scale filter which
  13069. is automatically inserted when an input change is detected in the
  13070. input size or format.
  13071. @item hw_frames_ctx
  13072. When using a hardware pixel format, this should be a reference to an
  13073. AVHWFramesContext describing input frames.
  13074. @end table
  13075. For example:
  13076. @example
  13077. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13078. @end example
  13079. will instruct the source to accept video frames with size 320x240 and
  13080. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13081. square pixels (1:1 sample aspect ratio).
  13082. Since the pixel format with name "yuv410p" corresponds to the number 6
  13083. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13084. this example corresponds to:
  13085. @example
  13086. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13087. @end example
  13088. Alternatively, the options can be specified as a flat string, but this
  13089. syntax is deprecated:
  13090. @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}]
  13091. @section cellauto
  13092. Create a pattern generated by an elementary cellular automaton.
  13093. The initial state of the cellular automaton can be defined through the
  13094. @option{filename} and @option{pattern} options. If such options are
  13095. not specified an initial state is created randomly.
  13096. At each new frame a new row in the video is filled with the result of
  13097. the cellular automaton next generation. The behavior when the whole
  13098. frame is filled is defined by the @option{scroll} option.
  13099. This source accepts the following options:
  13100. @table @option
  13101. @item filename, f
  13102. Read the initial cellular automaton state, i.e. the starting row, from
  13103. the specified file.
  13104. In the file, each non-whitespace character is considered an alive
  13105. cell, a newline will terminate the row, and further characters in the
  13106. file will be ignored.
  13107. @item pattern, p
  13108. Read the initial cellular automaton state, i.e. the starting row, from
  13109. the specified string.
  13110. Each non-whitespace character in the string is considered an alive
  13111. cell, a newline will terminate the row, and further characters in the
  13112. string will be ignored.
  13113. @item rate, r
  13114. Set the video rate, that is the number of frames generated per second.
  13115. Default is 25.
  13116. @item random_fill_ratio, ratio
  13117. Set the random fill ratio for the initial cellular automaton row. It
  13118. is a floating point number value ranging from 0 to 1, defaults to
  13119. 1/PHI.
  13120. This option is ignored when a file or a pattern is specified.
  13121. @item random_seed, seed
  13122. Set the seed for filling randomly the initial row, must be an integer
  13123. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13124. set to -1, the filter will try to use a good random seed on a best
  13125. effort basis.
  13126. @item rule
  13127. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13128. Default value is 110.
  13129. @item size, s
  13130. Set the size of the output video. For the syntax of this option, check the
  13131. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13132. If @option{filename} or @option{pattern} is specified, the size is set
  13133. by default to the width of the specified initial state row, and the
  13134. height is set to @var{width} * PHI.
  13135. If @option{size} is set, it must contain the width of the specified
  13136. pattern string, and the specified pattern will be centered in the
  13137. larger row.
  13138. If a filename or a pattern string is not specified, the size value
  13139. defaults to "320x518" (used for a randomly generated initial state).
  13140. @item scroll
  13141. If set to 1, scroll the output upward when all the rows in the output
  13142. have been already filled. If set to 0, the new generated row will be
  13143. written over the top row just after the bottom row is filled.
  13144. Defaults to 1.
  13145. @item start_full, full
  13146. If set to 1, completely fill the output with generated rows before
  13147. outputting the first frame.
  13148. This is the default behavior, for disabling set the value to 0.
  13149. @item stitch
  13150. If set to 1, stitch the left and right row edges together.
  13151. This is the default behavior, for disabling set the value to 0.
  13152. @end table
  13153. @subsection Examples
  13154. @itemize
  13155. @item
  13156. Read the initial state from @file{pattern}, and specify an output of
  13157. size 200x400.
  13158. @example
  13159. cellauto=f=pattern:s=200x400
  13160. @end example
  13161. @item
  13162. Generate a random initial row with a width of 200 cells, with a fill
  13163. ratio of 2/3:
  13164. @example
  13165. cellauto=ratio=2/3:s=200x200
  13166. @end example
  13167. @item
  13168. Create a pattern generated by rule 18 starting by a single alive cell
  13169. centered on an initial row with width 100:
  13170. @example
  13171. cellauto=p=@@:s=100x400:full=0:rule=18
  13172. @end example
  13173. @item
  13174. Specify a more elaborated initial pattern:
  13175. @example
  13176. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13177. @end example
  13178. @end itemize
  13179. @anchor{coreimagesrc}
  13180. @section coreimagesrc
  13181. Video source generated on GPU using Apple's CoreImage API on OSX.
  13182. This video source is a specialized version of the @ref{coreimage} video filter.
  13183. Use a core image generator at the beginning of the applied filterchain to
  13184. generate the content.
  13185. The coreimagesrc video source accepts the following options:
  13186. @table @option
  13187. @item list_generators
  13188. List all available generators along with all their respective options as well as
  13189. possible minimum and maximum values along with the default values.
  13190. @example
  13191. list_generators=true
  13192. @end example
  13193. @item size, s
  13194. Specify the size of the sourced video. For the syntax of this option, check the
  13195. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13196. The default value is @code{320x240}.
  13197. @item rate, r
  13198. Specify the frame rate of the sourced video, as the number of frames
  13199. generated per second. It has to be a string in the format
  13200. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13201. number or a valid video frame rate abbreviation. The default value is
  13202. "25".
  13203. @item sar
  13204. Set the sample aspect ratio of the sourced video.
  13205. @item duration, d
  13206. Set the duration of the sourced video. See
  13207. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13208. for the accepted syntax.
  13209. If not specified, or the expressed duration is negative, the video is
  13210. supposed to be generated forever.
  13211. @end table
  13212. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13213. A complete filterchain can be used for further processing of the
  13214. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13215. and examples for details.
  13216. @subsection Examples
  13217. @itemize
  13218. @item
  13219. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13220. given as complete and escaped command-line for Apple's standard bash shell:
  13221. @example
  13222. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13223. @end example
  13224. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13225. need for a nullsrc video source.
  13226. @end itemize
  13227. @section mandelbrot
  13228. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13229. point specified with @var{start_x} and @var{start_y}.
  13230. This source accepts the following options:
  13231. @table @option
  13232. @item end_pts
  13233. Set the terminal pts value. Default value is 400.
  13234. @item end_scale
  13235. Set the terminal scale value.
  13236. Must be a floating point value. Default value is 0.3.
  13237. @item inner
  13238. Set the inner coloring mode, that is the algorithm used to draw the
  13239. Mandelbrot fractal internal region.
  13240. It shall assume one of the following values:
  13241. @table @option
  13242. @item black
  13243. Set black mode.
  13244. @item convergence
  13245. Show time until convergence.
  13246. @item mincol
  13247. Set color based on point closest to the origin of the iterations.
  13248. @item period
  13249. Set period mode.
  13250. @end table
  13251. Default value is @var{mincol}.
  13252. @item bailout
  13253. Set the bailout value. Default value is 10.0.
  13254. @item maxiter
  13255. Set the maximum of iterations performed by the rendering
  13256. algorithm. Default value is 7189.
  13257. @item outer
  13258. Set outer coloring mode.
  13259. It shall assume one of following values:
  13260. @table @option
  13261. @item iteration_count
  13262. Set iteration cound mode.
  13263. @item normalized_iteration_count
  13264. set normalized iteration count mode.
  13265. @end table
  13266. Default value is @var{normalized_iteration_count}.
  13267. @item rate, r
  13268. Set frame rate, expressed as number of frames per second. Default
  13269. value is "25".
  13270. @item size, s
  13271. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13272. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13273. @item start_scale
  13274. Set the initial scale value. Default value is 3.0.
  13275. @item start_x
  13276. Set the initial x position. Must be a floating point value between
  13277. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13278. @item start_y
  13279. Set the initial y position. Must be a floating point value between
  13280. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13281. @end table
  13282. @section mptestsrc
  13283. Generate various test patterns, as generated by the MPlayer test filter.
  13284. The size of the generated video is fixed, and is 256x256.
  13285. This source is useful in particular for testing encoding features.
  13286. This source accepts the following options:
  13287. @table @option
  13288. @item rate, r
  13289. Specify the frame rate of the sourced video, as the number of frames
  13290. generated per second. It has to be a string in the format
  13291. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13292. number or a valid video frame rate abbreviation. The default value is
  13293. "25".
  13294. @item duration, d
  13295. Set the duration of the sourced video. See
  13296. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13297. for the accepted syntax.
  13298. If not specified, or the expressed duration is negative, the video is
  13299. supposed to be generated forever.
  13300. @item test, t
  13301. Set the number or the name of the test to perform. Supported tests are:
  13302. @table @option
  13303. @item dc_luma
  13304. @item dc_chroma
  13305. @item freq_luma
  13306. @item freq_chroma
  13307. @item amp_luma
  13308. @item amp_chroma
  13309. @item cbp
  13310. @item mv
  13311. @item ring1
  13312. @item ring2
  13313. @item all
  13314. @end table
  13315. Default value is "all", which will cycle through the list of all tests.
  13316. @end table
  13317. Some examples:
  13318. @example
  13319. mptestsrc=t=dc_luma
  13320. @end example
  13321. will generate a "dc_luma" test pattern.
  13322. @section frei0r_src
  13323. Provide a frei0r source.
  13324. To enable compilation of this filter you need to install the frei0r
  13325. header and configure FFmpeg with @code{--enable-frei0r}.
  13326. This source accepts the following parameters:
  13327. @table @option
  13328. @item size
  13329. The size of the video to generate. For the syntax of this option, check the
  13330. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13331. @item framerate
  13332. The framerate of the generated video. It may be a string of the form
  13333. @var{num}/@var{den} or a frame rate abbreviation.
  13334. @item filter_name
  13335. The name to the frei0r source to load. For more information regarding frei0r and
  13336. how to set the parameters, read the @ref{frei0r} section in the video filters
  13337. documentation.
  13338. @item filter_params
  13339. A '|'-separated list of parameters to pass to the frei0r source.
  13340. @end table
  13341. For example, to generate a frei0r partik0l source with size 200x200
  13342. and frame rate 10 which is overlaid on the overlay filter main input:
  13343. @example
  13344. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13345. @end example
  13346. @section life
  13347. Generate a life pattern.
  13348. This source is based on a generalization of John Conway's life game.
  13349. The sourced input represents a life grid, each pixel represents a cell
  13350. which can be in one of two possible states, alive or dead. Every cell
  13351. interacts with its eight neighbours, which are the cells that are
  13352. horizontally, vertically, or diagonally adjacent.
  13353. At each interaction the grid evolves according to the adopted rule,
  13354. which specifies the number of neighbor alive cells which will make a
  13355. cell stay alive or born. The @option{rule} option allows one to specify
  13356. the rule to adopt.
  13357. This source accepts the following options:
  13358. @table @option
  13359. @item filename, f
  13360. Set the file from which to read the initial grid state. In the file,
  13361. each non-whitespace character is considered an alive cell, and newline
  13362. is used to delimit the end of each row.
  13363. If this option is not specified, the initial grid is generated
  13364. randomly.
  13365. @item rate, r
  13366. Set the video rate, that is the number of frames generated per second.
  13367. Default is 25.
  13368. @item random_fill_ratio, ratio
  13369. Set the random fill ratio for the initial random grid. It is a
  13370. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13371. It is ignored when a file is specified.
  13372. @item random_seed, seed
  13373. Set the seed for filling the initial random grid, must be an integer
  13374. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13375. set to -1, the filter will try to use a good random seed on a best
  13376. effort basis.
  13377. @item rule
  13378. Set the life rule.
  13379. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13380. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13381. @var{NS} specifies the number of alive neighbor cells which make a
  13382. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13383. which make a dead cell to become alive (i.e. to "born").
  13384. "s" and "b" can be used in place of "S" and "B", respectively.
  13385. Alternatively a rule can be specified by an 18-bits integer. The 9
  13386. high order bits are used to encode the next cell state if it is alive
  13387. for each number of neighbor alive cells, the low order bits specify
  13388. the rule for "borning" new cells. Higher order bits encode for an
  13389. higher number of neighbor cells.
  13390. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13391. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13392. Default value is "S23/B3", which is the original Conway's game of life
  13393. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13394. cells, and will born a new cell if there are three alive cells around
  13395. a dead cell.
  13396. @item size, s
  13397. Set the size of the output video. For the syntax of this option, check the
  13398. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13399. If @option{filename} is specified, the size is set by default to the
  13400. same size of the input file. If @option{size} is set, it must contain
  13401. the size specified in the input file, and the initial grid defined in
  13402. that file is centered in the larger resulting area.
  13403. If a filename is not specified, the size value defaults to "320x240"
  13404. (used for a randomly generated initial grid).
  13405. @item stitch
  13406. If set to 1, stitch the left and right grid edges together, and the
  13407. top and bottom edges also. Defaults to 1.
  13408. @item mold
  13409. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13410. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13411. value from 0 to 255.
  13412. @item life_color
  13413. Set the color of living (or new born) cells.
  13414. @item death_color
  13415. Set the color of dead cells. If @option{mold} is set, this is the first color
  13416. used to represent a dead cell.
  13417. @item mold_color
  13418. Set mold color, for definitely dead and moldy cells.
  13419. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13420. ffmpeg-utils manual,ffmpeg-utils}.
  13421. @end table
  13422. @subsection Examples
  13423. @itemize
  13424. @item
  13425. Read a grid from @file{pattern}, and center it on a grid of size
  13426. 300x300 pixels:
  13427. @example
  13428. life=f=pattern:s=300x300
  13429. @end example
  13430. @item
  13431. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13432. @example
  13433. life=ratio=2/3:s=200x200
  13434. @end example
  13435. @item
  13436. Specify a custom rule for evolving a randomly generated grid:
  13437. @example
  13438. life=rule=S14/B34
  13439. @end example
  13440. @item
  13441. Full example with slow death effect (mold) using @command{ffplay}:
  13442. @example
  13443. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13444. @end example
  13445. @end itemize
  13446. @anchor{allrgb}
  13447. @anchor{allyuv}
  13448. @anchor{color}
  13449. @anchor{haldclutsrc}
  13450. @anchor{nullsrc}
  13451. @anchor{rgbtestsrc}
  13452. @anchor{smptebars}
  13453. @anchor{smptehdbars}
  13454. @anchor{testsrc}
  13455. @anchor{testsrc2}
  13456. @anchor{yuvtestsrc}
  13457. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13458. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13459. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13460. The @code{color} source provides an uniformly colored input.
  13461. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13462. @ref{haldclut} filter.
  13463. The @code{nullsrc} source returns unprocessed video frames. It is
  13464. mainly useful to be employed in analysis / debugging tools, or as the
  13465. source for filters which ignore the input data.
  13466. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13467. detecting RGB vs BGR issues. You should see a red, green and blue
  13468. stripe from top to bottom.
  13469. The @code{smptebars} source generates a color bars pattern, based on
  13470. the SMPTE Engineering Guideline EG 1-1990.
  13471. The @code{smptehdbars} source generates a color bars pattern, based on
  13472. the SMPTE RP 219-2002.
  13473. The @code{testsrc} source generates a test video pattern, showing a
  13474. color pattern, a scrolling gradient and a timestamp. This is mainly
  13475. intended for testing purposes.
  13476. The @code{testsrc2} source is similar to testsrc, but supports more
  13477. pixel formats instead of just @code{rgb24}. This allows using it as an
  13478. input for other tests without requiring a format conversion.
  13479. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13480. see a y, cb and cr stripe from top to bottom.
  13481. The sources accept the following parameters:
  13482. @table @option
  13483. @item level
  13484. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13485. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13486. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13487. coded on a @code{1/(N*N)} scale.
  13488. @item color, c
  13489. Specify the color of the source, only available in the @code{color}
  13490. source. For the syntax of this option, check the
  13491. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13492. @item size, s
  13493. Specify the size of the sourced video. For the syntax of this option, check the
  13494. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13495. The default value is @code{320x240}.
  13496. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13497. @code{haldclutsrc} filters.
  13498. @item rate, r
  13499. Specify the frame rate of the sourced video, as the number of frames
  13500. generated per second. It has to be a string in the format
  13501. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13502. number or a valid video frame rate abbreviation. The default value is
  13503. "25".
  13504. @item duration, d
  13505. Set the duration of the sourced video. See
  13506. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13507. for the accepted syntax.
  13508. If not specified, or the expressed duration is negative, the video is
  13509. supposed to be generated forever.
  13510. @item sar
  13511. Set the sample aspect ratio of the sourced video.
  13512. @item alpha
  13513. Specify the alpha (opacity) of the background, only available in the
  13514. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13515. 255 (fully opaque, the default).
  13516. @item decimals, n
  13517. Set the number of decimals to show in the timestamp, only available in the
  13518. @code{testsrc} source.
  13519. The displayed timestamp value will correspond to the original
  13520. timestamp value multiplied by the power of 10 of the specified
  13521. value. Default value is 0.
  13522. @end table
  13523. @subsection Examples
  13524. @itemize
  13525. @item
  13526. Generate a video with a duration of 5.3 seconds, with size
  13527. 176x144 and a frame rate of 10 frames per second:
  13528. @example
  13529. testsrc=duration=5.3:size=qcif:rate=10
  13530. @end example
  13531. @item
  13532. The following graph description will generate a red source
  13533. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13534. frames per second:
  13535. @example
  13536. color=c=red@@0.2:s=qcif:r=10
  13537. @end example
  13538. @item
  13539. If the input content is to be ignored, @code{nullsrc} can be used. The
  13540. following command generates noise in the luminance plane by employing
  13541. the @code{geq} filter:
  13542. @example
  13543. nullsrc=s=256x256, geq=random(1)*255:128:128
  13544. @end example
  13545. @end itemize
  13546. @subsection Commands
  13547. The @code{color} source supports the following commands:
  13548. @table @option
  13549. @item c, color
  13550. Set the color of the created image. Accepts the same syntax of the
  13551. corresponding @option{color} option.
  13552. @end table
  13553. @section openclsrc
  13554. Generate video using an OpenCL program.
  13555. @table @option
  13556. @item source
  13557. OpenCL program source file.
  13558. @item kernel
  13559. Kernel name in program.
  13560. @item size, s
  13561. Size of frames to generate. This must be set.
  13562. @item format
  13563. Pixel format to use for the generated frames. This must be set.
  13564. @item rate, r
  13565. Number of frames generated every second. Default value is '25'.
  13566. @end table
  13567. For details of how the program loading works, see the @ref{program_opencl}
  13568. filter.
  13569. Example programs:
  13570. @itemize
  13571. @item
  13572. Generate a colour ramp by setting pixel values from the position of the pixel
  13573. in the output image. (Note that this will work with all pixel formats, but
  13574. the generated output will not be the same.)
  13575. @verbatim
  13576. __kernel void ramp(__write_only image2d_t dst,
  13577. unsigned int index)
  13578. {
  13579. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13580. float4 val;
  13581. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13582. write_imagef(dst, loc, val);
  13583. }
  13584. @end verbatim
  13585. @item
  13586. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13587. @verbatim
  13588. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13589. unsigned int index)
  13590. {
  13591. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13592. float4 value = 0.0f;
  13593. int x = loc.x + index;
  13594. int y = loc.y + index;
  13595. while (x > 0 || y > 0) {
  13596. if (x % 3 == 1 && y % 3 == 1) {
  13597. value = 1.0f;
  13598. break;
  13599. }
  13600. x /= 3;
  13601. y /= 3;
  13602. }
  13603. write_imagef(dst, loc, value);
  13604. }
  13605. @end verbatim
  13606. @end itemize
  13607. @c man end VIDEO SOURCES
  13608. @chapter Video Sinks
  13609. @c man begin VIDEO SINKS
  13610. Below is a description of the currently available video sinks.
  13611. @section buffersink
  13612. Buffer video frames, and make them available to the end of the filter
  13613. graph.
  13614. This sink is mainly intended for programmatic use, in particular
  13615. through the interface defined in @file{libavfilter/buffersink.h}
  13616. or the options system.
  13617. It accepts a pointer to an AVBufferSinkContext structure, which
  13618. defines the incoming buffers' formats, to be passed as the opaque
  13619. parameter to @code{avfilter_init_filter} for initialization.
  13620. @section nullsink
  13621. Null video sink: do absolutely nothing with the input video. It is
  13622. mainly useful as a template and for use in analysis / debugging
  13623. tools.
  13624. @c man end VIDEO SINKS
  13625. @chapter Multimedia Filters
  13626. @c man begin MULTIMEDIA FILTERS
  13627. Below is a description of the currently available multimedia filters.
  13628. @section abitscope
  13629. Convert input audio to a video output, displaying the audio bit scope.
  13630. The filter accepts the following options:
  13631. @table @option
  13632. @item rate, r
  13633. Set frame rate, expressed as number of frames per second. Default
  13634. value is "25".
  13635. @item size, s
  13636. Specify the video size for the output. For the syntax of this option, check the
  13637. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13638. Default value is @code{1024x256}.
  13639. @item colors
  13640. Specify list of colors separated by space or by '|' which will be used to
  13641. draw channels. Unrecognized or missing colors will be replaced
  13642. by white color.
  13643. @end table
  13644. @section ahistogram
  13645. Convert input audio to a video output, displaying the volume histogram.
  13646. The filter accepts the following options:
  13647. @table @option
  13648. @item dmode
  13649. Specify how histogram is calculated.
  13650. It accepts the following values:
  13651. @table @samp
  13652. @item single
  13653. Use single histogram for all channels.
  13654. @item separate
  13655. Use separate histogram for each channel.
  13656. @end table
  13657. Default is @code{single}.
  13658. @item rate, r
  13659. Set frame rate, expressed as number of frames per second. Default
  13660. value is "25".
  13661. @item size, s
  13662. Specify the video size for the output. For the syntax of this option, check the
  13663. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13664. Default value is @code{hd720}.
  13665. @item scale
  13666. Set display scale.
  13667. It accepts the following values:
  13668. @table @samp
  13669. @item log
  13670. logarithmic
  13671. @item sqrt
  13672. square root
  13673. @item cbrt
  13674. cubic root
  13675. @item lin
  13676. linear
  13677. @item rlog
  13678. reverse logarithmic
  13679. @end table
  13680. Default is @code{log}.
  13681. @item ascale
  13682. Set amplitude scale.
  13683. It accepts the following values:
  13684. @table @samp
  13685. @item log
  13686. logarithmic
  13687. @item lin
  13688. linear
  13689. @end table
  13690. Default is @code{log}.
  13691. @item acount
  13692. Set how much frames to accumulate in histogram.
  13693. Defauls is 1. Setting this to -1 accumulates all frames.
  13694. @item rheight
  13695. Set histogram ratio of window height.
  13696. @item slide
  13697. Set sonogram sliding.
  13698. It accepts the following values:
  13699. @table @samp
  13700. @item replace
  13701. replace old rows with new ones.
  13702. @item scroll
  13703. scroll from top to bottom.
  13704. @end table
  13705. Default is @code{replace}.
  13706. @end table
  13707. @section aphasemeter
  13708. Convert input audio to a video output, displaying the audio phase.
  13709. The filter accepts the following options:
  13710. @table @option
  13711. @item rate, r
  13712. Set the output frame rate. Default value is @code{25}.
  13713. @item size, s
  13714. Set the video size for the output. For the syntax of this option, check the
  13715. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13716. Default value is @code{800x400}.
  13717. @item rc
  13718. @item gc
  13719. @item bc
  13720. Specify the red, green, blue contrast. Default values are @code{2},
  13721. @code{7} and @code{1}.
  13722. Allowed range is @code{[0, 255]}.
  13723. @item mpc
  13724. Set color which will be used for drawing median phase. If color is
  13725. @code{none} which is default, no median phase value will be drawn.
  13726. @item video
  13727. Enable video output. Default is enabled.
  13728. @end table
  13729. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13730. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13731. The @code{-1} means left and right channels are completely out of phase and
  13732. @code{1} means channels are in phase.
  13733. @section avectorscope
  13734. Convert input audio to a video output, representing the audio vector
  13735. scope.
  13736. The filter is used to measure the difference between channels of stereo
  13737. audio stream. A monoaural signal, consisting of identical left and right
  13738. signal, results in straight vertical line. Any stereo separation is visible
  13739. as a deviation from this line, creating a Lissajous figure.
  13740. If the straight (or deviation from it) but horizontal line appears this
  13741. indicates that the left and right channels are out of phase.
  13742. The filter accepts the following options:
  13743. @table @option
  13744. @item mode, m
  13745. Set the vectorscope mode.
  13746. Available values are:
  13747. @table @samp
  13748. @item lissajous
  13749. Lissajous rotated by 45 degrees.
  13750. @item lissajous_xy
  13751. Same as above but not rotated.
  13752. @item polar
  13753. Shape resembling half of circle.
  13754. @end table
  13755. Default value is @samp{lissajous}.
  13756. @item size, s
  13757. Set the video size for the output. For the syntax of this option, check the
  13758. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13759. Default value is @code{400x400}.
  13760. @item rate, r
  13761. Set the output frame rate. Default value is @code{25}.
  13762. @item rc
  13763. @item gc
  13764. @item bc
  13765. @item ac
  13766. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13767. @code{160}, @code{80} and @code{255}.
  13768. Allowed range is @code{[0, 255]}.
  13769. @item rf
  13770. @item gf
  13771. @item bf
  13772. @item af
  13773. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13774. @code{10}, @code{5} and @code{5}.
  13775. Allowed range is @code{[0, 255]}.
  13776. @item zoom
  13777. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13778. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13779. @item draw
  13780. Set the vectorscope drawing mode.
  13781. Available values are:
  13782. @table @samp
  13783. @item dot
  13784. Draw dot for each sample.
  13785. @item line
  13786. Draw line between previous and current sample.
  13787. @end table
  13788. Default value is @samp{dot}.
  13789. @item scale
  13790. Specify amplitude scale of audio samples.
  13791. Available values are:
  13792. @table @samp
  13793. @item lin
  13794. Linear.
  13795. @item sqrt
  13796. Square root.
  13797. @item cbrt
  13798. Cubic root.
  13799. @item log
  13800. Logarithmic.
  13801. @end table
  13802. @item swap
  13803. Swap left channel axis with right channel axis.
  13804. @item mirror
  13805. Mirror axis.
  13806. @table @samp
  13807. @item none
  13808. No mirror.
  13809. @item x
  13810. Mirror only x axis.
  13811. @item y
  13812. Mirror only y axis.
  13813. @item xy
  13814. Mirror both axis.
  13815. @end table
  13816. @end table
  13817. @subsection Examples
  13818. @itemize
  13819. @item
  13820. Complete example using @command{ffplay}:
  13821. @example
  13822. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13823. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13824. @end example
  13825. @end itemize
  13826. @section bench, abench
  13827. Benchmark part of a filtergraph.
  13828. The filter accepts the following options:
  13829. @table @option
  13830. @item action
  13831. Start or stop a timer.
  13832. Available values are:
  13833. @table @samp
  13834. @item start
  13835. Get the current time, set it as frame metadata (using the key
  13836. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13837. @item stop
  13838. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13839. the input frame metadata to get the time difference. Time difference, average,
  13840. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13841. @code{min}) are then printed. The timestamps are expressed in seconds.
  13842. @end table
  13843. @end table
  13844. @subsection Examples
  13845. @itemize
  13846. @item
  13847. Benchmark @ref{selectivecolor} filter:
  13848. @example
  13849. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13850. @end example
  13851. @end itemize
  13852. @section concat
  13853. Concatenate audio and video streams, joining them together one after the
  13854. other.
  13855. The filter works on segments of synchronized video and audio streams. All
  13856. segments must have the same number of streams of each type, and that will
  13857. also be the number of streams at output.
  13858. The filter accepts the following options:
  13859. @table @option
  13860. @item n
  13861. Set the number of segments. Default is 2.
  13862. @item v
  13863. Set the number of output video streams, that is also the number of video
  13864. streams in each segment. Default is 1.
  13865. @item a
  13866. Set the number of output audio streams, that is also the number of audio
  13867. streams in each segment. Default is 0.
  13868. @item unsafe
  13869. Activate unsafe mode: do not fail if segments have a different format.
  13870. @end table
  13871. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13872. @var{a} audio outputs.
  13873. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13874. segment, in the same order as the outputs, then the inputs for the second
  13875. segment, etc.
  13876. Related streams do not always have exactly the same duration, for various
  13877. reasons including codec frame size or sloppy authoring. For that reason,
  13878. related synchronized streams (e.g. a video and its audio track) should be
  13879. concatenated at once. The concat filter will use the duration of the longest
  13880. stream in each segment (except the last one), and if necessary pad shorter
  13881. audio streams with silence.
  13882. For this filter to work correctly, all segments must start at timestamp 0.
  13883. All corresponding streams must have the same parameters in all segments; the
  13884. filtering system will automatically select a common pixel format for video
  13885. streams, and a common sample format, sample rate and channel layout for
  13886. audio streams, but other settings, such as resolution, must be converted
  13887. explicitly by the user.
  13888. Different frame rates are acceptable but will result in variable frame rate
  13889. at output; be sure to configure the output file to handle it.
  13890. @subsection Examples
  13891. @itemize
  13892. @item
  13893. Concatenate an opening, an episode and an ending, all in bilingual version
  13894. (video in stream 0, audio in streams 1 and 2):
  13895. @example
  13896. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13897. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13898. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13899. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13900. @end example
  13901. @item
  13902. Concatenate two parts, handling audio and video separately, using the
  13903. (a)movie sources, and adjusting the resolution:
  13904. @example
  13905. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13906. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13907. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13908. @end example
  13909. Note that a desync will happen at the stitch if the audio and video streams
  13910. do not have exactly the same duration in the first file.
  13911. @end itemize
  13912. @subsection Commands
  13913. This filter supports the following commands:
  13914. @table @option
  13915. @item next
  13916. Close the current segment and step to the next one
  13917. @end table
  13918. @section drawgraph, adrawgraph
  13919. Draw a graph using input video or audio metadata.
  13920. It accepts the following parameters:
  13921. @table @option
  13922. @item m1
  13923. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13924. @item fg1
  13925. Set 1st foreground color expression.
  13926. @item m2
  13927. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13928. @item fg2
  13929. Set 2nd foreground color expression.
  13930. @item m3
  13931. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13932. @item fg3
  13933. Set 3rd foreground color expression.
  13934. @item m4
  13935. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13936. @item fg4
  13937. Set 4th foreground color expression.
  13938. @item min
  13939. Set minimal value of metadata value.
  13940. @item max
  13941. Set maximal value of metadata value.
  13942. @item bg
  13943. Set graph background color. Default is white.
  13944. @item mode
  13945. Set graph mode.
  13946. Available values for mode is:
  13947. @table @samp
  13948. @item bar
  13949. @item dot
  13950. @item line
  13951. @end table
  13952. Default is @code{line}.
  13953. @item slide
  13954. Set slide mode.
  13955. Available values for slide is:
  13956. @table @samp
  13957. @item frame
  13958. Draw new frame when right border is reached.
  13959. @item replace
  13960. Replace old columns with new ones.
  13961. @item scroll
  13962. Scroll from right to left.
  13963. @item rscroll
  13964. Scroll from left to right.
  13965. @item picture
  13966. Draw single picture.
  13967. @end table
  13968. Default is @code{frame}.
  13969. @item size
  13970. Set size of graph video. For the syntax of this option, check the
  13971. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13972. The default value is @code{900x256}.
  13973. The foreground color expressions can use the following variables:
  13974. @table @option
  13975. @item MIN
  13976. Minimal value of metadata value.
  13977. @item MAX
  13978. Maximal value of metadata value.
  13979. @item VAL
  13980. Current metadata key value.
  13981. @end table
  13982. The color is defined as 0xAABBGGRR.
  13983. @end table
  13984. Example using metadata from @ref{signalstats} filter:
  13985. @example
  13986. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13987. @end example
  13988. Example using metadata from @ref{ebur128} filter:
  13989. @example
  13990. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13991. @end example
  13992. @anchor{ebur128}
  13993. @section ebur128
  13994. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13995. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13996. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13997. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13998. The filter also has a video output (see the @var{video} option) with a real
  13999. time graph to observe the loudness evolution. The graphic contains the logged
  14000. message mentioned above, so it is not printed anymore when this option is set,
  14001. unless the verbose logging is set. The main graphing area contains the
  14002. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14003. the momentary loudness (400 milliseconds).
  14004. More information about the Loudness Recommendation EBU R128 on
  14005. @url{http://tech.ebu.ch/loudness}.
  14006. The filter accepts the following options:
  14007. @table @option
  14008. @item video
  14009. Activate the video output. The audio stream is passed unchanged whether this
  14010. option is set or no. The video stream will be the first output stream if
  14011. activated. Default is @code{0}.
  14012. @item size
  14013. Set the video size. This option is for video only. For the syntax of this
  14014. option, check the
  14015. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14016. Default and minimum resolution is @code{640x480}.
  14017. @item meter
  14018. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14019. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14020. other integer value between this range is allowed.
  14021. @item metadata
  14022. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14023. into 100ms output frames, each of them containing various loudness information
  14024. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14025. Default is @code{0}.
  14026. @item framelog
  14027. Force the frame logging level.
  14028. Available values are:
  14029. @table @samp
  14030. @item info
  14031. information logging level
  14032. @item verbose
  14033. verbose logging level
  14034. @end table
  14035. By default, the logging level is set to @var{info}. If the @option{video} or
  14036. the @option{metadata} options are set, it switches to @var{verbose}.
  14037. @item peak
  14038. Set peak mode(s).
  14039. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14040. values are:
  14041. @table @samp
  14042. @item none
  14043. Disable any peak mode (default).
  14044. @item sample
  14045. Enable sample-peak mode.
  14046. Simple peak mode looking for the higher sample value. It logs a message
  14047. for sample-peak (identified by @code{SPK}).
  14048. @item true
  14049. Enable true-peak mode.
  14050. If enabled, the peak lookup is done on an over-sampled version of the input
  14051. stream for better peak accuracy. It logs a message for true-peak.
  14052. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14053. This mode requires a build with @code{libswresample}.
  14054. @end table
  14055. @item dualmono
  14056. Treat mono input files as "dual mono". If a mono file is intended for playback
  14057. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14058. If set to @code{true}, this option will compensate for this effect.
  14059. Multi-channel input files are not affected by this option.
  14060. @item panlaw
  14061. Set a specific pan law to be used for the measurement of dual mono files.
  14062. This parameter is optional, and has a default value of -3.01dB.
  14063. @end table
  14064. @subsection Examples
  14065. @itemize
  14066. @item
  14067. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14068. @example
  14069. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14070. @end example
  14071. @item
  14072. Run an analysis with @command{ffmpeg}:
  14073. @example
  14074. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14075. @end example
  14076. @end itemize
  14077. @section interleave, ainterleave
  14078. Temporally interleave frames from several inputs.
  14079. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14080. These filters read frames from several inputs and send the oldest
  14081. queued frame to the output.
  14082. Input streams must have well defined, monotonically increasing frame
  14083. timestamp values.
  14084. In order to submit one frame to output, these filters need to enqueue
  14085. at least one frame for each input, so they cannot work in case one
  14086. input is not yet terminated and will not receive incoming frames.
  14087. For example consider the case when one input is a @code{select} filter
  14088. which always drops input frames. The @code{interleave} filter will keep
  14089. reading from that input, but it will never be able to send new frames
  14090. to output until the input sends an end-of-stream signal.
  14091. Also, depending on inputs synchronization, the filters will drop
  14092. frames in case one input receives more frames than the other ones, and
  14093. the queue is already filled.
  14094. These filters accept the following options:
  14095. @table @option
  14096. @item nb_inputs, n
  14097. Set the number of different inputs, it is 2 by default.
  14098. @end table
  14099. @subsection Examples
  14100. @itemize
  14101. @item
  14102. Interleave frames belonging to different streams using @command{ffmpeg}:
  14103. @example
  14104. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14105. @end example
  14106. @item
  14107. Add flickering blur effect:
  14108. @example
  14109. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14110. @end example
  14111. @end itemize
  14112. @section metadata, ametadata
  14113. Manipulate frame metadata.
  14114. This filter accepts the following options:
  14115. @table @option
  14116. @item mode
  14117. Set mode of operation of the filter.
  14118. Can be one of the following:
  14119. @table @samp
  14120. @item select
  14121. If both @code{value} and @code{key} is set, select frames
  14122. which have such metadata. If only @code{key} is set, select
  14123. every frame that has such key in metadata.
  14124. @item add
  14125. Add new metadata @code{key} and @code{value}. If key is already available
  14126. do nothing.
  14127. @item modify
  14128. Modify value of already present key.
  14129. @item delete
  14130. If @code{value} is set, delete only keys that have such value.
  14131. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14132. the frame.
  14133. @item print
  14134. Print key and its value if metadata was found. If @code{key} is not set print all
  14135. metadata values available in frame.
  14136. @end table
  14137. @item key
  14138. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14139. @item value
  14140. Set metadata value which will be used. This option is mandatory for
  14141. @code{modify} and @code{add} mode.
  14142. @item function
  14143. Which function to use when comparing metadata value and @code{value}.
  14144. Can be one of following:
  14145. @table @samp
  14146. @item same_str
  14147. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14148. @item starts_with
  14149. Values are interpreted as strings, returns true if metadata value starts with
  14150. the @code{value} option string.
  14151. @item less
  14152. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14153. @item equal
  14154. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14155. @item greater
  14156. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14157. @item expr
  14158. Values are interpreted as floats, returns true if expression from option @code{expr}
  14159. evaluates to true.
  14160. @end table
  14161. @item expr
  14162. Set expression which is used when @code{function} is set to @code{expr}.
  14163. The expression is evaluated through the eval API and can contain the following
  14164. constants:
  14165. @table @option
  14166. @item VALUE1
  14167. Float representation of @code{value} from metadata key.
  14168. @item VALUE2
  14169. Float representation of @code{value} as supplied by user in @code{value} option.
  14170. @end table
  14171. @item file
  14172. If specified in @code{print} mode, output is written to the named file. Instead of
  14173. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14174. for standard output. If @code{file} option is not set, output is written to the log
  14175. with AV_LOG_INFO loglevel.
  14176. @end table
  14177. @subsection Examples
  14178. @itemize
  14179. @item
  14180. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14181. between 0 and 1.
  14182. @example
  14183. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14184. @end example
  14185. @item
  14186. Print silencedetect output to file @file{metadata.txt}.
  14187. @example
  14188. silencedetect,ametadata=mode=print:file=metadata.txt
  14189. @end example
  14190. @item
  14191. Direct all metadata to a pipe with file descriptor 4.
  14192. @example
  14193. metadata=mode=print:file='pipe\:4'
  14194. @end example
  14195. @end itemize
  14196. @section perms, aperms
  14197. Set read/write permissions for the output frames.
  14198. These filters are mainly aimed at developers to test direct path in the
  14199. following filter in the filtergraph.
  14200. The filters accept the following options:
  14201. @table @option
  14202. @item mode
  14203. Select the permissions mode.
  14204. It accepts the following values:
  14205. @table @samp
  14206. @item none
  14207. Do nothing. This is the default.
  14208. @item ro
  14209. Set all the output frames read-only.
  14210. @item rw
  14211. Set all the output frames directly writable.
  14212. @item toggle
  14213. Make the frame read-only if writable, and writable if read-only.
  14214. @item random
  14215. Set each output frame read-only or writable randomly.
  14216. @end table
  14217. @item seed
  14218. Set the seed for the @var{random} mode, must be an integer included between
  14219. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14220. @code{-1}, the filter will try to use a good random seed on a best effort
  14221. basis.
  14222. @end table
  14223. Note: in case of auto-inserted filter between the permission filter and the
  14224. following one, the permission might not be received as expected in that
  14225. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14226. perms/aperms filter can avoid this problem.
  14227. @section realtime, arealtime
  14228. Slow down filtering to match real time approximately.
  14229. These filters will pause the filtering for a variable amount of time to
  14230. match the output rate with the input timestamps.
  14231. They are similar to the @option{re} option to @code{ffmpeg}.
  14232. They accept the following options:
  14233. @table @option
  14234. @item limit
  14235. Time limit for the pauses. Any pause longer than that will be considered
  14236. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14237. @end table
  14238. @anchor{select}
  14239. @section select, aselect
  14240. Select frames to pass in output.
  14241. This filter accepts the following options:
  14242. @table @option
  14243. @item expr, e
  14244. Set expression, which is evaluated for each input frame.
  14245. If the expression is evaluated to zero, the frame is discarded.
  14246. If the evaluation result is negative or NaN, the frame is sent to the
  14247. first output; otherwise it is sent to the output with index
  14248. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14249. For example a value of @code{1.2} corresponds to the output with index
  14250. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14251. @item outputs, n
  14252. Set the number of outputs. The output to which to send the selected
  14253. frame is based on the result of the evaluation. Default value is 1.
  14254. @end table
  14255. The expression can contain the following constants:
  14256. @table @option
  14257. @item n
  14258. The (sequential) number of the filtered frame, starting from 0.
  14259. @item selected_n
  14260. The (sequential) number of the selected frame, starting from 0.
  14261. @item prev_selected_n
  14262. The sequential number of the last selected frame. It's NAN if undefined.
  14263. @item TB
  14264. The timebase of the input timestamps.
  14265. @item pts
  14266. The PTS (Presentation TimeStamp) of the filtered video frame,
  14267. expressed in @var{TB} units. It's NAN if undefined.
  14268. @item t
  14269. The PTS of the filtered video frame,
  14270. expressed in seconds. It's NAN if undefined.
  14271. @item prev_pts
  14272. The PTS of the previously filtered video frame. It's NAN if undefined.
  14273. @item prev_selected_pts
  14274. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14275. @item prev_selected_t
  14276. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14277. @item start_pts
  14278. The PTS of the first video frame in the video. It's NAN if undefined.
  14279. @item start_t
  14280. The time of the first video frame in the video. It's NAN if undefined.
  14281. @item pict_type @emph{(video only)}
  14282. The type of the filtered frame. It can assume one of the following
  14283. values:
  14284. @table @option
  14285. @item I
  14286. @item P
  14287. @item B
  14288. @item S
  14289. @item SI
  14290. @item SP
  14291. @item BI
  14292. @end table
  14293. @item interlace_type @emph{(video only)}
  14294. The frame interlace type. It can assume one of the following values:
  14295. @table @option
  14296. @item PROGRESSIVE
  14297. The frame is progressive (not interlaced).
  14298. @item TOPFIRST
  14299. The frame is top-field-first.
  14300. @item BOTTOMFIRST
  14301. The frame is bottom-field-first.
  14302. @end table
  14303. @item consumed_sample_n @emph{(audio only)}
  14304. the number of selected samples before the current frame
  14305. @item samples_n @emph{(audio only)}
  14306. the number of samples in the current frame
  14307. @item sample_rate @emph{(audio only)}
  14308. the input sample rate
  14309. @item key
  14310. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14311. @item pos
  14312. the position in the file of the filtered frame, -1 if the information
  14313. is not available (e.g. for synthetic video)
  14314. @item scene @emph{(video only)}
  14315. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14316. probability for the current frame to introduce a new scene, while a higher
  14317. value means the current frame is more likely to be one (see the example below)
  14318. @item concatdec_select
  14319. The concat demuxer can select only part of a concat input file by setting an
  14320. inpoint and an outpoint, but the output packets may not be entirely contained
  14321. in the selected interval. By using this variable, it is possible to skip frames
  14322. generated by the concat demuxer which are not exactly contained in the selected
  14323. interval.
  14324. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14325. and the @var{lavf.concat.duration} packet metadata values which are also
  14326. present in the decoded frames.
  14327. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14328. start_time and either the duration metadata is missing or the frame pts is less
  14329. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14330. missing.
  14331. That basically means that an input frame is selected if its pts is within the
  14332. interval set by the concat demuxer.
  14333. @end table
  14334. The default value of the select expression is "1".
  14335. @subsection Examples
  14336. @itemize
  14337. @item
  14338. Select all frames in input:
  14339. @example
  14340. select
  14341. @end example
  14342. The example above is the same as:
  14343. @example
  14344. select=1
  14345. @end example
  14346. @item
  14347. Skip all frames:
  14348. @example
  14349. select=0
  14350. @end example
  14351. @item
  14352. Select only I-frames:
  14353. @example
  14354. select='eq(pict_type\,I)'
  14355. @end example
  14356. @item
  14357. Select one frame every 100:
  14358. @example
  14359. select='not(mod(n\,100))'
  14360. @end example
  14361. @item
  14362. Select only frames contained in the 10-20 time interval:
  14363. @example
  14364. select=between(t\,10\,20)
  14365. @end example
  14366. @item
  14367. Select only I-frames contained in the 10-20 time interval:
  14368. @example
  14369. select=between(t\,10\,20)*eq(pict_type\,I)
  14370. @end example
  14371. @item
  14372. Select frames with a minimum distance of 10 seconds:
  14373. @example
  14374. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14375. @end example
  14376. @item
  14377. Use aselect to select only audio frames with samples number > 100:
  14378. @example
  14379. aselect='gt(samples_n\,100)'
  14380. @end example
  14381. @item
  14382. Create a mosaic of the first scenes:
  14383. @example
  14384. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14385. @end example
  14386. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14387. choice.
  14388. @item
  14389. Send even and odd frames to separate outputs, and compose them:
  14390. @example
  14391. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14392. @end example
  14393. @item
  14394. Select useful frames from an ffconcat file which is using inpoints and
  14395. outpoints but where the source files are not intra frame only.
  14396. @example
  14397. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14398. @end example
  14399. @end itemize
  14400. @section sendcmd, asendcmd
  14401. Send commands to filters in the filtergraph.
  14402. These filters read commands to be sent to other filters in the
  14403. filtergraph.
  14404. @code{sendcmd} must be inserted between two video filters,
  14405. @code{asendcmd} must be inserted between two audio filters, but apart
  14406. from that they act the same way.
  14407. The specification of commands can be provided in the filter arguments
  14408. with the @var{commands} option, or in a file specified by the
  14409. @var{filename} option.
  14410. These filters accept the following options:
  14411. @table @option
  14412. @item commands, c
  14413. Set the commands to be read and sent to the other filters.
  14414. @item filename, f
  14415. Set the filename of the commands to be read and sent to the other
  14416. filters.
  14417. @end table
  14418. @subsection Commands syntax
  14419. A commands description consists of a sequence of interval
  14420. specifications, comprising a list of commands to be executed when a
  14421. particular event related to that interval occurs. The occurring event
  14422. is typically the current frame time entering or leaving a given time
  14423. interval.
  14424. An interval is specified by the following syntax:
  14425. @example
  14426. @var{START}[-@var{END}] @var{COMMANDS};
  14427. @end example
  14428. The time interval is specified by the @var{START} and @var{END} times.
  14429. @var{END} is optional and defaults to the maximum time.
  14430. The current frame time is considered within the specified interval if
  14431. it is included in the interval [@var{START}, @var{END}), that is when
  14432. the time is greater or equal to @var{START} and is lesser than
  14433. @var{END}.
  14434. @var{COMMANDS} consists of a sequence of one or more command
  14435. specifications, separated by ",", relating to that interval. The
  14436. syntax of a command specification is given by:
  14437. @example
  14438. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14439. @end example
  14440. @var{FLAGS} is optional and specifies the type of events relating to
  14441. the time interval which enable sending the specified command, and must
  14442. be a non-null sequence of identifier flags separated by "+" or "|" and
  14443. enclosed between "[" and "]".
  14444. The following flags are recognized:
  14445. @table @option
  14446. @item enter
  14447. The command is sent when the current frame timestamp enters the
  14448. specified interval. In other words, the command is sent when the
  14449. previous frame timestamp was not in the given interval, and the
  14450. current is.
  14451. @item leave
  14452. The command is sent when the current frame timestamp leaves the
  14453. specified interval. In other words, the command is sent when the
  14454. previous frame timestamp was in the given interval, and the
  14455. current is not.
  14456. @end table
  14457. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14458. assumed.
  14459. @var{TARGET} specifies the target of the command, usually the name of
  14460. the filter class or a specific filter instance name.
  14461. @var{COMMAND} specifies the name of the command for the target filter.
  14462. @var{ARG} is optional and specifies the optional list of argument for
  14463. the given @var{COMMAND}.
  14464. Between one interval specification and another, whitespaces, or
  14465. sequences of characters starting with @code{#} until the end of line,
  14466. are ignored and can be used to annotate comments.
  14467. A simplified BNF description of the commands specification syntax
  14468. follows:
  14469. @example
  14470. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14471. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14472. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14473. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14474. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14475. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14476. @end example
  14477. @subsection Examples
  14478. @itemize
  14479. @item
  14480. Specify audio tempo change at second 4:
  14481. @example
  14482. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14483. @end example
  14484. @item
  14485. Target a specific filter instance:
  14486. @example
  14487. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14488. @end example
  14489. @item
  14490. Specify a list of drawtext and hue commands in a file.
  14491. @example
  14492. # show text in the interval 5-10
  14493. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14494. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14495. # desaturate the image in the interval 15-20
  14496. 15.0-20.0 [enter] hue s 0,
  14497. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14498. [leave] hue s 1,
  14499. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14500. # apply an exponential saturation fade-out effect, starting from time 25
  14501. 25 [enter] hue s exp(25-t)
  14502. @end example
  14503. A filtergraph allowing to read and process the above command list
  14504. stored in a file @file{test.cmd}, can be specified with:
  14505. @example
  14506. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14507. @end example
  14508. @end itemize
  14509. @anchor{setpts}
  14510. @section setpts, asetpts
  14511. Change the PTS (presentation timestamp) of the input frames.
  14512. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14513. This filter accepts the following options:
  14514. @table @option
  14515. @item expr
  14516. The expression which is evaluated for each frame to construct its timestamp.
  14517. @end table
  14518. The expression is evaluated through the eval API and can contain the following
  14519. constants:
  14520. @table @option
  14521. @item FRAME_RATE
  14522. frame rate, only defined for constant frame-rate video
  14523. @item PTS
  14524. The presentation timestamp in input
  14525. @item N
  14526. The count of the input frame for video or the number of consumed samples,
  14527. not including the current frame for audio, starting from 0.
  14528. @item NB_CONSUMED_SAMPLES
  14529. The number of consumed samples, not including the current frame (only
  14530. audio)
  14531. @item NB_SAMPLES, S
  14532. The number of samples in the current frame (only audio)
  14533. @item SAMPLE_RATE, SR
  14534. The audio sample rate.
  14535. @item STARTPTS
  14536. The PTS of the first frame.
  14537. @item STARTT
  14538. the time in seconds of the first frame
  14539. @item INTERLACED
  14540. State whether the current frame is interlaced.
  14541. @item T
  14542. the time in seconds of the current frame
  14543. @item POS
  14544. original position in the file of the frame, or undefined if undefined
  14545. for the current frame
  14546. @item PREV_INPTS
  14547. The previous input PTS.
  14548. @item PREV_INT
  14549. previous input time in seconds
  14550. @item PREV_OUTPTS
  14551. The previous output PTS.
  14552. @item PREV_OUTT
  14553. previous output time in seconds
  14554. @item RTCTIME
  14555. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14556. instead.
  14557. @item RTCSTART
  14558. The wallclock (RTC) time at the start of the movie in microseconds.
  14559. @item TB
  14560. The timebase of the input timestamps.
  14561. @end table
  14562. @subsection Examples
  14563. @itemize
  14564. @item
  14565. Start counting PTS from zero
  14566. @example
  14567. setpts=PTS-STARTPTS
  14568. @end example
  14569. @item
  14570. Apply fast motion effect:
  14571. @example
  14572. setpts=0.5*PTS
  14573. @end example
  14574. @item
  14575. Apply slow motion effect:
  14576. @example
  14577. setpts=2.0*PTS
  14578. @end example
  14579. @item
  14580. Set fixed rate of 25 frames per second:
  14581. @example
  14582. setpts=N/(25*TB)
  14583. @end example
  14584. @item
  14585. Set fixed rate 25 fps with some jitter:
  14586. @example
  14587. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14588. @end example
  14589. @item
  14590. Apply an offset of 10 seconds to the input PTS:
  14591. @example
  14592. setpts=PTS+10/TB
  14593. @end example
  14594. @item
  14595. Generate timestamps from a "live source" and rebase onto the current timebase:
  14596. @example
  14597. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14598. @end example
  14599. @item
  14600. Generate timestamps by counting samples:
  14601. @example
  14602. asetpts=N/SR/TB
  14603. @end example
  14604. @end itemize
  14605. @section setrange
  14606. Force color range for the output video frame.
  14607. The @code{setrange} filter marks the color range property for the
  14608. output frames. It does not change the input frame, but only sets the
  14609. corresponding property, which affects how the frame is treated by
  14610. following filters.
  14611. The filter accepts the following options:
  14612. @table @option
  14613. @item range
  14614. Available values are:
  14615. @table @samp
  14616. @item auto
  14617. Keep the same color range property.
  14618. @item unspecified, unknown
  14619. Set the color range as unspecified.
  14620. @item limited, tv, mpeg
  14621. Set the color range as limited.
  14622. @item full, pc, jpeg
  14623. Set the color range as full.
  14624. @end table
  14625. @end table
  14626. @section settb, asettb
  14627. Set the timebase to use for the output frames timestamps.
  14628. It is mainly useful for testing timebase configuration.
  14629. It accepts the following parameters:
  14630. @table @option
  14631. @item expr, tb
  14632. The expression which is evaluated into the output timebase.
  14633. @end table
  14634. The value for @option{tb} is an arithmetic expression representing a
  14635. rational. The expression can contain the constants "AVTB" (the default
  14636. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14637. audio only). Default value is "intb".
  14638. @subsection Examples
  14639. @itemize
  14640. @item
  14641. Set the timebase to 1/25:
  14642. @example
  14643. settb=expr=1/25
  14644. @end example
  14645. @item
  14646. Set the timebase to 1/10:
  14647. @example
  14648. settb=expr=0.1
  14649. @end example
  14650. @item
  14651. Set the timebase to 1001/1000:
  14652. @example
  14653. settb=1+0.001
  14654. @end example
  14655. @item
  14656. Set the timebase to 2*intb:
  14657. @example
  14658. settb=2*intb
  14659. @end example
  14660. @item
  14661. Set the default timebase value:
  14662. @example
  14663. settb=AVTB
  14664. @end example
  14665. @end itemize
  14666. @section showcqt
  14667. Convert input audio to a video output representing frequency spectrum
  14668. logarithmically using Brown-Puckette constant Q transform algorithm with
  14669. direct frequency domain coefficient calculation (but the transform itself
  14670. is not really constant Q, instead the Q factor is actually variable/clamped),
  14671. with musical tone scale, from E0 to D#10.
  14672. The filter accepts the following options:
  14673. @table @option
  14674. @item size, s
  14675. Specify the video size for the output. It must be even. For the syntax of this option,
  14676. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14677. Default value is @code{1920x1080}.
  14678. @item fps, rate, r
  14679. Set the output frame rate. Default value is @code{25}.
  14680. @item bar_h
  14681. Set the bargraph height. It must be even. Default value is @code{-1} which
  14682. computes the bargraph height automatically.
  14683. @item axis_h
  14684. Set the axis height. It must be even. Default value is @code{-1} which computes
  14685. the axis height automatically.
  14686. @item sono_h
  14687. Set the sonogram height. It must be even. Default value is @code{-1} which
  14688. computes the sonogram height automatically.
  14689. @item fullhd
  14690. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14691. instead. Default value is @code{1}.
  14692. @item sono_v, volume
  14693. Specify the sonogram volume expression. It can contain variables:
  14694. @table @option
  14695. @item bar_v
  14696. the @var{bar_v} evaluated expression
  14697. @item frequency, freq, f
  14698. the frequency where it is evaluated
  14699. @item timeclamp, tc
  14700. the value of @var{timeclamp} option
  14701. @end table
  14702. and functions:
  14703. @table @option
  14704. @item a_weighting(f)
  14705. A-weighting of equal loudness
  14706. @item b_weighting(f)
  14707. B-weighting of equal loudness
  14708. @item c_weighting(f)
  14709. C-weighting of equal loudness.
  14710. @end table
  14711. Default value is @code{16}.
  14712. @item bar_v, volume2
  14713. Specify the bargraph volume expression. It can contain variables:
  14714. @table @option
  14715. @item sono_v
  14716. the @var{sono_v} evaluated expression
  14717. @item frequency, freq, f
  14718. the frequency where it is evaluated
  14719. @item timeclamp, tc
  14720. the value of @var{timeclamp} option
  14721. @end table
  14722. and functions:
  14723. @table @option
  14724. @item a_weighting(f)
  14725. A-weighting of equal loudness
  14726. @item b_weighting(f)
  14727. B-weighting of equal loudness
  14728. @item c_weighting(f)
  14729. C-weighting of equal loudness.
  14730. @end table
  14731. Default value is @code{sono_v}.
  14732. @item sono_g, gamma
  14733. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14734. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14735. Acceptable range is @code{[1, 7]}.
  14736. @item bar_g, gamma2
  14737. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14738. @code{[1, 7]}.
  14739. @item bar_t
  14740. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14741. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14742. @item timeclamp, tc
  14743. Specify the transform timeclamp. At low frequency, there is trade-off between
  14744. accuracy in time domain and frequency domain. If timeclamp is lower,
  14745. event in time domain is represented more accurately (such as fast bass drum),
  14746. otherwise event in frequency domain is represented more accurately
  14747. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14748. @item attack
  14749. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14750. limits future samples by applying asymmetric windowing in time domain, useful
  14751. when low latency is required. Accepted range is @code{[0, 1]}.
  14752. @item basefreq
  14753. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14754. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14755. @item endfreq
  14756. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14757. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14758. @item coeffclamp
  14759. This option is deprecated and ignored.
  14760. @item tlength
  14761. Specify the transform length in time domain. Use this option to control accuracy
  14762. trade-off between time domain and frequency domain at every frequency sample.
  14763. It can contain variables:
  14764. @table @option
  14765. @item frequency, freq, f
  14766. the frequency where it is evaluated
  14767. @item timeclamp, tc
  14768. the value of @var{timeclamp} option.
  14769. @end table
  14770. Default value is @code{384*tc/(384+tc*f)}.
  14771. @item count
  14772. Specify the transform count for every video frame. Default value is @code{6}.
  14773. Acceptable range is @code{[1, 30]}.
  14774. @item fcount
  14775. Specify the transform count for every single pixel. Default value is @code{0},
  14776. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14777. @item fontfile
  14778. Specify font file for use with freetype to draw the axis. If not specified,
  14779. use embedded font. Note that drawing with font file or embedded font is not
  14780. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14781. option instead.
  14782. @item font
  14783. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14784. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14785. @item fontcolor
  14786. Specify font color expression. This is arithmetic expression that should return
  14787. integer value 0xRRGGBB. It can contain variables:
  14788. @table @option
  14789. @item frequency, freq, f
  14790. the frequency where it is evaluated
  14791. @item timeclamp, tc
  14792. the value of @var{timeclamp} option
  14793. @end table
  14794. and functions:
  14795. @table @option
  14796. @item midi(f)
  14797. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14798. @item r(x), g(x), b(x)
  14799. red, green, and blue value of intensity x.
  14800. @end table
  14801. Default value is @code{st(0, (midi(f)-59.5)/12);
  14802. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14803. r(1-ld(1)) + b(ld(1))}.
  14804. @item axisfile
  14805. Specify image file to draw the axis. This option override @var{fontfile} and
  14806. @var{fontcolor} option.
  14807. @item axis, text
  14808. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14809. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14810. Default value is @code{1}.
  14811. @item csp
  14812. Set colorspace. The accepted values are:
  14813. @table @samp
  14814. @item unspecified
  14815. Unspecified (default)
  14816. @item bt709
  14817. BT.709
  14818. @item fcc
  14819. FCC
  14820. @item bt470bg
  14821. BT.470BG or BT.601-6 625
  14822. @item smpte170m
  14823. SMPTE-170M or BT.601-6 525
  14824. @item smpte240m
  14825. SMPTE-240M
  14826. @item bt2020ncl
  14827. BT.2020 with non-constant luminance
  14828. @end table
  14829. @item cscheme
  14830. Set spectrogram color scheme. This is list of floating point values with format
  14831. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14832. The default is @code{1|0.5|0|0|0.5|1}.
  14833. @end table
  14834. @subsection Examples
  14835. @itemize
  14836. @item
  14837. Playing audio while showing the spectrum:
  14838. @example
  14839. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14840. @end example
  14841. @item
  14842. Same as above, but with frame rate 30 fps:
  14843. @example
  14844. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14845. @end example
  14846. @item
  14847. Playing at 1280x720:
  14848. @example
  14849. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14850. @end example
  14851. @item
  14852. Disable sonogram display:
  14853. @example
  14854. sono_h=0
  14855. @end example
  14856. @item
  14857. A1 and its harmonics: A1, A2, (near)E3, A3:
  14858. @example
  14859. 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),
  14860. asplit[a][out1]; [a] showcqt [out0]'
  14861. @end example
  14862. @item
  14863. Same as above, but with more accuracy in frequency domain:
  14864. @example
  14865. 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),
  14866. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14867. @end example
  14868. @item
  14869. Custom volume:
  14870. @example
  14871. bar_v=10:sono_v=bar_v*a_weighting(f)
  14872. @end example
  14873. @item
  14874. Custom gamma, now spectrum is linear to the amplitude.
  14875. @example
  14876. bar_g=2:sono_g=2
  14877. @end example
  14878. @item
  14879. Custom tlength equation:
  14880. @example
  14881. 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)))'
  14882. @end example
  14883. @item
  14884. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14885. @example
  14886. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14887. @end example
  14888. @item
  14889. Custom font using fontconfig:
  14890. @example
  14891. font='Courier New,Monospace,mono|bold'
  14892. @end example
  14893. @item
  14894. Custom frequency range with custom axis using image file:
  14895. @example
  14896. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14897. @end example
  14898. @end itemize
  14899. @section showfreqs
  14900. Convert input audio to video output representing the audio power spectrum.
  14901. Audio amplitude is on Y-axis while frequency is on X-axis.
  14902. The filter accepts the following options:
  14903. @table @option
  14904. @item size, s
  14905. Specify size of video. For the syntax of this option, check the
  14906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14907. Default is @code{1024x512}.
  14908. @item mode
  14909. Set display mode.
  14910. This set how each frequency bin will be represented.
  14911. It accepts the following values:
  14912. @table @samp
  14913. @item line
  14914. @item bar
  14915. @item dot
  14916. @end table
  14917. Default is @code{bar}.
  14918. @item ascale
  14919. Set amplitude scale.
  14920. It accepts the following values:
  14921. @table @samp
  14922. @item lin
  14923. Linear scale.
  14924. @item sqrt
  14925. Square root scale.
  14926. @item cbrt
  14927. Cubic root scale.
  14928. @item log
  14929. Logarithmic scale.
  14930. @end table
  14931. Default is @code{log}.
  14932. @item fscale
  14933. Set frequency scale.
  14934. It accepts the following values:
  14935. @table @samp
  14936. @item lin
  14937. Linear scale.
  14938. @item log
  14939. Logarithmic scale.
  14940. @item rlog
  14941. Reverse logarithmic scale.
  14942. @end table
  14943. Default is @code{lin}.
  14944. @item win_size
  14945. Set window size.
  14946. It accepts the following values:
  14947. @table @samp
  14948. @item w16
  14949. @item w32
  14950. @item w64
  14951. @item w128
  14952. @item w256
  14953. @item w512
  14954. @item w1024
  14955. @item w2048
  14956. @item w4096
  14957. @item w8192
  14958. @item w16384
  14959. @item w32768
  14960. @item w65536
  14961. @end table
  14962. Default is @code{w2048}
  14963. @item win_func
  14964. Set windowing function.
  14965. It accepts the following values:
  14966. @table @samp
  14967. @item rect
  14968. @item bartlett
  14969. @item hanning
  14970. @item hamming
  14971. @item blackman
  14972. @item welch
  14973. @item flattop
  14974. @item bharris
  14975. @item bnuttall
  14976. @item bhann
  14977. @item sine
  14978. @item nuttall
  14979. @item lanczos
  14980. @item gauss
  14981. @item tukey
  14982. @item dolph
  14983. @item cauchy
  14984. @item parzen
  14985. @item poisson
  14986. @end table
  14987. Default is @code{hanning}.
  14988. @item overlap
  14989. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14990. which means optimal overlap for selected window function will be picked.
  14991. @item averaging
  14992. Set time averaging. Setting this to 0 will display current maximal peaks.
  14993. Default is @code{1}, which means time averaging is disabled.
  14994. @item colors
  14995. Specify list of colors separated by space or by '|' which will be used to
  14996. draw channel frequencies. Unrecognized or missing colors will be replaced
  14997. by white color.
  14998. @item cmode
  14999. Set channel display mode.
  15000. It accepts the following values:
  15001. @table @samp
  15002. @item combined
  15003. @item separate
  15004. @end table
  15005. Default is @code{combined}.
  15006. @item minamp
  15007. Set minimum amplitude used in @code{log} amplitude scaler.
  15008. @end table
  15009. @anchor{showspectrum}
  15010. @section showspectrum
  15011. Convert input audio to a video output, representing the audio frequency
  15012. spectrum.
  15013. The filter accepts the following options:
  15014. @table @option
  15015. @item size, s
  15016. Specify the video size for the output. For the syntax of this option, check the
  15017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15018. Default value is @code{640x512}.
  15019. @item slide
  15020. Specify how the spectrum should slide along the window.
  15021. It accepts the following values:
  15022. @table @samp
  15023. @item replace
  15024. the samples start again on the left when they reach the right
  15025. @item scroll
  15026. the samples scroll from right to left
  15027. @item fullframe
  15028. frames are only produced when the samples reach the right
  15029. @item rscroll
  15030. the samples scroll from left to right
  15031. @end table
  15032. Default value is @code{replace}.
  15033. @item mode
  15034. Specify display mode.
  15035. It accepts the following values:
  15036. @table @samp
  15037. @item combined
  15038. all channels are displayed in the same row
  15039. @item separate
  15040. all channels are displayed in separate rows
  15041. @end table
  15042. Default value is @samp{combined}.
  15043. @item color
  15044. Specify display color mode.
  15045. It accepts the following values:
  15046. @table @samp
  15047. @item channel
  15048. each channel is displayed in a separate color
  15049. @item intensity
  15050. each channel is displayed using the same color scheme
  15051. @item rainbow
  15052. each channel is displayed using the rainbow color scheme
  15053. @item moreland
  15054. each channel is displayed using the moreland color scheme
  15055. @item nebulae
  15056. each channel is displayed using the nebulae color scheme
  15057. @item fire
  15058. each channel is displayed using the fire color scheme
  15059. @item fiery
  15060. each channel is displayed using the fiery color scheme
  15061. @item fruit
  15062. each channel is displayed using the fruit color scheme
  15063. @item cool
  15064. each channel is displayed using the cool color scheme
  15065. @end table
  15066. Default value is @samp{channel}.
  15067. @item scale
  15068. Specify scale used for calculating intensity color values.
  15069. It accepts the following values:
  15070. @table @samp
  15071. @item lin
  15072. linear
  15073. @item sqrt
  15074. square root, default
  15075. @item cbrt
  15076. cubic root
  15077. @item log
  15078. logarithmic
  15079. @item 4thrt
  15080. 4th root
  15081. @item 5thrt
  15082. 5th root
  15083. @end table
  15084. Default value is @samp{sqrt}.
  15085. @item saturation
  15086. Set saturation modifier for displayed colors. Negative values provide
  15087. alternative color scheme. @code{0} is no saturation at all.
  15088. Saturation must be in [-10.0, 10.0] range.
  15089. Default value is @code{1}.
  15090. @item win_func
  15091. Set window function.
  15092. It accepts the following values:
  15093. @table @samp
  15094. @item rect
  15095. @item bartlett
  15096. @item hann
  15097. @item hanning
  15098. @item hamming
  15099. @item blackman
  15100. @item welch
  15101. @item flattop
  15102. @item bharris
  15103. @item bnuttall
  15104. @item bhann
  15105. @item sine
  15106. @item nuttall
  15107. @item lanczos
  15108. @item gauss
  15109. @item tukey
  15110. @item dolph
  15111. @item cauchy
  15112. @item parzen
  15113. @item poisson
  15114. @end table
  15115. Default value is @code{hann}.
  15116. @item orientation
  15117. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15118. @code{horizontal}. Default is @code{vertical}.
  15119. @item overlap
  15120. Set ratio of overlap window. Default value is @code{0}.
  15121. When value is @code{1} overlap is set to recommended size for specific
  15122. window function currently used.
  15123. @item gain
  15124. Set scale gain for calculating intensity color values.
  15125. Default value is @code{1}.
  15126. @item data
  15127. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15128. @item rotation
  15129. Set color rotation, must be in [-1.0, 1.0] range.
  15130. Default value is @code{0}.
  15131. @end table
  15132. The usage is very similar to the showwaves filter; see the examples in that
  15133. section.
  15134. @subsection Examples
  15135. @itemize
  15136. @item
  15137. Large window with logarithmic color scaling:
  15138. @example
  15139. showspectrum=s=1280x480:scale=log
  15140. @end example
  15141. @item
  15142. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15143. @example
  15144. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15145. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15146. @end example
  15147. @end itemize
  15148. @section showspectrumpic
  15149. Convert input audio to a single video frame, representing the audio frequency
  15150. spectrum.
  15151. The filter accepts the following options:
  15152. @table @option
  15153. @item size, s
  15154. Specify the video size for the output. For the syntax of this option, check the
  15155. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15156. Default value is @code{4096x2048}.
  15157. @item mode
  15158. Specify display mode.
  15159. It accepts the following values:
  15160. @table @samp
  15161. @item combined
  15162. all channels are displayed in the same row
  15163. @item separate
  15164. all channels are displayed in separate rows
  15165. @end table
  15166. Default value is @samp{combined}.
  15167. @item color
  15168. Specify display color mode.
  15169. It accepts the following values:
  15170. @table @samp
  15171. @item channel
  15172. each channel is displayed in a separate color
  15173. @item intensity
  15174. each channel is displayed using the same color scheme
  15175. @item rainbow
  15176. each channel is displayed using the rainbow color scheme
  15177. @item moreland
  15178. each channel is displayed using the moreland color scheme
  15179. @item nebulae
  15180. each channel is displayed using the nebulae color scheme
  15181. @item fire
  15182. each channel is displayed using the fire color scheme
  15183. @item fiery
  15184. each channel is displayed using the fiery color scheme
  15185. @item fruit
  15186. each channel is displayed using the fruit color scheme
  15187. @item cool
  15188. each channel is displayed using the cool color scheme
  15189. @end table
  15190. Default value is @samp{intensity}.
  15191. @item scale
  15192. Specify scale used for calculating intensity color values.
  15193. It accepts the following values:
  15194. @table @samp
  15195. @item lin
  15196. linear
  15197. @item sqrt
  15198. square root, default
  15199. @item cbrt
  15200. cubic root
  15201. @item log
  15202. logarithmic
  15203. @item 4thrt
  15204. 4th root
  15205. @item 5thrt
  15206. 5th root
  15207. @end table
  15208. Default value is @samp{log}.
  15209. @item saturation
  15210. Set saturation modifier for displayed colors. Negative values provide
  15211. alternative color scheme. @code{0} is no saturation at all.
  15212. Saturation must be in [-10.0, 10.0] range.
  15213. Default value is @code{1}.
  15214. @item win_func
  15215. Set window function.
  15216. It accepts the following values:
  15217. @table @samp
  15218. @item rect
  15219. @item bartlett
  15220. @item hann
  15221. @item hanning
  15222. @item hamming
  15223. @item blackman
  15224. @item welch
  15225. @item flattop
  15226. @item bharris
  15227. @item bnuttall
  15228. @item bhann
  15229. @item sine
  15230. @item nuttall
  15231. @item lanczos
  15232. @item gauss
  15233. @item tukey
  15234. @item dolph
  15235. @item cauchy
  15236. @item parzen
  15237. @item poisson
  15238. @end table
  15239. Default value is @code{hann}.
  15240. @item orientation
  15241. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15242. @code{horizontal}. Default is @code{vertical}.
  15243. @item gain
  15244. Set scale gain for calculating intensity color values.
  15245. Default value is @code{1}.
  15246. @item legend
  15247. Draw time and frequency axes and legends. Default is enabled.
  15248. @item rotation
  15249. Set color rotation, must be in [-1.0, 1.0] range.
  15250. Default value is @code{0}.
  15251. @end table
  15252. @subsection Examples
  15253. @itemize
  15254. @item
  15255. Extract an audio spectrogram of a whole audio track
  15256. in a 1024x1024 picture using @command{ffmpeg}:
  15257. @example
  15258. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15259. @end example
  15260. @end itemize
  15261. @section showvolume
  15262. Convert input audio volume to a video output.
  15263. The filter accepts the following options:
  15264. @table @option
  15265. @item rate, r
  15266. Set video rate.
  15267. @item b
  15268. Set border width, allowed range is [0, 5]. Default is 1.
  15269. @item w
  15270. Set channel width, allowed range is [80, 8192]. Default is 400.
  15271. @item h
  15272. Set channel height, allowed range is [1, 900]. Default is 20.
  15273. @item f
  15274. Set fade, allowed range is [0, 1]. Default is 0.95.
  15275. @item c
  15276. Set volume color expression.
  15277. The expression can use the following variables:
  15278. @table @option
  15279. @item VOLUME
  15280. Current max volume of channel in dB.
  15281. @item PEAK
  15282. Current peak.
  15283. @item CHANNEL
  15284. Current channel number, starting from 0.
  15285. @end table
  15286. @item t
  15287. If set, displays channel names. Default is enabled.
  15288. @item v
  15289. If set, displays volume values. Default is enabled.
  15290. @item o
  15291. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15292. default is @code{h}.
  15293. @item s
  15294. Set step size, allowed range is [0, 5]. Default is 0, which means
  15295. step is disabled.
  15296. @item p
  15297. Set background opacity, allowed range is [0, 1]. Default is 0.
  15298. @item m
  15299. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15300. default is @code{p}.
  15301. @item ds
  15302. Set display scale, can be linear: @code{lin} or log: @code{log},
  15303. default is @code{lin}.
  15304. @item dm
  15305. In second.
  15306. If set to > 0., display a line for the max level
  15307. in the previous seconds.
  15308. default is disabled: @code{0.}
  15309. @item dmc
  15310. The color of the max line. Use when @code{dm} option is set to > 0.
  15311. default is: @code{orange}
  15312. @end table
  15313. @section showwaves
  15314. Convert input audio to a video output, representing the samples waves.
  15315. The filter accepts the following options:
  15316. @table @option
  15317. @item size, s
  15318. Specify the video size for the output. For the syntax of this option, check the
  15319. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15320. Default value is @code{600x240}.
  15321. @item mode
  15322. Set display mode.
  15323. Available values are:
  15324. @table @samp
  15325. @item point
  15326. Draw a point for each sample.
  15327. @item line
  15328. Draw a vertical line for each sample.
  15329. @item p2p
  15330. Draw a point for each sample and a line between them.
  15331. @item cline
  15332. Draw a centered vertical line for each sample.
  15333. @end table
  15334. Default value is @code{point}.
  15335. @item n
  15336. Set the number of samples which are printed on the same column. A
  15337. larger value will decrease the frame rate. Must be a positive
  15338. integer. This option can be set only if the value for @var{rate}
  15339. is not explicitly specified.
  15340. @item rate, r
  15341. Set the (approximate) output frame rate. This is done by setting the
  15342. option @var{n}. Default value is "25".
  15343. @item split_channels
  15344. Set if channels should be drawn separately or overlap. Default value is 0.
  15345. @item colors
  15346. Set colors separated by '|' which are going to be used for drawing of each channel.
  15347. @item scale
  15348. Set amplitude scale.
  15349. Available values are:
  15350. @table @samp
  15351. @item lin
  15352. Linear.
  15353. @item log
  15354. Logarithmic.
  15355. @item sqrt
  15356. Square root.
  15357. @item cbrt
  15358. Cubic root.
  15359. @end table
  15360. Default is linear.
  15361. @item draw
  15362. Set the draw mode. This is mostly useful to set for high @var{n}.
  15363. Available values are:
  15364. @table @samp
  15365. @item scale
  15366. Scale pixel values for each drawn sample.
  15367. @item full
  15368. Draw every sample directly.
  15369. @end table
  15370. Default value is @code{scale}.
  15371. @end table
  15372. @subsection Examples
  15373. @itemize
  15374. @item
  15375. Output the input file audio and the corresponding video representation
  15376. at the same time:
  15377. @example
  15378. amovie=a.mp3,asplit[out0],showwaves[out1]
  15379. @end example
  15380. @item
  15381. Create a synthetic signal and show it with showwaves, forcing a
  15382. frame rate of 30 frames per second:
  15383. @example
  15384. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15385. @end example
  15386. @end itemize
  15387. @section showwavespic
  15388. Convert input audio to a single video frame, representing the samples waves.
  15389. The filter accepts the following options:
  15390. @table @option
  15391. @item size, s
  15392. Specify the video size for the output. For the syntax of this option, check the
  15393. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15394. Default value is @code{600x240}.
  15395. @item split_channels
  15396. Set if channels should be drawn separately or overlap. Default value is 0.
  15397. @item colors
  15398. Set colors separated by '|' which are going to be used for drawing of each channel.
  15399. @item scale
  15400. Set amplitude scale.
  15401. Available values are:
  15402. @table @samp
  15403. @item lin
  15404. Linear.
  15405. @item log
  15406. Logarithmic.
  15407. @item sqrt
  15408. Square root.
  15409. @item cbrt
  15410. Cubic root.
  15411. @end table
  15412. Default is linear.
  15413. @end table
  15414. @subsection Examples
  15415. @itemize
  15416. @item
  15417. Extract a channel split representation of the wave form of a whole audio track
  15418. in a 1024x800 picture using @command{ffmpeg}:
  15419. @example
  15420. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15421. @end example
  15422. @end itemize
  15423. @section sidedata, asidedata
  15424. Delete frame side data, or select frames based on it.
  15425. This filter accepts the following options:
  15426. @table @option
  15427. @item mode
  15428. Set mode of operation of the filter.
  15429. Can be one of the following:
  15430. @table @samp
  15431. @item select
  15432. Select every frame with side data of @code{type}.
  15433. @item delete
  15434. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15435. data in the frame.
  15436. @end table
  15437. @item type
  15438. Set side data type used with all modes. Must be set for @code{select} mode. For
  15439. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15440. in @file{libavutil/frame.h}. For example, to choose
  15441. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15442. @end table
  15443. @section spectrumsynth
  15444. Sythesize audio from 2 input video spectrums, first input stream represents
  15445. magnitude across time and second represents phase across time.
  15446. The filter will transform from frequency domain as displayed in videos back
  15447. to time domain as presented in audio output.
  15448. This filter is primarily created for reversing processed @ref{showspectrum}
  15449. filter outputs, but can synthesize sound from other spectrograms too.
  15450. But in such case results are going to be poor if the phase data is not
  15451. available, because in such cases phase data need to be recreated, usually
  15452. its just recreated from random noise.
  15453. For best results use gray only output (@code{channel} color mode in
  15454. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15455. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15456. @code{data} option. Inputs videos should generally use @code{fullframe}
  15457. slide mode as that saves resources needed for decoding video.
  15458. The filter accepts the following options:
  15459. @table @option
  15460. @item sample_rate
  15461. Specify sample rate of output audio, the sample rate of audio from which
  15462. spectrum was generated may differ.
  15463. @item channels
  15464. Set number of channels represented in input video spectrums.
  15465. @item scale
  15466. Set scale which was used when generating magnitude input spectrum.
  15467. Can be @code{lin} or @code{log}. Default is @code{log}.
  15468. @item slide
  15469. Set slide which was used when generating inputs spectrums.
  15470. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15471. Default is @code{fullframe}.
  15472. @item win_func
  15473. Set window function used for resynthesis.
  15474. @item overlap
  15475. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15476. which means optimal overlap for selected window function will be picked.
  15477. @item orientation
  15478. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15479. Default is @code{vertical}.
  15480. @end table
  15481. @subsection Examples
  15482. @itemize
  15483. @item
  15484. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15485. then resynthesize videos back to audio with spectrumsynth:
  15486. @example
  15487. 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
  15488. 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
  15489. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15490. @end example
  15491. @end itemize
  15492. @section split, asplit
  15493. Split input into several identical outputs.
  15494. @code{asplit} works with audio input, @code{split} with video.
  15495. The filter accepts a single parameter which specifies the number of outputs. If
  15496. unspecified, it defaults to 2.
  15497. @subsection Examples
  15498. @itemize
  15499. @item
  15500. Create two separate outputs from the same input:
  15501. @example
  15502. [in] split [out0][out1]
  15503. @end example
  15504. @item
  15505. To create 3 or more outputs, you need to specify the number of
  15506. outputs, like in:
  15507. @example
  15508. [in] asplit=3 [out0][out1][out2]
  15509. @end example
  15510. @item
  15511. Create two separate outputs from the same input, one cropped and
  15512. one padded:
  15513. @example
  15514. [in] split [splitout1][splitout2];
  15515. [splitout1] crop=100:100:0:0 [cropout];
  15516. [splitout2] pad=200:200:100:100 [padout];
  15517. @end example
  15518. @item
  15519. Create 5 copies of the input audio with @command{ffmpeg}:
  15520. @example
  15521. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15522. @end example
  15523. @end itemize
  15524. @section zmq, azmq
  15525. Receive commands sent through a libzmq client, and forward them to
  15526. filters in the filtergraph.
  15527. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15528. must be inserted between two video filters, @code{azmq} between two
  15529. audio filters. Both are capable to send messages to any filter type.
  15530. To enable these filters you need to install the libzmq library and
  15531. headers and configure FFmpeg with @code{--enable-libzmq}.
  15532. For more information about libzmq see:
  15533. @url{http://www.zeromq.org/}
  15534. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15535. receives messages sent through a network interface defined by the
  15536. @option{bind_address} (or the abbreviation "@option{b}") option.
  15537. Default value of this option is @file{tcp://localhost:5555}. You may
  15538. want to alter this value to your needs, but do not forget to escape any
  15539. ':' signs (see @ref{filtergraph escaping}).
  15540. The received message must be in the form:
  15541. @example
  15542. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15543. @end example
  15544. @var{TARGET} specifies the target of the command, usually the name of
  15545. the filter class or a specific filter instance name. The default
  15546. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15547. but you can override this by using the @samp{filter_name@@id} syntax
  15548. (see @ref{Filtergraph syntax}).
  15549. @var{COMMAND} specifies the name of the command for the target filter.
  15550. @var{ARG} is optional and specifies the optional argument list for the
  15551. given @var{COMMAND}.
  15552. Upon reception, the message is processed and the corresponding command
  15553. is injected into the filtergraph. Depending on the result, the filter
  15554. will send a reply to the client, adopting the format:
  15555. @example
  15556. @var{ERROR_CODE} @var{ERROR_REASON}
  15557. @var{MESSAGE}
  15558. @end example
  15559. @var{MESSAGE} is optional.
  15560. @subsection Examples
  15561. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15562. be used to send commands processed by these filters.
  15563. Consider the following filtergraph generated by @command{ffplay}.
  15564. In this example the last overlay filter has an instance name. All other
  15565. filters will have default instance names.
  15566. @example
  15567. ffplay -dumpgraph 1 -f lavfi "
  15568. color=s=100x100:c=red [l];
  15569. color=s=100x100:c=blue [r];
  15570. nullsrc=s=200x100, zmq [bg];
  15571. [bg][l] overlay [bg+l];
  15572. [bg+l][r] overlay@@my=x=100 "
  15573. @end example
  15574. To change the color of the left side of the video, the following
  15575. command can be used:
  15576. @example
  15577. echo Parsed_color_0 c yellow | tools/zmqsend
  15578. @end example
  15579. To change the right side:
  15580. @example
  15581. echo Parsed_color_1 c pink | tools/zmqsend
  15582. @end example
  15583. To change the position of the right side:
  15584. @example
  15585. echo overlay@@my x 150 | tools/zmqsend
  15586. @end example
  15587. @c man end MULTIMEDIA FILTERS
  15588. @chapter Multimedia Sources
  15589. @c man begin MULTIMEDIA SOURCES
  15590. Below is a description of the currently available multimedia sources.
  15591. @section amovie
  15592. This is the same as @ref{movie} source, except it selects an audio
  15593. stream by default.
  15594. @anchor{movie}
  15595. @section movie
  15596. Read audio and/or video stream(s) from a movie container.
  15597. It accepts the following parameters:
  15598. @table @option
  15599. @item filename
  15600. The name of the resource to read (not necessarily a file; it can also be a
  15601. device or a stream accessed through some protocol).
  15602. @item format_name, f
  15603. Specifies the format assumed for the movie to read, and can be either
  15604. the name of a container or an input device. If not specified, the
  15605. format is guessed from @var{movie_name} or by probing.
  15606. @item seek_point, sp
  15607. Specifies the seek point in seconds. The frames will be output
  15608. starting from this seek point. The parameter is evaluated with
  15609. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15610. postfix. The default value is "0".
  15611. @item streams, s
  15612. Specifies the streams to read. Several streams can be specified,
  15613. separated by "+". The source will then have as many outputs, in the
  15614. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15615. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15616. respectively the default (best suited) video and audio stream. Default
  15617. is "dv", or "da" if the filter is called as "amovie".
  15618. @item stream_index, si
  15619. Specifies the index of the video stream to read. If the value is -1,
  15620. the most suitable video stream will be automatically selected. The default
  15621. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15622. audio instead of video.
  15623. @item loop
  15624. Specifies how many times to read the stream in sequence.
  15625. If the value is 0, the stream will be looped infinitely.
  15626. Default value is "1".
  15627. Note that when the movie is looped the source timestamps are not
  15628. changed, so it will generate non monotonically increasing timestamps.
  15629. @item discontinuity
  15630. Specifies the time difference between frames above which the point is
  15631. considered a timestamp discontinuity which is removed by adjusting the later
  15632. timestamps.
  15633. @end table
  15634. It allows overlaying a second video on top of the main input of
  15635. a filtergraph, as shown in this graph:
  15636. @example
  15637. input -----------> deltapts0 --> overlay --> output
  15638. ^
  15639. |
  15640. movie --> scale--> deltapts1 -------+
  15641. @end example
  15642. @subsection Examples
  15643. @itemize
  15644. @item
  15645. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15646. on top of the input labelled "in":
  15647. @example
  15648. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15649. [in] setpts=PTS-STARTPTS [main];
  15650. [main][over] overlay=16:16 [out]
  15651. @end example
  15652. @item
  15653. Read from a video4linux2 device, and overlay it on top of the input
  15654. labelled "in":
  15655. @example
  15656. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15657. [in] setpts=PTS-STARTPTS [main];
  15658. [main][over] overlay=16:16 [out]
  15659. @end example
  15660. @item
  15661. Read the first video stream and the audio stream with id 0x81 from
  15662. dvd.vob; the video is connected to the pad named "video" and the audio is
  15663. connected to the pad named "audio":
  15664. @example
  15665. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15666. @end example
  15667. @end itemize
  15668. @subsection Commands
  15669. Both movie and amovie support the following commands:
  15670. @table @option
  15671. @item seek
  15672. Perform seek using "av_seek_frame".
  15673. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15674. @itemize
  15675. @item
  15676. @var{stream_index}: If stream_index is -1, a default
  15677. stream is selected, and @var{timestamp} is automatically converted
  15678. from AV_TIME_BASE units to the stream specific time_base.
  15679. @item
  15680. @var{timestamp}: Timestamp in AVStream.time_base units
  15681. or, if no stream is specified, in AV_TIME_BASE units.
  15682. @item
  15683. @var{flags}: Flags which select direction and seeking mode.
  15684. @end itemize
  15685. @item get_duration
  15686. Get movie duration in AV_TIME_BASE units.
  15687. @end table
  15688. @c man end MULTIMEDIA SOURCES