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.

19338 lines
514KB

  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. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to draw the last overlay frame over the
  272. main input until the end of the stream. A value of 0 disables this
  273. behavior. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acopy
  345. Copy the input audio source unchanged to the output. This is mainly useful for
  346. testing purposes.
  347. @section acrossfade
  348. Apply cross fade from one input audio stream to another input audio stream.
  349. The cross fade is applied for specified duration near the end of first stream.
  350. The filter accepts the following options:
  351. @table @option
  352. @item nb_samples, ns
  353. Specify the number of samples for which the cross fade effect has to last.
  354. At the end of the cross fade effect the first input audio will be completely
  355. silent. Default is 44100.
  356. @item duration, d
  357. Specify the duration of the cross fade effect. See
  358. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  359. for the accepted syntax.
  360. By default the duration is determined by @var{nb_samples}.
  361. If set this option is used instead of @var{nb_samples}.
  362. @item overlap, o
  363. Should first stream end overlap with second stream start. Default is enabled.
  364. @item curve1
  365. Set curve for cross fade transition for first stream.
  366. @item curve2
  367. Set curve for cross fade transition for second stream.
  368. For description of available curve types see @ref{afade} filter description.
  369. @end table
  370. @subsection Examples
  371. @itemize
  372. @item
  373. Cross fade from one input to another:
  374. @example
  375. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  376. @end example
  377. @item
  378. Cross fade from one input to another but without overlapping:
  379. @example
  380. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  381. @end example
  382. @end itemize
  383. @section acrusher
  384. Reduce audio bit resolution.
  385. This filter is bit crusher with enhanced functionality. A bit crusher
  386. is used to audibly reduce number of bits an audio signal is sampled
  387. with. This doesn't change the bit depth at all, it just produces the
  388. effect. Material reduced in bit depth sounds more harsh and "digital".
  389. This filter is able to even round to continuous values instead of discrete
  390. bit depths.
  391. Additionally it has a D/C offset which results in different crushing of
  392. the lower and the upper half of the signal.
  393. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  394. Another feature of this filter is the logarithmic mode.
  395. This setting switches from linear distances between bits to logarithmic ones.
  396. The result is a much more "natural" sounding crusher which doesn't gate low
  397. signals for example. The human ear has a logarithmic perception, too
  398. so this kind of crushing is much more pleasant.
  399. Logarithmic crushing is also able to get anti-aliased.
  400. The filter accepts the following options:
  401. @table @option
  402. @item level_in
  403. Set level in.
  404. @item level_out
  405. Set level out.
  406. @item bits
  407. Set bit reduction.
  408. @item mix
  409. Set mixing amount.
  410. @item mode
  411. Can be linear: @code{lin} or logarithmic: @code{log}.
  412. @item dc
  413. Set DC.
  414. @item aa
  415. Set anti-aliasing.
  416. @item samples
  417. Set sample reduction.
  418. @item lfo
  419. Enable LFO. By default disabled.
  420. @item lforange
  421. Set LFO range.
  422. @item lforate
  423. Set LFO rate.
  424. @end table
  425. @section adelay
  426. Delay one or more audio channels.
  427. Samples in delayed channel are filled with silence.
  428. The filter accepts the following option:
  429. @table @option
  430. @item delays
  431. Set list of delays in milliseconds for each channel separated by '|'.
  432. Unused delays will be silently ignored. If number of given delays is
  433. smaller than number of channels all remaining channels will not be delayed.
  434. If you want to delay exact number of samples, append 'S' to number.
  435. @end table
  436. @subsection Examples
  437. @itemize
  438. @item
  439. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  440. the second channel (and any other channels that may be present) unchanged.
  441. @example
  442. adelay=1500|0|500
  443. @end example
  444. @item
  445. Delay second channel by 500 samples, the third channel by 700 samples and leave
  446. the first channel (and any other channels that may be present) unchanged.
  447. @example
  448. adelay=0|500S|700S
  449. @end example
  450. @end itemize
  451. @section aecho
  452. Apply echoing to the input audio.
  453. Echoes are reflected sound and can occur naturally amongst mountains
  454. (and sometimes large buildings) when talking or shouting; digital echo
  455. effects emulate this behaviour and are often used to help fill out the
  456. sound of a single instrument or vocal. The time difference between the
  457. original signal and the reflection is the @code{delay}, and the
  458. loudness of the reflected signal is the @code{decay}.
  459. Multiple echoes can have different delays and decays.
  460. A description of the accepted parameters follows.
  461. @table @option
  462. @item in_gain
  463. Set input gain of reflected signal. Default is @code{0.6}.
  464. @item out_gain
  465. Set output gain of reflected signal. Default is @code{0.3}.
  466. @item delays
  467. Set list of time intervals in milliseconds between original signal and reflections
  468. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  469. Default is @code{1000}.
  470. @item decays
  471. Set list of loudnesses of reflected signals separated by '|'.
  472. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  473. Default is @code{0.5}.
  474. @end table
  475. @subsection Examples
  476. @itemize
  477. @item
  478. Make it sound as if there are twice as many instruments as are actually playing:
  479. @example
  480. aecho=0.8:0.88:60:0.4
  481. @end example
  482. @item
  483. If delay is very short, then it sound like a (metallic) robot playing music:
  484. @example
  485. aecho=0.8:0.88:6:0.4
  486. @end example
  487. @item
  488. A longer delay will sound like an open air concert in the mountains:
  489. @example
  490. aecho=0.8:0.9:1000:0.3
  491. @end example
  492. @item
  493. Same as above but with one more mountain:
  494. @example
  495. aecho=0.8:0.9:1000|1800:0.3|0.25
  496. @end example
  497. @end itemize
  498. @section aemphasis
  499. Audio emphasis filter creates or restores material directly taken from LPs or
  500. emphased CDs with different filter curves. E.g. to store music on vinyl the
  501. signal has to be altered by a filter first to even out the disadvantages of
  502. this recording medium.
  503. Once the material is played back the inverse filter has to be applied to
  504. restore the distortion of the frequency response.
  505. The filter accepts the following options:
  506. @table @option
  507. @item level_in
  508. Set input gain.
  509. @item level_out
  510. Set output gain.
  511. @item mode
  512. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  513. use @code{production} mode. Default is @code{reproduction} mode.
  514. @item type
  515. Set filter type. Selects medium. Can be one of the following:
  516. @table @option
  517. @item col
  518. select Columbia.
  519. @item emi
  520. select EMI.
  521. @item bsi
  522. select BSI (78RPM).
  523. @item riaa
  524. select RIAA.
  525. @item cd
  526. select Compact Disc (CD).
  527. @item 50fm
  528. select 50µs (FM).
  529. @item 75fm
  530. select 75µs (FM).
  531. @item 50kf
  532. select 50µs (FM-KF).
  533. @item 75kf
  534. select 75µs (FM-KF).
  535. @end table
  536. @end table
  537. @section aeval
  538. Modify an audio signal according to the specified expressions.
  539. This filter accepts one or more expressions (one for each channel),
  540. which are evaluated and used to modify a corresponding audio signal.
  541. It accepts the following parameters:
  542. @table @option
  543. @item exprs
  544. Set the '|'-separated expressions list for each separate channel. If
  545. the number of input channels is greater than the number of
  546. expressions, the last specified expression is used for the remaining
  547. output channels.
  548. @item channel_layout, c
  549. Set output channel layout. If not specified, the channel layout is
  550. specified by the number of expressions. If set to @samp{same}, it will
  551. use by default the same input channel layout.
  552. @end table
  553. Each expression in @var{exprs} can contain the following constants and functions:
  554. @table @option
  555. @item ch
  556. channel number of the current expression
  557. @item n
  558. number of the evaluated sample, starting from 0
  559. @item s
  560. sample rate
  561. @item t
  562. time of the evaluated sample expressed in seconds
  563. @item nb_in_channels
  564. @item nb_out_channels
  565. input and output number of channels
  566. @item val(CH)
  567. the value of input channel with number @var{CH}
  568. @end table
  569. Note: this filter is slow. For faster processing you should use a
  570. dedicated filter.
  571. @subsection Examples
  572. @itemize
  573. @item
  574. Half volume:
  575. @example
  576. aeval=val(ch)/2:c=same
  577. @end example
  578. @item
  579. Invert phase of the second channel:
  580. @example
  581. aeval=val(0)|-val(1)
  582. @end example
  583. @end itemize
  584. @anchor{afade}
  585. @section afade
  586. Apply fade-in/out effect to input audio.
  587. A description of the accepted parameters follows.
  588. @table @option
  589. @item type, t
  590. Specify the effect type, can be either @code{in} for fade-in, or
  591. @code{out} for a fade-out effect. Default is @code{in}.
  592. @item start_sample, ss
  593. Specify the number of the start sample for starting to apply the fade
  594. effect. Default is 0.
  595. @item nb_samples, ns
  596. Specify the number of samples for which the fade effect has to last. At
  597. the end of the fade-in effect the output audio will have the same
  598. volume as the input audio, at the end of the fade-out transition
  599. the output audio will be silence. Default is 44100.
  600. @item start_time, st
  601. Specify the start time of the fade effect. Default is 0.
  602. The value must be specified as a time duration; see
  603. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  604. for the accepted syntax.
  605. If set this option is used instead of @var{start_sample}.
  606. @item duration, d
  607. Specify the duration of the fade effect. See
  608. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  609. for the accepted syntax.
  610. At the end of the fade-in effect the output audio will have the same
  611. volume as the input audio, at the end of the fade-out transition
  612. the output audio will be silence.
  613. By default the duration is determined by @var{nb_samples}.
  614. If set this option is used instead of @var{nb_samples}.
  615. @item curve
  616. Set curve for fade transition.
  617. It accepts the following values:
  618. @table @option
  619. @item tri
  620. select triangular, linear slope (default)
  621. @item qsin
  622. select quarter of sine wave
  623. @item hsin
  624. select half of sine wave
  625. @item esin
  626. select exponential sine wave
  627. @item log
  628. select logarithmic
  629. @item ipar
  630. select inverted parabola
  631. @item qua
  632. select quadratic
  633. @item cub
  634. select cubic
  635. @item squ
  636. select square root
  637. @item cbr
  638. select cubic root
  639. @item par
  640. select parabola
  641. @item exp
  642. select exponential
  643. @item iqsin
  644. select inverted quarter of sine wave
  645. @item ihsin
  646. select inverted half of sine wave
  647. @item dese
  648. select double-exponential seat
  649. @item desi
  650. select double-exponential sigmoid
  651. @end table
  652. @end table
  653. @subsection Examples
  654. @itemize
  655. @item
  656. Fade in first 15 seconds of audio:
  657. @example
  658. afade=t=in:ss=0:d=15
  659. @end example
  660. @item
  661. Fade out last 25 seconds of a 900 seconds audio:
  662. @example
  663. afade=t=out:st=875:d=25
  664. @end example
  665. @end itemize
  666. @section afftfilt
  667. Apply arbitrary expressions to samples in frequency domain.
  668. @table @option
  669. @item real
  670. Set frequency domain real expression for each separate channel separated
  671. by '|'. Default is "1".
  672. If the number of input channels is greater than the number of
  673. expressions, the last specified expression is used for the remaining
  674. output channels.
  675. @item imag
  676. Set frequency domain imaginary expression for each separate channel
  677. separated by '|'. If not set, @var{real} option is used.
  678. Each expression in @var{real} and @var{imag} can contain the following
  679. constants:
  680. @table @option
  681. @item sr
  682. sample rate
  683. @item b
  684. current frequency bin number
  685. @item nb
  686. number of available bins
  687. @item ch
  688. channel number of the current expression
  689. @item chs
  690. number of channels
  691. @item pts
  692. current frame pts
  693. @end table
  694. @item win_size
  695. Set window size.
  696. It accepts the following values:
  697. @table @samp
  698. @item w16
  699. @item w32
  700. @item w64
  701. @item w128
  702. @item w256
  703. @item w512
  704. @item w1024
  705. @item w2048
  706. @item w4096
  707. @item w8192
  708. @item w16384
  709. @item w32768
  710. @item w65536
  711. @end table
  712. Default is @code{w4096}
  713. @item win_func
  714. Set window function. Default is @code{hann}.
  715. @item overlap
  716. Set window overlap. If set to 1, the recommended overlap for selected
  717. window function will be picked. Default is @code{0.75}.
  718. @end table
  719. @subsection Examples
  720. @itemize
  721. @item
  722. Leave almost only low frequencies in audio:
  723. @example
  724. afftfilt="1-clip((b/nb)*b,0,1)"
  725. @end example
  726. @end itemize
  727. @section afir
  728. Apply an arbitrary Frequency Impulse Response filter.
  729. This filter is designed for applying long FIR filters,
  730. up to 30 seconds long.
  731. It can be used as component for digital crossover filters,
  732. room equalization, cross talk cancellation, wavefield synthesis,
  733. auralization, ambiophonics and ambisonics.
  734. This filter uses second stream as FIR coefficients.
  735. If second stream holds single channel, it will be used
  736. for all input channels in first stream, otherwise
  737. number of channels in second stream must be same as
  738. number of channels in first stream.
  739. It accepts the following parameters:
  740. @table @option
  741. @item dry
  742. Set dry gain. This sets input gain.
  743. @item wet
  744. Set wet gain. This sets final output gain.
  745. @item length
  746. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  747. @item again
  748. Enable applying gain measured from power of IR.
  749. @end table
  750. @subsection Examples
  751. @itemize
  752. @item
  753. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  754. @example
  755. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  756. @end example
  757. @end itemize
  758. @anchor{aformat}
  759. @section aformat
  760. Set output format constraints for the input audio. The framework will
  761. negotiate the most appropriate format to minimize conversions.
  762. It accepts the following parameters:
  763. @table @option
  764. @item sample_fmts
  765. A '|'-separated list of requested sample formats.
  766. @item sample_rates
  767. A '|'-separated list of requested sample rates.
  768. @item channel_layouts
  769. A '|'-separated list of requested channel layouts.
  770. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  771. for the required syntax.
  772. @end table
  773. If a parameter is omitted, all values are allowed.
  774. Force the output to either unsigned 8-bit or signed 16-bit stereo
  775. @example
  776. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  777. @end example
  778. @section agate
  779. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  780. processing reduces disturbing noise between useful signals.
  781. Gating is done by detecting the volume below a chosen level @var{threshold}
  782. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  783. floor is set via @var{range}. Because an exact manipulation of the signal
  784. would cause distortion of the waveform the reduction can be levelled over
  785. time. This is done by setting @var{attack} and @var{release}.
  786. @var{attack} determines how long the signal has to fall below the threshold
  787. before any reduction will occur and @var{release} sets the time the signal
  788. has to rise above the threshold to reduce the reduction again.
  789. Shorter signals than the chosen attack time will be left untouched.
  790. @table @option
  791. @item level_in
  792. Set input level before filtering.
  793. Default is 1. Allowed range is from 0.015625 to 64.
  794. @item range
  795. Set the level of gain reduction when the signal is below the threshold.
  796. Default is 0.06125. Allowed range is from 0 to 1.
  797. @item threshold
  798. If a signal rises above this level the gain reduction is released.
  799. Default is 0.125. Allowed range is from 0 to 1.
  800. @item ratio
  801. Set a ratio by which the signal is reduced.
  802. Default is 2. Allowed range is from 1 to 9000.
  803. @item attack
  804. Amount of milliseconds the signal has to rise above the threshold before gain
  805. reduction stops.
  806. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  807. @item release
  808. Amount of milliseconds the signal has to fall below the threshold before the
  809. reduction is increased again. Default is 250 milliseconds.
  810. Allowed range is from 0.01 to 9000.
  811. @item makeup
  812. Set amount of amplification of signal after processing.
  813. Default is 1. Allowed range is from 1 to 64.
  814. @item knee
  815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  816. Default is 2.828427125. Allowed range is from 1 to 8.
  817. @item detection
  818. Choose if exact signal should be taken for detection or an RMS like one.
  819. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  820. @item link
  821. Choose if the average level between all channels or the louder channel affects
  822. the reduction.
  823. Default is @code{average}. Can be @code{average} or @code{maximum}.
  824. @end table
  825. @section alimiter
  826. The limiter prevents an input signal from rising over a desired threshold.
  827. This limiter uses lookahead technology to prevent your signal from distorting.
  828. It means that there is a small delay after the signal is processed. Keep in mind
  829. that the delay it produces is the attack time you set.
  830. The filter accepts the following options:
  831. @table @option
  832. @item level_in
  833. Set input gain. Default is 1.
  834. @item level_out
  835. Set output gain. Default is 1.
  836. @item limit
  837. Don't let signals above this level pass the limiter. Default is 1.
  838. @item attack
  839. The limiter will reach its attenuation level in this amount of time in
  840. milliseconds. Default is 5 milliseconds.
  841. @item release
  842. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  843. Default is 50 milliseconds.
  844. @item asc
  845. When gain reduction is always needed ASC takes care of releasing to an
  846. average reduction level rather than reaching a reduction of 0 in the release
  847. time.
  848. @item asc_level
  849. Select how much the release time is affected by ASC, 0 means nearly no changes
  850. in release time while 1 produces higher release times.
  851. @item level
  852. Auto level output signal. Default is enabled.
  853. This normalizes audio back to 0dB if enabled.
  854. @end table
  855. Depending on picked setting it is recommended to upsample input 2x or 4x times
  856. with @ref{aresample} before applying this filter.
  857. @section allpass
  858. Apply a two-pole all-pass filter with central frequency (in Hz)
  859. @var{frequency}, and filter-width @var{width}.
  860. An all-pass filter changes the audio's frequency to phase relationship
  861. without changing its frequency to amplitude relationship.
  862. The filter accepts the following options:
  863. @table @option
  864. @item frequency, f
  865. Set frequency in Hz.
  866. @item width_type, t
  867. Set method to specify band-width of filter.
  868. @table @option
  869. @item h
  870. Hz
  871. @item q
  872. Q-Factor
  873. @item o
  874. octave
  875. @item s
  876. slope
  877. @end table
  878. @item width, w
  879. Specify the band-width of a filter in width_type units.
  880. @item channels, c
  881. Specify which channels to filter, by default all available are filtered.
  882. @end table
  883. @section aloop
  884. Loop audio samples.
  885. The filter accepts the following options:
  886. @table @option
  887. @item loop
  888. Set the number of loops.
  889. @item size
  890. Set maximal number of samples.
  891. @item start
  892. Set first sample of loop.
  893. @end table
  894. @anchor{amerge}
  895. @section amerge
  896. Merge two or more audio streams into a single multi-channel stream.
  897. The filter accepts the following options:
  898. @table @option
  899. @item inputs
  900. Set the number of inputs. Default is 2.
  901. @end table
  902. If the channel layouts of the inputs are disjoint, and therefore compatible,
  903. the channel layout of the output will be set accordingly and the channels
  904. will be reordered as necessary. If the channel layouts of the inputs are not
  905. disjoint, the output will have all the channels of the first input then all
  906. the channels of the second input, in that order, and the channel layout of
  907. the output will be the default value corresponding to the total number of
  908. channels.
  909. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  910. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  911. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  912. first input, b1 is the first channel of the second input).
  913. On the other hand, if both input are in stereo, the output channels will be
  914. in the default order: a1, a2, b1, b2, and the channel layout will be
  915. arbitrarily set to 4.0, which may or may not be the expected value.
  916. All inputs must have the same sample rate, and format.
  917. If inputs do not have the same duration, the output will stop with the
  918. shortest.
  919. @subsection Examples
  920. @itemize
  921. @item
  922. Merge two mono files into a stereo stream:
  923. @example
  924. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  925. @end example
  926. @item
  927. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  928. @example
  929. 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
  930. @end example
  931. @end itemize
  932. @section amix
  933. Mixes multiple audio inputs into a single output.
  934. Note that this filter only supports float samples (the @var{amerge}
  935. and @var{pan} audio filters support many formats). If the @var{amix}
  936. input has integer samples then @ref{aresample} will be automatically
  937. inserted to perform the conversion to float samples.
  938. For example
  939. @example
  940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  941. @end example
  942. will mix 3 input audio streams to a single output with the same duration as the
  943. first input and a dropout transition time of 3 seconds.
  944. It accepts the following parameters:
  945. @table @option
  946. @item inputs
  947. The number of inputs. If unspecified, it defaults to 2.
  948. @item duration
  949. How to determine the end-of-stream.
  950. @table @option
  951. @item longest
  952. The duration of the longest input. (default)
  953. @item shortest
  954. The duration of the shortest input.
  955. @item first
  956. The duration of the first input.
  957. @end table
  958. @item dropout_transition
  959. The transition time, in seconds, for volume renormalization when an input
  960. stream ends. The default value is 2 seconds.
  961. @end table
  962. @section anequalizer
  963. High-order parametric multiband equalizer for each channel.
  964. It accepts the following parameters:
  965. @table @option
  966. @item params
  967. This option string is in format:
  968. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  969. Each equalizer band is separated by '|'.
  970. @table @option
  971. @item chn
  972. Set channel number to which equalization will be applied.
  973. If input doesn't have that channel the entry is ignored.
  974. @item f
  975. Set central frequency for band.
  976. If input doesn't have that frequency the entry is ignored.
  977. @item w
  978. Set band width in hertz.
  979. @item g
  980. Set band gain in dB.
  981. @item t
  982. Set filter type for band, optional, can be:
  983. @table @samp
  984. @item 0
  985. Butterworth, this is default.
  986. @item 1
  987. Chebyshev type 1.
  988. @item 2
  989. Chebyshev type 2.
  990. @end table
  991. @end table
  992. @item curves
  993. With this option activated frequency response of anequalizer is displayed
  994. in video stream.
  995. @item size
  996. Set video stream size. Only useful if curves option is activated.
  997. @item mgain
  998. Set max gain that will be displayed. Only useful if curves option is activated.
  999. Setting this to a reasonable value makes it possible to display gain which is derived from
  1000. neighbour bands which are too close to each other and thus produce higher gain
  1001. when both are activated.
  1002. @item fscale
  1003. Set frequency scale used to draw frequency response in video output.
  1004. Can be linear or logarithmic. Default is logarithmic.
  1005. @item colors
  1006. Set color for each channel curve which is going to be displayed in video stream.
  1007. This is list of color names separated by space or by '|'.
  1008. Unrecognised or missing colors will be replaced by white color.
  1009. @end table
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1014. for first 2 channels using Chebyshev type 1 filter:
  1015. @example
  1016. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1017. @end example
  1018. @end itemize
  1019. @subsection Commands
  1020. This filter supports the following commands:
  1021. @table @option
  1022. @item change
  1023. Alter existing filter parameters.
  1024. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1025. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1026. error is returned.
  1027. @var{freq} set new frequency parameter.
  1028. @var{width} set new width parameter in herz.
  1029. @var{gain} set new gain parameter in dB.
  1030. Full filter invocation with asendcmd may look like this:
  1031. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1032. @end table
  1033. @section anull
  1034. Pass the audio source unchanged to the output.
  1035. @section apad
  1036. Pad the end of an audio stream with silence.
  1037. This can be used together with @command{ffmpeg} @option{-shortest} to
  1038. extend audio streams to the same length as the video stream.
  1039. A description of the accepted options follows.
  1040. @table @option
  1041. @item packet_size
  1042. Set silence packet size. Default value is 4096.
  1043. @item pad_len
  1044. Set the number of samples of silence to add to the end. After the
  1045. value is reached, the stream is terminated. This option is mutually
  1046. exclusive with @option{whole_len}.
  1047. @item whole_len
  1048. Set the minimum total number of samples in the output audio stream. If
  1049. the value is longer than the input audio length, silence is added to
  1050. the end, until the value is reached. This option is mutually exclusive
  1051. with @option{pad_len}.
  1052. @end table
  1053. If neither the @option{pad_len} nor the @option{whole_len} option is
  1054. set, the filter will add silence to the end of the input stream
  1055. indefinitely.
  1056. @subsection Examples
  1057. @itemize
  1058. @item
  1059. Add 1024 samples of silence to the end of the input:
  1060. @example
  1061. apad=pad_len=1024
  1062. @end example
  1063. @item
  1064. Make sure the audio output will contain at least 10000 samples, pad
  1065. the input with silence if required:
  1066. @example
  1067. apad=whole_len=10000
  1068. @end example
  1069. @item
  1070. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1071. video stream will always result the shortest and will be converted
  1072. until the end in the output file when using the @option{shortest}
  1073. option:
  1074. @example
  1075. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1076. @end example
  1077. @end itemize
  1078. @section aphaser
  1079. Add a phasing effect to the input audio.
  1080. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1081. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1082. A description of the accepted parameters follows.
  1083. @table @option
  1084. @item in_gain
  1085. Set input gain. Default is 0.4.
  1086. @item out_gain
  1087. Set output gain. Default is 0.74
  1088. @item delay
  1089. Set delay in milliseconds. Default is 3.0.
  1090. @item decay
  1091. Set decay. Default is 0.4.
  1092. @item speed
  1093. Set modulation speed in Hz. Default is 0.5.
  1094. @item type
  1095. Set modulation type. Default is triangular.
  1096. It accepts the following values:
  1097. @table @samp
  1098. @item triangular, t
  1099. @item sinusoidal, s
  1100. @end table
  1101. @end table
  1102. @section apulsator
  1103. Audio pulsator is something between an autopanner and a tremolo.
  1104. But it can produce funny stereo effects as well. Pulsator changes the volume
  1105. of the left and right channel based on a LFO (low frequency oscillator) with
  1106. different waveforms and shifted phases.
  1107. This filter have the ability to define an offset between left and right
  1108. channel. An offset of 0 means that both LFO shapes match each other.
  1109. The left and right channel are altered equally - a conventional tremolo.
  1110. An offset of 50% means that the shape of the right channel is exactly shifted
  1111. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1112. an autopanner. At 1 both curves match again. Every setting in between moves the
  1113. phase shift gapless between all stages and produces some "bypassing" sounds with
  1114. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1115. the 0.5) the faster the signal passes from the left to the right speaker.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1120. @item level_out
  1121. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1122. @item mode
  1123. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1124. sawup or sawdown. Default is sine.
  1125. @item amount
  1126. Set modulation. Define how much of original signal is affected by the LFO.
  1127. @item offset_l
  1128. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1129. @item offset_r
  1130. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1131. @item width
  1132. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1133. @item timing
  1134. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1135. @item bpm
  1136. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1137. is set to bpm.
  1138. @item ms
  1139. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1140. is set to ms.
  1141. @item hz
  1142. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1143. if timing is set to hz.
  1144. @end table
  1145. @anchor{aresample}
  1146. @section aresample
  1147. Resample the input audio to the specified parameters, using the
  1148. libswresample library. If none are specified then the filter will
  1149. automatically convert between its input and output.
  1150. This filter is also able to stretch/squeeze the audio data to make it match
  1151. the timestamps or to inject silence / cut out audio to make it match the
  1152. timestamps, do a combination of both or do neither.
  1153. The filter accepts the syntax
  1154. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1155. expresses a sample rate and @var{resampler_options} is a list of
  1156. @var{key}=@var{value} pairs, separated by ":". See the
  1157. @ref{Resampler Options,,the "Resampler Options" section in the
  1158. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1159. for the complete list of supported options.
  1160. @subsection Examples
  1161. @itemize
  1162. @item
  1163. Resample the input audio to 44100Hz:
  1164. @example
  1165. aresample=44100
  1166. @end example
  1167. @item
  1168. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1169. samples per second compensation:
  1170. @example
  1171. aresample=async=1000
  1172. @end example
  1173. @end itemize
  1174. @section areverse
  1175. Reverse an audio clip.
  1176. Warning: This filter requires memory to buffer the entire clip, so trimming
  1177. is suggested.
  1178. @subsection Examples
  1179. @itemize
  1180. @item
  1181. Take the first 5 seconds of a clip, and reverse it.
  1182. @example
  1183. atrim=end=5,areverse
  1184. @end example
  1185. @end itemize
  1186. @section asetnsamples
  1187. Set the number of samples per each output audio frame.
  1188. The last output packet may contain a different number of samples, as
  1189. the filter will flush all the remaining samples when the input audio
  1190. signals its end.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item nb_out_samples, n
  1194. Set the number of frames per each output audio frame. The number is
  1195. intended as the number of samples @emph{per each channel}.
  1196. Default value is 1024.
  1197. @item pad, p
  1198. If set to 1, the filter will pad the last audio frame with zeroes, so
  1199. that the last frame will contain the same number of samples as the
  1200. previous ones. Default value is 1.
  1201. @end table
  1202. For example, to set the number of per-frame samples to 1234 and
  1203. disable padding for the last frame, use:
  1204. @example
  1205. asetnsamples=n=1234:p=0
  1206. @end example
  1207. @section asetrate
  1208. Set the sample rate without altering the PCM data.
  1209. This will result in a change of speed and pitch.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item sample_rate, r
  1213. Set the output sample rate. Default is 44100 Hz.
  1214. @end table
  1215. @section ashowinfo
  1216. Show a line containing various information for each input audio frame.
  1217. The input audio is not modified.
  1218. The shown line contains a sequence of key/value pairs of the form
  1219. @var{key}:@var{value}.
  1220. The following values are shown in the output:
  1221. @table @option
  1222. @item n
  1223. The (sequential) number of the input frame, starting from 0.
  1224. @item pts
  1225. The presentation timestamp of the input frame, in time base units; the time base
  1226. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1227. @item pts_time
  1228. The presentation timestamp of the input frame in seconds.
  1229. @item pos
  1230. position of the frame in the input stream, -1 if this information in
  1231. unavailable and/or meaningless (for example in case of synthetic audio)
  1232. @item fmt
  1233. The sample format.
  1234. @item chlayout
  1235. The channel layout.
  1236. @item rate
  1237. The sample rate for the audio frame.
  1238. @item nb_samples
  1239. The number of samples (per channel) in the frame.
  1240. @item checksum
  1241. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1242. audio, the data is treated as if all the planes were concatenated.
  1243. @item plane_checksums
  1244. A list of Adler-32 checksums for each data plane.
  1245. @end table
  1246. @anchor{astats}
  1247. @section astats
  1248. Display time domain statistical information about the audio channels.
  1249. Statistics are calculated and displayed for each audio channel and,
  1250. where applicable, an overall figure is also given.
  1251. It accepts the following option:
  1252. @table @option
  1253. @item length
  1254. Short window length in seconds, used for peak and trough RMS measurement.
  1255. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1256. @item metadata
  1257. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1258. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1259. disabled.
  1260. Available keys for each channel are:
  1261. DC_offset
  1262. Min_level
  1263. Max_level
  1264. Min_difference
  1265. Max_difference
  1266. Mean_difference
  1267. RMS_difference
  1268. Peak_level
  1269. RMS_peak
  1270. RMS_trough
  1271. Crest_factor
  1272. Flat_factor
  1273. Peak_count
  1274. Bit_depth
  1275. Dynamic_range
  1276. and for Overall:
  1277. DC_offset
  1278. Min_level
  1279. Max_level
  1280. Min_difference
  1281. Max_difference
  1282. Mean_difference
  1283. RMS_difference
  1284. Peak_level
  1285. RMS_level
  1286. RMS_peak
  1287. RMS_trough
  1288. Flat_factor
  1289. Peak_count
  1290. Bit_depth
  1291. Number_of_samples
  1292. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1293. this @code{lavfi.astats.Overall.Peak_count}.
  1294. For description what each key means read below.
  1295. @item reset
  1296. Set number of frame after which stats are going to be recalculated.
  1297. Default is disabled.
  1298. @end table
  1299. A description of each shown parameter follows:
  1300. @table @option
  1301. @item DC offset
  1302. Mean amplitude displacement from zero.
  1303. @item Min level
  1304. Minimal sample level.
  1305. @item Max level
  1306. Maximal sample level.
  1307. @item Min difference
  1308. Minimal difference between two consecutive samples.
  1309. @item Max difference
  1310. Maximal difference between two consecutive samples.
  1311. @item Mean difference
  1312. Mean difference between two consecutive samples.
  1313. The average of each difference between two consecutive samples.
  1314. @item RMS difference
  1315. Root Mean Square difference between two consecutive samples.
  1316. @item Peak level dB
  1317. @item RMS level dB
  1318. Standard peak and RMS level measured in dBFS.
  1319. @item RMS peak dB
  1320. @item RMS trough dB
  1321. Peak and trough values for RMS level measured over a short window.
  1322. @item Crest factor
  1323. Standard ratio of peak to RMS level (note: not in dB).
  1324. @item Flat factor
  1325. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1326. (i.e. either @var{Min level} or @var{Max level}).
  1327. @item Peak count
  1328. Number of occasions (not the number of samples) that the signal attained either
  1329. @var{Min level} or @var{Max level}.
  1330. @item Bit depth
  1331. Overall bit depth of audio. Number of bits used for each sample.
  1332. @item Dynamic range
  1333. Measured dynamic range of audio in dB.
  1334. @end table
  1335. @section atempo
  1336. Adjust audio tempo.
  1337. The filter accepts exactly one parameter, the audio tempo. If not
  1338. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1339. be in the [0.5, 2.0] range.
  1340. @subsection Examples
  1341. @itemize
  1342. @item
  1343. Slow down audio to 80% tempo:
  1344. @example
  1345. atempo=0.8
  1346. @end example
  1347. @item
  1348. To speed up audio to 125% tempo:
  1349. @example
  1350. atempo=1.25
  1351. @end example
  1352. @end itemize
  1353. @section atrim
  1354. Trim the input so that the output contains one continuous subpart of the input.
  1355. It accepts the following parameters:
  1356. @table @option
  1357. @item start
  1358. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1359. sample with the timestamp @var{start} will be the first sample in the output.
  1360. @item end
  1361. Specify time of the first audio sample that will be dropped, i.e. the
  1362. audio sample immediately preceding the one with the timestamp @var{end} will be
  1363. the last sample in the output.
  1364. @item start_pts
  1365. Same as @var{start}, except this option sets the start timestamp in samples
  1366. instead of seconds.
  1367. @item end_pts
  1368. Same as @var{end}, except this option sets the end timestamp in samples instead
  1369. of seconds.
  1370. @item duration
  1371. The maximum duration of the output in seconds.
  1372. @item start_sample
  1373. The number of the first sample that should be output.
  1374. @item end_sample
  1375. The number of the first sample that should be dropped.
  1376. @end table
  1377. @option{start}, @option{end}, and @option{duration} are expressed as time
  1378. duration specifications; see
  1379. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1380. Note that the first two sets of the start/end options and the @option{duration}
  1381. option look at the frame timestamp, while the _sample options simply count the
  1382. samples that pass through the filter. So start/end_pts and start/end_sample will
  1383. give different results when the timestamps are wrong, inexact or do not start at
  1384. zero. Also note that this filter does not modify the timestamps. If you wish
  1385. to have the output timestamps start at zero, insert the asetpts filter after the
  1386. atrim filter.
  1387. If multiple start or end options are set, this filter tries to be greedy and
  1388. keep all samples that match at least one of the specified constraints. To keep
  1389. only the part that matches all the constraints at once, chain multiple atrim
  1390. filters.
  1391. The defaults are such that all the input is kept. So it is possible to set e.g.
  1392. just the end values to keep everything before the specified time.
  1393. Examples:
  1394. @itemize
  1395. @item
  1396. Drop everything except the second minute of input:
  1397. @example
  1398. ffmpeg -i INPUT -af atrim=60:120
  1399. @end example
  1400. @item
  1401. Keep only the first 1000 samples:
  1402. @example
  1403. ffmpeg -i INPUT -af atrim=end_sample=1000
  1404. @end example
  1405. @end itemize
  1406. @section bandpass
  1407. Apply a two-pole Butterworth band-pass filter with central
  1408. frequency @var{frequency}, and (3dB-point) band-width width.
  1409. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1410. instead of the default: constant 0dB peak gain.
  1411. The filter roll off at 6dB per octave (20dB per decade).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item frequency, f
  1415. Set the filter's central frequency. Default is @code{3000}.
  1416. @item csg
  1417. Constant skirt gain if set to 1. Defaults to 0.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bandreject
  1436. Apply a two-pole Butterworth band-reject filter with central
  1437. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1438. The filter roll off at 6dB per octave (20dB per decade).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item frequency, f
  1442. Set the filter's central frequency. Default is @code{3000}.
  1443. @item width_type, t
  1444. Set method to specify band-width of filter.
  1445. @table @option
  1446. @item h
  1447. Hz
  1448. @item q
  1449. Q-Factor
  1450. @item o
  1451. octave
  1452. @item s
  1453. slope
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @section bass
  1461. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1462. shelving filter with a response similar to that of a standard
  1463. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1464. The filter accepts the following options:
  1465. @table @option
  1466. @item gain, g
  1467. Give the gain at 0 Hz. Its useful range is about -20
  1468. (for a large cut) to +20 (for a large boost).
  1469. Beware of clipping when using a positive gain.
  1470. @item frequency, f
  1471. Set the filter's central frequency and so can be used
  1472. to extend or reduce the frequency range to be boosted or cut.
  1473. The default value is @code{100} Hz.
  1474. @item width_type, t
  1475. Set method to specify band-width of filter.
  1476. @table @option
  1477. @item h
  1478. Hz
  1479. @item q
  1480. Q-Factor
  1481. @item o
  1482. octave
  1483. @item s
  1484. slope
  1485. @end table
  1486. @item width, w
  1487. Determine how steep is the filter's shelf transition.
  1488. @item channels, c
  1489. Specify which channels to filter, by default all available are filtered.
  1490. @end table
  1491. @section biquad
  1492. Apply a biquad IIR filter with the given coefficients.
  1493. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1494. are the numerator and denominator coefficients respectively.
  1495. and @var{channels}, @var{c} specify which channels to filter, by default all
  1496. available are filtered.
  1497. @section bs2b
  1498. Bauer stereo to binaural transformation, which improves headphone listening of
  1499. stereo audio records.
  1500. To enable compilation of this filter you need to configure FFmpeg with
  1501. @code{--enable-libbs2b}.
  1502. It accepts the following parameters:
  1503. @table @option
  1504. @item profile
  1505. Pre-defined crossfeed level.
  1506. @table @option
  1507. @item default
  1508. Default level (fcut=700, feed=50).
  1509. @item cmoy
  1510. Chu Moy circuit (fcut=700, feed=60).
  1511. @item jmeier
  1512. Jan Meier circuit (fcut=650, feed=95).
  1513. @end table
  1514. @item fcut
  1515. Cut frequency (in Hz).
  1516. @item feed
  1517. Feed level (in Hz).
  1518. @end table
  1519. @section channelmap
  1520. Remap input channels to new locations.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item map
  1524. Map channels from input to output. The argument is a '|'-separated list of
  1525. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1526. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1527. channel (e.g. FL for front left) or its index in the input channel layout.
  1528. @var{out_channel} is the name of the output channel or its index in the output
  1529. channel layout. If @var{out_channel} is not given then it is implicitly an
  1530. index, starting with zero and increasing by one for each mapping.
  1531. @item channel_layout
  1532. The channel layout of the output stream.
  1533. @end table
  1534. If no mapping is present, the filter will implicitly map input channels to
  1535. output channels, preserving indices.
  1536. For example, assuming a 5.1+downmix input MOV file,
  1537. @example
  1538. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1539. @end example
  1540. will create an output WAV file tagged as stereo from the downmix channels of
  1541. the input.
  1542. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1543. @example
  1544. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1545. @end example
  1546. @section channelsplit
  1547. Split each channel from an input audio stream into a separate output stream.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item channel_layout
  1551. The channel layout of the input stream. The default is "stereo".
  1552. @end table
  1553. For example, assuming a stereo input MP3 file,
  1554. @example
  1555. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1556. @end example
  1557. will create an output Matroska file with two audio streams, one containing only
  1558. the left channel and the other the right channel.
  1559. Split a 5.1 WAV file into per-channel files:
  1560. @example
  1561. ffmpeg -i in.wav -filter_complex
  1562. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1563. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1564. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1565. side_right.wav
  1566. @end example
  1567. @section chorus
  1568. Add a chorus effect to the audio.
  1569. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1570. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1571. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1572. The modulation depth defines the range the modulated delay is played before or after
  1573. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1574. sound tuned around the original one, like in a chorus where some vocals are slightly
  1575. off key.
  1576. It accepts the following parameters:
  1577. @table @option
  1578. @item in_gain
  1579. Set input gain. Default is 0.4.
  1580. @item out_gain
  1581. Set output gain. Default is 0.4.
  1582. @item delays
  1583. Set delays. A typical delay is around 40ms to 60ms.
  1584. @item decays
  1585. Set decays.
  1586. @item speeds
  1587. Set speeds.
  1588. @item depths
  1589. Set depths.
  1590. @end table
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. A single delay:
  1595. @example
  1596. chorus=0.7:0.9:55:0.4:0.25:2
  1597. @end example
  1598. @item
  1599. Two delays:
  1600. @example
  1601. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1602. @end example
  1603. @item
  1604. Fuller sounding chorus with three delays:
  1605. @example
  1606. 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
  1607. @end example
  1608. @end itemize
  1609. @section compand
  1610. Compress or expand the audio's dynamic range.
  1611. It accepts the following parameters:
  1612. @table @option
  1613. @item attacks
  1614. @item decays
  1615. A list of times in seconds for each channel over which the instantaneous level
  1616. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1617. increase of volume and @var{decays} refers to decrease of volume. For most
  1618. situations, the attack time (response to the audio getting louder) should be
  1619. shorter than the decay time, because the human ear is more sensitive to sudden
  1620. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1621. a typical value for decay is 0.8 seconds.
  1622. If specified number of attacks & decays is lower than number of channels, the last
  1623. set attack/decay will be used for all remaining channels.
  1624. @item points
  1625. A list of points for the transfer function, specified in dB relative to the
  1626. maximum possible signal amplitude. Each key points list must be defined using
  1627. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1628. @code{x0/y0 x1/y1 x2/y2 ....}
  1629. The input values must be in strictly increasing order but the transfer function
  1630. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1631. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1632. function are @code{-70/-70|-60/-20|1/0}.
  1633. @item soft-knee
  1634. Set the curve radius in dB for all joints. It defaults to 0.01.
  1635. @item gain
  1636. Set the additional gain in dB to be applied at all points on the transfer
  1637. function. This allows for easy adjustment of the overall gain.
  1638. It defaults to 0.
  1639. @item volume
  1640. Set an initial volume, in dB, to be assumed for each channel when filtering
  1641. starts. This permits the user to supply a nominal level initially, so that, for
  1642. example, a very large gain is not applied to initial signal levels before the
  1643. companding has begun to operate. A typical value for audio which is initially
  1644. quiet is -90 dB. It defaults to 0.
  1645. @item delay
  1646. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1647. delayed before being fed to the volume adjuster. Specifying a delay
  1648. approximately equal to the attack/decay times allows the filter to effectively
  1649. operate in predictive rather than reactive mode. It defaults to 0.
  1650. @end table
  1651. @subsection Examples
  1652. @itemize
  1653. @item
  1654. Make music with both quiet and loud passages suitable for listening to in a
  1655. noisy environment:
  1656. @example
  1657. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1658. @end example
  1659. Another example for audio with whisper and explosion parts:
  1660. @example
  1661. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1662. @end example
  1663. @item
  1664. A noise gate for when the noise is at a lower level than the signal:
  1665. @example
  1666. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1667. @end example
  1668. @item
  1669. Here is another noise gate, this time for when the noise is at a higher level
  1670. than the signal (making it, in some ways, similar to squelch):
  1671. @example
  1672. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1673. @end example
  1674. @item
  1675. 2:1 compression starting at -6dB:
  1676. @example
  1677. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1678. @end example
  1679. @item
  1680. 2:1 compression starting at -9dB:
  1681. @example
  1682. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1683. @end example
  1684. @item
  1685. 2:1 compression starting at -12dB:
  1686. @example
  1687. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1688. @end example
  1689. @item
  1690. 2:1 compression starting at -18dB:
  1691. @example
  1692. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1693. @end example
  1694. @item
  1695. 3:1 compression starting at -15dB:
  1696. @example
  1697. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1698. @end example
  1699. @item
  1700. Compressor/Gate:
  1701. @example
  1702. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1703. @end example
  1704. @item
  1705. Expander:
  1706. @example
  1707. 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
  1708. @end example
  1709. @item
  1710. Hard limiter at -6dB:
  1711. @example
  1712. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1713. @end example
  1714. @item
  1715. Hard limiter at -12dB:
  1716. @example
  1717. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1718. @end example
  1719. @item
  1720. Hard noise gate at -35 dB:
  1721. @example
  1722. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1723. @end example
  1724. @item
  1725. Soft limiter:
  1726. @example
  1727. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1728. @end example
  1729. @end itemize
  1730. @section compensationdelay
  1731. Compensation Delay Line is a metric based delay to compensate differing
  1732. positions of microphones or speakers.
  1733. For example, you have recorded guitar with two microphones placed in
  1734. different location. Because the front of sound wave has fixed speed in
  1735. normal conditions, the phasing of microphones can vary and depends on
  1736. their location and interposition. The best sound mix can be achieved when
  1737. these microphones are in phase (synchronized). Note that distance of
  1738. ~30 cm between microphones makes one microphone to capture signal in
  1739. antiphase to another microphone. That makes the final mix sounding moody.
  1740. This filter helps to solve phasing problems by adding different delays
  1741. to each microphone track and make them synchronized.
  1742. The best result can be reached when you take one track as base and
  1743. synchronize other tracks one by one with it.
  1744. Remember that synchronization/delay tolerance depends on sample rate, too.
  1745. Higher sample rates will give more tolerance.
  1746. It accepts the following parameters:
  1747. @table @option
  1748. @item mm
  1749. Set millimeters distance. This is compensation distance for fine tuning.
  1750. Default is 0.
  1751. @item cm
  1752. Set cm distance. This is compensation distance for tightening distance setup.
  1753. Default is 0.
  1754. @item m
  1755. Set meters distance. This is compensation distance for hard distance setup.
  1756. Default is 0.
  1757. @item dry
  1758. Set dry amount. Amount of unprocessed (dry) signal.
  1759. Default is 0.
  1760. @item wet
  1761. Set wet amount. Amount of processed (wet) signal.
  1762. Default is 1.
  1763. @item temp
  1764. Set temperature degree in Celsius. This is the temperature of the environment.
  1765. Default is 20.
  1766. @end table
  1767. @section crossfeed
  1768. Apply headphone crossfeed filter.
  1769. Crossfeed is the process of blending the left and right channels of stereo
  1770. audio recording.
  1771. It is mainly used to reduce extreme stereo separation of low frequencies.
  1772. The intent is to produce more speaker like sound to the listener.
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item strength
  1776. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1777. This sets gain of low shelf filter for side part of stereo image.
  1778. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1779. @item range
  1780. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1781. This sets cut off frequency of low shelf filter. Default is cut off near
  1782. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1783. @item level_in
  1784. Set input gain. Default is 0.9.
  1785. @item level_out
  1786. Set output gain. Default is 1.
  1787. @end table
  1788. @section crystalizer
  1789. Simple algorithm to expand audio dynamic range.
  1790. The filter accepts the following options:
  1791. @table @option
  1792. @item i
  1793. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1794. (unchanged sound) to 10.0 (maximum effect).
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section dcshift
  1799. Apply a DC shift to the audio.
  1800. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1801. in the recording chain) from the audio. The effect of a DC offset is reduced
  1802. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1803. a signal has a DC offset.
  1804. @table @option
  1805. @item shift
  1806. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1807. the audio.
  1808. @item limitergain
  1809. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1810. used to prevent clipping.
  1811. @end table
  1812. @section dynaudnorm
  1813. Dynamic Audio Normalizer.
  1814. This filter applies a certain amount of gain to the input audio in order
  1815. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1816. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1817. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1818. This allows for applying extra gain to the "quiet" sections of the audio
  1819. while avoiding distortions or clipping the "loud" sections. In other words:
  1820. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1821. sections, in the sense that the volume of each section is brought to the
  1822. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1823. this goal *without* applying "dynamic range compressing". It will retain 100%
  1824. of the dynamic range *within* each section of the audio file.
  1825. @table @option
  1826. @item f
  1827. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1828. Default is 500 milliseconds.
  1829. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1830. referred to as frames. This is required, because a peak magnitude has no
  1831. meaning for just a single sample value. Instead, we need to determine the
  1832. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1833. normalizer would simply use the peak magnitude of the complete file, the
  1834. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1835. frame. The length of a frame is specified in milliseconds. By default, the
  1836. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1837. been found to give good results with most files.
  1838. Note that the exact frame length, in number of samples, will be determined
  1839. automatically, based on the sampling rate of the individual input audio file.
  1840. @item g
  1841. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1842. number. Default is 31.
  1843. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1844. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1845. is specified in frames, centered around the current frame. For the sake of
  1846. simplicity, this must be an odd number. Consequently, the default value of 31
  1847. takes into account the current frame, as well as the 15 preceding frames and
  1848. the 15 subsequent frames. Using a larger window results in a stronger
  1849. smoothing effect and thus in less gain variation, i.e. slower gain
  1850. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1851. effect and thus in more gain variation, i.e. faster gain adaptation.
  1852. In other words, the more you increase this value, the more the Dynamic Audio
  1853. Normalizer will behave like a "traditional" normalization filter. On the
  1854. contrary, the more you decrease this value, the more the Dynamic Audio
  1855. Normalizer will behave like a dynamic range compressor.
  1856. @item p
  1857. Set the target peak value. This specifies the highest permissible magnitude
  1858. level for the normalized audio input. This filter will try to approach the
  1859. target peak magnitude as closely as possible, but at the same time it also
  1860. makes sure that the normalized signal will never exceed the peak magnitude.
  1861. A frame's maximum local gain factor is imposed directly by the target peak
  1862. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1863. It is not recommended to go above this value.
  1864. @item m
  1865. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1866. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1867. factor for each input frame, i.e. the maximum gain factor that does not
  1868. result in clipping or distortion. The maximum gain factor is determined by
  1869. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1870. additionally bounds the frame's maximum gain factor by a predetermined
  1871. (global) maximum gain factor. This is done in order to avoid excessive gain
  1872. factors in "silent" or almost silent frames. By default, the maximum gain
  1873. factor is 10.0, For most inputs the default value should be sufficient and
  1874. it usually is not recommended to increase this value. Though, for input
  1875. with an extremely low overall volume level, it may be necessary to allow even
  1876. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1877. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1878. Instead, a "sigmoid" threshold function will be applied. This way, the
  1879. gain factors will smoothly approach the threshold value, but never exceed that
  1880. value.
  1881. @item r
  1882. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1883. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1884. This means that the maximum local gain factor for each frame is defined
  1885. (only) by the frame's highest magnitude sample. This way, the samples can
  1886. be amplified as much as possible without exceeding the maximum signal
  1887. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1888. Normalizer can also take into account the frame's root mean square,
  1889. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1890. determine the power of a time-varying signal. It is therefore considered
  1891. that the RMS is a better approximation of the "perceived loudness" than
  1892. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1893. frames to a constant RMS value, a uniform "perceived loudness" can be
  1894. established. If a target RMS value has been specified, a frame's local gain
  1895. factor is defined as the factor that would result in exactly that RMS value.
  1896. Note, however, that the maximum local gain factor is still restricted by the
  1897. frame's highest magnitude sample, in order to prevent clipping.
  1898. @item n
  1899. Enable channels coupling. By default is enabled.
  1900. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1901. amount. This means the same gain factor will be applied to all channels, i.e.
  1902. the maximum possible gain factor is determined by the "loudest" channel.
  1903. However, in some recordings, it may happen that the volume of the different
  1904. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1905. In this case, this option can be used to disable the channel coupling. This way,
  1906. the gain factor will be determined independently for each channel, depending
  1907. only on the individual channel's highest magnitude sample. This allows for
  1908. harmonizing the volume of the different channels.
  1909. @item c
  1910. Enable DC bias correction. By default is disabled.
  1911. An audio signal (in the time domain) is a sequence of sample values.
  1912. In the Dynamic Audio Normalizer these sample values are represented in the
  1913. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1914. audio signal, or "waveform", should be centered around the zero point.
  1915. That means if we calculate the mean value of all samples in a file, or in a
  1916. single frame, then the result should be 0.0 or at least very close to that
  1917. value. If, however, there is a significant deviation of the mean value from
  1918. 0.0, in either positive or negative direction, this is referred to as a
  1919. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1920. Audio Normalizer provides optional DC bias correction.
  1921. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1922. the mean value, or "DC correction" offset, of each input frame and subtract
  1923. that value from all of the frame's sample values which ensures those samples
  1924. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1925. boundaries, the DC correction offset values will be interpolated smoothly
  1926. between neighbouring frames.
  1927. @item b
  1928. Enable alternative boundary mode. By default is disabled.
  1929. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1930. around each frame. This includes the preceding frames as well as the
  1931. subsequent frames. However, for the "boundary" frames, located at the very
  1932. beginning and at the very end of the audio file, not all neighbouring
  1933. frames are available. In particular, for the first few frames in the audio
  1934. file, the preceding frames are not known. And, similarly, for the last few
  1935. frames in the audio file, the subsequent frames are not known. Thus, the
  1936. question arises which gain factors should be assumed for the missing frames
  1937. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1938. to deal with this situation. The default boundary mode assumes a gain factor
  1939. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1940. "fade out" at the beginning and at the end of the input, respectively.
  1941. @item s
  1942. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1943. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1944. compression. This means that signal peaks will not be pruned and thus the
  1945. full dynamic range will be retained within each local neighbourhood. However,
  1946. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1947. normalization algorithm with a more "traditional" compression.
  1948. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1949. (thresholding) function. If (and only if) the compression feature is enabled,
  1950. all input frames will be processed by a soft knee thresholding function prior
  1951. to the actual normalization process. Put simply, the thresholding function is
  1952. going to prune all samples whose magnitude exceeds a certain threshold value.
  1953. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1954. value. Instead, the threshold value will be adjusted for each individual
  1955. frame.
  1956. In general, smaller parameters result in stronger compression, and vice versa.
  1957. Values below 3.0 are not recommended, because audible distortion may appear.
  1958. @end table
  1959. @section earwax
  1960. Make audio easier to listen to on headphones.
  1961. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1962. so that when listened to on headphones the stereo image is moved from
  1963. inside your head (standard for headphones) to outside and in front of
  1964. the listener (standard for speakers).
  1965. Ported from SoX.
  1966. @section equalizer
  1967. Apply a two-pole peaking equalisation (EQ) filter. With this
  1968. filter, the signal-level at and around a selected frequency can
  1969. be increased or decreased, whilst (unlike bandpass and bandreject
  1970. filters) that at all other frequencies is unchanged.
  1971. In order to produce complex equalisation curves, this filter can
  1972. be given several times, each with a different central frequency.
  1973. The filter accepts the following options:
  1974. @table @option
  1975. @item frequency, f
  1976. Set the filter's central frequency in Hz.
  1977. @item width_type, t
  1978. Set method to specify band-width of filter.
  1979. @table @option
  1980. @item h
  1981. Hz
  1982. @item q
  1983. Q-Factor
  1984. @item o
  1985. octave
  1986. @item s
  1987. slope
  1988. @end table
  1989. @item width, w
  1990. Specify the band-width of a filter in width_type units.
  1991. @item gain, g
  1992. Set the required gain or attenuation in dB.
  1993. Beware of clipping when using a positive gain.
  1994. @item channels, c
  1995. Specify which channels to filter, by default all available are filtered.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2001. @example
  2002. equalizer=f=1000:t=h:width=200:g=-10
  2003. @end example
  2004. @item
  2005. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2006. @example
  2007. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2008. @end example
  2009. @end itemize
  2010. @section extrastereo
  2011. Linearly increases the difference between left and right channels which
  2012. adds some sort of "live" effect to playback.
  2013. The filter accepts the following options:
  2014. @table @option
  2015. @item m
  2016. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2017. (average of both channels), with 1.0 sound will be unchanged, with
  2018. -1.0 left and right channels will be swapped.
  2019. @item c
  2020. Enable clipping. By default is enabled.
  2021. @end table
  2022. @section firequalizer
  2023. Apply FIR Equalization using arbitrary frequency response.
  2024. The filter accepts the following option:
  2025. @table @option
  2026. @item gain
  2027. Set gain curve equation (in dB). The expression can contain variables:
  2028. @table @option
  2029. @item f
  2030. the evaluated frequency
  2031. @item sr
  2032. sample rate
  2033. @item ch
  2034. channel number, set to 0 when multichannels evaluation is disabled
  2035. @item chid
  2036. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2037. multichannels evaluation is disabled
  2038. @item chs
  2039. number of channels
  2040. @item chlayout
  2041. channel_layout, see libavutil/channel_layout.h
  2042. @end table
  2043. and functions:
  2044. @table @option
  2045. @item gain_interpolate(f)
  2046. interpolate gain on frequency f based on gain_entry
  2047. @item cubic_interpolate(f)
  2048. same as gain_interpolate, but smoother
  2049. @end table
  2050. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2051. @item gain_entry
  2052. Set gain entry for gain_interpolate function. The expression can
  2053. contain functions:
  2054. @table @option
  2055. @item entry(f, g)
  2056. store gain entry at frequency f with value g
  2057. @end table
  2058. This option is also available as command.
  2059. @item delay
  2060. Set filter delay in seconds. Higher value means more accurate.
  2061. Default is @code{0.01}.
  2062. @item accuracy
  2063. Set filter accuracy in Hz. Lower value means more accurate.
  2064. Default is @code{5}.
  2065. @item wfunc
  2066. Set window function. Acceptable values are:
  2067. @table @option
  2068. @item rectangular
  2069. rectangular window, useful when gain curve is already smooth
  2070. @item hann
  2071. hann window (default)
  2072. @item hamming
  2073. hamming window
  2074. @item blackman
  2075. blackman window
  2076. @item nuttall3
  2077. 3-terms continuous 1st derivative nuttall window
  2078. @item mnuttall3
  2079. minimum 3-terms discontinuous nuttall window
  2080. @item nuttall
  2081. 4-terms continuous 1st derivative nuttall window
  2082. @item bnuttall
  2083. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2084. @item bharris
  2085. blackman-harris window
  2086. @item tukey
  2087. tukey window
  2088. @end table
  2089. @item fixed
  2090. If enabled, use fixed number of audio samples. This improves speed when
  2091. filtering with large delay. Default is disabled.
  2092. @item multi
  2093. Enable multichannels evaluation on gain. Default is disabled.
  2094. @item zero_phase
  2095. Enable zero phase mode by subtracting timestamp to compensate delay.
  2096. Default is disabled.
  2097. @item scale
  2098. Set scale used by gain. Acceptable values are:
  2099. @table @option
  2100. @item linlin
  2101. linear frequency, linear gain
  2102. @item linlog
  2103. linear frequency, logarithmic (in dB) gain (default)
  2104. @item loglin
  2105. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2106. @item loglog
  2107. logarithmic frequency, logarithmic gain
  2108. @end table
  2109. @item dumpfile
  2110. Set file for dumping, suitable for gnuplot.
  2111. @item dumpscale
  2112. Set scale for dumpfile. Acceptable values are same with scale option.
  2113. Default is linlog.
  2114. @item fft2
  2115. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2116. Default is disabled.
  2117. @item min_phase
  2118. Enable minimum phase impulse response. Default is disabled.
  2119. @end table
  2120. @subsection Examples
  2121. @itemize
  2122. @item
  2123. lowpass at 1000 Hz:
  2124. @example
  2125. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2126. @end example
  2127. @item
  2128. lowpass at 1000 Hz with gain_entry:
  2129. @example
  2130. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2131. @end example
  2132. @item
  2133. custom equalization:
  2134. @example
  2135. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2136. @end example
  2137. @item
  2138. higher delay with zero phase to compensate delay:
  2139. @example
  2140. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2141. @end example
  2142. @item
  2143. lowpass on left channel, highpass on right channel:
  2144. @example
  2145. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2146. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2147. @end example
  2148. @end itemize
  2149. @section flanger
  2150. Apply a flanging effect to the audio.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item delay
  2154. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2155. @item depth
  2156. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2157. @item regen
  2158. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2159. Default value is 0.
  2160. @item width
  2161. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2162. Default value is 71.
  2163. @item speed
  2164. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2165. @item shape
  2166. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2167. Default value is @var{sinusoidal}.
  2168. @item phase
  2169. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2170. Default value is 25.
  2171. @item interp
  2172. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2173. Default is @var{linear}.
  2174. @end table
  2175. @section hdcd
  2176. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2177. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2178. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2179. of HDCD, and detects the Transient Filter flag.
  2180. @example
  2181. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2182. @end example
  2183. When using the filter with wav, note the default encoding for wav is 16-bit,
  2184. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2185. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2186. @example
  2187. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2188. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2189. @end example
  2190. The filter accepts the following options:
  2191. @table @option
  2192. @item disable_autoconvert
  2193. Disable any automatic format conversion or resampling in the filter graph.
  2194. @item process_stereo
  2195. Process the stereo channels together. If target_gain does not match between
  2196. channels, consider it invalid and use the last valid target_gain.
  2197. @item cdt_ms
  2198. Set the code detect timer period in ms.
  2199. @item force_pe
  2200. Always extend peaks above -3dBFS even if PE isn't signaled.
  2201. @item analyze_mode
  2202. Replace audio with a solid tone and adjust the amplitude to signal some
  2203. specific aspect of the decoding process. The output file can be loaded in
  2204. an audio editor alongside the original to aid analysis.
  2205. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2206. Modes are:
  2207. @table @samp
  2208. @item 0, off
  2209. Disabled
  2210. @item 1, lle
  2211. Gain adjustment level at each sample
  2212. @item 2, pe
  2213. Samples where peak extend occurs
  2214. @item 3, cdt
  2215. Samples where the code detect timer is active
  2216. @item 4, tgm
  2217. Samples where the target gain does not match between channels
  2218. @end table
  2219. @end table
  2220. @section headphone
  2221. Apply head-related transfer functions (HRTFs) to create virtual
  2222. loudspeakers around the user for binaural listening via headphones.
  2223. The HRIRs are provided via additional streams, for each channel
  2224. one stereo input stream is needed.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item map
  2228. Set mapping of input streams for convolution.
  2229. The argument is a '|'-separated list of channel names in order as they
  2230. are given as additional stream inputs for filter.
  2231. This also specify number of input streams. Number of input streams
  2232. must be not less than number of channels in first stream plus one.
  2233. @item gain
  2234. Set gain applied to audio. Value is in dB. Default is 0.
  2235. @item type
  2236. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2237. processing audio in time domain which is slow.
  2238. @var{freq} is processing audio in frequency domain which is fast.
  2239. Default is @var{freq}.
  2240. @item lfe
  2241. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2242. @end table
  2243. @subsection Examples
  2244. @itemize
  2245. @item
  2246. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2247. each amovie filter use stereo file with IR coefficients as input.
  2248. The files give coefficients for each position of virtual loudspeaker:
  2249. @example
  2250. 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"
  2251. output.wav
  2252. @end example
  2253. @end itemize
  2254. @section highpass
  2255. Apply a high-pass filter with 3dB point frequency.
  2256. The filter can be either single-pole, or double-pole (the default).
  2257. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2258. The filter accepts the following options:
  2259. @table @option
  2260. @item frequency, f
  2261. Set frequency in Hz. Default is 3000.
  2262. @item poles, p
  2263. Set number of poles. Default is 2.
  2264. @item width_type, t
  2265. Set method to specify band-width of filter.
  2266. @table @option
  2267. @item h
  2268. Hz
  2269. @item q
  2270. Q-Factor
  2271. @item o
  2272. octave
  2273. @item s
  2274. slope
  2275. @end table
  2276. @item width, w
  2277. Specify the band-width of a filter in width_type units.
  2278. Applies only to double-pole filter.
  2279. The default is 0.707q and gives a Butterworth response.
  2280. @item channels, c
  2281. Specify which channels to filter, by default all available are filtered.
  2282. @end table
  2283. @section join
  2284. Join multiple input streams into one multi-channel stream.
  2285. It accepts the following parameters:
  2286. @table @option
  2287. @item inputs
  2288. The number of input streams. It defaults to 2.
  2289. @item channel_layout
  2290. The desired output channel layout. It defaults to stereo.
  2291. @item map
  2292. Map channels from inputs to output. The argument is a '|'-separated list of
  2293. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2294. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2295. can be either the name of the input channel (e.g. FL for front left) or its
  2296. index in the specified input stream. @var{out_channel} is the name of the output
  2297. channel.
  2298. @end table
  2299. The filter will attempt to guess the mappings when they are not specified
  2300. explicitly. It does so by first trying to find an unused matching input channel
  2301. and if that fails it picks the first unused input channel.
  2302. Join 3 inputs (with properly set channel layouts):
  2303. @example
  2304. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2305. @end example
  2306. Build a 5.1 output from 6 single-channel streams:
  2307. @example
  2308. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2309. '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'
  2310. out
  2311. @end example
  2312. @section ladspa
  2313. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2314. To enable compilation of this filter you need to configure FFmpeg with
  2315. @code{--enable-ladspa}.
  2316. @table @option
  2317. @item file, f
  2318. Specifies the name of LADSPA plugin library to load. If the environment
  2319. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2320. each one of the directories specified by the colon separated list in
  2321. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2322. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2323. @file{/usr/lib/ladspa/}.
  2324. @item plugin, p
  2325. Specifies the plugin within the library. Some libraries contain only
  2326. one plugin, but others contain many of them. If this is not set filter
  2327. will list all available plugins within the specified library.
  2328. @item controls, c
  2329. Set the '|' separated list of controls which are zero or more floating point
  2330. values that determine the behavior of the loaded plugin (for example delay,
  2331. threshold or gain).
  2332. Controls need to be defined using the following syntax:
  2333. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2334. @var{valuei} is the value set on the @var{i}-th control.
  2335. Alternatively they can be also defined using the following syntax:
  2336. @var{value0}|@var{value1}|@var{value2}|..., where
  2337. @var{valuei} is the value set on the @var{i}-th control.
  2338. If @option{controls} is set to @code{help}, all available controls and
  2339. their valid ranges are printed.
  2340. @item sample_rate, s
  2341. Specify the sample rate, default to 44100. Only used if plugin have
  2342. zero inputs.
  2343. @item nb_samples, n
  2344. Set the number of samples per channel per each output frame, default
  2345. is 1024. Only used if plugin have zero inputs.
  2346. @item duration, d
  2347. Set the minimum duration of the sourced audio. See
  2348. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2349. for the accepted syntax.
  2350. Note that the resulting duration may be greater than the specified duration,
  2351. as the generated audio is always cut at the end of a complete frame.
  2352. If not specified, or the expressed duration is negative, the audio is
  2353. supposed to be generated forever.
  2354. Only used if plugin have zero inputs.
  2355. @end table
  2356. @subsection Examples
  2357. @itemize
  2358. @item
  2359. List all available plugins within amp (LADSPA example plugin) library:
  2360. @example
  2361. ladspa=file=amp
  2362. @end example
  2363. @item
  2364. List all available controls and their valid ranges for @code{vcf_notch}
  2365. plugin from @code{VCF} library:
  2366. @example
  2367. ladspa=f=vcf:p=vcf_notch:c=help
  2368. @end example
  2369. @item
  2370. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2371. plugin library:
  2372. @example
  2373. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2374. @end example
  2375. @item
  2376. Add reverberation to the audio using TAP-plugins
  2377. (Tom's Audio Processing plugins):
  2378. @example
  2379. ladspa=file=tap_reverb:tap_reverb
  2380. @end example
  2381. @item
  2382. Generate white noise, with 0.2 amplitude:
  2383. @example
  2384. ladspa=file=cmt:noise_source_white:c=c0=.2
  2385. @end example
  2386. @item
  2387. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2388. @code{C* Audio Plugin Suite} (CAPS) library:
  2389. @example
  2390. ladspa=file=caps:Click:c=c1=20'
  2391. @end example
  2392. @item
  2393. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2394. @example
  2395. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2396. @end example
  2397. @item
  2398. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2399. @code{SWH Plugins} collection:
  2400. @example
  2401. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2402. @end example
  2403. @item
  2404. Attenuate low frequencies using Multiband EQ from Steve Harris
  2405. @code{SWH Plugins} collection:
  2406. @example
  2407. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2408. @end example
  2409. @item
  2410. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2411. (CAPS) library:
  2412. @example
  2413. ladspa=caps:Narrower
  2414. @end example
  2415. @item
  2416. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2417. @example
  2418. ladspa=caps:White:.2
  2419. @end example
  2420. @item
  2421. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2422. @example
  2423. ladspa=caps:Fractal:c=c1=1
  2424. @end example
  2425. @item
  2426. Dynamic volume normalization using @code{VLevel} plugin:
  2427. @example
  2428. ladspa=vlevel-ladspa:vlevel_mono
  2429. @end example
  2430. @end itemize
  2431. @subsection Commands
  2432. This filter supports the following commands:
  2433. @table @option
  2434. @item cN
  2435. Modify the @var{N}-th control value.
  2436. If the specified value is not valid, it is ignored and prior one is kept.
  2437. @end table
  2438. @section loudnorm
  2439. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2440. Support for both single pass (livestreams, files) and double pass (files) modes.
  2441. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2442. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2443. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2444. The filter accepts the following options:
  2445. @table @option
  2446. @item I, i
  2447. Set integrated loudness target.
  2448. Range is -70.0 - -5.0. Default value is -24.0.
  2449. @item LRA, lra
  2450. Set loudness range target.
  2451. Range is 1.0 - 20.0. Default value is 7.0.
  2452. @item TP, tp
  2453. Set maximum true peak.
  2454. Range is -9.0 - +0.0. Default value is -2.0.
  2455. @item measured_I, measured_i
  2456. Measured IL of input file.
  2457. Range is -99.0 - +0.0.
  2458. @item measured_LRA, measured_lra
  2459. Measured LRA of input file.
  2460. Range is 0.0 - 99.0.
  2461. @item measured_TP, measured_tp
  2462. Measured true peak of input file.
  2463. Range is -99.0 - +99.0.
  2464. @item measured_thresh
  2465. Measured threshold of input file.
  2466. Range is -99.0 - +0.0.
  2467. @item offset
  2468. Set offset gain. Gain is applied before the true-peak limiter.
  2469. Range is -99.0 - +99.0. Default is +0.0.
  2470. @item linear
  2471. Normalize linearly if possible.
  2472. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2473. to be specified in order to use this mode.
  2474. Options are true or false. Default is true.
  2475. @item dual_mono
  2476. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2477. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2478. If set to @code{true}, this option will compensate for this effect.
  2479. Multi-channel input files are not affected by this option.
  2480. Options are true or false. Default is false.
  2481. @item print_format
  2482. Set print format for stats. Options are summary, json, or none.
  2483. Default value is none.
  2484. @end table
  2485. @section lowpass
  2486. Apply a low-pass filter with 3dB point frequency.
  2487. The filter can be either single-pole or double-pole (the default).
  2488. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2489. The filter accepts the following options:
  2490. @table @option
  2491. @item frequency, f
  2492. Set frequency in Hz. Default is 500.
  2493. @item poles, p
  2494. Set number of poles. Default is 2.
  2495. @item width_type, t
  2496. Set method to specify band-width of filter.
  2497. @table @option
  2498. @item h
  2499. Hz
  2500. @item q
  2501. Q-Factor
  2502. @item o
  2503. octave
  2504. @item s
  2505. slope
  2506. @end table
  2507. @item width, w
  2508. Specify the band-width of a filter in width_type units.
  2509. Applies only to double-pole filter.
  2510. The default is 0.707q and gives a Butterworth response.
  2511. @item channels, c
  2512. Specify which channels to filter, by default all available are filtered.
  2513. @end table
  2514. @subsection Examples
  2515. @itemize
  2516. @item
  2517. Lowpass only LFE channel, it LFE is not present it does nothing:
  2518. @example
  2519. lowpass=c=LFE
  2520. @end example
  2521. @end itemize
  2522. @anchor{pan}
  2523. @section pan
  2524. Mix channels with specific gain levels. The filter accepts the output
  2525. channel layout followed by a set of channels definitions.
  2526. This filter is also designed to efficiently remap the channels of an audio
  2527. stream.
  2528. The filter accepts parameters of the form:
  2529. "@var{l}|@var{outdef}|@var{outdef}|..."
  2530. @table @option
  2531. @item l
  2532. output channel layout or number of channels
  2533. @item outdef
  2534. output channel specification, of the form:
  2535. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2536. @item out_name
  2537. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2538. number (c0, c1, etc.)
  2539. @item gain
  2540. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2541. @item in_name
  2542. input channel to use, see out_name for details; it is not possible to mix
  2543. named and numbered input channels
  2544. @end table
  2545. If the `=' in a channel specification is replaced by `<', then the gains for
  2546. that specification will be renormalized so that the total is 1, thus
  2547. avoiding clipping noise.
  2548. @subsection Mixing examples
  2549. For example, if you want to down-mix from stereo to mono, but with a bigger
  2550. factor for the left channel:
  2551. @example
  2552. pan=1c|c0=0.9*c0+0.1*c1
  2553. @end example
  2554. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2555. 7-channels surround:
  2556. @example
  2557. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2558. @end example
  2559. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2560. that should be preferred (see "-ac" option) unless you have very specific
  2561. needs.
  2562. @subsection Remapping examples
  2563. The channel remapping will be effective if, and only if:
  2564. @itemize
  2565. @item gain coefficients are zeroes or ones,
  2566. @item only one input per channel output,
  2567. @end itemize
  2568. If all these conditions are satisfied, the filter will notify the user ("Pure
  2569. channel mapping detected"), and use an optimized and lossless method to do the
  2570. remapping.
  2571. For example, if you have a 5.1 source and want a stereo audio stream by
  2572. dropping the extra channels:
  2573. @example
  2574. pan="stereo| c0=FL | c1=FR"
  2575. @end example
  2576. Given the same source, you can also switch front left and front right channels
  2577. and keep the input channel layout:
  2578. @example
  2579. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2580. @end example
  2581. If the input is a stereo audio stream, you can mute the front left channel (and
  2582. still keep the stereo channel layout) with:
  2583. @example
  2584. pan="stereo|c1=c1"
  2585. @end example
  2586. Still with a stereo audio stream input, you can copy the right channel in both
  2587. front left and right:
  2588. @example
  2589. pan="stereo| c0=FR | c1=FR"
  2590. @end example
  2591. @section replaygain
  2592. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2593. outputs it unchanged.
  2594. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2595. @section resample
  2596. Convert the audio sample format, sample rate and channel layout. It is
  2597. not meant to be used directly.
  2598. @section rubberband
  2599. Apply time-stretching and pitch-shifting with librubberband.
  2600. The filter accepts the following options:
  2601. @table @option
  2602. @item tempo
  2603. Set tempo scale factor.
  2604. @item pitch
  2605. Set pitch scale factor.
  2606. @item transients
  2607. Set transients detector.
  2608. Possible values are:
  2609. @table @var
  2610. @item crisp
  2611. @item mixed
  2612. @item smooth
  2613. @end table
  2614. @item detector
  2615. Set detector.
  2616. Possible values are:
  2617. @table @var
  2618. @item compound
  2619. @item percussive
  2620. @item soft
  2621. @end table
  2622. @item phase
  2623. Set phase.
  2624. Possible values are:
  2625. @table @var
  2626. @item laminar
  2627. @item independent
  2628. @end table
  2629. @item window
  2630. Set processing window size.
  2631. Possible values are:
  2632. @table @var
  2633. @item standard
  2634. @item short
  2635. @item long
  2636. @end table
  2637. @item smoothing
  2638. Set smoothing.
  2639. Possible values are:
  2640. @table @var
  2641. @item off
  2642. @item on
  2643. @end table
  2644. @item formant
  2645. Enable formant preservation when shift pitching.
  2646. Possible values are:
  2647. @table @var
  2648. @item shifted
  2649. @item preserved
  2650. @end table
  2651. @item pitchq
  2652. Set pitch quality.
  2653. Possible values are:
  2654. @table @var
  2655. @item quality
  2656. @item speed
  2657. @item consistency
  2658. @end table
  2659. @item channels
  2660. Set channels.
  2661. Possible values are:
  2662. @table @var
  2663. @item apart
  2664. @item together
  2665. @end table
  2666. @end table
  2667. @section sidechaincompress
  2668. This filter acts like normal compressor but has the ability to compress
  2669. detected signal using second input signal.
  2670. It needs two input streams and returns one output stream.
  2671. First input stream will be processed depending on second stream signal.
  2672. The filtered signal then can be filtered with other filters in later stages of
  2673. processing. See @ref{pan} and @ref{amerge} filter.
  2674. The filter accepts the following options:
  2675. @table @option
  2676. @item level_in
  2677. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2678. @item threshold
  2679. If a signal of second stream raises above this level it will affect the gain
  2680. reduction of first stream.
  2681. By default is 0.125. Range is between 0.00097563 and 1.
  2682. @item ratio
  2683. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2684. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2685. Default is 2. Range is between 1 and 20.
  2686. @item attack
  2687. Amount of milliseconds the signal has to rise above the threshold before gain
  2688. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2689. @item release
  2690. Amount of milliseconds the signal has to fall below the threshold before
  2691. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2692. @item makeup
  2693. Set the amount by how much signal will be amplified after processing.
  2694. Default is 1. Range is from 1 to 64.
  2695. @item knee
  2696. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2697. Default is 2.82843. Range is between 1 and 8.
  2698. @item link
  2699. Choose if the @code{average} level between all channels of side-chain stream
  2700. or the louder(@code{maximum}) channel of side-chain stream affects the
  2701. reduction. Default is @code{average}.
  2702. @item detection
  2703. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2704. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2705. @item level_sc
  2706. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2707. @item mix
  2708. How much to use compressed signal in output. Default is 1.
  2709. Range is between 0 and 1.
  2710. @end table
  2711. @subsection Examples
  2712. @itemize
  2713. @item
  2714. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2715. depending on the signal of 2nd input and later compressed signal to be
  2716. merged with 2nd input:
  2717. @example
  2718. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2719. @end example
  2720. @end itemize
  2721. @section sidechaingate
  2722. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2723. filter the detected signal before sending it to the gain reduction stage.
  2724. Normally a gate uses the full range signal to detect a level above the
  2725. threshold.
  2726. For example: If you cut all lower frequencies from your sidechain signal
  2727. the gate will decrease the volume of your track only if not enough highs
  2728. appear. With this technique you are able to reduce the resonation of a
  2729. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2730. guitar.
  2731. It needs two input streams and returns one output stream.
  2732. First input stream will be processed depending on second stream signal.
  2733. The filter accepts the following options:
  2734. @table @option
  2735. @item level_in
  2736. Set input level before filtering.
  2737. Default is 1. Allowed range is from 0.015625 to 64.
  2738. @item range
  2739. Set the level of gain reduction when the signal is below the threshold.
  2740. Default is 0.06125. Allowed range is from 0 to 1.
  2741. @item threshold
  2742. If a signal rises above this level the gain reduction is released.
  2743. Default is 0.125. Allowed range is from 0 to 1.
  2744. @item ratio
  2745. Set a ratio about which the signal is reduced.
  2746. Default is 2. Allowed range is from 1 to 9000.
  2747. @item attack
  2748. Amount of milliseconds the signal has to rise above the threshold before gain
  2749. reduction stops.
  2750. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2751. @item release
  2752. Amount of milliseconds the signal has to fall below the threshold before the
  2753. reduction is increased again. Default is 250 milliseconds.
  2754. Allowed range is from 0.01 to 9000.
  2755. @item makeup
  2756. Set amount of amplification of signal after processing.
  2757. Default is 1. Allowed range is from 1 to 64.
  2758. @item knee
  2759. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2760. Default is 2.828427125. Allowed range is from 1 to 8.
  2761. @item detection
  2762. Choose if exact signal should be taken for detection or an RMS like one.
  2763. Default is rms. Can be peak or rms.
  2764. @item link
  2765. Choose if the average level between all channels or the louder channel affects
  2766. the reduction.
  2767. Default is average. Can be average or maximum.
  2768. @item level_sc
  2769. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2770. @end table
  2771. @section silencedetect
  2772. Detect silence in an audio stream.
  2773. This filter logs a message when it detects that the input audio volume is less
  2774. or equal to a noise tolerance value for a duration greater or equal to the
  2775. minimum detected noise duration.
  2776. The printed times and duration are expressed in seconds.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item duration, d
  2780. Set silence duration until notification (default is 2 seconds).
  2781. @item noise, n
  2782. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2783. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2784. @end table
  2785. @subsection Examples
  2786. @itemize
  2787. @item
  2788. Detect 5 seconds of silence with -50dB noise tolerance:
  2789. @example
  2790. silencedetect=n=-50dB:d=5
  2791. @end example
  2792. @item
  2793. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2794. tolerance in @file{silence.mp3}:
  2795. @example
  2796. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2797. @end example
  2798. @end itemize
  2799. @section silenceremove
  2800. Remove silence from the beginning, middle or end of the audio.
  2801. The filter accepts the following options:
  2802. @table @option
  2803. @item start_periods
  2804. This value is used to indicate if audio should be trimmed at beginning of
  2805. the audio. A value of zero indicates no silence should be trimmed from the
  2806. beginning. When specifying a non-zero value, it trims audio up until it
  2807. finds non-silence. Normally, when trimming silence from beginning of audio
  2808. the @var{start_periods} will be @code{1} but it can be increased to higher
  2809. values to trim all audio up to specific count of non-silence periods.
  2810. Default value is @code{0}.
  2811. @item start_duration
  2812. Specify the amount of time that non-silence must be detected before it stops
  2813. trimming audio. By increasing the duration, bursts of noises can be treated
  2814. as silence and trimmed off. Default value is @code{0}.
  2815. @item start_threshold
  2816. This indicates what sample value should be treated as silence. For digital
  2817. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2818. you may wish to increase the value to account for background noise.
  2819. Can be specified in dB (in case "dB" is appended to the specified value)
  2820. or amplitude ratio. Default value is @code{0}.
  2821. @item stop_periods
  2822. Set the count for trimming silence from the end of audio.
  2823. To remove silence from the middle of a file, specify a @var{stop_periods}
  2824. that is negative. This value is then treated as a positive value and is
  2825. used to indicate the effect should restart processing as specified by
  2826. @var{start_periods}, making it suitable for removing periods of silence
  2827. in the middle of the audio.
  2828. Default value is @code{0}.
  2829. @item stop_duration
  2830. Specify a duration of silence that must exist before audio is not copied any
  2831. more. By specifying a higher duration, silence that is wanted can be left in
  2832. the audio.
  2833. Default value is @code{0}.
  2834. @item stop_threshold
  2835. This is the same as @option{start_threshold} but for trimming silence from
  2836. the end of audio.
  2837. Can be specified in dB (in case "dB" is appended to the specified value)
  2838. or amplitude ratio. Default value is @code{0}.
  2839. @item leave_silence
  2840. This indicates that @var{stop_duration} length of audio should be left intact
  2841. at the beginning of each period of silence.
  2842. For example, if you want to remove long pauses between words but do not want
  2843. to remove the pauses completely. Default value is @code{0}.
  2844. @item detection
  2845. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2846. and works better with digital silence which is exactly 0.
  2847. Default value is @code{rms}.
  2848. @item window
  2849. Set ratio used to calculate size of window for detecting silence.
  2850. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2851. @end table
  2852. @subsection Examples
  2853. @itemize
  2854. @item
  2855. The following example shows how this filter can be used to start a recording
  2856. that does not contain the delay at the start which usually occurs between
  2857. pressing the record button and the start of the performance:
  2858. @example
  2859. silenceremove=1:5:0.02
  2860. @end example
  2861. @item
  2862. Trim all silence encountered from beginning to end where there is more than 1
  2863. second of silence in audio:
  2864. @example
  2865. silenceremove=0:0:0:-1:1:-90dB
  2866. @end example
  2867. @end itemize
  2868. @section sofalizer
  2869. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2870. loudspeakers around the user for binaural listening via headphones (audio
  2871. formats up to 9 channels supported).
  2872. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2873. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2874. Austrian Academy of Sciences.
  2875. To enable compilation of this filter you need to configure FFmpeg with
  2876. @code{--enable-libmysofa}.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item sofa
  2880. Set the SOFA file used for rendering.
  2881. @item gain
  2882. Set gain applied to audio. Value is in dB. Default is 0.
  2883. @item rotation
  2884. Set rotation of virtual loudspeakers in deg. Default is 0.
  2885. @item elevation
  2886. Set elevation of virtual speakers in deg. Default is 0.
  2887. @item radius
  2888. Set distance in meters between loudspeakers and the listener with near-field
  2889. HRTFs. Default is 1.
  2890. @item type
  2891. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2892. processing audio in time domain which is slow.
  2893. @var{freq} is processing audio in frequency domain which is fast.
  2894. Default is @var{freq}.
  2895. @item speakers
  2896. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2897. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2898. Each virtual loudspeaker is described with short channel name following with
  2899. azimuth and elevation in degreees.
  2900. Each virtual loudspeaker description is separated by '|'.
  2901. For example to override front left and front right channel positions use:
  2902. 'speakers=FL 45 15|FR 345 15'.
  2903. Descriptions with unrecognised channel names are ignored.
  2904. @item lfegain
  2905. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2906. @end table
  2907. @subsection Examples
  2908. @itemize
  2909. @item
  2910. Using ClubFritz6 sofa file:
  2911. @example
  2912. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2913. @end example
  2914. @item
  2915. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2916. @example
  2917. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2918. @end example
  2919. @item
  2920. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2921. and also with custom gain:
  2922. @example
  2923. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2924. @end example
  2925. @end itemize
  2926. @section stereotools
  2927. This filter has some handy utilities to manage stereo signals, for converting
  2928. M/S stereo recordings to L/R signal while having control over the parameters
  2929. or spreading the stereo image of master track.
  2930. The filter accepts the following options:
  2931. @table @option
  2932. @item level_in
  2933. Set input level before filtering for both channels. Defaults is 1.
  2934. Allowed range is from 0.015625 to 64.
  2935. @item level_out
  2936. Set output level after filtering for both channels. Defaults is 1.
  2937. Allowed range is from 0.015625 to 64.
  2938. @item balance_in
  2939. Set input balance between both channels. Default is 0.
  2940. Allowed range is from -1 to 1.
  2941. @item balance_out
  2942. Set output balance between both channels. Default is 0.
  2943. Allowed range is from -1 to 1.
  2944. @item softclip
  2945. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2946. clipping. Disabled by default.
  2947. @item mutel
  2948. Mute the left channel. Disabled by default.
  2949. @item muter
  2950. Mute the right channel. Disabled by default.
  2951. @item phasel
  2952. Change the phase of the left channel. Disabled by default.
  2953. @item phaser
  2954. Change the phase of the right channel. Disabled by default.
  2955. @item mode
  2956. Set stereo mode. Available values are:
  2957. @table @samp
  2958. @item lr>lr
  2959. Left/Right to Left/Right, this is default.
  2960. @item lr>ms
  2961. Left/Right to Mid/Side.
  2962. @item ms>lr
  2963. Mid/Side to Left/Right.
  2964. @item lr>ll
  2965. Left/Right to Left/Left.
  2966. @item lr>rr
  2967. Left/Right to Right/Right.
  2968. @item lr>l+r
  2969. Left/Right to Left + Right.
  2970. @item lr>rl
  2971. Left/Right to Right/Left.
  2972. @item ms>ll
  2973. Mid/Side to Left/Left.
  2974. @item ms>rr
  2975. Mid/Side to Right/Right.
  2976. @end table
  2977. @item slev
  2978. Set level of side signal. Default is 1.
  2979. Allowed range is from 0.015625 to 64.
  2980. @item sbal
  2981. Set balance of side signal. Default is 0.
  2982. Allowed range is from -1 to 1.
  2983. @item mlev
  2984. Set level of the middle signal. Default is 1.
  2985. Allowed range is from 0.015625 to 64.
  2986. @item mpan
  2987. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2988. @item base
  2989. Set stereo base between mono and inversed channels. Default is 0.
  2990. Allowed range is from -1 to 1.
  2991. @item delay
  2992. Set delay in milliseconds how much to delay left from right channel and
  2993. vice versa. Default is 0. Allowed range is from -20 to 20.
  2994. @item sclevel
  2995. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2996. @item phase
  2997. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2998. @item bmode_in, bmode_out
  2999. Set balance mode for balance_in/balance_out option.
  3000. Can be one of the following:
  3001. @table @samp
  3002. @item balance
  3003. Classic balance mode. Attenuate one channel at time.
  3004. Gain is raised up to 1.
  3005. @item amplitude
  3006. Similar as classic mode above but gain is raised up to 2.
  3007. @item power
  3008. Equal power distribution, from -6dB to +6dB range.
  3009. @end table
  3010. @end table
  3011. @subsection Examples
  3012. @itemize
  3013. @item
  3014. Apply karaoke like effect:
  3015. @example
  3016. stereotools=mlev=0.015625
  3017. @end example
  3018. @item
  3019. Convert M/S signal to L/R:
  3020. @example
  3021. "stereotools=mode=ms>lr"
  3022. @end example
  3023. @end itemize
  3024. @section stereowiden
  3025. This filter enhance the stereo effect by suppressing signal common to both
  3026. channels and by delaying the signal of left into right and vice versa,
  3027. thereby widening the stereo effect.
  3028. The filter accepts the following options:
  3029. @table @option
  3030. @item delay
  3031. Time in milliseconds of the delay of left signal into right and vice versa.
  3032. Default is 20 milliseconds.
  3033. @item feedback
  3034. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3035. effect of left signal in right output and vice versa which gives widening
  3036. effect. Default is 0.3.
  3037. @item crossfeed
  3038. Cross feed of left into right with inverted phase. This helps in suppressing
  3039. the mono. If the value is 1 it will cancel all the signal common to both
  3040. channels. Default is 0.3.
  3041. @item drymix
  3042. Set level of input signal of original channel. Default is 0.8.
  3043. @end table
  3044. @section superequalizer
  3045. Apply 18 band equalizer.
  3046. The filter accepts the following options:
  3047. @table @option
  3048. @item 1b
  3049. Set 65Hz band gain.
  3050. @item 2b
  3051. Set 92Hz band gain.
  3052. @item 3b
  3053. Set 131Hz band gain.
  3054. @item 4b
  3055. Set 185Hz band gain.
  3056. @item 5b
  3057. Set 262Hz band gain.
  3058. @item 6b
  3059. Set 370Hz band gain.
  3060. @item 7b
  3061. Set 523Hz band gain.
  3062. @item 8b
  3063. Set 740Hz band gain.
  3064. @item 9b
  3065. Set 1047Hz band gain.
  3066. @item 10b
  3067. Set 1480Hz band gain.
  3068. @item 11b
  3069. Set 2093Hz band gain.
  3070. @item 12b
  3071. Set 2960Hz band gain.
  3072. @item 13b
  3073. Set 4186Hz band gain.
  3074. @item 14b
  3075. Set 5920Hz band gain.
  3076. @item 15b
  3077. Set 8372Hz band gain.
  3078. @item 16b
  3079. Set 11840Hz band gain.
  3080. @item 17b
  3081. Set 16744Hz band gain.
  3082. @item 18b
  3083. Set 20000Hz band gain.
  3084. @end table
  3085. @section surround
  3086. Apply audio surround upmix filter.
  3087. This filter allows to produce multichannel output from audio stream.
  3088. The filter accepts the following options:
  3089. @table @option
  3090. @item chl_out
  3091. Set output channel layout. By default, this is @var{5.1}.
  3092. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3093. for the required syntax.
  3094. @item chl_in
  3095. Set input channel layout. By default, this is @var{stereo}.
  3096. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3097. for the required syntax.
  3098. @item level_in
  3099. Set input volume level. By default, this is @var{1}.
  3100. @item level_out
  3101. Set output volume level. By default, this is @var{1}.
  3102. @item lfe
  3103. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3104. @item lfe_low
  3105. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3106. @item lfe_high
  3107. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3108. @item fc_in
  3109. Set front center input volume. By default, this is @var{1}.
  3110. @item fc_out
  3111. Set front center output volume. By default, this is @var{1}.
  3112. @item lfe_in
  3113. Set LFE input volume. By default, this is @var{1}.
  3114. @item lfe_out
  3115. Set LFE output volume. By default, this is @var{1}.
  3116. @end table
  3117. @section treble
  3118. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3119. shelving filter with a response similar to that of a standard
  3120. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3121. The filter accepts the following options:
  3122. @table @option
  3123. @item gain, g
  3124. Give the gain at whichever is the lower of ~22 kHz and the
  3125. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3126. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3127. @item frequency, f
  3128. Set the filter's central frequency and so can be used
  3129. to extend or reduce the frequency range to be boosted or cut.
  3130. The default value is @code{3000} Hz.
  3131. @item width_type, t
  3132. Set method to specify band-width of filter.
  3133. @table @option
  3134. @item h
  3135. Hz
  3136. @item q
  3137. Q-Factor
  3138. @item o
  3139. octave
  3140. @item s
  3141. slope
  3142. @end table
  3143. @item width, w
  3144. Determine how steep is the filter's shelf transition.
  3145. @item channels, c
  3146. Specify which channels to filter, by default all available are filtered.
  3147. @end table
  3148. @section tremolo
  3149. Sinusoidal amplitude modulation.
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item f
  3153. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3154. (20 Hz or lower) will result in a tremolo effect.
  3155. This filter may also be used as a ring modulator by specifying
  3156. a modulation frequency higher than 20 Hz.
  3157. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3158. @item d
  3159. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3160. Default value is 0.5.
  3161. @end table
  3162. @section vibrato
  3163. Sinusoidal phase modulation.
  3164. The filter accepts the following options:
  3165. @table @option
  3166. @item f
  3167. Modulation frequency in Hertz.
  3168. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3169. @item d
  3170. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3171. Default value is 0.5.
  3172. @end table
  3173. @section volume
  3174. Adjust the input audio volume.
  3175. It accepts the following parameters:
  3176. @table @option
  3177. @item volume
  3178. Set audio volume expression.
  3179. Output values are clipped to the maximum value.
  3180. The output audio volume is given by the relation:
  3181. @example
  3182. @var{output_volume} = @var{volume} * @var{input_volume}
  3183. @end example
  3184. The default value for @var{volume} is "1.0".
  3185. @item precision
  3186. This parameter represents the mathematical precision.
  3187. It determines which input sample formats will be allowed, which affects the
  3188. precision of the volume scaling.
  3189. @table @option
  3190. @item fixed
  3191. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3192. @item float
  3193. 32-bit floating-point; this limits input sample format to FLT. (default)
  3194. @item double
  3195. 64-bit floating-point; this limits input sample format to DBL.
  3196. @end table
  3197. @item replaygain
  3198. Choose the behaviour on encountering ReplayGain side data in input frames.
  3199. @table @option
  3200. @item drop
  3201. Remove ReplayGain side data, ignoring its contents (the default).
  3202. @item ignore
  3203. Ignore ReplayGain side data, but leave it in the frame.
  3204. @item track
  3205. Prefer the track gain, if present.
  3206. @item album
  3207. Prefer the album gain, if present.
  3208. @end table
  3209. @item replaygain_preamp
  3210. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3211. Default value for @var{replaygain_preamp} is 0.0.
  3212. @item eval
  3213. Set when the volume expression is evaluated.
  3214. It accepts the following values:
  3215. @table @samp
  3216. @item once
  3217. only evaluate expression once during the filter initialization, or
  3218. when the @samp{volume} command is sent
  3219. @item frame
  3220. evaluate expression for each incoming frame
  3221. @end table
  3222. Default value is @samp{once}.
  3223. @end table
  3224. The volume expression can contain the following parameters.
  3225. @table @option
  3226. @item n
  3227. frame number (starting at zero)
  3228. @item nb_channels
  3229. number of channels
  3230. @item nb_consumed_samples
  3231. number of samples consumed by the filter
  3232. @item nb_samples
  3233. number of samples in the current frame
  3234. @item pos
  3235. original frame position in the file
  3236. @item pts
  3237. frame PTS
  3238. @item sample_rate
  3239. sample rate
  3240. @item startpts
  3241. PTS at start of stream
  3242. @item startt
  3243. time at start of stream
  3244. @item t
  3245. frame time
  3246. @item tb
  3247. timestamp timebase
  3248. @item volume
  3249. last set volume value
  3250. @end table
  3251. Note that when @option{eval} is set to @samp{once} only the
  3252. @var{sample_rate} and @var{tb} variables are available, all other
  3253. variables will evaluate to NAN.
  3254. @subsection Commands
  3255. This filter supports the following commands:
  3256. @table @option
  3257. @item volume
  3258. Modify the volume expression.
  3259. The command accepts the same syntax of the corresponding option.
  3260. If the specified expression is not valid, it is kept at its current
  3261. value.
  3262. @item replaygain_noclip
  3263. Prevent clipping by limiting the gain applied.
  3264. Default value for @var{replaygain_noclip} is 1.
  3265. @end table
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. Halve the input audio volume:
  3270. @example
  3271. volume=volume=0.5
  3272. volume=volume=1/2
  3273. volume=volume=-6.0206dB
  3274. @end example
  3275. In all the above example the named key for @option{volume} can be
  3276. omitted, for example like in:
  3277. @example
  3278. volume=0.5
  3279. @end example
  3280. @item
  3281. Increase input audio power by 6 decibels using fixed-point precision:
  3282. @example
  3283. volume=volume=6dB:precision=fixed
  3284. @end example
  3285. @item
  3286. Fade volume after time 10 with an annihilation period of 5 seconds:
  3287. @example
  3288. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3289. @end example
  3290. @end itemize
  3291. @section volumedetect
  3292. Detect the volume of the input video.
  3293. The filter has no parameters. The input is not modified. Statistics about
  3294. the volume will be printed in the log when the input stream end is reached.
  3295. In particular it will show the mean volume (root mean square), maximum
  3296. volume (on a per-sample basis), and the beginning of a histogram of the
  3297. registered volume values (from the maximum value to a cumulated 1/1000 of
  3298. the samples).
  3299. All volumes are in decibels relative to the maximum PCM value.
  3300. @subsection Examples
  3301. Here is an excerpt of the output:
  3302. @example
  3303. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3304. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3305. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3306. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3307. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3308. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3309. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3310. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3311. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3312. @end example
  3313. It means that:
  3314. @itemize
  3315. @item
  3316. The mean square energy is approximately -27 dB, or 10^-2.7.
  3317. @item
  3318. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3319. @item
  3320. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3321. @end itemize
  3322. In other words, raising the volume by +4 dB does not cause any clipping,
  3323. raising it by +5 dB causes clipping for 6 samples, etc.
  3324. @c man end AUDIO FILTERS
  3325. @chapter Audio Sources
  3326. @c man begin AUDIO SOURCES
  3327. Below is a description of the currently available audio sources.
  3328. @section abuffer
  3329. Buffer audio frames, and make them available to the filter chain.
  3330. This source is mainly intended for a programmatic use, in particular
  3331. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3332. It accepts the following parameters:
  3333. @table @option
  3334. @item time_base
  3335. The timebase which will be used for timestamps of submitted frames. It must be
  3336. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3337. @item sample_rate
  3338. The sample rate of the incoming audio buffers.
  3339. @item sample_fmt
  3340. The sample format of the incoming audio buffers.
  3341. Either a sample format name or its corresponding integer representation from
  3342. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3343. @item channel_layout
  3344. The channel layout of the incoming audio buffers.
  3345. Either a channel layout name from channel_layout_map in
  3346. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3347. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3348. @item channels
  3349. The number of channels of the incoming audio buffers.
  3350. If both @var{channels} and @var{channel_layout} are specified, then they
  3351. must be consistent.
  3352. @end table
  3353. @subsection Examples
  3354. @example
  3355. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3356. @end example
  3357. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3358. Since the sample format with name "s16p" corresponds to the number
  3359. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3360. equivalent to:
  3361. @example
  3362. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3363. @end example
  3364. @section aevalsrc
  3365. Generate an audio signal specified by an expression.
  3366. This source accepts in input one or more expressions (one for each
  3367. channel), which are evaluated and used to generate a corresponding
  3368. audio signal.
  3369. This source accepts the following options:
  3370. @table @option
  3371. @item exprs
  3372. Set the '|'-separated expressions list for each separate channel. In case the
  3373. @option{channel_layout} option is not specified, the selected channel layout
  3374. depends on the number of provided expressions. Otherwise the last
  3375. specified expression is applied to the remaining output channels.
  3376. @item channel_layout, c
  3377. Set the channel layout. The number of channels in the specified layout
  3378. must be equal to the number of specified expressions.
  3379. @item duration, d
  3380. Set the minimum duration of the sourced audio. See
  3381. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3382. for the accepted syntax.
  3383. Note that the resulting duration may be greater than the specified
  3384. duration, as the generated audio is always cut at the end of a
  3385. complete frame.
  3386. If not specified, or the expressed duration is negative, the audio is
  3387. supposed to be generated forever.
  3388. @item nb_samples, n
  3389. Set the number of samples per channel per each output frame,
  3390. default to 1024.
  3391. @item sample_rate, s
  3392. Specify the sample rate, default to 44100.
  3393. @end table
  3394. Each expression in @var{exprs} can contain the following constants:
  3395. @table @option
  3396. @item n
  3397. number of the evaluated sample, starting from 0
  3398. @item t
  3399. time of the evaluated sample expressed in seconds, starting from 0
  3400. @item s
  3401. sample rate
  3402. @end table
  3403. @subsection Examples
  3404. @itemize
  3405. @item
  3406. Generate silence:
  3407. @example
  3408. aevalsrc=0
  3409. @end example
  3410. @item
  3411. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3412. 8000 Hz:
  3413. @example
  3414. aevalsrc="sin(440*2*PI*t):s=8000"
  3415. @end example
  3416. @item
  3417. Generate a two channels signal, specify the channel layout (Front
  3418. Center + Back Center) explicitly:
  3419. @example
  3420. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3421. @end example
  3422. @item
  3423. Generate white noise:
  3424. @example
  3425. aevalsrc="-2+random(0)"
  3426. @end example
  3427. @item
  3428. Generate an amplitude modulated signal:
  3429. @example
  3430. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3431. @end example
  3432. @item
  3433. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3434. @example
  3435. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3436. @end example
  3437. @end itemize
  3438. @section anullsrc
  3439. The null audio source, return unprocessed audio frames. It is mainly useful
  3440. as a template and to be employed in analysis / debugging tools, or as
  3441. the source for filters which ignore the input data (for example the sox
  3442. synth filter).
  3443. This source accepts the following options:
  3444. @table @option
  3445. @item channel_layout, cl
  3446. Specifies the channel layout, and can be either an integer or a string
  3447. representing a channel layout. The default value of @var{channel_layout}
  3448. is "stereo".
  3449. Check the channel_layout_map definition in
  3450. @file{libavutil/channel_layout.c} for the mapping between strings and
  3451. channel layout values.
  3452. @item sample_rate, r
  3453. Specifies the sample rate, and defaults to 44100.
  3454. @item nb_samples, n
  3455. Set the number of samples per requested frames.
  3456. @end table
  3457. @subsection Examples
  3458. @itemize
  3459. @item
  3460. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3461. @example
  3462. anullsrc=r=48000:cl=4
  3463. @end example
  3464. @item
  3465. Do the same operation with a more obvious syntax:
  3466. @example
  3467. anullsrc=r=48000:cl=mono
  3468. @end example
  3469. @end itemize
  3470. All the parameters need to be explicitly defined.
  3471. @section flite
  3472. Synthesize a voice utterance using the libflite library.
  3473. To enable compilation of this filter you need to configure FFmpeg with
  3474. @code{--enable-libflite}.
  3475. Note that the flite library is not thread-safe.
  3476. The filter accepts the following options:
  3477. @table @option
  3478. @item list_voices
  3479. If set to 1, list the names of the available voices and exit
  3480. immediately. Default value is 0.
  3481. @item nb_samples, n
  3482. Set the maximum number of samples per frame. Default value is 512.
  3483. @item textfile
  3484. Set the filename containing the text to speak.
  3485. @item text
  3486. Set the text to speak.
  3487. @item voice, v
  3488. Set the voice to use for the speech synthesis. Default value is
  3489. @code{kal}. See also the @var{list_voices} option.
  3490. @end table
  3491. @subsection Examples
  3492. @itemize
  3493. @item
  3494. Read from file @file{speech.txt}, and synthesize the text using the
  3495. standard flite voice:
  3496. @example
  3497. flite=textfile=speech.txt
  3498. @end example
  3499. @item
  3500. Read the specified text selecting the @code{slt} voice:
  3501. @example
  3502. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3503. @end example
  3504. @item
  3505. Input text to ffmpeg:
  3506. @example
  3507. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3508. @end example
  3509. @item
  3510. Make @file{ffplay} speak the specified text, using @code{flite} and
  3511. the @code{lavfi} device:
  3512. @example
  3513. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3514. @end example
  3515. @end itemize
  3516. For more information about libflite, check:
  3517. @url{http://www.speech.cs.cmu.edu/flite/}
  3518. @section anoisesrc
  3519. Generate a noise audio signal.
  3520. The filter accepts the following options:
  3521. @table @option
  3522. @item sample_rate, r
  3523. Specify the sample rate. Default value is 48000 Hz.
  3524. @item amplitude, a
  3525. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3526. is 1.0.
  3527. @item duration, d
  3528. Specify the duration of the generated audio stream. Not specifying this option
  3529. results in noise with an infinite length.
  3530. @item color, colour, c
  3531. Specify the color of noise. Available noise colors are white, pink, brown,
  3532. blue and violet. Default color is white.
  3533. @item seed, s
  3534. Specify a value used to seed the PRNG.
  3535. @item nb_samples, n
  3536. Set the number of samples per each output frame, default is 1024.
  3537. @end table
  3538. @subsection Examples
  3539. @itemize
  3540. @item
  3541. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3542. @example
  3543. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3544. @end example
  3545. @end itemize
  3546. @section sine
  3547. Generate an audio signal made of a sine wave with amplitude 1/8.
  3548. The audio signal is bit-exact.
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item frequency, f
  3552. Set the carrier frequency. Default is 440 Hz.
  3553. @item beep_factor, b
  3554. Enable a periodic beep every second with frequency @var{beep_factor} times
  3555. the carrier frequency. Default is 0, meaning the beep is disabled.
  3556. @item sample_rate, r
  3557. Specify the sample rate, default is 44100.
  3558. @item duration, d
  3559. Specify the duration of the generated audio stream.
  3560. @item samples_per_frame
  3561. Set the number of samples per output frame.
  3562. The expression can contain the following constants:
  3563. @table @option
  3564. @item n
  3565. The (sequential) number of the output audio frame, starting from 0.
  3566. @item pts
  3567. The PTS (Presentation TimeStamp) of the output audio frame,
  3568. expressed in @var{TB} units.
  3569. @item t
  3570. The PTS of the output audio frame, expressed in seconds.
  3571. @item TB
  3572. The timebase of the output audio frames.
  3573. @end table
  3574. Default is @code{1024}.
  3575. @end table
  3576. @subsection Examples
  3577. @itemize
  3578. @item
  3579. Generate a simple 440 Hz sine wave:
  3580. @example
  3581. sine
  3582. @end example
  3583. @item
  3584. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3585. @example
  3586. sine=220:4:d=5
  3587. sine=f=220:b=4:d=5
  3588. sine=frequency=220:beep_factor=4:duration=5
  3589. @end example
  3590. @item
  3591. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3592. pattern:
  3593. @example
  3594. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3595. @end example
  3596. @end itemize
  3597. @c man end AUDIO SOURCES
  3598. @chapter Audio Sinks
  3599. @c man begin AUDIO SINKS
  3600. Below is a description of the currently available audio sinks.
  3601. @section abuffersink
  3602. Buffer audio frames, and make them available to the end of filter chain.
  3603. This sink is mainly intended for programmatic use, in particular
  3604. through the interface defined in @file{libavfilter/buffersink.h}
  3605. or the options system.
  3606. It accepts a pointer to an AVABufferSinkContext structure, which
  3607. defines the incoming buffers' formats, to be passed as the opaque
  3608. parameter to @code{avfilter_init_filter} for initialization.
  3609. @section anullsink
  3610. Null audio sink; do absolutely nothing with the input audio. It is
  3611. mainly useful as a template and for use in analysis / debugging
  3612. tools.
  3613. @c man end AUDIO SINKS
  3614. @chapter Video Filters
  3615. @c man begin VIDEO FILTERS
  3616. When you configure your FFmpeg build, you can disable any of the
  3617. existing filters using @code{--disable-filters}.
  3618. The configure output will show the video filters included in your
  3619. build.
  3620. Below is a description of the currently available video filters.
  3621. @section alphaextract
  3622. Extract the alpha component from the input as a grayscale video. This
  3623. is especially useful with the @var{alphamerge} filter.
  3624. @section alphamerge
  3625. Add or replace the alpha component of the primary input with the
  3626. grayscale value of a second input. This is intended for use with
  3627. @var{alphaextract} to allow the transmission or storage of frame
  3628. sequences that have alpha in a format that doesn't support an alpha
  3629. channel.
  3630. For example, to reconstruct full frames from a normal YUV-encoded video
  3631. and a separate video created with @var{alphaextract}, you might use:
  3632. @example
  3633. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3634. @end example
  3635. Since this filter is designed for reconstruction, it operates on frame
  3636. sequences without considering timestamps, and terminates when either
  3637. input reaches end of stream. This will cause problems if your encoding
  3638. pipeline drops frames. If you're trying to apply an image as an
  3639. overlay to a video stream, consider the @var{overlay} filter instead.
  3640. @section ass
  3641. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3642. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3643. Substation Alpha) subtitles files.
  3644. This filter accepts the following option in addition to the common options from
  3645. the @ref{subtitles} filter:
  3646. @table @option
  3647. @item shaping
  3648. Set the shaping engine
  3649. Available values are:
  3650. @table @samp
  3651. @item auto
  3652. The default libass shaping engine, which is the best available.
  3653. @item simple
  3654. Fast, font-agnostic shaper that can do only substitutions
  3655. @item complex
  3656. Slower shaper using OpenType for substitutions and positioning
  3657. @end table
  3658. The default is @code{auto}.
  3659. @end table
  3660. @section atadenoise
  3661. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3662. The filter accepts the following options:
  3663. @table @option
  3664. @item 0a
  3665. Set threshold A for 1st plane. Default is 0.02.
  3666. Valid range is 0 to 0.3.
  3667. @item 0b
  3668. Set threshold B for 1st plane. Default is 0.04.
  3669. Valid range is 0 to 5.
  3670. @item 1a
  3671. Set threshold A for 2nd plane. Default is 0.02.
  3672. Valid range is 0 to 0.3.
  3673. @item 1b
  3674. Set threshold B for 2nd plane. Default is 0.04.
  3675. Valid range is 0 to 5.
  3676. @item 2a
  3677. Set threshold A for 3rd plane. Default is 0.02.
  3678. Valid range is 0 to 0.3.
  3679. @item 2b
  3680. Set threshold B for 3rd plane. Default is 0.04.
  3681. Valid range is 0 to 5.
  3682. Threshold A is designed to react on abrupt changes in the input signal and
  3683. threshold B is designed to react on continuous changes in the input signal.
  3684. @item s
  3685. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3686. number in range [5, 129].
  3687. @item p
  3688. Set what planes of frame filter will use for averaging. Default is all.
  3689. @end table
  3690. @section avgblur
  3691. Apply average blur filter.
  3692. The filter accepts the following options:
  3693. @table @option
  3694. @item sizeX
  3695. Set horizontal kernel size.
  3696. @item planes
  3697. Set which planes to filter. By default all planes are filtered.
  3698. @item sizeY
  3699. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3700. Default is @code{0}.
  3701. @end table
  3702. @section bbox
  3703. Compute the bounding box for the non-black pixels in the input frame
  3704. luminance plane.
  3705. This filter computes the bounding box containing all the pixels with a
  3706. luminance value greater than the minimum allowed value.
  3707. The parameters describing the bounding box are printed on the filter
  3708. log.
  3709. The filter accepts the following option:
  3710. @table @option
  3711. @item min_val
  3712. Set the minimal luminance value. Default is @code{16}.
  3713. @end table
  3714. @section bitplanenoise
  3715. Show and measure bit plane noise.
  3716. The filter accepts the following options:
  3717. @table @option
  3718. @item bitplane
  3719. Set which plane to analyze. Default is @code{1}.
  3720. @item filter
  3721. Filter out noisy pixels from @code{bitplane} set above.
  3722. Default is disabled.
  3723. @end table
  3724. @section blackdetect
  3725. Detect video intervals that are (almost) completely black. Can be
  3726. useful to detect chapter transitions, commercials, or invalid
  3727. recordings. Output lines contains the time for the start, end and
  3728. duration of the detected black interval expressed in seconds.
  3729. In order to display the output lines, you need to set the loglevel at
  3730. least to the AV_LOG_INFO value.
  3731. The filter accepts the following options:
  3732. @table @option
  3733. @item black_min_duration, d
  3734. Set the minimum detected black duration expressed in seconds. It must
  3735. be a non-negative floating point number.
  3736. Default value is 2.0.
  3737. @item picture_black_ratio_th, pic_th
  3738. Set the threshold for considering a picture "black".
  3739. Express the minimum value for the ratio:
  3740. @example
  3741. @var{nb_black_pixels} / @var{nb_pixels}
  3742. @end example
  3743. for which a picture is considered black.
  3744. Default value is 0.98.
  3745. @item pixel_black_th, pix_th
  3746. Set the threshold for considering a pixel "black".
  3747. The threshold expresses the maximum pixel luminance value for which a
  3748. pixel is considered "black". The provided value is scaled according to
  3749. the following equation:
  3750. @example
  3751. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3752. @end example
  3753. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3754. the input video format, the range is [0-255] for YUV full-range
  3755. formats and [16-235] for YUV non full-range formats.
  3756. Default value is 0.10.
  3757. @end table
  3758. The following example sets the maximum pixel threshold to the minimum
  3759. value, and detects only black intervals of 2 or more seconds:
  3760. @example
  3761. blackdetect=d=2:pix_th=0.00
  3762. @end example
  3763. @section blackframe
  3764. Detect frames that are (almost) completely black. Can be useful to
  3765. detect chapter transitions or commercials. Output lines consist of
  3766. the frame number of the detected frame, the percentage of blackness,
  3767. the position in the file if known or -1 and the timestamp in seconds.
  3768. In order to display the output lines, you need to set the loglevel at
  3769. least to the AV_LOG_INFO value.
  3770. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3771. The value represents the percentage of pixels in the picture that
  3772. are below the threshold value.
  3773. It accepts the following parameters:
  3774. @table @option
  3775. @item amount
  3776. The percentage of the pixels that have to be below the threshold; it defaults to
  3777. @code{98}.
  3778. @item threshold, thresh
  3779. The threshold below which a pixel value is considered black; it defaults to
  3780. @code{32}.
  3781. @end table
  3782. @section blend, tblend
  3783. Blend two video frames into each other.
  3784. The @code{blend} filter takes two input streams and outputs one
  3785. stream, the first input is the "top" layer and second input is
  3786. "bottom" layer. By default, the output terminates when the longest input terminates.
  3787. The @code{tblend} (time blend) filter takes two consecutive frames
  3788. from one single stream, and outputs the result obtained by blending
  3789. the new frame on top of the old frame.
  3790. A description of the accepted options follows.
  3791. @table @option
  3792. @item c0_mode
  3793. @item c1_mode
  3794. @item c2_mode
  3795. @item c3_mode
  3796. @item all_mode
  3797. Set blend mode for specific pixel component or all pixel components in case
  3798. of @var{all_mode}. Default value is @code{normal}.
  3799. Available values for component modes are:
  3800. @table @samp
  3801. @item addition
  3802. @item grainmerge
  3803. @item and
  3804. @item average
  3805. @item burn
  3806. @item darken
  3807. @item difference
  3808. @item grainextract
  3809. @item divide
  3810. @item dodge
  3811. @item freeze
  3812. @item exclusion
  3813. @item extremity
  3814. @item glow
  3815. @item hardlight
  3816. @item hardmix
  3817. @item heat
  3818. @item lighten
  3819. @item linearlight
  3820. @item multiply
  3821. @item multiply128
  3822. @item negation
  3823. @item normal
  3824. @item or
  3825. @item overlay
  3826. @item phoenix
  3827. @item pinlight
  3828. @item reflect
  3829. @item screen
  3830. @item softlight
  3831. @item subtract
  3832. @item vividlight
  3833. @item xor
  3834. @end table
  3835. @item c0_opacity
  3836. @item c1_opacity
  3837. @item c2_opacity
  3838. @item c3_opacity
  3839. @item all_opacity
  3840. Set blend opacity for specific pixel component or all pixel components in case
  3841. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3842. @item c0_expr
  3843. @item c1_expr
  3844. @item c2_expr
  3845. @item c3_expr
  3846. @item all_expr
  3847. Set blend expression for specific pixel component or all pixel components in case
  3848. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3849. The expressions can use the following variables:
  3850. @table @option
  3851. @item N
  3852. The sequential number of the filtered frame, starting from @code{0}.
  3853. @item X
  3854. @item Y
  3855. the coordinates of the current sample
  3856. @item W
  3857. @item H
  3858. the width and height of currently filtered plane
  3859. @item SW
  3860. @item SH
  3861. Width and height scale depending on the currently filtered plane. It is the
  3862. ratio between the corresponding luma plane number of pixels and the current
  3863. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3864. @code{0.5,0.5} for chroma planes.
  3865. @item T
  3866. Time of the current frame, expressed in seconds.
  3867. @item TOP, A
  3868. Value of pixel component at current location for first video frame (top layer).
  3869. @item BOTTOM, B
  3870. Value of pixel component at current location for second video frame (bottom layer).
  3871. @end table
  3872. @end table
  3873. The @code{blend} filter also supports the @ref{framesync} options.
  3874. @subsection Examples
  3875. @itemize
  3876. @item
  3877. Apply transition from bottom layer to top layer in first 10 seconds:
  3878. @example
  3879. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3880. @end example
  3881. @item
  3882. Apply 1x1 checkerboard effect:
  3883. @example
  3884. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3885. @end example
  3886. @item
  3887. Apply uncover left effect:
  3888. @example
  3889. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3890. @end example
  3891. @item
  3892. Apply uncover down effect:
  3893. @example
  3894. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3895. @end example
  3896. @item
  3897. Apply uncover up-left effect:
  3898. @example
  3899. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3900. @end example
  3901. @item
  3902. Split diagonally video and shows top and bottom layer on each side:
  3903. @example
  3904. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3905. @end example
  3906. @item
  3907. Display differences between the current and the previous frame:
  3908. @example
  3909. tblend=all_mode=grainextract
  3910. @end example
  3911. @end itemize
  3912. @section boxblur
  3913. Apply a boxblur algorithm to the input video.
  3914. It accepts the following parameters:
  3915. @table @option
  3916. @item luma_radius, lr
  3917. @item luma_power, lp
  3918. @item chroma_radius, cr
  3919. @item chroma_power, cp
  3920. @item alpha_radius, ar
  3921. @item alpha_power, ap
  3922. @end table
  3923. A description of the accepted options follows.
  3924. @table @option
  3925. @item luma_radius, lr
  3926. @item chroma_radius, cr
  3927. @item alpha_radius, ar
  3928. Set an expression for the box radius in pixels used for blurring the
  3929. corresponding input plane.
  3930. The radius value must be a non-negative number, and must not be
  3931. greater than the value of the expression @code{min(w,h)/2} for the
  3932. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3933. planes.
  3934. Default value for @option{luma_radius} is "2". If not specified,
  3935. @option{chroma_radius} and @option{alpha_radius} default to the
  3936. corresponding value set for @option{luma_radius}.
  3937. The expressions can contain the following constants:
  3938. @table @option
  3939. @item w
  3940. @item h
  3941. The input width and height in pixels.
  3942. @item cw
  3943. @item ch
  3944. The input chroma image width and height in pixels.
  3945. @item hsub
  3946. @item vsub
  3947. The horizontal and vertical chroma subsample values. For example, for the
  3948. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3949. @end table
  3950. @item luma_power, lp
  3951. @item chroma_power, cp
  3952. @item alpha_power, ap
  3953. Specify how many times the boxblur filter is applied to the
  3954. corresponding plane.
  3955. Default value for @option{luma_power} is 2. If not specified,
  3956. @option{chroma_power} and @option{alpha_power} default to the
  3957. corresponding value set for @option{luma_power}.
  3958. A value of 0 will disable the effect.
  3959. @end table
  3960. @subsection Examples
  3961. @itemize
  3962. @item
  3963. Apply a boxblur filter with the luma, chroma, and alpha radii
  3964. set to 2:
  3965. @example
  3966. boxblur=luma_radius=2:luma_power=1
  3967. boxblur=2:1
  3968. @end example
  3969. @item
  3970. Set the luma radius to 2, and alpha and chroma radius to 0:
  3971. @example
  3972. boxblur=2:1:cr=0:ar=0
  3973. @end example
  3974. @item
  3975. Set the luma and chroma radii to a fraction of the video dimension:
  3976. @example
  3977. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3978. @end example
  3979. @end itemize
  3980. @section bwdif
  3981. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3982. Deinterlacing Filter").
  3983. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3984. interpolation algorithms.
  3985. It accepts the following parameters:
  3986. @table @option
  3987. @item mode
  3988. The interlacing mode to adopt. It accepts one of the following values:
  3989. @table @option
  3990. @item 0, send_frame
  3991. Output one frame for each frame.
  3992. @item 1, send_field
  3993. Output one frame for each field.
  3994. @end table
  3995. The default value is @code{send_field}.
  3996. @item parity
  3997. The picture field parity assumed for the input interlaced video. It accepts one
  3998. of the following values:
  3999. @table @option
  4000. @item 0, tff
  4001. Assume the top field is first.
  4002. @item 1, bff
  4003. Assume the bottom field is first.
  4004. @item -1, auto
  4005. Enable automatic detection of field parity.
  4006. @end table
  4007. The default value is @code{auto}.
  4008. If the interlacing is unknown or the decoder does not export this information,
  4009. top field first will be assumed.
  4010. @item deint
  4011. Specify which frames to deinterlace. Accept one of the following
  4012. values:
  4013. @table @option
  4014. @item 0, all
  4015. Deinterlace all frames.
  4016. @item 1, interlaced
  4017. Only deinterlace frames marked as interlaced.
  4018. @end table
  4019. The default value is @code{all}.
  4020. @end table
  4021. @section chromakey
  4022. YUV colorspace color/chroma keying.
  4023. The filter accepts the following options:
  4024. @table @option
  4025. @item color
  4026. The color which will be replaced with transparency.
  4027. @item similarity
  4028. Similarity percentage with the key color.
  4029. 0.01 matches only the exact key color, while 1.0 matches everything.
  4030. @item blend
  4031. Blend percentage.
  4032. 0.0 makes pixels either fully transparent, or not transparent at all.
  4033. Higher values result in semi-transparent pixels, with a higher transparency
  4034. the more similar the pixels color is to the key color.
  4035. @item yuv
  4036. Signals that the color passed is already in YUV instead of RGB.
  4037. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4038. This can be used to pass exact YUV values as hexadecimal numbers.
  4039. @end table
  4040. @subsection Examples
  4041. @itemize
  4042. @item
  4043. Make every green pixel in the input image transparent:
  4044. @example
  4045. ffmpeg -i input.png -vf chromakey=green out.png
  4046. @end example
  4047. @item
  4048. Overlay a greenscreen-video on top of a static black background.
  4049. @example
  4050. 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
  4051. @end example
  4052. @end itemize
  4053. @section ciescope
  4054. Display CIE color diagram with pixels overlaid onto it.
  4055. The filter accepts the following options:
  4056. @table @option
  4057. @item system
  4058. Set color system.
  4059. @table @samp
  4060. @item ntsc, 470m
  4061. @item ebu, 470bg
  4062. @item smpte
  4063. @item 240m
  4064. @item apple
  4065. @item widergb
  4066. @item cie1931
  4067. @item rec709, hdtv
  4068. @item uhdtv, rec2020
  4069. @end table
  4070. @item cie
  4071. Set CIE system.
  4072. @table @samp
  4073. @item xyy
  4074. @item ucs
  4075. @item luv
  4076. @end table
  4077. @item gamuts
  4078. Set what gamuts to draw.
  4079. See @code{system} option for available values.
  4080. @item size, s
  4081. Set ciescope size, by default set to 512.
  4082. @item intensity, i
  4083. Set intensity used to map input pixel values to CIE diagram.
  4084. @item contrast
  4085. Set contrast used to draw tongue colors that are out of active color system gamut.
  4086. @item corrgamma
  4087. Correct gamma displayed on scope, by default enabled.
  4088. @item showwhite
  4089. Show white point on CIE diagram, by default disabled.
  4090. @item gamma
  4091. Set input gamma. Used only with XYZ input color space.
  4092. @end table
  4093. @section codecview
  4094. Visualize information exported by some codecs.
  4095. Some codecs can export information through frames using side-data or other
  4096. means. For example, some MPEG based codecs export motion vectors through the
  4097. @var{export_mvs} flag in the codec @option{flags2} option.
  4098. The filter accepts the following option:
  4099. @table @option
  4100. @item mv
  4101. Set motion vectors to visualize.
  4102. Available flags for @var{mv} are:
  4103. @table @samp
  4104. @item pf
  4105. forward predicted MVs of P-frames
  4106. @item bf
  4107. forward predicted MVs of B-frames
  4108. @item bb
  4109. backward predicted MVs of B-frames
  4110. @end table
  4111. @item qp
  4112. Display quantization parameters using the chroma planes.
  4113. @item mv_type, mvt
  4114. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4115. Available flags for @var{mv_type} are:
  4116. @table @samp
  4117. @item fp
  4118. forward predicted MVs
  4119. @item bp
  4120. backward predicted MVs
  4121. @end table
  4122. @item frame_type, ft
  4123. Set frame type to visualize motion vectors of.
  4124. Available flags for @var{frame_type} are:
  4125. @table @samp
  4126. @item if
  4127. intra-coded frames (I-frames)
  4128. @item pf
  4129. predicted frames (P-frames)
  4130. @item bf
  4131. bi-directionally predicted frames (B-frames)
  4132. @end table
  4133. @end table
  4134. @subsection Examples
  4135. @itemize
  4136. @item
  4137. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4138. @example
  4139. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4140. @end example
  4141. @item
  4142. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4143. @example
  4144. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4145. @end example
  4146. @end itemize
  4147. @section colorbalance
  4148. Modify intensity of primary colors (red, green and blue) of input frames.
  4149. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4150. regions for the red-cyan, green-magenta or blue-yellow balance.
  4151. A positive adjustment value shifts the balance towards the primary color, a negative
  4152. value towards the complementary color.
  4153. The filter accepts the following options:
  4154. @table @option
  4155. @item rs
  4156. @item gs
  4157. @item bs
  4158. Adjust red, green and blue shadows (darkest pixels).
  4159. @item rm
  4160. @item gm
  4161. @item bm
  4162. Adjust red, green and blue midtones (medium pixels).
  4163. @item rh
  4164. @item gh
  4165. @item bh
  4166. Adjust red, green and blue highlights (brightest pixels).
  4167. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4168. @end table
  4169. @subsection Examples
  4170. @itemize
  4171. @item
  4172. Add red color cast to shadows:
  4173. @example
  4174. colorbalance=rs=.3
  4175. @end example
  4176. @end itemize
  4177. @section colorkey
  4178. RGB colorspace color keying.
  4179. The filter accepts the following options:
  4180. @table @option
  4181. @item color
  4182. The color which will be replaced with transparency.
  4183. @item similarity
  4184. Similarity percentage with the key color.
  4185. 0.01 matches only the exact key color, while 1.0 matches everything.
  4186. @item blend
  4187. Blend percentage.
  4188. 0.0 makes pixels either fully transparent, or not transparent at all.
  4189. Higher values result in semi-transparent pixels, with a higher transparency
  4190. the more similar the pixels color is to the key color.
  4191. @end table
  4192. @subsection Examples
  4193. @itemize
  4194. @item
  4195. Make every green pixel in the input image transparent:
  4196. @example
  4197. ffmpeg -i input.png -vf colorkey=green out.png
  4198. @end example
  4199. @item
  4200. Overlay a greenscreen-video on top of a static background image.
  4201. @example
  4202. 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
  4203. @end example
  4204. @end itemize
  4205. @section colorlevels
  4206. Adjust video input frames using levels.
  4207. The filter accepts the following options:
  4208. @table @option
  4209. @item rimin
  4210. @item gimin
  4211. @item bimin
  4212. @item aimin
  4213. Adjust red, green, blue and alpha input black point.
  4214. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4215. @item rimax
  4216. @item gimax
  4217. @item bimax
  4218. @item aimax
  4219. Adjust red, green, blue and alpha input white point.
  4220. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4221. Input levels are used to lighten highlights (bright tones), darken shadows
  4222. (dark tones), change the balance of bright and dark tones.
  4223. @item romin
  4224. @item gomin
  4225. @item bomin
  4226. @item aomin
  4227. Adjust red, green, blue and alpha output black point.
  4228. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4229. @item romax
  4230. @item gomax
  4231. @item bomax
  4232. @item aomax
  4233. Adjust red, green, blue and alpha output white point.
  4234. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4235. Output levels allows manual selection of a constrained output level range.
  4236. @end table
  4237. @subsection Examples
  4238. @itemize
  4239. @item
  4240. Make video output darker:
  4241. @example
  4242. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4243. @end example
  4244. @item
  4245. Increase contrast:
  4246. @example
  4247. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4248. @end example
  4249. @item
  4250. Make video output lighter:
  4251. @example
  4252. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4253. @end example
  4254. @item
  4255. Increase brightness:
  4256. @example
  4257. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4258. @end example
  4259. @end itemize
  4260. @section colorchannelmixer
  4261. Adjust video input frames by re-mixing color channels.
  4262. This filter modifies a color channel by adding the values associated to
  4263. the other channels of the same pixels. For example if the value to
  4264. modify is red, the output value will be:
  4265. @example
  4266. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4267. @end example
  4268. The filter accepts the following options:
  4269. @table @option
  4270. @item rr
  4271. @item rg
  4272. @item rb
  4273. @item ra
  4274. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4275. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4276. @item gr
  4277. @item gg
  4278. @item gb
  4279. @item ga
  4280. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4281. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4282. @item br
  4283. @item bg
  4284. @item bb
  4285. @item ba
  4286. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4287. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4288. @item ar
  4289. @item ag
  4290. @item ab
  4291. @item aa
  4292. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4293. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4294. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4295. @end table
  4296. @subsection Examples
  4297. @itemize
  4298. @item
  4299. Convert source to grayscale:
  4300. @example
  4301. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4302. @end example
  4303. @item
  4304. Simulate sepia tones:
  4305. @example
  4306. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4307. @end example
  4308. @end itemize
  4309. @section colormatrix
  4310. Convert color matrix.
  4311. The filter accepts the following options:
  4312. @table @option
  4313. @item src
  4314. @item dst
  4315. Specify the source and destination color matrix. Both values must be
  4316. specified.
  4317. The accepted values are:
  4318. @table @samp
  4319. @item bt709
  4320. BT.709
  4321. @item fcc
  4322. FCC
  4323. @item bt601
  4324. BT.601
  4325. @item bt470
  4326. BT.470
  4327. @item bt470bg
  4328. BT.470BG
  4329. @item smpte170m
  4330. SMPTE-170M
  4331. @item smpte240m
  4332. SMPTE-240M
  4333. @item bt2020
  4334. BT.2020
  4335. @end table
  4336. @end table
  4337. For example to convert from BT.601 to SMPTE-240M, use the command:
  4338. @example
  4339. colormatrix=bt601:smpte240m
  4340. @end example
  4341. @section colorspace
  4342. Convert colorspace, transfer characteristics or color primaries.
  4343. Input video needs to have an even size.
  4344. The filter accepts the following options:
  4345. @table @option
  4346. @anchor{all}
  4347. @item all
  4348. Specify all color properties at once.
  4349. The accepted values are:
  4350. @table @samp
  4351. @item bt470m
  4352. BT.470M
  4353. @item bt470bg
  4354. BT.470BG
  4355. @item bt601-6-525
  4356. BT.601-6 525
  4357. @item bt601-6-625
  4358. BT.601-6 625
  4359. @item bt709
  4360. BT.709
  4361. @item smpte170m
  4362. SMPTE-170M
  4363. @item smpte240m
  4364. SMPTE-240M
  4365. @item bt2020
  4366. BT.2020
  4367. @end table
  4368. @anchor{space}
  4369. @item space
  4370. Specify output colorspace.
  4371. The accepted values are:
  4372. @table @samp
  4373. @item bt709
  4374. BT.709
  4375. @item fcc
  4376. FCC
  4377. @item bt470bg
  4378. BT.470BG or BT.601-6 625
  4379. @item smpte170m
  4380. SMPTE-170M or BT.601-6 525
  4381. @item smpte240m
  4382. SMPTE-240M
  4383. @item ycgco
  4384. YCgCo
  4385. @item bt2020ncl
  4386. BT.2020 with non-constant luminance
  4387. @end table
  4388. @anchor{trc}
  4389. @item trc
  4390. Specify output transfer characteristics.
  4391. The accepted values are:
  4392. @table @samp
  4393. @item bt709
  4394. BT.709
  4395. @item bt470m
  4396. BT.470M
  4397. @item bt470bg
  4398. BT.470BG
  4399. @item gamma22
  4400. Constant gamma of 2.2
  4401. @item gamma28
  4402. Constant gamma of 2.8
  4403. @item smpte170m
  4404. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4405. @item smpte240m
  4406. SMPTE-240M
  4407. @item srgb
  4408. SRGB
  4409. @item iec61966-2-1
  4410. iec61966-2-1
  4411. @item iec61966-2-4
  4412. iec61966-2-4
  4413. @item xvycc
  4414. xvycc
  4415. @item bt2020-10
  4416. BT.2020 for 10-bits content
  4417. @item bt2020-12
  4418. BT.2020 for 12-bits content
  4419. @end table
  4420. @anchor{primaries}
  4421. @item primaries
  4422. Specify output color primaries.
  4423. The accepted values are:
  4424. @table @samp
  4425. @item bt709
  4426. BT.709
  4427. @item bt470m
  4428. BT.470M
  4429. @item bt470bg
  4430. BT.470BG or BT.601-6 625
  4431. @item smpte170m
  4432. SMPTE-170M or BT.601-6 525
  4433. @item smpte240m
  4434. SMPTE-240M
  4435. @item film
  4436. film
  4437. @item smpte431
  4438. SMPTE-431
  4439. @item smpte432
  4440. SMPTE-432
  4441. @item bt2020
  4442. BT.2020
  4443. @item jedec-p22
  4444. JEDEC P22 phosphors
  4445. @end table
  4446. @anchor{range}
  4447. @item range
  4448. Specify output color range.
  4449. The accepted values are:
  4450. @table @samp
  4451. @item tv
  4452. TV (restricted) range
  4453. @item mpeg
  4454. MPEG (restricted) range
  4455. @item pc
  4456. PC (full) range
  4457. @item jpeg
  4458. JPEG (full) range
  4459. @end table
  4460. @item format
  4461. Specify output color format.
  4462. The accepted values are:
  4463. @table @samp
  4464. @item yuv420p
  4465. YUV 4:2:0 planar 8-bits
  4466. @item yuv420p10
  4467. YUV 4:2:0 planar 10-bits
  4468. @item yuv420p12
  4469. YUV 4:2:0 planar 12-bits
  4470. @item yuv422p
  4471. YUV 4:2:2 planar 8-bits
  4472. @item yuv422p10
  4473. YUV 4:2:2 planar 10-bits
  4474. @item yuv422p12
  4475. YUV 4:2:2 planar 12-bits
  4476. @item yuv444p
  4477. YUV 4:4:4 planar 8-bits
  4478. @item yuv444p10
  4479. YUV 4:4:4 planar 10-bits
  4480. @item yuv444p12
  4481. YUV 4:4:4 planar 12-bits
  4482. @end table
  4483. @item fast
  4484. Do a fast conversion, which skips gamma/primary correction. This will take
  4485. significantly less CPU, but will be mathematically incorrect. To get output
  4486. compatible with that produced by the colormatrix filter, use fast=1.
  4487. @item dither
  4488. Specify dithering mode.
  4489. The accepted values are:
  4490. @table @samp
  4491. @item none
  4492. No dithering
  4493. @item fsb
  4494. Floyd-Steinberg dithering
  4495. @end table
  4496. @item wpadapt
  4497. Whitepoint adaptation mode.
  4498. The accepted values are:
  4499. @table @samp
  4500. @item bradford
  4501. Bradford whitepoint adaptation
  4502. @item vonkries
  4503. von Kries whitepoint adaptation
  4504. @item identity
  4505. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4506. @end table
  4507. @item iall
  4508. Override all input properties at once. Same accepted values as @ref{all}.
  4509. @item ispace
  4510. Override input colorspace. Same accepted values as @ref{space}.
  4511. @item iprimaries
  4512. Override input color primaries. Same accepted values as @ref{primaries}.
  4513. @item itrc
  4514. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4515. @item irange
  4516. Override input color range. Same accepted values as @ref{range}.
  4517. @end table
  4518. The filter converts the transfer characteristics, color space and color
  4519. primaries to the specified user values. The output value, if not specified,
  4520. is set to a default value based on the "all" property. If that property is
  4521. also not specified, the filter will log an error. The output color range and
  4522. format default to the same value as the input color range and format. The
  4523. input transfer characteristics, color space, color primaries and color range
  4524. should be set on the input data. If any of these are missing, the filter will
  4525. log an error and no conversion will take place.
  4526. For example to convert the input to SMPTE-240M, use the command:
  4527. @example
  4528. colorspace=smpte240m
  4529. @end example
  4530. @section convolution
  4531. Apply convolution 3x3 or 5x5 filter.
  4532. The filter accepts the following options:
  4533. @table @option
  4534. @item 0m
  4535. @item 1m
  4536. @item 2m
  4537. @item 3m
  4538. Set matrix for each plane.
  4539. Matrix is sequence of 9 or 25 signed integers.
  4540. @item 0rdiv
  4541. @item 1rdiv
  4542. @item 2rdiv
  4543. @item 3rdiv
  4544. Set multiplier for calculated value for each plane.
  4545. @item 0bias
  4546. @item 1bias
  4547. @item 2bias
  4548. @item 3bias
  4549. Set bias for each plane. This value is added to the result of the multiplication.
  4550. Useful for making the overall image brighter or darker. Default is 0.0.
  4551. @end table
  4552. @subsection Examples
  4553. @itemize
  4554. @item
  4555. Apply sharpen:
  4556. @example
  4557. 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"
  4558. @end example
  4559. @item
  4560. Apply blur:
  4561. @example
  4562. 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"
  4563. @end example
  4564. @item
  4565. Apply edge enhance:
  4566. @example
  4567. 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"
  4568. @end example
  4569. @item
  4570. Apply edge detect:
  4571. @example
  4572. 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"
  4573. @end example
  4574. @item
  4575. Apply laplacian edge detector which includes diagonals:
  4576. @example
  4577. 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"
  4578. @end example
  4579. @item
  4580. Apply emboss:
  4581. @example
  4582. 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"
  4583. @end example
  4584. @end itemize
  4585. @section copy
  4586. Copy the input video source unchanged to the output. This is mainly useful for
  4587. testing purposes.
  4588. @anchor{coreimage}
  4589. @section coreimage
  4590. Video filtering on GPU using Apple's CoreImage API on OSX.
  4591. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4592. processed by video hardware. However, software-based OpenGL implementations
  4593. exist which means there is no guarantee for hardware processing. It depends on
  4594. the respective OSX.
  4595. There are many filters and image generators provided by Apple that come with a
  4596. large variety of options. The filter has to be referenced by its name along
  4597. with its options.
  4598. The coreimage filter accepts the following options:
  4599. @table @option
  4600. @item list_filters
  4601. List all available filters and generators along with all their respective
  4602. options as well as possible minimum and maximum values along with the default
  4603. values.
  4604. @example
  4605. list_filters=true
  4606. @end example
  4607. @item filter
  4608. Specify all filters by their respective name and options.
  4609. Use @var{list_filters} to determine all valid filter names and options.
  4610. Numerical options are specified by a float value and are automatically clamped
  4611. to their respective value range. Vector and color options have to be specified
  4612. by a list of space separated float values. Character escaping has to be done.
  4613. A special option name @code{default} is available to use default options for a
  4614. filter.
  4615. It is required to specify either @code{default} or at least one of the filter options.
  4616. All omitted options are used with their default values.
  4617. The syntax of the filter string is as follows:
  4618. @example
  4619. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4620. @end example
  4621. @item output_rect
  4622. Specify a rectangle where the output of the filter chain is copied into the
  4623. input image. It is given by a list of space separated float values:
  4624. @example
  4625. output_rect=x\ y\ width\ height
  4626. @end example
  4627. If not given, the output rectangle equals the dimensions of the input image.
  4628. The output rectangle is automatically cropped at the borders of the input
  4629. image. Negative values are valid for each component.
  4630. @example
  4631. output_rect=25\ 25\ 100\ 100
  4632. @end example
  4633. @end table
  4634. Several filters can be chained for successive processing without GPU-HOST
  4635. transfers allowing for fast processing of complex filter chains.
  4636. Currently, only filters with zero (generators) or exactly one (filters) input
  4637. image and one output image are supported. Also, transition filters are not yet
  4638. usable as intended.
  4639. Some filters generate output images with additional padding depending on the
  4640. respective filter kernel. The padding is automatically removed to ensure the
  4641. filter output has the same size as the input image.
  4642. For image generators, the size of the output image is determined by the
  4643. previous output image of the filter chain or the input image of the whole
  4644. filterchain, respectively. The generators do not use the pixel information of
  4645. this image to generate their output. However, the generated output is
  4646. blended onto this image, resulting in partial or complete coverage of the
  4647. output image.
  4648. The @ref{coreimagesrc} video source can be used for generating input images
  4649. which are directly fed into the filter chain. By using it, providing input
  4650. images by another video source or an input video is not required.
  4651. @subsection Examples
  4652. @itemize
  4653. @item
  4654. List all filters available:
  4655. @example
  4656. coreimage=list_filters=true
  4657. @end example
  4658. @item
  4659. Use the CIBoxBlur filter with default options to blur an image:
  4660. @example
  4661. coreimage=filter=CIBoxBlur@@default
  4662. @end example
  4663. @item
  4664. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4665. its center at 100x100 and a radius of 50 pixels:
  4666. @example
  4667. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4668. @end example
  4669. @item
  4670. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4671. given as complete and escaped command-line for Apple's standard bash shell:
  4672. @example
  4673. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4674. @end example
  4675. @end itemize
  4676. @section crop
  4677. Crop the input video to given dimensions.
  4678. It accepts the following parameters:
  4679. @table @option
  4680. @item w, out_w
  4681. The width of the output video. It defaults to @code{iw}.
  4682. This expression is evaluated only once during the filter
  4683. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4684. @item h, out_h
  4685. The height of the output video. It defaults to @code{ih}.
  4686. This expression is evaluated only once during the filter
  4687. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4688. @item x
  4689. The horizontal position, in the input video, of the left edge of the output
  4690. video. It defaults to @code{(in_w-out_w)/2}.
  4691. This expression is evaluated per-frame.
  4692. @item y
  4693. The vertical position, in the input video, of the top edge of the output video.
  4694. It defaults to @code{(in_h-out_h)/2}.
  4695. This expression is evaluated per-frame.
  4696. @item keep_aspect
  4697. If set to 1 will force the output display aspect ratio
  4698. to be the same of the input, by changing the output sample aspect
  4699. ratio. It defaults to 0.
  4700. @item exact
  4701. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4702. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4703. It defaults to 0.
  4704. @end table
  4705. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4706. expressions containing the following constants:
  4707. @table @option
  4708. @item x
  4709. @item y
  4710. The computed values for @var{x} and @var{y}. They are evaluated for
  4711. each new frame.
  4712. @item in_w
  4713. @item in_h
  4714. The input width and height.
  4715. @item iw
  4716. @item ih
  4717. These are the same as @var{in_w} and @var{in_h}.
  4718. @item out_w
  4719. @item out_h
  4720. The output (cropped) width and height.
  4721. @item ow
  4722. @item oh
  4723. These are the same as @var{out_w} and @var{out_h}.
  4724. @item a
  4725. same as @var{iw} / @var{ih}
  4726. @item sar
  4727. input sample aspect ratio
  4728. @item dar
  4729. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4730. @item hsub
  4731. @item vsub
  4732. horizontal and vertical chroma subsample values. For example for the
  4733. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4734. @item n
  4735. The number of the input frame, starting from 0.
  4736. @item pos
  4737. the position in the file of the input frame, NAN if unknown
  4738. @item t
  4739. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4740. @end table
  4741. The expression for @var{out_w} may depend on the value of @var{out_h},
  4742. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4743. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4744. evaluated after @var{out_w} and @var{out_h}.
  4745. The @var{x} and @var{y} parameters specify the expressions for the
  4746. position of the top-left corner of the output (non-cropped) area. They
  4747. are evaluated for each frame. If the evaluated value is not valid, it
  4748. is approximated to the nearest valid value.
  4749. The expression for @var{x} may depend on @var{y}, and the expression
  4750. for @var{y} may depend on @var{x}.
  4751. @subsection Examples
  4752. @itemize
  4753. @item
  4754. Crop area with size 100x100 at position (12,34).
  4755. @example
  4756. crop=100:100:12:34
  4757. @end example
  4758. Using named options, the example above becomes:
  4759. @example
  4760. crop=w=100:h=100:x=12:y=34
  4761. @end example
  4762. @item
  4763. Crop the central input area with size 100x100:
  4764. @example
  4765. crop=100:100
  4766. @end example
  4767. @item
  4768. Crop the central input area with size 2/3 of the input video:
  4769. @example
  4770. crop=2/3*in_w:2/3*in_h
  4771. @end example
  4772. @item
  4773. Crop the input video central square:
  4774. @example
  4775. crop=out_w=in_h
  4776. crop=in_h
  4777. @end example
  4778. @item
  4779. Delimit the rectangle with the top-left corner placed at position
  4780. 100:100 and the right-bottom corner corresponding to the right-bottom
  4781. corner of the input image.
  4782. @example
  4783. crop=in_w-100:in_h-100:100:100
  4784. @end example
  4785. @item
  4786. Crop 10 pixels from the left and right borders, and 20 pixels from
  4787. the top and bottom borders
  4788. @example
  4789. crop=in_w-2*10:in_h-2*20
  4790. @end example
  4791. @item
  4792. Keep only the bottom right quarter of the input image:
  4793. @example
  4794. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4795. @end example
  4796. @item
  4797. Crop height for getting Greek harmony:
  4798. @example
  4799. crop=in_w:1/PHI*in_w
  4800. @end example
  4801. @item
  4802. Apply trembling effect:
  4803. @example
  4804. 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)
  4805. @end example
  4806. @item
  4807. Apply erratic camera effect depending on timestamp:
  4808. @example
  4809. 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)"
  4810. @end example
  4811. @item
  4812. Set x depending on the value of y:
  4813. @example
  4814. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4815. @end example
  4816. @end itemize
  4817. @subsection Commands
  4818. This filter supports the following commands:
  4819. @table @option
  4820. @item w, out_w
  4821. @item h, out_h
  4822. @item x
  4823. @item y
  4824. Set width/height of the output video and the horizontal/vertical position
  4825. in the input video.
  4826. The command accepts the same syntax of the corresponding option.
  4827. If the specified expression is not valid, it is kept at its current
  4828. value.
  4829. @end table
  4830. @section cropdetect
  4831. Auto-detect the crop size.
  4832. It calculates the necessary cropping parameters and prints the
  4833. recommended parameters via the logging system. The detected dimensions
  4834. correspond to the non-black area of the input video.
  4835. It accepts the following parameters:
  4836. @table @option
  4837. @item limit
  4838. Set higher black value threshold, which can be optionally specified
  4839. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4840. value greater to the set value is considered non-black. It defaults to 24.
  4841. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4842. on the bitdepth of the pixel format.
  4843. @item round
  4844. The value which the width/height should be divisible by. It defaults to
  4845. 16. The offset is automatically adjusted to center the video. Use 2 to
  4846. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4847. encoding to most video codecs.
  4848. @item reset_count, reset
  4849. Set the counter that determines after how many frames cropdetect will
  4850. reset the previously detected largest video area and start over to
  4851. detect the current optimal crop area. Default value is 0.
  4852. This can be useful when channel logos distort the video area. 0
  4853. indicates 'never reset', and returns the largest area encountered during
  4854. playback.
  4855. @end table
  4856. @anchor{curves}
  4857. @section curves
  4858. Apply color adjustments using curves.
  4859. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4860. component (red, green and blue) has its values defined by @var{N} key points
  4861. tied from each other using a smooth curve. The x-axis represents the pixel
  4862. values from the input frame, and the y-axis the new pixel values to be set for
  4863. the output frame.
  4864. By default, a component curve is defined by the two points @var{(0;0)} and
  4865. @var{(1;1)}. This creates a straight line where each original pixel value is
  4866. "adjusted" to its own value, which means no change to the image.
  4867. The filter allows you to redefine these two points and add some more. A new
  4868. curve (using a natural cubic spline interpolation) will be define to pass
  4869. smoothly through all these new coordinates. The new defined points needs to be
  4870. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4871. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4872. the vector spaces, the values will be clipped accordingly.
  4873. The filter accepts the following options:
  4874. @table @option
  4875. @item preset
  4876. Select one of the available color presets. This option can be used in addition
  4877. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4878. options takes priority on the preset values.
  4879. Available presets are:
  4880. @table @samp
  4881. @item none
  4882. @item color_negative
  4883. @item cross_process
  4884. @item darker
  4885. @item increase_contrast
  4886. @item lighter
  4887. @item linear_contrast
  4888. @item medium_contrast
  4889. @item negative
  4890. @item strong_contrast
  4891. @item vintage
  4892. @end table
  4893. Default is @code{none}.
  4894. @item master, m
  4895. Set the master key points. These points will define a second pass mapping. It
  4896. is sometimes called a "luminance" or "value" mapping. It can be used with
  4897. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4898. post-processing LUT.
  4899. @item red, r
  4900. Set the key points for the red component.
  4901. @item green, g
  4902. Set the key points for the green component.
  4903. @item blue, b
  4904. Set the key points for the blue component.
  4905. @item all
  4906. Set the key points for all components (not including master).
  4907. Can be used in addition to the other key points component
  4908. options. In this case, the unset component(s) will fallback on this
  4909. @option{all} setting.
  4910. @item psfile
  4911. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4912. @item plot
  4913. Save Gnuplot script of the curves in specified file.
  4914. @end table
  4915. To avoid some filtergraph syntax conflicts, each key points list need to be
  4916. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4917. @subsection Examples
  4918. @itemize
  4919. @item
  4920. Increase slightly the middle level of blue:
  4921. @example
  4922. curves=blue='0/0 0.5/0.58 1/1'
  4923. @end example
  4924. @item
  4925. Vintage effect:
  4926. @example
  4927. 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'
  4928. @end example
  4929. Here we obtain the following coordinates for each components:
  4930. @table @var
  4931. @item red
  4932. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4933. @item green
  4934. @code{(0;0) (0.50;0.48) (1;1)}
  4935. @item blue
  4936. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4937. @end table
  4938. @item
  4939. The previous example can also be achieved with the associated built-in preset:
  4940. @example
  4941. curves=preset=vintage
  4942. @end example
  4943. @item
  4944. Or simply:
  4945. @example
  4946. curves=vintage
  4947. @end example
  4948. @item
  4949. Use a Photoshop preset and redefine the points of the green component:
  4950. @example
  4951. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4952. @end example
  4953. @item
  4954. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4955. and @command{gnuplot}:
  4956. @example
  4957. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4958. gnuplot -p /tmp/curves.plt
  4959. @end example
  4960. @end itemize
  4961. @section datascope
  4962. Video data analysis filter.
  4963. This filter shows hexadecimal pixel values of part of video.
  4964. The filter accepts the following options:
  4965. @table @option
  4966. @item size, s
  4967. Set output video size.
  4968. @item x
  4969. Set x offset from where to pick pixels.
  4970. @item y
  4971. Set y offset from where to pick pixels.
  4972. @item mode
  4973. Set scope mode, can be one of the following:
  4974. @table @samp
  4975. @item mono
  4976. Draw hexadecimal pixel values with white color on black background.
  4977. @item color
  4978. Draw hexadecimal pixel values with input video pixel color on black
  4979. background.
  4980. @item color2
  4981. Draw hexadecimal pixel values on color background picked from input video,
  4982. the text color is picked in such way so its always visible.
  4983. @end table
  4984. @item axis
  4985. Draw rows and columns numbers on left and top of video.
  4986. @item opacity
  4987. Set background opacity.
  4988. @end table
  4989. @section dctdnoiz
  4990. Denoise frames using 2D DCT (frequency domain filtering).
  4991. This filter is not designed for real time.
  4992. The filter accepts the following options:
  4993. @table @option
  4994. @item sigma, s
  4995. Set the noise sigma constant.
  4996. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4997. coefficient (absolute value) below this threshold with be dropped.
  4998. If you need a more advanced filtering, see @option{expr}.
  4999. Default is @code{0}.
  5000. @item overlap
  5001. Set number overlapping pixels for each block. Since the filter can be slow, you
  5002. may want to reduce this value, at the cost of a less effective filter and the
  5003. risk of various artefacts.
  5004. If the overlapping value doesn't permit processing the whole input width or
  5005. height, a warning will be displayed and according borders won't be denoised.
  5006. Default value is @var{blocksize}-1, which is the best possible setting.
  5007. @item expr, e
  5008. Set the coefficient factor expression.
  5009. For each coefficient of a DCT block, this expression will be evaluated as a
  5010. multiplier value for the coefficient.
  5011. If this is option is set, the @option{sigma} option will be ignored.
  5012. The absolute value of the coefficient can be accessed through the @var{c}
  5013. variable.
  5014. @item n
  5015. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5016. @var{blocksize}, which is the width and height of the processed blocks.
  5017. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5018. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5019. on the speed processing. Also, a larger block size does not necessarily means a
  5020. better de-noising.
  5021. @end table
  5022. @subsection Examples
  5023. Apply a denoise with a @option{sigma} of @code{4.5}:
  5024. @example
  5025. dctdnoiz=4.5
  5026. @end example
  5027. The same operation can be achieved using the expression system:
  5028. @example
  5029. dctdnoiz=e='gte(c, 4.5*3)'
  5030. @end example
  5031. Violent denoise using a block size of @code{16x16}:
  5032. @example
  5033. dctdnoiz=15:n=4
  5034. @end example
  5035. @section deband
  5036. Remove banding artifacts from input video.
  5037. It works by replacing banded pixels with average value of referenced pixels.
  5038. The filter accepts the following options:
  5039. @table @option
  5040. @item 1thr
  5041. @item 2thr
  5042. @item 3thr
  5043. @item 4thr
  5044. Set banding detection threshold for each plane. Default is 0.02.
  5045. Valid range is 0.00003 to 0.5.
  5046. If difference between current pixel and reference pixel is less than threshold,
  5047. it will be considered as banded.
  5048. @item range, r
  5049. Banding detection range in pixels. Default is 16. If positive, random number
  5050. in range 0 to set value will be used. If negative, exact absolute value
  5051. will be used.
  5052. The range defines square of four pixels around current pixel.
  5053. @item direction, d
  5054. Set direction in radians from which four pixel will be compared. If positive,
  5055. random direction from 0 to set direction will be picked. If negative, exact of
  5056. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5057. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5058. column.
  5059. @item blur, b
  5060. If enabled, current pixel is compared with average value of all four
  5061. surrounding pixels. The default is enabled. If disabled current pixel is
  5062. compared with all four surrounding pixels. The pixel is considered banded
  5063. if only all four differences with surrounding pixels are less than threshold.
  5064. @item coupling, c
  5065. If enabled, current pixel is changed if and only if all pixel components are banded,
  5066. e.g. banding detection threshold is triggered for all color components.
  5067. The default is disabled.
  5068. @end table
  5069. @anchor{decimate}
  5070. @section decimate
  5071. Drop duplicated frames at regular intervals.
  5072. The filter accepts the following options:
  5073. @table @option
  5074. @item cycle
  5075. Set the number of frames from which one will be dropped. Setting this to
  5076. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5077. Default is @code{5}.
  5078. @item dupthresh
  5079. Set the threshold for duplicate detection. If the difference metric for a frame
  5080. is less than or equal to this value, then it is declared as duplicate. Default
  5081. is @code{1.1}
  5082. @item scthresh
  5083. Set scene change threshold. Default is @code{15}.
  5084. @item blockx
  5085. @item blocky
  5086. Set the size of the x and y-axis blocks used during metric calculations.
  5087. Larger blocks give better noise suppression, but also give worse detection of
  5088. small movements. Must be a power of two. Default is @code{32}.
  5089. @item ppsrc
  5090. Mark main input as a pre-processed input and activate clean source input
  5091. stream. This allows the input to be pre-processed with various filters to help
  5092. the metrics calculation while keeping the frame selection lossless. When set to
  5093. @code{1}, the first stream is for the pre-processed input, and the second
  5094. stream is the clean source from where the kept frames are chosen. Default is
  5095. @code{0}.
  5096. @item chroma
  5097. Set whether or not chroma is considered in the metric calculations. Default is
  5098. @code{1}.
  5099. @end table
  5100. @section deflate
  5101. Apply deflate effect to the video.
  5102. This filter replaces the pixel by the local(3x3) average by taking into account
  5103. only values lower than the pixel.
  5104. It accepts the following options:
  5105. @table @option
  5106. @item threshold0
  5107. @item threshold1
  5108. @item threshold2
  5109. @item threshold3
  5110. Limit the maximum change for each plane, default is 65535.
  5111. If 0, plane will remain unchanged.
  5112. @end table
  5113. @section deflicker
  5114. Remove temporal frame luminance variations.
  5115. It accepts the following options:
  5116. @table @option
  5117. @item size, s
  5118. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5119. @item mode, m
  5120. Set averaging mode to smooth temporal luminance variations.
  5121. Available values are:
  5122. @table @samp
  5123. @item am
  5124. Arithmetic mean
  5125. @item gm
  5126. Geometric mean
  5127. @item hm
  5128. Harmonic mean
  5129. @item qm
  5130. Quadratic mean
  5131. @item cm
  5132. Cubic mean
  5133. @item pm
  5134. Power mean
  5135. @item median
  5136. Median
  5137. @end table
  5138. @item bypass
  5139. Do not actually modify frame. Useful when one only wants metadata.
  5140. @end table
  5141. @section dejudder
  5142. Remove judder produced by partially interlaced telecined content.
  5143. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5144. source was partially telecined content then the output of @code{pullup,dejudder}
  5145. will have a variable frame rate. May change the recorded frame rate of the
  5146. container. Aside from that change, this filter will not affect constant frame
  5147. rate video.
  5148. The option available in this filter is:
  5149. @table @option
  5150. @item cycle
  5151. Specify the length of the window over which the judder repeats.
  5152. Accepts any integer greater than 1. Useful values are:
  5153. @table @samp
  5154. @item 4
  5155. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5156. @item 5
  5157. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5158. @item 20
  5159. If a mixture of the two.
  5160. @end table
  5161. The default is @samp{4}.
  5162. @end table
  5163. @section delogo
  5164. Suppress a TV station logo by a simple interpolation of the surrounding
  5165. pixels. Just set a rectangle covering the logo and watch it disappear
  5166. (and sometimes something even uglier appear - your mileage may vary).
  5167. It accepts the following parameters:
  5168. @table @option
  5169. @item x
  5170. @item y
  5171. Specify the top left corner coordinates of the logo. They must be
  5172. specified.
  5173. @item w
  5174. @item h
  5175. Specify the width and height of the logo to clear. They must be
  5176. specified.
  5177. @item band, t
  5178. Specify the thickness of the fuzzy edge of the rectangle (added to
  5179. @var{w} and @var{h}). The default value is 1. This option is
  5180. deprecated, setting higher values should no longer be necessary and
  5181. is not recommended.
  5182. @item show
  5183. When set to 1, a green rectangle is drawn on the screen to simplify
  5184. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5185. The default value is 0.
  5186. The rectangle is drawn on the outermost pixels which will be (partly)
  5187. replaced with interpolated values. The values of the next pixels
  5188. immediately outside this rectangle in each direction will be used to
  5189. compute the interpolated pixel values inside the rectangle.
  5190. @end table
  5191. @subsection Examples
  5192. @itemize
  5193. @item
  5194. Set a rectangle covering the area with top left corner coordinates 0,0
  5195. and size 100x77, and a band of size 10:
  5196. @example
  5197. delogo=x=0:y=0:w=100:h=77:band=10
  5198. @end example
  5199. @end itemize
  5200. @section deshake
  5201. Attempt to fix small changes in horizontal and/or vertical shift. This
  5202. filter helps remove camera shake from hand-holding a camera, bumping a
  5203. tripod, moving on a vehicle, etc.
  5204. The filter accepts the following options:
  5205. @table @option
  5206. @item x
  5207. @item y
  5208. @item w
  5209. @item h
  5210. Specify a rectangular area where to limit the search for motion
  5211. vectors.
  5212. If desired the search for motion vectors can be limited to a
  5213. rectangular area of the frame defined by its top left corner, width
  5214. and height. These parameters have the same meaning as the drawbox
  5215. filter which can be used to visualise the position of the bounding
  5216. box.
  5217. This is useful when simultaneous movement of subjects within the frame
  5218. might be confused for camera motion by the motion vector search.
  5219. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5220. then the full frame is used. This allows later options to be set
  5221. without specifying the bounding box for the motion vector search.
  5222. Default - search the whole frame.
  5223. @item rx
  5224. @item ry
  5225. Specify the maximum extent of movement in x and y directions in the
  5226. range 0-64 pixels. Default 16.
  5227. @item edge
  5228. Specify how to generate pixels to fill blanks at the edge of the
  5229. frame. Available values are:
  5230. @table @samp
  5231. @item blank, 0
  5232. Fill zeroes at blank locations
  5233. @item original, 1
  5234. Original image at blank locations
  5235. @item clamp, 2
  5236. Extruded edge value at blank locations
  5237. @item mirror, 3
  5238. Mirrored edge at blank locations
  5239. @end table
  5240. Default value is @samp{mirror}.
  5241. @item blocksize
  5242. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5243. default 8.
  5244. @item contrast
  5245. Specify the contrast threshold for blocks. Only blocks with more than
  5246. the specified contrast (difference between darkest and lightest
  5247. pixels) will be considered. Range 1-255, default 125.
  5248. @item search
  5249. Specify the search strategy. Available values are:
  5250. @table @samp
  5251. @item exhaustive, 0
  5252. Set exhaustive search
  5253. @item less, 1
  5254. Set less exhaustive search.
  5255. @end table
  5256. Default value is @samp{exhaustive}.
  5257. @item filename
  5258. If set then a detailed log of the motion search is written to the
  5259. specified file.
  5260. @item opencl
  5261. If set to 1, specify using OpenCL capabilities, only available if
  5262. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5263. @end table
  5264. @section detelecine
  5265. Apply an exact inverse of the telecine operation. It requires a predefined
  5266. pattern specified using the pattern option which must be the same as that passed
  5267. to the telecine filter.
  5268. This filter accepts the following options:
  5269. @table @option
  5270. @item first_field
  5271. @table @samp
  5272. @item top, t
  5273. top field first
  5274. @item bottom, b
  5275. bottom field first
  5276. The default value is @code{top}.
  5277. @end table
  5278. @item pattern
  5279. A string of numbers representing the pulldown pattern you wish to apply.
  5280. The default value is @code{23}.
  5281. @item start_frame
  5282. A number representing position of the first frame with respect to the telecine
  5283. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5284. @end table
  5285. @section dilation
  5286. Apply dilation effect to the video.
  5287. This filter replaces the pixel by the local(3x3) maximum.
  5288. It accepts the following options:
  5289. @table @option
  5290. @item threshold0
  5291. @item threshold1
  5292. @item threshold2
  5293. @item threshold3
  5294. Limit the maximum change for each plane, default is 65535.
  5295. If 0, plane will remain unchanged.
  5296. @item coordinates
  5297. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5298. pixels are used.
  5299. Flags to local 3x3 coordinates maps like this:
  5300. 1 2 3
  5301. 4 5
  5302. 6 7 8
  5303. @end table
  5304. @section displace
  5305. Displace pixels as indicated by second and third input stream.
  5306. It takes three input streams and outputs one stream, the first input is the
  5307. source, and second and third input are displacement maps.
  5308. The second input specifies how much to displace pixels along the
  5309. x-axis, while the third input specifies how much to displace pixels
  5310. along the y-axis.
  5311. If one of displacement map streams terminates, last frame from that
  5312. displacement map will be used.
  5313. Note that once generated, displacements maps can be reused over and over again.
  5314. A description of the accepted options follows.
  5315. @table @option
  5316. @item edge
  5317. Set displace behavior for pixels that are out of range.
  5318. Available values are:
  5319. @table @samp
  5320. @item blank
  5321. Missing pixels are replaced by black pixels.
  5322. @item smear
  5323. Adjacent pixels will spread out to replace missing pixels.
  5324. @item wrap
  5325. Out of range pixels are wrapped so they point to pixels of other side.
  5326. @end table
  5327. Default is @samp{smear}.
  5328. @end table
  5329. @subsection Examples
  5330. @itemize
  5331. @item
  5332. Add ripple effect to rgb input of video size hd720:
  5333. @example
  5334. 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
  5335. @end example
  5336. @item
  5337. Add wave effect to rgb input of video size hd720:
  5338. @example
  5339. 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
  5340. @end example
  5341. @end itemize
  5342. @section drawbox
  5343. Draw a colored box on the input image.
  5344. It accepts the following parameters:
  5345. @table @option
  5346. @item x
  5347. @item y
  5348. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5349. @item width, w
  5350. @item height, h
  5351. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5352. the input width and height. It defaults to 0.
  5353. @item color, c
  5354. Specify the color of the box to write. For the general syntax of this option,
  5355. check the "Color" section in the ffmpeg-utils manual. If the special
  5356. value @code{invert} is used, the box edge color is the same as the
  5357. video with inverted luma.
  5358. @item thickness, t
  5359. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5360. See below for the list of accepted constants.
  5361. @end table
  5362. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5363. following constants:
  5364. @table @option
  5365. @item dar
  5366. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5367. @item hsub
  5368. @item vsub
  5369. horizontal and vertical chroma subsample values. For example for the
  5370. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5371. @item in_h, ih
  5372. @item in_w, iw
  5373. The input width and height.
  5374. @item sar
  5375. The input sample aspect ratio.
  5376. @item x
  5377. @item y
  5378. The x and y offset coordinates where the box is drawn.
  5379. @item w
  5380. @item h
  5381. The width and height of the drawn box.
  5382. @item t
  5383. The thickness of the drawn box.
  5384. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5385. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5386. @end table
  5387. @subsection Examples
  5388. @itemize
  5389. @item
  5390. Draw a black box around the edge of the input image:
  5391. @example
  5392. drawbox
  5393. @end example
  5394. @item
  5395. Draw a box with color red and an opacity of 50%:
  5396. @example
  5397. drawbox=10:20:200:60:red@@0.5
  5398. @end example
  5399. The previous example can be specified as:
  5400. @example
  5401. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5402. @end example
  5403. @item
  5404. Fill the box with pink color:
  5405. @example
  5406. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5407. @end example
  5408. @item
  5409. Draw a 2-pixel red 2.40:1 mask:
  5410. @example
  5411. 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
  5412. @end example
  5413. @end itemize
  5414. @section drawgrid
  5415. Draw a grid on the input image.
  5416. It accepts the following parameters:
  5417. @table @option
  5418. @item x
  5419. @item y
  5420. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5421. @item width, w
  5422. @item height, h
  5423. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5424. input width and height, respectively, minus @code{thickness}, so image gets
  5425. framed. Default to 0.
  5426. @item color, c
  5427. Specify the color of the grid. For the general syntax of this option,
  5428. check the "Color" section in the ffmpeg-utils manual. If the special
  5429. value @code{invert} is used, the grid color is the same as the
  5430. video with inverted luma.
  5431. @item thickness, t
  5432. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5433. See below for the list of accepted constants.
  5434. @end table
  5435. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5436. following constants:
  5437. @table @option
  5438. @item dar
  5439. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5440. @item hsub
  5441. @item vsub
  5442. horizontal and vertical chroma subsample values. For example for the
  5443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5444. @item in_h, ih
  5445. @item in_w, iw
  5446. The input grid cell width and height.
  5447. @item sar
  5448. The input sample aspect ratio.
  5449. @item x
  5450. @item y
  5451. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5452. @item w
  5453. @item h
  5454. The width and height of the drawn cell.
  5455. @item t
  5456. The thickness of the drawn cell.
  5457. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5458. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5459. @end table
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5464. @example
  5465. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5466. @end example
  5467. @item
  5468. Draw a white 3x3 grid with an opacity of 50%:
  5469. @example
  5470. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5471. @end example
  5472. @end itemize
  5473. @anchor{drawtext}
  5474. @section drawtext
  5475. Draw a text string or text from a specified file on top of a video, using the
  5476. libfreetype library.
  5477. To enable compilation of this filter, you need to configure FFmpeg with
  5478. @code{--enable-libfreetype}.
  5479. To enable default font fallback and the @var{font} option you need to
  5480. configure FFmpeg with @code{--enable-libfontconfig}.
  5481. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5482. @code{--enable-libfribidi}.
  5483. @subsection Syntax
  5484. It accepts the following parameters:
  5485. @table @option
  5486. @item box
  5487. Used to draw a box around text using the background color.
  5488. The value must be either 1 (enable) or 0 (disable).
  5489. The default value of @var{box} is 0.
  5490. @item boxborderw
  5491. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5492. The default value of @var{boxborderw} is 0.
  5493. @item boxcolor
  5494. The color to be used for drawing box around text. For the syntax of this
  5495. option, check the "Color" section in the ffmpeg-utils manual.
  5496. The default value of @var{boxcolor} is "white".
  5497. @item line_spacing
  5498. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5499. The default value of @var{line_spacing} is 0.
  5500. @item borderw
  5501. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5502. The default value of @var{borderw} is 0.
  5503. @item bordercolor
  5504. Set the color to be used for drawing border around text. For the syntax of this
  5505. option, check the "Color" section in the ffmpeg-utils manual.
  5506. The default value of @var{bordercolor} is "black".
  5507. @item expansion
  5508. Select how the @var{text} is expanded. Can be either @code{none},
  5509. @code{strftime} (deprecated) or
  5510. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5511. below for details.
  5512. @item basetime
  5513. Set a start time for the count. Value is in microseconds. Only applied
  5514. in the deprecated strftime expansion mode. To emulate in normal expansion
  5515. mode use the @code{pts} function, supplying the start time (in seconds)
  5516. as the second argument.
  5517. @item fix_bounds
  5518. If true, check and fix text coords to avoid clipping.
  5519. @item fontcolor
  5520. The color to be used for drawing fonts. For the syntax of this option, check
  5521. the "Color" section in the ffmpeg-utils manual.
  5522. The default value of @var{fontcolor} is "black".
  5523. @item fontcolor_expr
  5524. String which is expanded the same way as @var{text} to obtain dynamic
  5525. @var{fontcolor} value. By default this option has empty value and is not
  5526. processed. When this option is set, it overrides @var{fontcolor} option.
  5527. @item font
  5528. The font family to be used for drawing text. By default Sans.
  5529. @item fontfile
  5530. The font file to be used for drawing text. The path must be included.
  5531. This parameter is mandatory if the fontconfig support is disabled.
  5532. @item alpha
  5533. Draw the text applying alpha blending. The value can
  5534. be a number between 0.0 and 1.0.
  5535. The expression accepts the same variables @var{x, y} as well.
  5536. The default value is 1.
  5537. Please see @var{fontcolor_expr}.
  5538. @item fontsize
  5539. The font size to be used for drawing text.
  5540. The default value of @var{fontsize} is 16.
  5541. @item text_shaping
  5542. If set to 1, attempt to shape the text (for example, reverse the order of
  5543. right-to-left text and join Arabic characters) before drawing it.
  5544. Otherwise, just draw the text exactly as given.
  5545. By default 1 (if supported).
  5546. @item ft_load_flags
  5547. The flags to be used for loading the fonts.
  5548. The flags map the corresponding flags supported by libfreetype, and are
  5549. a combination of the following values:
  5550. @table @var
  5551. @item default
  5552. @item no_scale
  5553. @item no_hinting
  5554. @item render
  5555. @item no_bitmap
  5556. @item vertical_layout
  5557. @item force_autohint
  5558. @item crop_bitmap
  5559. @item pedantic
  5560. @item ignore_global_advance_width
  5561. @item no_recurse
  5562. @item ignore_transform
  5563. @item monochrome
  5564. @item linear_design
  5565. @item no_autohint
  5566. @end table
  5567. Default value is "default".
  5568. For more information consult the documentation for the FT_LOAD_*
  5569. libfreetype flags.
  5570. @item shadowcolor
  5571. The color to be used for drawing a shadow behind the drawn text. For the
  5572. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5573. The default value of @var{shadowcolor} is "black".
  5574. @item shadowx
  5575. @item shadowy
  5576. The x and y offsets for the text shadow position with respect to the
  5577. position of the text. They can be either positive or negative
  5578. values. The default value for both is "0".
  5579. @item start_number
  5580. The starting frame number for the n/frame_num variable. The default value
  5581. is "0".
  5582. @item tabsize
  5583. The size in number of spaces to use for rendering the tab.
  5584. Default value is 4.
  5585. @item timecode
  5586. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5587. format. It can be used with or without text parameter. @var{timecode_rate}
  5588. option must be specified.
  5589. @item timecode_rate, rate, r
  5590. Set the timecode frame rate (timecode only).
  5591. @item tc24hmax
  5592. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5593. Default is 0 (disabled).
  5594. @item text
  5595. The text string to be drawn. The text must be a sequence of UTF-8
  5596. encoded characters.
  5597. This parameter is mandatory if no file is specified with the parameter
  5598. @var{textfile}.
  5599. @item textfile
  5600. A text file containing text to be drawn. The text must be a sequence
  5601. of UTF-8 encoded characters.
  5602. This parameter is mandatory if no text string is specified with the
  5603. parameter @var{text}.
  5604. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5605. @item reload
  5606. If set to 1, the @var{textfile} will be reloaded before each frame.
  5607. Be sure to update it atomically, or it may be read partially, or even fail.
  5608. @item x
  5609. @item y
  5610. The expressions which specify the offsets where text will be drawn
  5611. within the video frame. They are relative to the top/left border of the
  5612. output image.
  5613. The default value of @var{x} and @var{y} is "0".
  5614. See below for the list of accepted constants and functions.
  5615. @end table
  5616. The parameters for @var{x} and @var{y} are expressions containing the
  5617. following constants and functions:
  5618. @table @option
  5619. @item dar
  5620. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5621. @item hsub
  5622. @item vsub
  5623. horizontal and vertical chroma subsample values. For example for the
  5624. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5625. @item line_h, lh
  5626. the height of each text line
  5627. @item main_h, h, H
  5628. the input height
  5629. @item main_w, w, W
  5630. the input width
  5631. @item max_glyph_a, ascent
  5632. the maximum distance from the baseline to the highest/upper grid
  5633. coordinate used to place a glyph outline point, for all the rendered
  5634. glyphs.
  5635. It is a positive value, due to the grid's orientation with the Y axis
  5636. upwards.
  5637. @item max_glyph_d, descent
  5638. the maximum distance from the baseline to the lowest grid coordinate
  5639. used to place a glyph outline point, for all the rendered glyphs.
  5640. This is a negative value, due to the grid's orientation, with the Y axis
  5641. upwards.
  5642. @item max_glyph_h
  5643. maximum glyph height, that is the maximum height for all the glyphs
  5644. contained in the rendered text, it is equivalent to @var{ascent} -
  5645. @var{descent}.
  5646. @item max_glyph_w
  5647. maximum glyph width, that is the maximum width for all the glyphs
  5648. contained in the rendered text
  5649. @item n
  5650. the number of input frame, starting from 0
  5651. @item rand(min, max)
  5652. return a random number included between @var{min} and @var{max}
  5653. @item sar
  5654. The input sample aspect ratio.
  5655. @item t
  5656. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5657. @item text_h, th
  5658. the height of the rendered text
  5659. @item text_w, tw
  5660. the width of the rendered text
  5661. @item x
  5662. @item y
  5663. the x and y offset coordinates where the text is drawn.
  5664. These parameters allow the @var{x} and @var{y} expressions to refer
  5665. each other, so you can for example specify @code{y=x/dar}.
  5666. @end table
  5667. @anchor{drawtext_expansion}
  5668. @subsection Text expansion
  5669. If @option{expansion} is set to @code{strftime},
  5670. the filter recognizes strftime() sequences in the provided text and
  5671. expands them accordingly. Check the documentation of strftime(). This
  5672. feature is deprecated.
  5673. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5674. If @option{expansion} is set to @code{normal} (which is the default),
  5675. the following expansion mechanism is used.
  5676. The backslash character @samp{\}, followed by any character, always expands to
  5677. the second character.
  5678. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5679. braces is a function name, possibly followed by arguments separated by ':'.
  5680. If the arguments contain special characters or delimiters (':' or '@}'),
  5681. they should be escaped.
  5682. Note that they probably must also be escaped as the value for the
  5683. @option{text} option in the filter argument string and as the filter
  5684. argument in the filtergraph description, and possibly also for the shell,
  5685. that makes up to four levels of escaping; using a text file avoids these
  5686. problems.
  5687. The following functions are available:
  5688. @table @command
  5689. @item expr, e
  5690. The expression evaluation result.
  5691. It must take one argument specifying the expression to be evaluated,
  5692. which accepts the same constants and functions as the @var{x} and
  5693. @var{y} values. Note that not all constants should be used, for
  5694. example the text size is not known when evaluating the expression, so
  5695. the constants @var{text_w} and @var{text_h} will have an undefined
  5696. value.
  5697. @item expr_int_format, eif
  5698. Evaluate the expression's value and output as formatted integer.
  5699. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5700. The second argument specifies the output format. Allowed values are @samp{x},
  5701. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5702. @code{printf} function.
  5703. The third parameter is optional and sets the number of positions taken by the output.
  5704. It can be used to add padding with zeros from the left.
  5705. @item gmtime
  5706. The time at which the filter is running, expressed in UTC.
  5707. It can accept an argument: a strftime() format string.
  5708. @item localtime
  5709. The time at which the filter is running, expressed in the local time zone.
  5710. It can accept an argument: a strftime() format string.
  5711. @item metadata
  5712. Frame metadata. Takes one or two arguments.
  5713. The first argument is mandatory and specifies the metadata key.
  5714. The second argument is optional and specifies a default value, used when the
  5715. metadata key is not found or empty.
  5716. @item n, frame_num
  5717. The frame number, starting from 0.
  5718. @item pict_type
  5719. A 1 character description of the current picture type.
  5720. @item pts
  5721. The timestamp of the current frame.
  5722. It can take up to three arguments.
  5723. The first argument is the format of the timestamp; it defaults to @code{flt}
  5724. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5725. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5726. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5727. @code{localtime} stands for the timestamp of the frame formatted as
  5728. local time zone time.
  5729. The second argument is an offset added to the timestamp.
  5730. If the format is set to @code{localtime} or @code{gmtime},
  5731. a third argument may be supplied: a strftime() format string.
  5732. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5733. @end table
  5734. @subsection Examples
  5735. @itemize
  5736. @item
  5737. Draw "Test Text" with font FreeSerif, using the default values for the
  5738. optional parameters.
  5739. @example
  5740. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5741. @end example
  5742. @item
  5743. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5744. and y=50 (counting from the top-left corner of the screen), text is
  5745. yellow with a red box around it. Both the text and the box have an
  5746. opacity of 20%.
  5747. @example
  5748. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5749. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5750. @end example
  5751. Note that the double quotes are not necessary if spaces are not used
  5752. within the parameter list.
  5753. @item
  5754. Show the text at the center of the video frame:
  5755. @example
  5756. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5757. @end example
  5758. @item
  5759. Show the text at a random position, switching to a new position every 30 seconds:
  5760. @example
  5761. 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)"
  5762. @end example
  5763. @item
  5764. Show a text line sliding from right to left in the last row of the video
  5765. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5766. with no newlines.
  5767. @example
  5768. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5769. @end example
  5770. @item
  5771. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5772. @example
  5773. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5774. @end example
  5775. @item
  5776. Draw a single green letter "g", at the center of the input video.
  5777. The glyph baseline is placed at half screen height.
  5778. @example
  5779. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5780. @end example
  5781. @item
  5782. Show text for 1 second every 3 seconds:
  5783. @example
  5784. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5785. @end example
  5786. @item
  5787. Use fontconfig to set the font. Note that the colons need to be escaped.
  5788. @example
  5789. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5790. @end example
  5791. @item
  5792. Print the date of a real-time encoding (see strftime(3)):
  5793. @example
  5794. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5795. @end example
  5796. @item
  5797. Show text fading in and out (appearing/disappearing):
  5798. @example
  5799. #!/bin/sh
  5800. DS=1.0 # display start
  5801. DE=10.0 # display end
  5802. FID=1.5 # fade in duration
  5803. FOD=5 # fade out duration
  5804. 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 @}"
  5805. @end example
  5806. @item
  5807. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5808. and the @option{fontsize} value are included in the @option{y} offset.
  5809. @example
  5810. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5811. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5812. @end example
  5813. @end itemize
  5814. For more information about libfreetype, check:
  5815. @url{http://www.freetype.org/}.
  5816. For more information about fontconfig, check:
  5817. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5818. For more information about libfribidi, check:
  5819. @url{http://fribidi.org/}.
  5820. @section edgedetect
  5821. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5822. The filter accepts the following options:
  5823. @table @option
  5824. @item low
  5825. @item high
  5826. Set low and high threshold values used by the Canny thresholding
  5827. algorithm.
  5828. The high threshold selects the "strong" edge pixels, which are then
  5829. connected through 8-connectivity with the "weak" edge pixels selected
  5830. by the low threshold.
  5831. @var{low} and @var{high} threshold values must be chosen in the range
  5832. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5833. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5834. is @code{50/255}.
  5835. @item mode
  5836. Define the drawing mode.
  5837. @table @samp
  5838. @item wires
  5839. Draw white/gray wires on black background.
  5840. @item colormix
  5841. Mix the colors to create a paint/cartoon effect.
  5842. @end table
  5843. Default value is @var{wires}.
  5844. @end table
  5845. @subsection Examples
  5846. @itemize
  5847. @item
  5848. Standard edge detection with custom values for the hysteresis thresholding:
  5849. @example
  5850. edgedetect=low=0.1:high=0.4
  5851. @end example
  5852. @item
  5853. Painting effect without thresholding:
  5854. @example
  5855. edgedetect=mode=colormix:high=0
  5856. @end example
  5857. @end itemize
  5858. @section eq
  5859. Set brightness, contrast, saturation and approximate gamma adjustment.
  5860. The filter accepts the following options:
  5861. @table @option
  5862. @item contrast
  5863. Set the contrast expression. The value must be a float value in range
  5864. @code{-2.0} to @code{2.0}. The default value is "1".
  5865. @item brightness
  5866. Set the brightness expression. The value must be a float value in
  5867. range @code{-1.0} to @code{1.0}. The default value is "0".
  5868. @item saturation
  5869. Set the saturation expression. The value must be a float in
  5870. range @code{0.0} to @code{3.0}. The default value is "1".
  5871. @item gamma
  5872. Set the gamma expression. The value must be a float in range
  5873. @code{0.1} to @code{10.0}. The default value is "1".
  5874. @item gamma_r
  5875. Set the gamma expression for red. The value must be a float in
  5876. range @code{0.1} to @code{10.0}. The default value is "1".
  5877. @item gamma_g
  5878. Set the gamma expression for green. The value must be a float in range
  5879. @code{0.1} to @code{10.0}. The default value is "1".
  5880. @item gamma_b
  5881. Set the gamma expression for blue. The value must be a float in range
  5882. @code{0.1} to @code{10.0}. The default value is "1".
  5883. @item gamma_weight
  5884. Set the gamma weight expression. It can be used to reduce the effect
  5885. of a high gamma value on bright image areas, e.g. keep them from
  5886. getting overamplified and just plain white. The value must be a float
  5887. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5888. gamma correction all the way down while @code{1.0} leaves it at its
  5889. full strength. Default is "1".
  5890. @item eval
  5891. Set when the expressions for brightness, contrast, saturation and
  5892. gamma expressions are evaluated.
  5893. It accepts the following values:
  5894. @table @samp
  5895. @item init
  5896. only evaluate expressions once during the filter initialization or
  5897. when a command is processed
  5898. @item frame
  5899. evaluate expressions for each incoming frame
  5900. @end table
  5901. Default value is @samp{init}.
  5902. @end table
  5903. The expressions accept the following parameters:
  5904. @table @option
  5905. @item n
  5906. frame count of the input frame starting from 0
  5907. @item pos
  5908. byte position of the corresponding packet in the input file, NAN if
  5909. unspecified
  5910. @item r
  5911. frame rate of the input video, NAN if the input frame rate is unknown
  5912. @item t
  5913. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5914. @end table
  5915. @subsection Commands
  5916. The filter supports the following commands:
  5917. @table @option
  5918. @item contrast
  5919. Set the contrast expression.
  5920. @item brightness
  5921. Set the brightness expression.
  5922. @item saturation
  5923. Set the saturation expression.
  5924. @item gamma
  5925. Set the gamma expression.
  5926. @item gamma_r
  5927. Set the gamma_r expression.
  5928. @item gamma_g
  5929. Set gamma_g expression.
  5930. @item gamma_b
  5931. Set gamma_b expression.
  5932. @item gamma_weight
  5933. Set gamma_weight expression.
  5934. The command accepts the same syntax of the corresponding option.
  5935. If the specified expression is not valid, it is kept at its current
  5936. value.
  5937. @end table
  5938. @section erosion
  5939. Apply erosion effect to the video.
  5940. This filter replaces the pixel by the local(3x3) minimum.
  5941. It accepts the following options:
  5942. @table @option
  5943. @item threshold0
  5944. @item threshold1
  5945. @item threshold2
  5946. @item threshold3
  5947. Limit the maximum change for each plane, default is 65535.
  5948. If 0, plane will remain unchanged.
  5949. @item coordinates
  5950. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5951. pixels are used.
  5952. Flags to local 3x3 coordinates maps like this:
  5953. 1 2 3
  5954. 4 5
  5955. 6 7 8
  5956. @end table
  5957. @section extractplanes
  5958. Extract color channel components from input video stream into
  5959. separate grayscale video streams.
  5960. The filter accepts the following option:
  5961. @table @option
  5962. @item planes
  5963. Set plane(s) to extract.
  5964. Available values for planes are:
  5965. @table @samp
  5966. @item y
  5967. @item u
  5968. @item v
  5969. @item a
  5970. @item r
  5971. @item g
  5972. @item b
  5973. @end table
  5974. Choosing planes not available in the input will result in an error.
  5975. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5976. with @code{y}, @code{u}, @code{v} planes at same time.
  5977. @end table
  5978. @subsection Examples
  5979. @itemize
  5980. @item
  5981. Extract luma, u and v color channel component from input video frame
  5982. into 3 grayscale outputs:
  5983. @example
  5984. 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
  5985. @end example
  5986. @end itemize
  5987. @section elbg
  5988. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5989. For each input image, the filter will compute the optimal mapping from
  5990. the input to the output given the codebook length, that is the number
  5991. of distinct output colors.
  5992. This filter accepts the following options.
  5993. @table @option
  5994. @item codebook_length, l
  5995. Set codebook length. The value must be a positive integer, and
  5996. represents the number of distinct output colors. Default value is 256.
  5997. @item nb_steps, n
  5998. Set the maximum number of iterations to apply for computing the optimal
  5999. mapping. The higher the value the better the result and the higher the
  6000. computation time. Default value is 1.
  6001. @item seed, s
  6002. Set a random seed, must be an integer included between 0 and
  6003. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6004. will try to use a good random seed on a best effort basis.
  6005. @item pal8
  6006. Set pal8 output pixel format. This option does not work with codebook
  6007. length greater than 256.
  6008. @end table
  6009. @section fade
  6010. Apply a fade-in/out effect to the input video.
  6011. It accepts the following parameters:
  6012. @table @option
  6013. @item type, t
  6014. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6015. effect.
  6016. Default is @code{in}.
  6017. @item start_frame, s
  6018. Specify the number of the frame to start applying the fade
  6019. effect at. Default is 0.
  6020. @item nb_frames, n
  6021. The number of frames that the fade effect lasts. At the end of the
  6022. fade-in effect, the output video will have the same intensity as the input video.
  6023. At the end of the fade-out transition, the output video will be filled with the
  6024. selected @option{color}.
  6025. Default is 25.
  6026. @item alpha
  6027. If set to 1, fade only alpha channel, if one exists on the input.
  6028. Default value is 0.
  6029. @item start_time, st
  6030. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6031. effect. If both start_frame and start_time are specified, the fade will start at
  6032. whichever comes last. Default is 0.
  6033. @item duration, d
  6034. The number of seconds for which the fade effect has to last. At the end of the
  6035. fade-in effect the output video will have the same intensity as the input video,
  6036. at the end of the fade-out transition the output video will be filled with the
  6037. selected @option{color}.
  6038. If both duration and nb_frames are specified, duration is used. Default is 0
  6039. (nb_frames is used by default).
  6040. @item color, c
  6041. Specify the color of the fade. Default is "black".
  6042. @end table
  6043. @subsection Examples
  6044. @itemize
  6045. @item
  6046. Fade in the first 30 frames of video:
  6047. @example
  6048. fade=in:0:30
  6049. @end example
  6050. The command above is equivalent to:
  6051. @example
  6052. fade=t=in:s=0:n=30
  6053. @end example
  6054. @item
  6055. Fade out the last 45 frames of a 200-frame video:
  6056. @example
  6057. fade=out:155:45
  6058. fade=type=out:start_frame=155:nb_frames=45
  6059. @end example
  6060. @item
  6061. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6062. @example
  6063. fade=in:0:25, fade=out:975:25
  6064. @end example
  6065. @item
  6066. Make the first 5 frames yellow, then fade in from frame 5-24:
  6067. @example
  6068. fade=in:5:20:color=yellow
  6069. @end example
  6070. @item
  6071. Fade in alpha over first 25 frames of video:
  6072. @example
  6073. fade=in:0:25:alpha=1
  6074. @end example
  6075. @item
  6076. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6077. @example
  6078. fade=t=in:st=5.5:d=0.5
  6079. @end example
  6080. @end itemize
  6081. @section fftfilt
  6082. Apply arbitrary expressions to samples in frequency domain
  6083. @table @option
  6084. @item dc_Y
  6085. Adjust the dc value (gain) of the luma plane of the image. The filter
  6086. accepts an integer value in range @code{0} to @code{1000}. The default
  6087. value is set to @code{0}.
  6088. @item dc_U
  6089. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6090. filter accepts an integer value in range @code{0} to @code{1000}. The
  6091. default value is set to @code{0}.
  6092. @item dc_V
  6093. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6094. filter accepts an integer value in range @code{0} to @code{1000}. The
  6095. default value is set to @code{0}.
  6096. @item weight_Y
  6097. Set the frequency domain weight expression for the luma plane.
  6098. @item weight_U
  6099. Set the frequency domain weight expression for the 1st chroma plane.
  6100. @item weight_V
  6101. Set the frequency domain weight expression for the 2nd chroma plane.
  6102. The filter accepts the following variables:
  6103. @item X
  6104. @item Y
  6105. The coordinates of the current sample.
  6106. @item W
  6107. @item H
  6108. The width and height of the image.
  6109. @end table
  6110. @subsection Examples
  6111. @itemize
  6112. @item
  6113. High-pass:
  6114. @example
  6115. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6116. @end example
  6117. @item
  6118. Low-pass:
  6119. @example
  6120. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6121. @end example
  6122. @item
  6123. Sharpen:
  6124. @example
  6125. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6126. @end example
  6127. @item
  6128. Blur:
  6129. @example
  6130. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6131. @end example
  6132. @end itemize
  6133. @section field
  6134. Extract a single field from an interlaced image using stride
  6135. arithmetic to avoid wasting CPU time. The output frames are marked as
  6136. non-interlaced.
  6137. The filter accepts the following options:
  6138. @table @option
  6139. @item type
  6140. Specify whether to extract the top (if the value is @code{0} or
  6141. @code{top}) or the bottom field (if the value is @code{1} or
  6142. @code{bottom}).
  6143. @end table
  6144. @section fieldhint
  6145. Create new frames by copying the top and bottom fields from surrounding frames
  6146. supplied as numbers by the hint file.
  6147. @table @option
  6148. @item hint
  6149. Set file containing hints: absolute/relative frame numbers.
  6150. There must be one line for each frame in a clip. Each line must contain two
  6151. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6152. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6153. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6154. for @code{relative} mode. First number tells from which frame to pick up top
  6155. field and second number tells from which frame to pick up bottom field.
  6156. If optionally followed by @code{+} output frame will be marked as interlaced,
  6157. else if followed by @code{-} output frame will be marked as progressive, else
  6158. it will be marked same as input frame.
  6159. If line starts with @code{#} or @code{;} that line is skipped.
  6160. @item mode
  6161. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6162. @end table
  6163. Example of first several lines of @code{hint} file for @code{relative} mode:
  6164. @example
  6165. 0,0 - # first frame
  6166. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6167. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6168. 1,0 -
  6169. 0,0 -
  6170. 0,0 -
  6171. 1,0 -
  6172. 1,0 -
  6173. 1,0 -
  6174. 0,0 -
  6175. 0,0 -
  6176. 1,0 -
  6177. 1,0 -
  6178. 1,0 -
  6179. 0,0 -
  6180. @end example
  6181. @section fieldmatch
  6182. Field matching filter for inverse telecine. It is meant to reconstruct the
  6183. progressive frames from a telecined stream. The filter does not drop duplicated
  6184. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6185. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6186. The separation of the field matching and the decimation is notably motivated by
  6187. the possibility of inserting a de-interlacing filter fallback between the two.
  6188. If the source has mixed telecined and real interlaced content,
  6189. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6190. But these remaining combed frames will be marked as interlaced, and thus can be
  6191. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6192. In addition to the various configuration options, @code{fieldmatch} can take an
  6193. optional second stream, activated through the @option{ppsrc} option. If
  6194. enabled, the frames reconstruction will be based on the fields and frames from
  6195. this second stream. This allows the first input to be pre-processed in order to
  6196. help the various algorithms of the filter, while keeping the output lossless
  6197. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6198. or brightness/contrast adjustments can help.
  6199. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6200. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6201. which @code{fieldmatch} is based on. While the semantic and usage are very
  6202. close, some behaviour and options names can differ.
  6203. The @ref{decimate} filter currently only works for constant frame rate input.
  6204. If your input has mixed telecined (30fps) and progressive content with a lower
  6205. framerate like 24fps use the following filterchain to produce the necessary cfr
  6206. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6207. The filter accepts the following options:
  6208. @table @option
  6209. @item order
  6210. Specify the assumed field order of the input stream. Available values are:
  6211. @table @samp
  6212. @item auto
  6213. Auto detect parity (use FFmpeg's internal parity value).
  6214. @item bff
  6215. Assume bottom field first.
  6216. @item tff
  6217. Assume top field first.
  6218. @end table
  6219. Note that it is sometimes recommended not to trust the parity announced by the
  6220. stream.
  6221. Default value is @var{auto}.
  6222. @item mode
  6223. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6224. sense that it won't risk creating jerkiness due to duplicate frames when
  6225. possible, but if there are bad edits or blended fields it will end up
  6226. outputting combed frames when a good match might actually exist. On the other
  6227. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6228. but will almost always find a good frame if there is one. The other values are
  6229. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6230. jerkiness and creating duplicate frames versus finding good matches in sections
  6231. with bad edits, orphaned fields, blended fields, etc.
  6232. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6233. Available values are:
  6234. @table @samp
  6235. @item pc
  6236. 2-way matching (p/c)
  6237. @item pc_n
  6238. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6239. @item pc_u
  6240. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6241. @item pc_n_ub
  6242. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6243. still combed (p/c + n + u/b)
  6244. @item pcn
  6245. 3-way matching (p/c/n)
  6246. @item pcn_ub
  6247. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6248. detected as combed (p/c/n + u/b)
  6249. @end table
  6250. The parenthesis at the end indicate the matches that would be used for that
  6251. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6252. @var{top}).
  6253. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6254. the slowest.
  6255. Default value is @var{pc_n}.
  6256. @item ppsrc
  6257. Mark the main input stream as a pre-processed input, and enable the secondary
  6258. input stream as the clean source to pick the fields from. See the filter
  6259. introduction for more details. It is similar to the @option{clip2} feature from
  6260. VFM/TFM.
  6261. Default value is @code{0} (disabled).
  6262. @item field
  6263. Set the field to match from. It is recommended to set this to the same value as
  6264. @option{order} unless you experience matching failures with that setting. In
  6265. certain circumstances changing the field that is used to match from can have a
  6266. large impact on matching performance. Available values are:
  6267. @table @samp
  6268. @item auto
  6269. Automatic (same value as @option{order}).
  6270. @item bottom
  6271. Match from the bottom field.
  6272. @item top
  6273. Match from the top field.
  6274. @end table
  6275. Default value is @var{auto}.
  6276. @item mchroma
  6277. Set whether or not chroma is included during the match comparisons. In most
  6278. cases it is recommended to leave this enabled. You should set this to @code{0}
  6279. only if your clip has bad chroma problems such as heavy rainbowing or other
  6280. artifacts. Setting this to @code{0} could also be used to speed things up at
  6281. the cost of some accuracy.
  6282. Default value is @code{1}.
  6283. @item y0
  6284. @item y1
  6285. These define an exclusion band which excludes the lines between @option{y0} and
  6286. @option{y1} from being included in the field matching decision. An exclusion
  6287. band can be used to ignore subtitles, a logo, or other things that may
  6288. interfere with the matching. @option{y0} sets the starting scan line and
  6289. @option{y1} sets the ending line; all lines in between @option{y0} and
  6290. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6291. @option{y0} and @option{y1} to the same value will disable the feature.
  6292. @option{y0} and @option{y1} defaults to @code{0}.
  6293. @item scthresh
  6294. Set the scene change detection threshold as a percentage of maximum change on
  6295. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6296. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6297. @option{scthresh} is @code{[0.0, 100.0]}.
  6298. Default value is @code{12.0}.
  6299. @item combmatch
  6300. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6301. account the combed scores of matches when deciding what match to use as the
  6302. final match. Available values are:
  6303. @table @samp
  6304. @item none
  6305. No final matching based on combed scores.
  6306. @item sc
  6307. Combed scores are only used when a scene change is detected.
  6308. @item full
  6309. Use combed scores all the time.
  6310. @end table
  6311. Default is @var{sc}.
  6312. @item combdbg
  6313. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6314. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6315. Available values are:
  6316. @table @samp
  6317. @item none
  6318. No forced calculation.
  6319. @item pcn
  6320. Force p/c/n calculations.
  6321. @item pcnub
  6322. Force p/c/n/u/b calculations.
  6323. @end table
  6324. Default value is @var{none}.
  6325. @item cthresh
  6326. This is the area combing threshold used for combed frame detection. This
  6327. essentially controls how "strong" or "visible" combing must be to be detected.
  6328. Larger values mean combing must be more visible and smaller values mean combing
  6329. can be less visible or strong and still be detected. Valid settings are from
  6330. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6331. be detected as combed). This is basically a pixel difference value. A good
  6332. range is @code{[8, 12]}.
  6333. Default value is @code{9}.
  6334. @item chroma
  6335. Sets whether or not chroma is considered in the combed frame decision. Only
  6336. disable this if your source has chroma problems (rainbowing, etc.) that are
  6337. causing problems for the combed frame detection with chroma enabled. Actually,
  6338. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6339. where there is chroma only combing in the source.
  6340. Default value is @code{0}.
  6341. @item blockx
  6342. @item blocky
  6343. Respectively set the x-axis and y-axis size of the window used during combed
  6344. frame detection. This has to do with the size of the area in which
  6345. @option{combpel} pixels are required to be detected as combed for a frame to be
  6346. declared combed. See the @option{combpel} parameter description for more info.
  6347. Possible values are any number that is a power of 2 starting at 4 and going up
  6348. to 512.
  6349. Default value is @code{16}.
  6350. @item combpel
  6351. The number of combed pixels inside any of the @option{blocky} by
  6352. @option{blockx} size blocks on the frame for the frame to be detected as
  6353. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6354. setting controls "how much" combing there must be in any localized area (a
  6355. window defined by the @option{blockx} and @option{blocky} settings) on the
  6356. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6357. which point no frames will ever be detected as combed). This setting is known
  6358. as @option{MI} in TFM/VFM vocabulary.
  6359. Default value is @code{80}.
  6360. @end table
  6361. @anchor{p/c/n/u/b meaning}
  6362. @subsection p/c/n/u/b meaning
  6363. @subsubsection p/c/n
  6364. We assume the following telecined stream:
  6365. @example
  6366. Top fields: 1 2 2 3 4
  6367. Bottom fields: 1 2 3 4 4
  6368. @end example
  6369. The numbers correspond to the progressive frame the fields relate to. Here, the
  6370. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6371. When @code{fieldmatch} is configured to run a matching from bottom
  6372. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6373. @example
  6374. Input stream:
  6375. T 1 2 2 3 4
  6376. B 1 2 3 4 4 <-- matching reference
  6377. Matches: c c n n c
  6378. Output stream:
  6379. T 1 2 3 4 4
  6380. B 1 2 3 4 4
  6381. @end example
  6382. As a result of the field matching, we can see that some frames get duplicated.
  6383. To perform a complete inverse telecine, you need to rely on a decimation filter
  6384. after this operation. See for instance the @ref{decimate} filter.
  6385. The same operation now matching from top fields (@option{field}=@var{top})
  6386. looks like this:
  6387. @example
  6388. Input stream:
  6389. T 1 2 2 3 4 <-- matching reference
  6390. B 1 2 3 4 4
  6391. Matches: c c p p c
  6392. Output stream:
  6393. T 1 2 2 3 4
  6394. B 1 2 2 3 4
  6395. @end example
  6396. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6397. basically, they refer to the frame and field of the opposite parity:
  6398. @itemize
  6399. @item @var{p} matches the field of the opposite parity in the previous frame
  6400. @item @var{c} matches the field of the opposite parity in the current frame
  6401. @item @var{n} matches the field of the opposite parity in the next frame
  6402. @end itemize
  6403. @subsubsection u/b
  6404. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6405. from the opposite parity flag. In the following examples, we assume that we are
  6406. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6407. 'x' is placed above and below each matched fields.
  6408. With bottom matching (@option{field}=@var{bottom}):
  6409. @example
  6410. Match: c p n b u
  6411. x x x x x
  6412. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6413. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6414. x x x x x
  6415. Output frames:
  6416. 2 1 2 2 2
  6417. 2 2 2 1 3
  6418. @end example
  6419. With top matching (@option{field}=@var{top}):
  6420. @example
  6421. Match: c p n b u
  6422. x x x x x
  6423. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6424. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6425. x x x x x
  6426. Output frames:
  6427. 2 2 2 1 2
  6428. 2 1 3 2 2
  6429. @end example
  6430. @subsection Examples
  6431. Simple IVTC of a top field first telecined stream:
  6432. @example
  6433. fieldmatch=order=tff:combmatch=none, decimate
  6434. @end example
  6435. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6436. @example
  6437. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6438. @end example
  6439. @section fieldorder
  6440. Transform the field order of the input video.
  6441. It accepts the following parameters:
  6442. @table @option
  6443. @item order
  6444. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6445. for bottom field first.
  6446. @end table
  6447. The default value is @samp{tff}.
  6448. The transformation is done by shifting the picture content up or down
  6449. by one line, and filling the remaining line with appropriate picture content.
  6450. This method is consistent with most broadcast field order converters.
  6451. If the input video is not flagged as being interlaced, or it is already
  6452. flagged as being of the required output field order, then this filter does
  6453. not alter the incoming video.
  6454. It is very useful when converting to or from PAL DV material,
  6455. which is bottom field first.
  6456. For example:
  6457. @example
  6458. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6459. @end example
  6460. @section fifo, afifo
  6461. Buffer input images and send them when they are requested.
  6462. It is mainly useful when auto-inserted by the libavfilter
  6463. framework.
  6464. It does not take parameters.
  6465. @section find_rect
  6466. Find a rectangular object
  6467. It accepts the following options:
  6468. @table @option
  6469. @item object
  6470. Filepath of the object image, needs to be in gray8.
  6471. @item threshold
  6472. Detection threshold, default is 0.5.
  6473. @item mipmaps
  6474. Number of mipmaps, default is 3.
  6475. @item xmin, ymin, xmax, ymax
  6476. Specifies the rectangle in which to search.
  6477. @end table
  6478. @subsection Examples
  6479. @itemize
  6480. @item
  6481. Generate a representative palette of a given video using @command{ffmpeg}:
  6482. @example
  6483. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6484. @end example
  6485. @end itemize
  6486. @section cover_rect
  6487. Cover a rectangular object
  6488. It accepts the following options:
  6489. @table @option
  6490. @item cover
  6491. Filepath of the optional cover image, needs to be in yuv420.
  6492. @item mode
  6493. Set covering mode.
  6494. It accepts the following values:
  6495. @table @samp
  6496. @item cover
  6497. cover it by the supplied image
  6498. @item blur
  6499. cover it by interpolating the surrounding pixels
  6500. @end table
  6501. Default value is @var{blur}.
  6502. @end table
  6503. @subsection Examples
  6504. @itemize
  6505. @item
  6506. Generate a representative palette of a given video using @command{ffmpeg}:
  6507. @example
  6508. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6509. @end example
  6510. @end itemize
  6511. @section floodfill
  6512. Flood area with values of same pixel components with another values.
  6513. It accepts the following options:
  6514. @table @option
  6515. @item x
  6516. Set pixel x coordinate.
  6517. @item y
  6518. Set pixel y coordinate.
  6519. @item s0
  6520. Set source #0 component value.
  6521. @item s1
  6522. Set source #1 component value.
  6523. @item s2
  6524. Set source #2 component value.
  6525. @item s3
  6526. Set source #3 component value.
  6527. @item d0
  6528. Set destination #0 component value.
  6529. @item d1
  6530. Set destination #1 component value.
  6531. @item d2
  6532. Set destination #2 component value.
  6533. @item d3
  6534. Set destination #3 component value.
  6535. @end table
  6536. @anchor{format}
  6537. @section format
  6538. Convert the input video to one of the specified pixel formats.
  6539. Libavfilter will try to pick one that is suitable as input to
  6540. the next filter.
  6541. It accepts the following parameters:
  6542. @table @option
  6543. @item pix_fmts
  6544. A '|'-separated list of pixel format names, such as
  6545. "pix_fmts=yuv420p|monow|rgb24".
  6546. @end table
  6547. @subsection Examples
  6548. @itemize
  6549. @item
  6550. Convert the input video to the @var{yuv420p} format
  6551. @example
  6552. format=pix_fmts=yuv420p
  6553. @end example
  6554. Convert the input video to any of the formats in the list
  6555. @example
  6556. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6557. @end example
  6558. @end itemize
  6559. @anchor{fps}
  6560. @section fps
  6561. Convert the video to specified constant frame rate by duplicating or dropping
  6562. frames as necessary.
  6563. It accepts the following parameters:
  6564. @table @option
  6565. @item fps
  6566. The desired output frame rate. The default is @code{25}.
  6567. @item round
  6568. Rounding method.
  6569. Possible values are:
  6570. @table @option
  6571. @item zero
  6572. zero round towards 0
  6573. @item inf
  6574. round away from 0
  6575. @item down
  6576. round towards -infinity
  6577. @item up
  6578. round towards +infinity
  6579. @item near
  6580. round to nearest
  6581. @end table
  6582. The default is @code{near}.
  6583. @item start_time
  6584. Assume the first PTS should be the given value, in seconds. This allows for
  6585. padding/trimming at the start of stream. By default, no assumption is made
  6586. about the first frame's expected PTS, so no padding or trimming is done.
  6587. For example, this could be set to 0 to pad the beginning with duplicates of
  6588. the first frame if a video stream starts after the audio stream or to trim any
  6589. frames with a negative PTS.
  6590. @end table
  6591. Alternatively, the options can be specified as a flat string:
  6592. @var{fps}[:@var{round}].
  6593. See also the @ref{setpts} filter.
  6594. @subsection Examples
  6595. @itemize
  6596. @item
  6597. A typical usage in order to set the fps to 25:
  6598. @example
  6599. fps=fps=25
  6600. @end example
  6601. @item
  6602. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6603. @example
  6604. fps=fps=film:round=near
  6605. @end example
  6606. @end itemize
  6607. @section framepack
  6608. Pack two different video streams into a stereoscopic video, setting proper
  6609. metadata on supported codecs. The two views should have the same size and
  6610. framerate and processing will stop when the shorter video ends. Please note
  6611. that you may conveniently adjust view properties with the @ref{scale} and
  6612. @ref{fps} filters.
  6613. It accepts the following parameters:
  6614. @table @option
  6615. @item format
  6616. The desired packing format. Supported values are:
  6617. @table @option
  6618. @item sbs
  6619. The views are next to each other (default).
  6620. @item tab
  6621. The views are on top of each other.
  6622. @item lines
  6623. The views are packed by line.
  6624. @item columns
  6625. The views are packed by column.
  6626. @item frameseq
  6627. The views are temporally interleaved.
  6628. @end table
  6629. @end table
  6630. Some examples:
  6631. @example
  6632. # Convert left and right views into a frame-sequential video
  6633. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6634. # Convert views into a side-by-side video with the same output resolution as the input
  6635. 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
  6636. @end example
  6637. @section framerate
  6638. Change the frame rate by interpolating new video output frames from the source
  6639. frames.
  6640. This filter is not designed to function correctly with interlaced media. If
  6641. you wish to change the frame rate of interlaced media then you are required
  6642. to deinterlace before this filter and re-interlace after this filter.
  6643. A description of the accepted options follows.
  6644. @table @option
  6645. @item fps
  6646. Specify the output frames per second. This option can also be specified
  6647. as a value alone. The default is @code{50}.
  6648. @item interp_start
  6649. Specify the start of a range where the output frame will be created as a
  6650. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6651. the default is @code{15}.
  6652. @item interp_end
  6653. Specify the end of a range where the output frame will be created as a
  6654. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6655. the default is @code{240}.
  6656. @item scene
  6657. Specify the level at which a scene change is detected as a value between
  6658. 0 and 100 to indicate a new scene; a low value reflects a low
  6659. probability for the current frame to introduce a new scene, while a higher
  6660. value means the current frame is more likely to be one.
  6661. The default is @code{7}.
  6662. @item flags
  6663. Specify flags influencing the filter process.
  6664. Available value for @var{flags} is:
  6665. @table @option
  6666. @item scene_change_detect, scd
  6667. Enable scene change detection using the value of the option @var{scene}.
  6668. This flag is enabled by default.
  6669. @end table
  6670. @end table
  6671. @section framestep
  6672. Select one frame every N-th frame.
  6673. This filter accepts the following option:
  6674. @table @option
  6675. @item step
  6676. Select frame after every @code{step} frames.
  6677. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6678. @end table
  6679. @anchor{frei0r}
  6680. @section frei0r
  6681. Apply a frei0r effect to the input video.
  6682. To enable the compilation of this filter, you need to install the frei0r
  6683. header and configure FFmpeg with @code{--enable-frei0r}.
  6684. It accepts the following parameters:
  6685. @table @option
  6686. @item filter_name
  6687. The name of the frei0r effect to load. If the environment variable
  6688. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6689. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6690. Otherwise, the standard frei0r paths are searched, in this order:
  6691. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6692. @file{/usr/lib/frei0r-1/}.
  6693. @item filter_params
  6694. A '|'-separated list of parameters to pass to the frei0r effect.
  6695. @end table
  6696. A frei0r effect parameter can be a boolean (its value is either
  6697. "y" or "n"), a double, a color (specified as
  6698. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6699. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6700. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6701. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6702. The number and types of parameters depend on the loaded effect. If an
  6703. effect parameter is not specified, the default value is set.
  6704. @subsection Examples
  6705. @itemize
  6706. @item
  6707. Apply the distort0r effect, setting the first two double parameters:
  6708. @example
  6709. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6710. @end example
  6711. @item
  6712. Apply the colordistance effect, taking a color as the first parameter:
  6713. @example
  6714. frei0r=colordistance:0.2/0.3/0.4
  6715. frei0r=colordistance:violet
  6716. frei0r=colordistance:0x112233
  6717. @end example
  6718. @item
  6719. Apply the perspective effect, specifying the top left and top right image
  6720. positions:
  6721. @example
  6722. frei0r=perspective:0.2/0.2|0.8/0.2
  6723. @end example
  6724. @end itemize
  6725. For more information, see
  6726. @url{http://frei0r.dyne.org}
  6727. @section fspp
  6728. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6729. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6730. processing filter, one of them is performed once per block, not per pixel.
  6731. This allows for much higher speed.
  6732. The filter accepts the following options:
  6733. @table @option
  6734. @item quality
  6735. Set quality. This option defines the number of levels for averaging. It accepts
  6736. an integer in the range 4-5. Default value is @code{4}.
  6737. @item qp
  6738. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6739. If not set, the filter will use the QP from the video stream (if available).
  6740. @item strength
  6741. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6742. more details but also more artifacts, while higher values make the image smoother
  6743. but also blurrier. Default value is @code{0} − PSNR optimal.
  6744. @item use_bframe_qp
  6745. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6746. option may cause flicker since the B-Frames have often larger QP. Default is
  6747. @code{0} (not enabled).
  6748. @end table
  6749. @section gblur
  6750. Apply Gaussian blur filter.
  6751. The filter accepts the following options:
  6752. @table @option
  6753. @item sigma
  6754. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6755. @item steps
  6756. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6757. @item planes
  6758. Set which planes to filter. By default all planes are filtered.
  6759. @item sigmaV
  6760. Set vertical sigma, if negative it will be same as @code{sigma}.
  6761. Default is @code{-1}.
  6762. @end table
  6763. @section geq
  6764. The filter accepts the following options:
  6765. @table @option
  6766. @item lum_expr, lum
  6767. Set the luminance expression.
  6768. @item cb_expr, cb
  6769. Set the chrominance blue expression.
  6770. @item cr_expr, cr
  6771. Set the chrominance red expression.
  6772. @item alpha_expr, a
  6773. Set the alpha expression.
  6774. @item red_expr, r
  6775. Set the red expression.
  6776. @item green_expr, g
  6777. Set the green expression.
  6778. @item blue_expr, b
  6779. Set the blue expression.
  6780. @end table
  6781. The colorspace is selected according to the specified options. If one
  6782. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6783. options is specified, the filter will automatically select a YCbCr
  6784. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6785. @option{blue_expr} options is specified, it will select an RGB
  6786. colorspace.
  6787. If one of the chrominance expression is not defined, it falls back on the other
  6788. one. If no alpha expression is specified it will evaluate to opaque value.
  6789. If none of chrominance expressions are specified, they will evaluate
  6790. to the luminance expression.
  6791. The expressions can use the following variables and functions:
  6792. @table @option
  6793. @item N
  6794. The sequential number of the filtered frame, starting from @code{0}.
  6795. @item X
  6796. @item Y
  6797. The coordinates of the current sample.
  6798. @item W
  6799. @item H
  6800. The width and height of the image.
  6801. @item SW
  6802. @item SH
  6803. Width and height scale depending on the currently filtered plane. It is the
  6804. ratio between the corresponding luma plane number of pixels and the current
  6805. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6806. @code{0.5,0.5} for chroma planes.
  6807. @item T
  6808. Time of the current frame, expressed in seconds.
  6809. @item p(x, y)
  6810. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6811. plane.
  6812. @item lum(x, y)
  6813. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6814. plane.
  6815. @item cb(x, y)
  6816. Return the value of the pixel at location (@var{x},@var{y}) of the
  6817. blue-difference chroma plane. Return 0 if there is no such plane.
  6818. @item cr(x, y)
  6819. Return the value of the pixel at location (@var{x},@var{y}) of the
  6820. red-difference chroma plane. Return 0 if there is no such plane.
  6821. @item r(x, y)
  6822. @item g(x, y)
  6823. @item b(x, y)
  6824. Return the value of the pixel at location (@var{x},@var{y}) of the
  6825. red/green/blue component. Return 0 if there is no such component.
  6826. @item alpha(x, y)
  6827. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6828. plane. Return 0 if there is no such plane.
  6829. @end table
  6830. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6831. automatically clipped to the closer edge.
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Flip the image horizontally:
  6836. @example
  6837. geq=p(W-X\,Y)
  6838. @end example
  6839. @item
  6840. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6841. wavelength of 100 pixels:
  6842. @example
  6843. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6844. @end example
  6845. @item
  6846. Generate a fancy enigmatic moving light:
  6847. @example
  6848. 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
  6849. @end example
  6850. @item
  6851. Generate a quick emboss effect:
  6852. @example
  6853. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6854. @end example
  6855. @item
  6856. Modify RGB components depending on pixel position:
  6857. @example
  6858. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6859. @end example
  6860. @item
  6861. Create a radial gradient that is the same size as the input (also see
  6862. the @ref{vignette} filter):
  6863. @example
  6864. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6865. @end example
  6866. @end itemize
  6867. @section gradfun
  6868. Fix the banding artifacts that are sometimes introduced into nearly flat
  6869. regions by truncation to 8-bit color depth.
  6870. Interpolate the gradients that should go where the bands are, and
  6871. dither them.
  6872. It is designed for playback only. Do not use it prior to
  6873. lossy compression, because compression tends to lose the dither and
  6874. bring back the bands.
  6875. It accepts the following parameters:
  6876. @table @option
  6877. @item strength
  6878. The maximum amount by which the filter will change any one pixel. This is also
  6879. the threshold for detecting nearly flat regions. Acceptable values range from
  6880. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6881. valid range.
  6882. @item radius
  6883. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6884. gradients, but also prevents the filter from modifying the pixels near detailed
  6885. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6886. values will be clipped to the valid range.
  6887. @end table
  6888. Alternatively, the options can be specified as a flat string:
  6889. @var{strength}[:@var{radius}]
  6890. @subsection Examples
  6891. @itemize
  6892. @item
  6893. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6894. @example
  6895. gradfun=3.5:8
  6896. @end example
  6897. @item
  6898. Specify radius, omitting the strength (which will fall-back to the default
  6899. value):
  6900. @example
  6901. gradfun=radius=8
  6902. @end example
  6903. @end itemize
  6904. @anchor{haldclut}
  6905. @section haldclut
  6906. Apply a Hald CLUT to a video stream.
  6907. First input is the video stream to process, and second one is the Hald CLUT.
  6908. The Hald CLUT input can be a simple picture or a complete video stream.
  6909. The filter accepts the following options:
  6910. @table @option
  6911. @item shortest
  6912. Force termination when the shortest input terminates. Default is @code{0}.
  6913. @item repeatlast
  6914. Continue applying the last CLUT after the end of the stream. A value of
  6915. @code{0} disable the filter after the last frame of the CLUT is reached.
  6916. Default is @code{1}.
  6917. @end table
  6918. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6919. filters share the same internals).
  6920. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6921. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6922. @subsection Workflow examples
  6923. @subsubsection Hald CLUT video stream
  6924. Generate an identity Hald CLUT stream altered with various effects:
  6925. @example
  6926. 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
  6927. @end example
  6928. Note: make sure you use a lossless codec.
  6929. Then use it with @code{haldclut} to apply it on some random stream:
  6930. @example
  6931. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6932. @end example
  6933. The Hald CLUT will be applied to the 10 first seconds (duration of
  6934. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6935. to the remaining frames of the @code{mandelbrot} stream.
  6936. @subsubsection Hald CLUT with preview
  6937. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6938. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6939. biggest possible square starting at the top left of the picture. The remaining
  6940. padding pixels (bottom or right) will be ignored. This area can be used to add
  6941. a preview of the Hald CLUT.
  6942. Typically, the following generated Hald CLUT will be supported by the
  6943. @code{haldclut} filter:
  6944. @example
  6945. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6946. pad=iw+320 [padded_clut];
  6947. smptebars=s=320x256, split [a][b];
  6948. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6949. [main][b] overlay=W-320" -frames:v 1 clut.png
  6950. @end example
  6951. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6952. bars are displayed on the right-top, and below the same color bars processed by
  6953. the color changes.
  6954. Then, the effect of this Hald CLUT can be visualized with:
  6955. @example
  6956. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6957. @end example
  6958. @section hflip
  6959. Flip the input video horizontally.
  6960. For example, to horizontally flip the input video with @command{ffmpeg}:
  6961. @example
  6962. ffmpeg -i in.avi -vf "hflip" out.avi
  6963. @end example
  6964. @section histeq
  6965. This filter applies a global color histogram equalization on a
  6966. per-frame basis.
  6967. It can be used to correct video that has a compressed range of pixel
  6968. intensities. The filter redistributes the pixel intensities to
  6969. equalize their distribution across the intensity range. It may be
  6970. viewed as an "automatically adjusting contrast filter". This filter is
  6971. useful only for correcting degraded or poorly captured source
  6972. video.
  6973. The filter accepts the following options:
  6974. @table @option
  6975. @item strength
  6976. Determine the amount of equalization to be applied. As the strength
  6977. is reduced, the distribution of pixel intensities more-and-more
  6978. approaches that of the input frame. The value must be a float number
  6979. in the range [0,1] and defaults to 0.200.
  6980. @item intensity
  6981. Set the maximum intensity that can generated and scale the output
  6982. values appropriately. The strength should be set as desired and then
  6983. the intensity can be limited if needed to avoid washing-out. The value
  6984. must be a float number in the range [0,1] and defaults to 0.210.
  6985. @item antibanding
  6986. Set the antibanding level. If enabled the filter will randomly vary
  6987. the luminance of output pixels by a small amount to avoid banding of
  6988. the histogram. Possible values are @code{none}, @code{weak} or
  6989. @code{strong}. It defaults to @code{none}.
  6990. @end table
  6991. @section histogram
  6992. Compute and draw a color distribution histogram for the input video.
  6993. The computed histogram is a representation of the color component
  6994. distribution in an image.
  6995. Standard histogram displays the color components distribution in an image.
  6996. Displays color graph for each color component. Shows distribution of
  6997. the Y, U, V, A or R, G, B components, depending on input format, in the
  6998. current frame. Below each graph a color component scale meter is shown.
  6999. The filter accepts the following options:
  7000. @table @option
  7001. @item level_height
  7002. Set height of level. Default value is @code{200}.
  7003. Allowed range is [50, 2048].
  7004. @item scale_height
  7005. Set height of color scale. Default value is @code{12}.
  7006. Allowed range is [0, 40].
  7007. @item display_mode
  7008. Set display mode.
  7009. It accepts the following values:
  7010. @table @samp
  7011. @item stack
  7012. Per color component graphs are placed below each other.
  7013. @item parade
  7014. Per color component graphs are placed side by side.
  7015. @item overlay
  7016. Presents information identical to that in the @code{parade}, except
  7017. that the graphs representing color components are superimposed directly
  7018. over one another.
  7019. @end table
  7020. Default is @code{stack}.
  7021. @item levels_mode
  7022. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7023. Default is @code{linear}.
  7024. @item components
  7025. Set what color components to display.
  7026. Default is @code{7}.
  7027. @item fgopacity
  7028. Set foreground opacity. Default is @code{0.7}.
  7029. @item bgopacity
  7030. Set background opacity. Default is @code{0.5}.
  7031. @end table
  7032. @subsection Examples
  7033. @itemize
  7034. @item
  7035. Calculate and draw histogram:
  7036. @example
  7037. ffplay -i input -vf histogram
  7038. @end example
  7039. @end itemize
  7040. @anchor{hqdn3d}
  7041. @section hqdn3d
  7042. This is a high precision/quality 3d denoise filter. It aims to reduce
  7043. image noise, producing smooth images and making still images really
  7044. still. It should enhance compressibility.
  7045. It accepts the following optional parameters:
  7046. @table @option
  7047. @item luma_spatial
  7048. A non-negative floating point number which specifies spatial luma strength.
  7049. It defaults to 4.0.
  7050. @item chroma_spatial
  7051. A non-negative floating point number which specifies spatial chroma strength.
  7052. It defaults to 3.0*@var{luma_spatial}/4.0.
  7053. @item luma_tmp
  7054. A floating point number which specifies luma temporal strength. It defaults to
  7055. 6.0*@var{luma_spatial}/4.0.
  7056. @item chroma_tmp
  7057. A floating point number which specifies chroma temporal strength. It defaults to
  7058. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7059. @end table
  7060. @section hwdownload
  7061. Download hardware frames to system memory.
  7062. The input must be in hardware frames, and the output a non-hardware format.
  7063. Not all formats will be supported on the output - it may be necessary to insert
  7064. an additional @option{format} filter immediately following in the graph to get
  7065. the output in a supported format.
  7066. @section hwmap
  7067. Map hardware frames to system memory or to another device.
  7068. This filter has several different modes of operation; which one is used depends
  7069. on the input and output formats:
  7070. @itemize
  7071. @item
  7072. Hardware frame input, normal frame output
  7073. Map the input frames to system memory and pass them to the output. If the
  7074. original hardware frame is later required (for example, after overlaying
  7075. something else on part of it), the @option{hwmap} filter can be used again
  7076. in the next mode to retrieve it.
  7077. @item
  7078. Normal frame input, hardware frame output
  7079. If the input is actually a software-mapped hardware frame, then unmap it -
  7080. that is, return the original hardware frame.
  7081. Otherwise, a device must be provided. Create new hardware surfaces on that
  7082. device for the output, then map them back to the software format at the input
  7083. and give those frames to the preceding filter. This will then act like the
  7084. @option{hwupload} filter, but may be able to avoid an additional copy when
  7085. the input is already in a compatible format.
  7086. @item
  7087. Hardware frame input and output
  7088. A device must be supplied for the output, either directly or with the
  7089. @option{derive_device} option. The input and output devices must be of
  7090. different types and compatible - the exact meaning of this is
  7091. system-dependent, but typically it means that they must refer to the same
  7092. underlying hardware context (for example, refer to the same graphics card).
  7093. If the input frames were originally created on the output device, then unmap
  7094. to retrieve the original frames.
  7095. Otherwise, map the frames to the output device - create new hardware frames
  7096. on the output corresponding to the frames on the input.
  7097. @end itemize
  7098. The following additional parameters are accepted:
  7099. @table @option
  7100. @item mode
  7101. Set the frame mapping mode. Some combination of:
  7102. @table @var
  7103. @item read
  7104. The mapped frame should be readable.
  7105. @item write
  7106. The mapped frame should be writeable.
  7107. @item overwrite
  7108. The mapping will always overwrite the entire frame.
  7109. This may improve performance in some cases, as the original contents of the
  7110. frame need not be loaded.
  7111. @item direct
  7112. The mapping must not involve any copying.
  7113. Indirect mappings to copies of frames are created in some cases where either
  7114. direct mapping is not possible or it would have unexpected properties.
  7115. Setting this flag ensures that the mapping is direct and will fail if that is
  7116. not possible.
  7117. @end table
  7118. Defaults to @var{read+write} if not specified.
  7119. @item derive_device @var{type}
  7120. Rather than using the device supplied at initialisation, instead derive a new
  7121. device of type @var{type} from the device the input frames exist on.
  7122. @item reverse
  7123. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7124. and map them back to the source. This may be necessary in some cases where
  7125. a mapping in one direction is required but only the opposite direction is
  7126. supported by the devices being used.
  7127. This option is dangerous - it may break the preceding filter in undefined
  7128. ways if there are any additional constraints on that filter's output.
  7129. Do not use it without fully understanding the implications of its use.
  7130. @end table
  7131. @section hwupload
  7132. Upload system memory frames to hardware surfaces.
  7133. The device to upload to must be supplied when the filter is initialised. If
  7134. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7135. option.
  7136. @anchor{hwupload_cuda}
  7137. @section hwupload_cuda
  7138. Upload system memory frames to a CUDA device.
  7139. It accepts the following optional parameters:
  7140. @table @option
  7141. @item device
  7142. The number of the CUDA device to use
  7143. @end table
  7144. @section hqx
  7145. Apply a high-quality magnification filter designed for pixel art. This filter
  7146. was originally created by Maxim Stepin.
  7147. It accepts the following option:
  7148. @table @option
  7149. @item n
  7150. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7151. @code{hq3x} and @code{4} for @code{hq4x}.
  7152. Default is @code{3}.
  7153. @end table
  7154. @section hstack
  7155. Stack input videos horizontally.
  7156. All streams must be of same pixel format and of same height.
  7157. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7158. to create same output.
  7159. The filter accept the following option:
  7160. @table @option
  7161. @item inputs
  7162. Set number of input streams. Default is 2.
  7163. @item shortest
  7164. If set to 1, force the output to terminate when the shortest input
  7165. terminates. Default value is 0.
  7166. @end table
  7167. @section hue
  7168. Modify the hue and/or the saturation of the input.
  7169. It accepts the following parameters:
  7170. @table @option
  7171. @item h
  7172. Specify the hue angle as a number of degrees. It accepts an expression,
  7173. and defaults to "0".
  7174. @item s
  7175. Specify the saturation in the [-10,10] range. It accepts an expression and
  7176. defaults to "1".
  7177. @item H
  7178. Specify the hue angle as a number of radians. It accepts an
  7179. expression, and defaults to "0".
  7180. @item b
  7181. Specify the brightness in the [-10,10] range. It accepts an expression and
  7182. defaults to "0".
  7183. @end table
  7184. @option{h} and @option{H} are mutually exclusive, and can't be
  7185. specified at the same time.
  7186. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7187. expressions containing the following constants:
  7188. @table @option
  7189. @item n
  7190. frame count of the input frame starting from 0
  7191. @item pts
  7192. presentation timestamp of the input frame expressed in time base units
  7193. @item r
  7194. frame rate of the input video, NAN if the input frame rate is unknown
  7195. @item t
  7196. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7197. @item tb
  7198. time base of the input video
  7199. @end table
  7200. @subsection Examples
  7201. @itemize
  7202. @item
  7203. Set the hue to 90 degrees and the saturation to 1.0:
  7204. @example
  7205. hue=h=90:s=1
  7206. @end example
  7207. @item
  7208. Same command but expressing the hue in radians:
  7209. @example
  7210. hue=H=PI/2:s=1
  7211. @end example
  7212. @item
  7213. Rotate hue and make the saturation swing between 0
  7214. and 2 over a period of 1 second:
  7215. @example
  7216. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7217. @end example
  7218. @item
  7219. Apply a 3 seconds saturation fade-in effect starting at 0:
  7220. @example
  7221. hue="s=min(t/3\,1)"
  7222. @end example
  7223. The general fade-in expression can be written as:
  7224. @example
  7225. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7226. @end example
  7227. @item
  7228. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7229. @example
  7230. hue="s=max(0\, min(1\, (8-t)/3))"
  7231. @end example
  7232. The general fade-out expression can be written as:
  7233. @example
  7234. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7235. @end example
  7236. @end itemize
  7237. @subsection Commands
  7238. This filter supports the following commands:
  7239. @table @option
  7240. @item b
  7241. @item s
  7242. @item h
  7243. @item H
  7244. Modify the hue and/or the saturation and/or brightness of the input video.
  7245. The command accepts the same syntax of the corresponding option.
  7246. If the specified expression is not valid, it is kept at its current
  7247. value.
  7248. @end table
  7249. @section hysteresis
  7250. Grow first stream into second stream by connecting components.
  7251. This makes it possible to build more robust edge masks.
  7252. This filter accepts the following options:
  7253. @table @option
  7254. @item planes
  7255. Set which planes will be processed as bitmap, unprocessed planes will be
  7256. copied from first stream.
  7257. By default value 0xf, all planes will be processed.
  7258. @item threshold
  7259. Set threshold which is used in filtering. If pixel component value is higher than
  7260. this value filter algorithm for connecting components is activated.
  7261. By default value is 0.
  7262. @end table
  7263. @section idet
  7264. Detect video interlacing type.
  7265. This filter tries to detect if the input frames are interlaced, progressive,
  7266. top or bottom field first. It will also try to detect fields that are
  7267. repeated between adjacent frames (a sign of telecine).
  7268. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7269. Multiple frame detection incorporates the classification history of previous frames.
  7270. The filter will log these metadata values:
  7271. @table @option
  7272. @item single.current_frame
  7273. Detected type of current frame using single-frame detection. One of:
  7274. ``tff'' (top field first), ``bff'' (bottom field first),
  7275. ``progressive'', or ``undetermined''
  7276. @item single.tff
  7277. Cumulative number of frames detected as top field first using single-frame detection.
  7278. @item multiple.tff
  7279. Cumulative number of frames detected as top field first using multiple-frame detection.
  7280. @item single.bff
  7281. Cumulative number of frames detected as bottom field first using single-frame detection.
  7282. @item multiple.current_frame
  7283. Detected type of current frame using multiple-frame detection. One of:
  7284. ``tff'' (top field first), ``bff'' (bottom field first),
  7285. ``progressive'', or ``undetermined''
  7286. @item multiple.bff
  7287. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7288. @item single.progressive
  7289. Cumulative number of frames detected as progressive using single-frame detection.
  7290. @item multiple.progressive
  7291. Cumulative number of frames detected as progressive using multiple-frame detection.
  7292. @item single.undetermined
  7293. Cumulative number of frames that could not be classified using single-frame detection.
  7294. @item multiple.undetermined
  7295. Cumulative number of frames that could not be classified using multiple-frame detection.
  7296. @item repeated.current_frame
  7297. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7298. @item repeated.neither
  7299. Cumulative number of frames with no repeated field.
  7300. @item repeated.top
  7301. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7302. @item repeated.bottom
  7303. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7304. @end table
  7305. The filter accepts the following options:
  7306. @table @option
  7307. @item intl_thres
  7308. Set interlacing threshold.
  7309. @item prog_thres
  7310. Set progressive threshold.
  7311. @item rep_thres
  7312. Threshold for repeated field detection.
  7313. @item half_life
  7314. Number of frames after which a given frame's contribution to the
  7315. statistics is halved (i.e., it contributes only 0.5 to its
  7316. classification). The default of 0 means that all frames seen are given
  7317. full weight of 1.0 forever.
  7318. @item analyze_interlaced_flag
  7319. When this is not 0 then idet will use the specified number of frames to determine
  7320. if the interlaced flag is accurate, it will not count undetermined frames.
  7321. If the flag is found to be accurate it will be used without any further
  7322. computations, if it is found to be inaccurate it will be cleared without any
  7323. further computations. This allows inserting the idet filter as a low computational
  7324. method to clean up the interlaced flag
  7325. @end table
  7326. @section il
  7327. Deinterleave or interleave fields.
  7328. This filter allows one to process interlaced images fields without
  7329. deinterlacing them. Deinterleaving splits the input frame into 2
  7330. fields (so called half pictures). Odd lines are moved to the top
  7331. half of the output image, even lines to the bottom half.
  7332. You can process (filter) them independently and then re-interleave them.
  7333. The filter accepts the following options:
  7334. @table @option
  7335. @item luma_mode, l
  7336. @item chroma_mode, c
  7337. @item alpha_mode, a
  7338. Available values for @var{luma_mode}, @var{chroma_mode} and
  7339. @var{alpha_mode} are:
  7340. @table @samp
  7341. @item none
  7342. Do nothing.
  7343. @item deinterleave, d
  7344. Deinterleave fields, placing one above the other.
  7345. @item interleave, i
  7346. Interleave fields. Reverse the effect of deinterleaving.
  7347. @end table
  7348. Default value is @code{none}.
  7349. @item luma_swap, ls
  7350. @item chroma_swap, cs
  7351. @item alpha_swap, as
  7352. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7353. @end table
  7354. @section inflate
  7355. Apply inflate effect to the video.
  7356. This filter replaces the pixel by the local(3x3) average by taking into account
  7357. only values higher than the pixel.
  7358. It accepts the following options:
  7359. @table @option
  7360. @item threshold0
  7361. @item threshold1
  7362. @item threshold2
  7363. @item threshold3
  7364. Limit the maximum change for each plane, default is 65535.
  7365. If 0, plane will remain unchanged.
  7366. @end table
  7367. @section interlace
  7368. Simple interlacing filter from progressive contents. This interleaves upper (or
  7369. lower) lines from odd frames with lower (or upper) lines from even frames,
  7370. halving the frame rate and preserving image height.
  7371. @example
  7372. Original Original New Frame
  7373. Frame 'j' Frame 'j+1' (tff)
  7374. ========== =========== ==================
  7375. Line 0 --------------------> Frame 'j' Line 0
  7376. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7377. Line 2 ---------------------> Frame 'j' Line 2
  7378. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7379. ... ... ...
  7380. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7381. @end example
  7382. It accepts the following optional parameters:
  7383. @table @option
  7384. @item scan
  7385. This determines whether the interlaced frame is taken from the even
  7386. (tff - default) or odd (bff) lines of the progressive frame.
  7387. @item lowpass
  7388. Vertical lowpass filter to avoid twitter interlacing and
  7389. reduce moire patterns.
  7390. @table @samp
  7391. @item 0, off
  7392. Disable vertical lowpass filter
  7393. @item 1, linear
  7394. Enable linear filter (default)
  7395. @item 2, complex
  7396. Enable complex filter. This will slightly less reduce twitter and moire
  7397. but better retain detail and subjective sharpness impression.
  7398. @end table
  7399. @end table
  7400. @section kerndeint
  7401. Deinterlace input video by applying Donald Graft's adaptive kernel
  7402. deinterling. Work on interlaced parts of a video to produce
  7403. progressive frames.
  7404. The description of the accepted parameters follows.
  7405. @table @option
  7406. @item thresh
  7407. Set the threshold which affects the filter's tolerance when
  7408. determining if a pixel line must be processed. It must be an integer
  7409. in the range [0,255] and defaults to 10. A value of 0 will result in
  7410. applying the process on every pixels.
  7411. @item map
  7412. Paint pixels exceeding the threshold value to white if set to 1.
  7413. Default is 0.
  7414. @item order
  7415. Set the fields order. Swap fields if set to 1, leave fields alone if
  7416. 0. Default is 0.
  7417. @item sharp
  7418. Enable additional sharpening if set to 1. Default is 0.
  7419. @item twoway
  7420. Enable twoway sharpening if set to 1. Default is 0.
  7421. @end table
  7422. @subsection Examples
  7423. @itemize
  7424. @item
  7425. Apply default values:
  7426. @example
  7427. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7428. @end example
  7429. @item
  7430. Enable additional sharpening:
  7431. @example
  7432. kerndeint=sharp=1
  7433. @end example
  7434. @item
  7435. Paint processed pixels in white:
  7436. @example
  7437. kerndeint=map=1
  7438. @end example
  7439. @end itemize
  7440. @section lenscorrection
  7441. Correct radial lens distortion
  7442. This filter can be used to correct for radial distortion as can result from the use
  7443. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7444. one can use tools available for example as part of opencv or simply trial-and-error.
  7445. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7446. and extract the k1 and k2 coefficients from the resulting matrix.
  7447. Note that effectively the same filter is available in the open-source tools Krita and
  7448. Digikam from the KDE project.
  7449. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7450. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7451. brightness distribution, so you may want to use both filters together in certain
  7452. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7453. be applied before or after lens correction.
  7454. @subsection Options
  7455. The filter accepts the following options:
  7456. @table @option
  7457. @item cx
  7458. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7459. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7460. width.
  7461. @item cy
  7462. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7463. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7464. height.
  7465. @item k1
  7466. Coefficient of the quadratic correction term. 0.5 means no correction.
  7467. @item k2
  7468. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7469. @end table
  7470. The formula that generates the correction is:
  7471. @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)
  7472. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7473. distances from the focal point in the source and target images, respectively.
  7474. @section libvmaf
  7475. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7476. score between two input videos.
  7477. This filter takes two input videos.
  7478. Both video inputs must have the same resolution and pixel format for
  7479. this filter to work correctly. Also it assumes that both inputs
  7480. have the same number of frames, which are compared one by one.
  7481. The obtained average VMAF score is printed through the logging system.
  7482. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7483. After installing the library it can be enabled using:
  7484. @code{./configure --enable-libvmaf}.
  7485. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7486. On the below examples the input file @file{main.mpg} being processed is
  7487. compared with the reference file @file{ref.mpg}.
  7488. The filter has following options:
  7489. @table @option
  7490. @item model_path
  7491. Set the model path which is to be used for SVM.
  7492. Default value: @code{"vmaf_v0.6.1.pkl"}
  7493. @item log_path
  7494. Set the file path to be used to store logs.
  7495. @item log_fmt
  7496. Set the format of the log file (xml or json).
  7497. @item enable_transform
  7498. Enables transform for computing vmaf.
  7499. @item phone_model
  7500. Invokes the phone model which will generate VMAF scores higher than in the
  7501. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7502. @item psnr
  7503. Enables computing psnr along with vmaf.
  7504. @item ssim
  7505. Enables computing ssim along with vmaf.
  7506. @item ms_ssim
  7507. Enables computing ms_ssim along with vmaf.
  7508. @item pool
  7509. Set the pool method to be used for computing vmaf.
  7510. @end table
  7511. This filter also supports the @ref{framesync} options.
  7512. For example:
  7513. @example
  7514. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7515. @end example
  7516. Example with options:
  7517. @example
  7518. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7519. @end example
  7520. @section limiter
  7521. Limits the pixel components values to the specified range [min, max].
  7522. The filter accepts the following options:
  7523. @table @option
  7524. @item min
  7525. Lower bound. Defaults to the lowest allowed value for the input.
  7526. @item max
  7527. Upper bound. Defaults to the highest allowed value for the input.
  7528. @item planes
  7529. Specify which planes will be processed. Defaults to all available.
  7530. @end table
  7531. @section loop
  7532. Loop video frames.
  7533. The filter accepts the following options:
  7534. @table @option
  7535. @item loop
  7536. Set the number of loops.
  7537. @item size
  7538. Set maximal size in number of frames.
  7539. @item start
  7540. Set first frame of loop.
  7541. @end table
  7542. @anchor{lut3d}
  7543. @section lut3d
  7544. Apply a 3D LUT to an input video.
  7545. The filter accepts the following options:
  7546. @table @option
  7547. @item file
  7548. Set the 3D LUT file name.
  7549. Currently supported formats:
  7550. @table @samp
  7551. @item 3dl
  7552. AfterEffects
  7553. @item cube
  7554. Iridas
  7555. @item dat
  7556. DaVinci
  7557. @item m3d
  7558. Pandora
  7559. @end table
  7560. @item interp
  7561. Select interpolation mode.
  7562. Available values are:
  7563. @table @samp
  7564. @item nearest
  7565. Use values from the nearest defined point.
  7566. @item trilinear
  7567. Interpolate values using the 8 points defining a cube.
  7568. @item tetrahedral
  7569. Interpolate values using a tetrahedron.
  7570. @end table
  7571. @end table
  7572. This filter also supports the @ref{framesync} options.
  7573. @section lumakey
  7574. Turn certain luma values into transparency.
  7575. The filter accepts the following options:
  7576. @table @option
  7577. @item threshold
  7578. Set the luma which will be used as base for transparency.
  7579. Default value is @code{0}.
  7580. @item tolerance
  7581. Set the range of luma values to be keyed out.
  7582. Default value is @code{0}.
  7583. @item softness
  7584. Set the range of softness. Default value is @code{0}.
  7585. Use this to control gradual transition from zero to full transparency.
  7586. @end table
  7587. @section lut, lutrgb, lutyuv
  7588. Compute a look-up table for binding each pixel component input value
  7589. to an output value, and apply it to the input video.
  7590. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7591. to an RGB input video.
  7592. These filters accept the following parameters:
  7593. @table @option
  7594. @item c0
  7595. set first pixel component expression
  7596. @item c1
  7597. set second pixel component expression
  7598. @item c2
  7599. set third pixel component expression
  7600. @item c3
  7601. set fourth pixel component expression, corresponds to the alpha component
  7602. @item r
  7603. set red component expression
  7604. @item g
  7605. set green component expression
  7606. @item b
  7607. set blue component expression
  7608. @item a
  7609. alpha component expression
  7610. @item y
  7611. set Y/luminance component expression
  7612. @item u
  7613. set U/Cb component expression
  7614. @item v
  7615. set V/Cr component expression
  7616. @end table
  7617. Each of them specifies the expression to use for computing the lookup table for
  7618. the corresponding pixel component values.
  7619. The exact component associated to each of the @var{c*} options depends on the
  7620. format in input.
  7621. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7622. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7623. The expressions can contain the following constants and functions:
  7624. @table @option
  7625. @item w
  7626. @item h
  7627. The input width and height.
  7628. @item val
  7629. The input value for the pixel component.
  7630. @item clipval
  7631. The input value, clipped to the @var{minval}-@var{maxval} range.
  7632. @item maxval
  7633. The maximum value for the pixel component.
  7634. @item minval
  7635. The minimum value for the pixel component.
  7636. @item negval
  7637. The negated value for the pixel component value, clipped to the
  7638. @var{minval}-@var{maxval} range; it corresponds to the expression
  7639. "maxval-clipval+minval".
  7640. @item clip(val)
  7641. The computed value in @var{val}, clipped to the
  7642. @var{minval}-@var{maxval} range.
  7643. @item gammaval(gamma)
  7644. The computed gamma correction value of the pixel component value,
  7645. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7646. expression
  7647. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7648. @end table
  7649. All expressions default to "val".
  7650. @subsection Examples
  7651. @itemize
  7652. @item
  7653. Negate input video:
  7654. @example
  7655. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7656. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7657. @end example
  7658. The above is the same as:
  7659. @example
  7660. lutrgb="r=negval:g=negval:b=negval"
  7661. lutyuv="y=negval:u=negval:v=negval"
  7662. @end example
  7663. @item
  7664. Negate luminance:
  7665. @example
  7666. lutyuv=y=negval
  7667. @end example
  7668. @item
  7669. Remove chroma components, turning the video into a graytone image:
  7670. @example
  7671. lutyuv="u=128:v=128"
  7672. @end example
  7673. @item
  7674. Apply a luma burning effect:
  7675. @example
  7676. lutyuv="y=2*val"
  7677. @end example
  7678. @item
  7679. Remove green and blue components:
  7680. @example
  7681. lutrgb="g=0:b=0"
  7682. @end example
  7683. @item
  7684. Set a constant alpha channel value on input:
  7685. @example
  7686. format=rgba,lutrgb=a="maxval-minval/2"
  7687. @end example
  7688. @item
  7689. Correct luminance gamma by a factor of 0.5:
  7690. @example
  7691. lutyuv=y=gammaval(0.5)
  7692. @end example
  7693. @item
  7694. Discard least significant bits of luma:
  7695. @example
  7696. lutyuv=y='bitand(val, 128+64+32)'
  7697. @end example
  7698. @item
  7699. Technicolor like effect:
  7700. @example
  7701. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7702. @end example
  7703. @end itemize
  7704. @section lut2, tlut2
  7705. The @code{lut2} filter takes two input streams and outputs one
  7706. stream.
  7707. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7708. from one single stream.
  7709. This filter accepts the following parameters:
  7710. @table @option
  7711. @item c0
  7712. set first pixel component expression
  7713. @item c1
  7714. set second pixel component expression
  7715. @item c2
  7716. set third pixel component expression
  7717. @item c3
  7718. set fourth pixel component expression, corresponds to the alpha component
  7719. @end table
  7720. Each of them specifies the expression to use for computing the lookup table for
  7721. the corresponding pixel component values.
  7722. The exact component associated to each of the @var{c*} options depends on the
  7723. format in inputs.
  7724. The expressions can contain the following constants:
  7725. @table @option
  7726. @item w
  7727. @item h
  7728. The input width and height.
  7729. @item x
  7730. The first input value for the pixel component.
  7731. @item y
  7732. The second input value for the pixel component.
  7733. @item bdx
  7734. The first input video bit depth.
  7735. @item bdy
  7736. The second input video bit depth.
  7737. @end table
  7738. All expressions default to "x".
  7739. @subsection Examples
  7740. @itemize
  7741. @item
  7742. Highlight differences between two RGB video streams:
  7743. @example
  7744. 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)'
  7745. @end example
  7746. @item
  7747. Highlight differences between two YUV video streams:
  7748. @example
  7749. 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)'
  7750. @end example
  7751. @item
  7752. Show max difference between two video streams:
  7753. @example
  7754. 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)))'
  7755. @end example
  7756. @end itemize
  7757. @section maskedclamp
  7758. Clamp the first input stream with the second input and third input stream.
  7759. Returns the value of first stream to be between second input
  7760. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7761. This filter accepts the following options:
  7762. @table @option
  7763. @item undershoot
  7764. Default value is @code{0}.
  7765. @item overshoot
  7766. Default value is @code{0}.
  7767. @item planes
  7768. Set which planes will be processed as bitmap, unprocessed planes will be
  7769. copied from first stream.
  7770. By default value 0xf, all planes will be processed.
  7771. @end table
  7772. @section maskedmerge
  7773. Merge the first input stream with the second input stream using per pixel
  7774. weights in the third input stream.
  7775. A value of 0 in the third stream pixel component means that pixel component
  7776. from first stream is returned unchanged, while maximum value (eg. 255 for
  7777. 8-bit videos) means that pixel component from second stream is returned
  7778. unchanged. Intermediate values define the amount of merging between both
  7779. input stream's pixel components.
  7780. This filter accepts the following options:
  7781. @table @option
  7782. @item planes
  7783. Set which planes will be processed as bitmap, unprocessed planes will be
  7784. copied from first stream.
  7785. By default value 0xf, all planes will be processed.
  7786. @end table
  7787. @section mcdeint
  7788. Apply motion-compensation deinterlacing.
  7789. It needs one field per frame as input and must thus be used together
  7790. with yadif=1/3 or equivalent.
  7791. This filter accepts the following options:
  7792. @table @option
  7793. @item mode
  7794. Set the deinterlacing mode.
  7795. It accepts one of the following values:
  7796. @table @samp
  7797. @item fast
  7798. @item medium
  7799. @item slow
  7800. use iterative motion estimation
  7801. @item extra_slow
  7802. like @samp{slow}, but use multiple reference frames.
  7803. @end table
  7804. Default value is @samp{fast}.
  7805. @item parity
  7806. Set the picture field parity assumed for the input video. It must be
  7807. one of the following values:
  7808. @table @samp
  7809. @item 0, tff
  7810. assume top field first
  7811. @item 1, bff
  7812. assume bottom field first
  7813. @end table
  7814. Default value is @samp{bff}.
  7815. @item qp
  7816. Set per-block quantization parameter (QP) used by the internal
  7817. encoder.
  7818. Higher values should result in a smoother motion vector field but less
  7819. optimal individual vectors. Default value is 1.
  7820. @end table
  7821. @section mergeplanes
  7822. Merge color channel components from several video streams.
  7823. The filter accepts up to 4 input streams, and merge selected input
  7824. planes to the output video.
  7825. This filter accepts the following options:
  7826. @table @option
  7827. @item mapping
  7828. Set input to output plane mapping. Default is @code{0}.
  7829. The mappings is specified as a bitmap. It should be specified as a
  7830. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7831. mapping for the first plane of the output stream. 'A' sets the number of
  7832. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7833. corresponding input to use (from 0 to 3). The rest of the mappings is
  7834. similar, 'Bb' describes the mapping for the output stream second
  7835. plane, 'Cc' describes the mapping for the output stream third plane and
  7836. 'Dd' describes the mapping for the output stream fourth plane.
  7837. @item format
  7838. Set output pixel format. Default is @code{yuva444p}.
  7839. @end table
  7840. @subsection Examples
  7841. @itemize
  7842. @item
  7843. Merge three gray video streams of same width and height into single video stream:
  7844. @example
  7845. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7846. @end example
  7847. @item
  7848. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7849. @example
  7850. [a0][a1]mergeplanes=0x00010210:yuva444p
  7851. @end example
  7852. @item
  7853. Swap Y and A plane in yuva444p stream:
  7854. @example
  7855. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7856. @end example
  7857. @item
  7858. Swap U and V plane in yuv420p stream:
  7859. @example
  7860. format=yuv420p,mergeplanes=0x000201:yuv420p
  7861. @end example
  7862. @item
  7863. Cast a rgb24 clip to yuv444p:
  7864. @example
  7865. format=rgb24,mergeplanes=0x000102:yuv444p
  7866. @end example
  7867. @end itemize
  7868. @section mestimate
  7869. Estimate and export motion vectors using block matching algorithms.
  7870. Motion vectors are stored in frame side data to be used by other filters.
  7871. This filter accepts the following options:
  7872. @table @option
  7873. @item method
  7874. Specify the motion estimation method. Accepts one of the following values:
  7875. @table @samp
  7876. @item esa
  7877. Exhaustive search algorithm.
  7878. @item tss
  7879. Three step search algorithm.
  7880. @item tdls
  7881. Two dimensional logarithmic search algorithm.
  7882. @item ntss
  7883. New three step search algorithm.
  7884. @item fss
  7885. Four step search algorithm.
  7886. @item ds
  7887. Diamond search algorithm.
  7888. @item hexbs
  7889. Hexagon-based search algorithm.
  7890. @item epzs
  7891. Enhanced predictive zonal search algorithm.
  7892. @item umh
  7893. Uneven multi-hexagon search algorithm.
  7894. @end table
  7895. Default value is @samp{esa}.
  7896. @item mb_size
  7897. Macroblock size. Default @code{16}.
  7898. @item search_param
  7899. Search parameter. Default @code{7}.
  7900. @end table
  7901. @section midequalizer
  7902. Apply Midway Image Equalization effect using two video streams.
  7903. Midway Image Equalization adjusts a pair of images to have the same
  7904. histogram, while maintaining their dynamics as much as possible. It's
  7905. useful for e.g. matching exposures from a pair of stereo cameras.
  7906. This filter has two inputs and one output, which must be of same pixel format, but
  7907. may be of different sizes. The output of filter is first input adjusted with
  7908. midway histogram of both inputs.
  7909. This filter accepts the following option:
  7910. @table @option
  7911. @item planes
  7912. Set which planes to process. Default is @code{15}, which is all available planes.
  7913. @end table
  7914. @section minterpolate
  7915. Convert the video to specified frame rate using motion interpolation.
  7916. This filter accepts the following options:
  7917. @table @option
  7918. @item fps
  7919. 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}.
  7920. @item mi_mode
  7921. Motion interpolation mode. Following values are accepted:
  7922. @table @samp
  7923. @item dup
  7924. Duplicate previous or next frame for interpolating new ones.
  7925. @item blend
  7926. Blend source frames. Interpolated frame is mean of previous and next frames.
  7927. @item mci
  7928. Motion compensated interpolation. Following options are effective when this mode is selected:
  7929. @table @samp
  7930. @item mc_mode
  7931. Motion compensation mode. Following values are accepted:
  7932. @table @samp
  7933. @item obmc
  7934. Overlapped block motion compensation.
  7935. @item aobmc
  7936. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7937. @end table
  7938. Default mode is @samp{obmc}.
  7939. @item me_mode
  7940. Motion estimation mode. Following values are accepted:
  7941. @table @samp
  7942. @item bidir
  7943. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7944. @item bilat
  7945. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7946. @end table
  7947. Default mode is @samp{bilat}.
  7948. @item me
  7949. The algorithm to be used for motion estimation. Following values are accepted:
  7950. @table @samp
  7951. @item esa
  7952. Exhaustive search algorithm.
  7953. @item tss
  7954. Three step search algorithm.
  7955. @item tdls
  7956. Two dimensional logarithmic search algorithm.
  7957. @item ntss
  7958. New three step search algorithm.
  7959. @item fss
  7960. Four step search algorithm.
  7961. @item ds
  7962. Diamond search algorithm.
  7963. @item hexbs
  7964. Hexagon-based search algorithm.
  7965. @item epzs
  7966. Enhanced predictive zonal search algorithm.
  7967. @item umh
  7968. Uneven multi-hexagon search algorithm.
  7969. @end table
  7970. Default algorithm is @samp{epzs}.
  7971. @item mb_size
  7972. Macroblock size. Default @code{16}.
  7973. @item search_param
  7974. Motion estimation search parameter. Default @code{32}.
  7975. @item vsbmc
  7976. 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).
  7977. @end table
  7978. @end table
  7979. @item scd
  7980. 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:
  7981. @table @samp
  7982. @item none
  7983. Disable scene change detection.
  7984. @item fdiff
  7985. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7986. @end table
  7987. Default method is @samp{fdiff}.
  7988. @item scd_threshold
  7989. Scene change detection threshold. Default is @code{5.0}.
  7990. @end table
  7991. @section mpdecimate
  7992. Drop frames that do not differ greatly from the previous frame in
  7993. order to reduce frame rate.
  7994. The main use of this filter is for very-low-bitrate encoding
  7995. (e.g. streaming over dialup modem), but it could in theory be used for
  7996. fixing movies that were inverse-telecined incorrectly.
  7997. A description of the accepted options follows.
  7998. @table @option
  7999. @item max
  8000. Set the maximum number of consecutive frames which can be dropped (if
  8001. positive), or the minimum interval between dropped frames (if
  8002. negative). If the value is 0, the frame is dropped unregarding the
  8003. number of previous sequentially dropped frames.
  8004. Default value is 0.
  8005. @item hi
  8006. @item lo
  8007. @item frac
  8008. Set the dropping threshold values.
  8009. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8010. represent actual pixel value differences, so a threshold of 64
  8011. corresponds to 1 unit of difference for each pixel, or the same spread
  8012. out differently over the block.
  8013. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8014. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8015. meaning the whole image) differ by more than a threshold of @option{lo}.
  8016. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8017. 64*5, and default value for @option{frac} is 0.33.
  8018. @end table
  8019. @section negate
  8020. Negate input video.
  8021. It accepts an integer in input; if non-zero it negates the
  8022. alpha component (if available). The default value in input is 0.
  8023. @section nlmeans
  8024. Denoise frames using Non-Local Means algorithm.
  8025. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8026. context similarity is defined by comparing their surrounding patches of size
  8027. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8028. around the pixel.
  8029. Note that the research area defines centers for patches, which means some
  8030. patches will be made of pixels outside that research area.
  8031. The filter accepts the following options.
  8032. @table @option
  8033. @item s
  8034. Set denoising strength.
  8035. @item p
  8036. Set patch size.
  8037. @item pc
  8038. Same as @option{p} but for chroma planes.
  8039. The default value is @var{0} and means automatic.
  8040. @item r
  8041. Set research size.
  8042. @item rc
  8043. Same as @option{r} but for chroma planes.
  8044. The default value is @var{0} and means automatic.
  8045. @end table
  8046. @section nnedi
  8047. Deinterlace video using neural network edge directed interpolation.
  8048. This filter accepts the following options:
  8049. @table @option
  8050. @item weights
  8051. Mandatory option, without binary file filter can not work.
  8052. Currently file can be found here:
  8053. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8054. @item deint
  8055. Set which frames to deinterlace, by default it is @code{all}.
  8056. Can be @code{all} or @code{interlaced}.
  8057. @item field
  8058. Set mode of operation.
  8059. Can be one of the following:
  8060. @table @samp
  8061. @item af
  8062. Use frame flags, both fields.
  8063. @item a
  8064. Use frame flags, single field.
  8065. @item t
  8066. Use top field only.
  8067. @item b
  8068. Use bottom field only.
  8069. @item tf
  8070. Use both fields, top first.
  8071. @item bf
  8072. Use both fields, bottom first.
  8073. @end table
  8074. @item planes
  8075. Set which planes to process, by default filter process all frames.
  8076. @item nsize
  8077. Set size of local neighborhood around each pixel, used by the predictor neural
  8078. network.
  8079. Can be one of the following:
  8080. @table @samp
  8081. @item s8x6
  8082. @item s16x6
  8083. @item s32x6
  8084. @item s48x6
  8085. @item s8x4
  8086. @item s16x4
  8087. @item s32x4
  8088. @end table
  8089. @item nns
  8090. Set the number of neurons in predicctor neural network.
  8091. Can be one of the following:
  8092. @table @samp
  8093. @item n16
  8094. @item n32
  8095. @item n64
  8096. @item n128
  8097. @item n256
  8098. @end table
  8099. @item qual
  8100. Controls the number of different neural network predictions that are blended
  8101. together to compute the final output value. Can be @code{fast}, default or
  8102. @code{slow}.
  8103. @item etype
  8104. Set which set of weights to use in the predictor.
  8105. Can be one of the following:
  8106. @table @samp
  8107. @item a
  8108. weights trained to minimize absolute error
  8109. @item s
  8110. weights trained to minimize squared error
  8111. @end table
  8112. @item pscrn
  8113. Controls whether or not the prescreener neural network is used to decide
  8114. which pixels should be processed by the predictor neural network and which
  8115. can be handled by simple cubic interpolation.
  8116. The prescreener is trained to know whether cubic interpolation will be
  8117. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8118. The computational complexity of the prescreener nn is much less than that of
  8119. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8120. using the prescreener generally results in much faster processing.
  8121. The prescreener is pretty accurate, so the difference between using it and not
  8122. using it is almost always unnoticeable.
  8123. Can be one of the following:
  8124. @table @samp
  8125. @item none
  8126. @item original
  8127. @item new
  8128. @end table
  8129. Default is @code{new}.
  8130. @item fapprox
  8131. Set various debugging flags.
  8132. @end table
  8133. @section noformat
  8134. Force libavfilter not to use any of the specified pixel formats for the
  8135. input to the next filter.
  8136. It accepts the following parameters:
  8137. @table @option
  8138. @item pix_fmts
  8139. A '|'-separated list of pixel format names, such as
  8140. apix_fmts=yuv420p|monow|rgb24".
  8141. @end table
  8142. @subsection Examples
  8143. @itemize
  8144. @item
  8145. Force libavfilter to use a format different from @var{yuv420p} for the
  8146. input to the vflip filter:
  8147. @example
  8148. noformat=pix_fmts=yuv420p,vflip
  8149. @end example
  8150. @item
  8151. Convert the input video to any of the formats not contained in the list:
  8152. @example
  8153. noformat=yuv420p|yuv444p|yuv410p
  8154. @end example
  8155. @end itemize
  8156. @section noise
  8157. Add noise on video input frame.
  8158. The filter accepts the following options:
  8159. @table @option
  8160. @item all_seed
  8161. @item c0_seed
  8162. @item c1_seed
  8163. @item c2_seed
  8164. @item c3_seed
  8165. Set noise seed for specific pixel component or all pixel components in case
  8166. of @var{all_seed}. Default value is @code{123457}.
  8167. @item all_strength, alls
  8168. @item c0_strength, c0s
  8169. @item c1_strength, c1s
  8170. @item c2_strength, c2s
  8171. @item c3_strength, c3s
  8172. Set noise strength for specific pixel component or all pixel components in case
  8173. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8174. @item all_flags, allf
  8175. @item c0_flags, c0f
  8176. @item c1_flags, c1f
  8177. @item c2_flags, c2f
  8178. @item c3_flags, c3f
  8179. Set pixel component flags or set flags for all components if @var{all_flags}.
  8180. Available values for component flags are:
  8181. @table @samp
  8182. @item a
  8183. averaged temporal noise (smoother)
  8184. @item p
  8185. mix random noise with a (semi)regular pattern
  8186. @item t
  8187. temporal noise (noise pattern changes between frames)
  8188. @item u
  8189. uniform noise (gaussian otherwise)
  8190. @end table
  8191. @end table
  8192. @subsection Examples
  8193. Add temporal and uniform noise to input video:
  8194. @example
  8195. noise=alls=20:allf=t+u
  8196. @end example
  8197. @section null
  8198. Pass the video source unchanged to the output.
  8199. @section ocr
  8200. Optical Character Recognition
  8201. This filter uses Tesseract for optical character recognition.
  8202. It accepts the following options:
  8203. @table @option
  8204. @item datapath
  8205. Set datapath to tesseract data. Default is to use whatever was
  8206. set at installation.
  8207. @item language
  8208. Set language, default is "eng".
  8209. @item whitelist
  8210. Set character whitelist.
  8211. @item blacklist
  8212. Set character blacklist.
  8213. @end table
  8214. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8215. @section ocv
  8216. Apply a video transform using libopencv.
  8217. To enable this filter, install the libopencv library and headers and
  8218. configure FFmpeg with @code{--enable-libopencv}.
  8219. It accepts the following parameters:
  8220. @table @option
  8221. @item filter_name
  8222. The name of the libopencv filter to apply.
  8223. @item filter_params
  8224. The parameters to pass to the libopencv filter. If not specified, the default
  8225. values are assumed.
  8226. @end table
  8227. Refer to the official libopencv documentation for more precise
  8228. information:
  8229. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8230. Several libopencv filters are supported; see the following subsections.
  8231. @anchor{dilate}
  8232. @subsection dilate
  8233. Dilate an image by using a specific structuring element.
  8234. It corresponds to the libopencv function @code{cvDilate}.
  8235. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8236. @var{struct_el} represents a structuring element, and has the syntax:
  8237. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8238. @var{cols} and @var{rows} represent the number of columns and rows of
  8239. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8240. point, and @var{shape} the shape for the structuring element. @var{shape}
  8241. must be "rect", "cross", "ellipse", or "custom".
  8242. If the value for @var{shape} is "custom", it must be followed by a
  8243. string of the form "=@var{filename}". The file with name
  8244. @var{filename} is assumed to represent a binary image, with each
  8245. printable character corresponding to a bright pixel. When a custom
  8246. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8247. or columns and rows of the read file are assumed instead.
  8248. The default value for @var{struct_el} is "3x3+0x0/rect".
  8249. @var{nb_iterations} specifies the number of times the transform is
  8250. applied to the image, and defaults to 1.
  8251. Some examples:
  8252. @example
  8253. # Use the default values
  8254. ocv=dilate
  8255. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8256. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8257. # Read the shape from the file diamond.shape, iterating two times.
  8258. # The file diamond.shape may contain a pattern of characters like this
  8259. # *
  8260. # ***
  8261. # *****
  8262. # ***
  8263. # *
  8264. # The specified columns and rows are ignored
  8265. # but the anchor point coordinates are not
  8266. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8267. @end example
  8268. @subsection erode
  8269. Erode an image by using a specific structuring element.
  8270. It corresponds to the libopencv function @code{cvErode}.
  8271. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8272. with the same syntax and semantics as the @ref{dilate} filter.
  8273. @subsection smooth
  8274. Smooth the input video.
  8275. The filter takes the following parameters:
  8276. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8277. @var{type} is the type of smooth filter to apply, and must be one of
  8278. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8279. or "bilateral". The default value is "gaussian".
  8280. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8281. depend on the smooth type. @var{param1} and
  8282. @var{param2} accept integer positive values or 0. @var{param3} and
  8283. @var{param4} accept floating point values.
  8284. The default value for @var{param1} is 3. The default value for the
  8285. other parameters is 0.
  8286. These parameters correspond to the parameters assigned to the
  8287. libopencv function @code{cvSmooth}.
  8288. @section oscilloscope
  8289. 2D Video Oscilloscope.
  8290. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8291. It accepts the following parameters:
  8292. @table @option
  8293. @item x
  8294. Set scope center x position.
  8295. @item y
  8296. Set scope center y position.
  8297. @item s
  8298. Set scope size, relative to frame diagonal.
  8299. @item t
  8300. Set scope tilt/rotation.
  8301. @item o
  8302. Set trace opacity.
  8303. @item tx
  8304. Set trace center x position.
  8305. @item ty
  8306. Set trace center y position.
  8307. @item tw
  8308. Set trace width, relative to width of frame.
  8309. @item th
  8310. Set trace height, relative to height of frame.
  8311. @item c
  8312. Set which components to trace. By default it traces first three components.
  8313. @item g
  8314. Draw trace grid. By default is enabled.
  8315. @item st
  8316. Draw some statistics. By default is enabled.
  8317. @item sc
  8318. Draw scope. By default is enabled.
  8319. @end table
  8320. @subsection Examples
  8321. @itemize
  8322. @item
  8323. Inspect full first row of video frame.
  8324. @example
  8325. oscilloscope=x=0.5:y=0:s=1
  8326. @end example
  8327. @item
  8328. Inspect full last row of video frame.
  8329. @example
  8330. oscilloscope=x=0.5:y=1:s=1
  8331. @end example
  8332. @item
  8333. Inspect full 5th line of video frame of height 1080.
  8334. @example
  8335. oscilloscope=x=0.5:y=5/1080:s=1
  8336. @end example
  8337. @item
  8338. Inspect full last column of video frame.
  8339. @example
  8340. oscilloscope=x=1:y=0.5:s=1:t=1
  8341. @end example
  8342. @end itemize
  8343. @anchor{overlay}
  8344. @section overlay
  8345. Overlay one video on top of another.
  8346. It takes two inputs and has one output. The first input is the "main"
  8347. video on which the second input is overlaid.
  8348. It accepts the following parameters:
  8349. A description of the accepted options follows.
  8350. @table @option
  8351. @item x
  8352. @item y
  8353. Set the expression for the x and y coordinates of the overlaid video
  8354. on the main video. Default value is "0" for both expressions. In case
  8355. the expression is invalid, it is set to a huge value (meaning that the
  8356. overlay will not be displayed within the output visible area).
  8357. @item eval
  8358. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8359. It accepts the following values:
  8360. @table @samp
  8361. @item init
  8362. only evaluate expressions once during the filter initialization or
  8363. when a command is processed
  8364. @item frame
  8365. evaluate expressions for each incoming frame
  8366. @end table
  8367. Default value is @samp{frame}.
  8368. @item format
  8369. Set the format for the output video.
  8370. It accepts the following values:
  8371. @table @samp
  8372. @item yuv420
  8373. force YUV420 output
  8374. @item yuv422
  8375. force YUV422 output
  8376. @item yuv444
  8377. force YUV444 output
  8378. @item rgb
  8379. force packed RGB output
  8380. @item gbrp
  8381. force planar RGB output
  8382. @item auto
  8383. automatically pick format
  8384. @end table
  8385. Default value is @samp{yuv420}.
  8386. @end table
  8387. The @option{x}, and @option{y} expressions can contain the following
  8388. parameters.
  8389. @table @option
  8390. @item main_w, W
  8391. @item main_h, H
  8392. The main input width and height.
  8393. @item overlay_w, w
  8394. @item overlay_h, h
  8395. The overlay input width and height.
  8396. @item x
  8397. @item y
  8398. The computed values for @var{x} and @var{y}. They are evaluated for
  8399. each new frame.
  8400. @item hsub
  8401. @item vsub
  8402. horizontal and vertical chroma subsample values of the output
  8403. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8404. @var{vsub} is 1.
  8405. @item n
  8406. the number of input frame, starting from 0
  8407. @item pos
  8408. the position in the file of the input frame, NAN if unknown
  8409. @item t
  8410. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8411. @end table
  8412. This filter also supports the @ref{framesync} options.
  8413. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8414. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8415. when @option{eval} is set to @samp{init}.
  8416. Be aware that frames are taken from each input video in timestamp
  8417. order, hence, if their initial timestamps differ, it is a good idea
  8418. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8419. have them begin in the same zero timestamp, as the example for
  8420. the @var{movie} filter does.
  8421. You can chain together more overlays but you should test the
  8422. efficiency of such approach.
  8423. @subsection Commands
  8424. This filter supports the following commands:
  8425. @table @option
  8426. @item x
  8427. @item y
  8428. Modify the x and y of the overlay input.
  8429. The command accepts the same syntax of the corresponding option.
  8430. If the specified expression is not valid, it is kept at its current
  8431. value.
  8432. @end table
  8433. @subsection Examples
  8434. @itemize
  8435. @item
  8436. Draw the overlay at 10 pixels from the bottom right corner of the main
  8437. video:
  8438. @example
  8439. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8440. @end example
  8441. Using named options the example above becomes:
  8442. @example
  8443. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8444. @end example
  8445. @item
  8446. Insert a transparent PNG logo in the bottom left corner of the input,
  8447. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8448. @example
  8449. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8450. @end example
  8451. @item
  8452. Insert 2 different transparent PNG logos (second logo on bottom
  8453. right corner) using the @command{ffmpeg} tool:
  8454. @example
  8455. 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
  8456. @end example
  8457. @item
  8458. Add a transparent color layer on top of the main video; @code{WxH}
  8459. must specify the size of the main input to the overlay filter:
  8460. @example
  8461. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8462. @end example
  8463. @item
  8464. Play an original video and a filtered version (here with the deshake
  8465. filter) side by side using the @command{ffplay} tool:
  8466. @example
  8467. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8468. @end example
  8469. The above command is the same as:
  8470. @example
  8471. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8472. @end example
  8473. @item
  8474. Make a sliding overlay appearing from the left to the right top part of the
  8475. screen starting since time 2:
  8476. @example
  8477. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8478. @end example
  8479. @item
  8480. Compose output by putting two input videos side to side:
  8481. @example
  8482. ffmpeg -i left.avi -i right.avi -filter_complex "
  8483. nullsrc=size=200x100 [background];
  8484. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8485. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8486. [background][left] overlay=shortest=1 [background+left];
  8487. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8488. "
  8489. @end example
  8490. @item
  8491. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8492. @example
  8493. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8494. -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]'
  8495. masked.avi
  8496. @end example
  8497. @item
  8498. Chain several overlays in cascade:
  8499. @example
  8500. nullsrc=s=200x200 [bg];
  8501. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8502. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8503. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8504. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8505. [in3] null, [mid2] overlay=100:100 [out0]
  8506. @end example
  8507. @end itemize
  8508. @section owdenoise
  8509. Apply Overcomplete Wavelet denoiser.
  8510. The filter accepts the following options:
  8511. @table @option
  8512. @item depth
  8513. Set depth.
  8514. Larger depth values will denoise lower frequency components more, but
  8515. slow down filtering.
  8516. Must be an int in the range 8-16, default is @code{8}.
  8517. @item luma_strength, ls
  8518. Set luma strength.
  8519. Must be a double value in the range 0-1000, default is @code{1.0}.
  8520. @item chroma_strength, cs
  8521. Set chroma strength.
  8522. Must be a double value in the range 0-1000, default is @code{1.0}.
  8523. @end table
  8524. @anchor{pad}
  8525. @section pad
  8526. Add paddings to the input image, and place the original input at the
  8527. provided @var{x}, @var{y} coordinates.
  8528. It accepts the following parameters:
  8529. @table @option
  8530. @item width, w
  8531. @item height, h
  8532. Specify an expression for the size of the output image with the
  8533. paddings added. If the value for @var{width} or @var{height} is 0, the
  8534. corresponding input size is used for the output.
  8535. The @var{width} expression can reference the value set by the
  8536. @var{height} expression, and vice versa.
  8537. The default value of @var{width} and @var{height} is 0.
  8538. @item x
  8539. @item y
  8540. Specify the offsets to place the input image at within the padded area,
  8541. with respect to the top/left border of the output image.
  8542. The @var{x} expression can reference the value set by the @var{y}
  8543. expression, and vice versa.
  8544. The default value of @var{x} and @var{y} is 0.
  8545. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8546. so the input image is centered on the padded area.
  8547. @item color
  8548. Specify the color of the padded area. For the syntax of this option,
  8549. check the "Color" section in the ffmpeg-utils manual.
  8550. The default value of @var{color} is "black".
  8551. @item eval
  8552. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8553. It accepts the following values:
  8554. @table @samp
  8555. @item init
  8556. Only evaluate expressions once during the filter initialization or when
  8557. a command is processed.
  8558. @item frame
  8559. Evaluate expressions for each incoming frame.
  8560. @end table
  8561. Default value is @samp{init}.
  8562. @item aspect
  8563. Pad to aspect instead to a resolution.
  8564. @end table
  8565. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8566. options are expressions containing the following constants:
  8567. @table @option
  8568. @item in_w
  8569. @item in_h
  8570. The input video width and height.
  8571. @item iw
  8572. @item ih
  8573. These are the same as @var{in_w} and @var{in_h}.
  8574. @item out_w
  8575. @item out_h
  8576. The output width and height (the size of the padded area), as
  8577. specified by the @var{width} and @var{height} expressions.
  8578. @item ow
  8579. @item oh
  8580. These are the same as @var{out_w} and @var{out_h}.
  8581. @item x
  8582. @item y
  8583. The x and y offsets as specified by the @var{x} and @var{y}
  8584. expressions, or NAN if not yet specified.
  8585. @item a
  8586. same as @var{iw} / @var{ih}
  8587. @item sar
  8588. input sample aspect ratio
  8589. @item dar
  8590. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8591. @item hsub
  8592. @item vsub
  8593. The horizontal and vertical chroma subsample values. For example for the
  8594. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8595. @end table
  8596. @subsection Examples
  8597. @itemize
  8598. @item
  8599. Add paddings with the color "violet" to the input video. The output video
  8600. size is 640x480, and the top-left corner of the input video is placed at
  8601. column 0, row 40
  8602. @example
  8603. pad=640:480:0:40:violet
  8604. @end example
  8605. The example above is equivalent to the following command:
  8606. @example
  8607. pad=width=640:height=480:x=0:y=40:color=violet
  8608. @end example
  8609. @item
  8610. Pad the input to get an output with dimensions increased by 3/2,
  8611. and put the input video at the center of the padded area:
  8612. @example
  8613. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8614. @end example
  8615. @item
  8616. Pad the input to get a squared output with size equal to the maximum
  8617. value between the input width and height, and put the input video at
  8618. the center of the padded area:
  8619. @example
  8620. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8621. @end example
  8622. @item
  8623. Pad the input to get a final w/h ratio of 16:9:
  8624. @example
  8625. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8626. @end example
  8627. @item
  8628. In case of anamorphic video, in order to set the output display aspect
  8629. correctly, it is necessary to use @var{sar} in the expression,
  8630. according to the relation:
  8631. @example
  8632. (ih * X / ih) * sar = output_dar
  8633. X = output_dar / sar
  8634. @end example
  8635. Thus the previous example needs to be modified to:
  8636. @example
  8637. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8638. @end example
  8639. @item
  8640. Double the output size and put the input video in the bottom-right
  8641. corner of the output padded area:
  8642. @example
  8643. pad="2*iw:2*ih:ow-iw:oh-ih"
  8644. @end example
  8645. @end itemize
  8646. @anchor{palettegen}
  8647. @section palettegen
  8648. Generate one palette for a whole video stream.
  8649. It accepts the following options:
  8650. @table @option
  8651. @item max_colors
  8652. Set the maximum number of colors to quantize in the palette.
  8653. Note: the palette will still contain 256 colors; the unused palette entries
  8654. will be black.
  8655. @item reserve_transparent
  8656. Create a palette of 255 colors maximum and reserve the last one for
  8657. transparency. Reserving the transparency color is useful for GIF optimization.
  8658. If not set, the maximum of colors in the palette will be 256. You probably want
  8659. to disable this option for a standalone image.
  8660. Set by default.
  8661. @item stats_mode
  8662. Set statistics mode.
  8663. It accepts the following values:
  8664. @table @samp
  8665. @item full
  8666. Compute full frame histograms.
  8667. @item diff
  8668. Compute histograms only for the part that differs from previous frame. This
  8669. might be relevant to give more importance to the moving part of your input if
  8670. the background is static.
  8671. @item single
  8672. Compute new histogram for each frame.
  8673. @end table
  8674. Default value is @var{full}.
  8675. @end table
  8676. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8677. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8678. color quantization of the palette. This information is also visible at
  8679. @var{info} logging level.
  8680. @subsection Examples
  8681. @itemize
  8682. @item
  8683. Generate a representative palette of a given video using @command{ffmpeg}:
  8684. @example
  8685. ffmpeg -i input.mkv -vf palettegen palette.png
  8686. @end example
  8687. @end itemize
  8688. @section paletteuse
  8689. Use a palette to downsample an input video stream.
  8690. The filter takes two inputs: one video stream and a palette. The palette must
  8691. be a 256 pixels image.
  8692. It accepts the following options:
  8693. @table @option
  8694. @item dither
  8695. Select dithering mode. Available algorithms are:
  8696. @table @samp
  8697. @item bayer
  8698. Ordered 8x8 bayer dithering (deterministic)
  8699. @item heckbert
  8700. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8701. Note: this dithering is sometimes considered "wrong" and is included as a
  8702. reference.
  8703. @item floyd_steinberg
  8704. Floyd and Steingberg dithering (error diffusion)
  8705. @item sierra2
  8706. Frankie Sierra dithering v2 (error diffusion)
  8707. @item sierra2_4a
  8708. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8709. @end table
  8710. Default is @var{sierra2_4a}.
  8711. @item bayer_scale
  8712. When @var{bayer} dithering is selected, this option defines the scale of the
  8713. pattern (how much the crosshatch pattern is visible). A low value means more
  8714. visible pattern for less banding, and higher value means less visible pattern
  8715. at the cost of more banding.
  8716. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8717. @item diff_mode
  8718. If set, define the zone to process
  8719. @table @samp
  8720. @item rectangle
  8721. Only the changing rectangle will be reprocessed. This is similar to GIF
  8722. cropping/offsetting compression mechanism. This option can be useful for speed
  8723. if only a part of the image is changing, and has use cases such as limiting the
  8724. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8725. moving scene (it leads to more deterministic output if the scene doesn't change
  8726. much, and as a result less moving noise and better GIF compression).
  8727. @end table
  8728. Default is @var{none}.
  8729. @item new
  8730. Take new palette for each output frame.
  8731. @end table
  8732. @subsection Examples
  8733. @itemize
  8734. @item
  8735. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8736. using @command{ffmpeg}:
  8737. @example
  8738. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8739. @end example
  8740. @end itemize
  8741. @section perspective
  8742. Correct perspective of video not recorded perpendicular to the screen.
  8743. A description of the accepted parameters follows.
  8744. @table @option
  8745. @item x0
  8746. @item y0
  8747. @item x1
  8748. @item y1
  8749. @item x2
  8750. @item y2
  8751. @item x3
  8752. @item y3
  8753. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8754. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8755. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8756. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8757. then the corners of the source will be sent to the specified coordinates.
  8758. The expressions can use the following variables:
  8759. @table @option
  8760. @item W
  8761. @item H
  8762. the width and height of video frame.
  8763. @item in
  8764. Input frame count.
  8765. @item on
  8766. Output frame count.
  8767. @end table
  8768. @item interpolation
  8769. Set interpolation for perspective correction.
  8770. It accepts the following values:
  8771. @table @samp
  8772. @item linear
  8773. @item cubic
  8774. @end table
  8775. Default value is @samp{linear}.
  8776. @item sense
  8777. Set interpretation of coordinate options.
  8778. It accepts the following values:
  8779. @table @samp
  8780. @item 0, source
  8781. Send point in the source specified by the given coordinates to
  8782. the corners of the destination.
  8783. @item 1, destination
  8784. Send the corners of the source to the point in the destination specified
  8785. by the given coordinates.
  8786. Default value is @samp{source}.
  8787. @end table
  8788. @item eval
  8789. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8790. It accepts the following values:
  8791. @table @samp
  8792. @item init
  8793. only evaluate expressions once during the filter initialization or
  8794. when a command is processed
  8795. @item frame
  8796. evaluate expressions for each incoming frame
  8797. @end table
  8798. Default value is @samp{init}.
  8799. @end table
  8800. @section phase
  8801. Delay interlaced video by one field time so that the field order changes.
  8802. The intended use is to fix PAL movies that have been captured with the
  8803. opposite field order to the film-to-video transfer.
  8804. A description of the accepted parameters follows.
  8805. @table @option
  8806. @item mode
  8807. Set phase mode.
  8808. It accepts the following values:
  8809. @table @samp
  8810. @item t
  8811. Capture field order top-first, transfer bottom-first.
  8812. Filter will delay the bottom field.
  8813. @item b
  8814. Capture field order bottom-first, transfer top-first.
  8815. Filter will delay the top field.
  8816. @item p
  8817. Capture and transfer with the same field order. This mode only exists
  8818. for the documentation of the other options to refer to, but if you
  8819. actually select it, the filter will faithfully do nothing.
  8820. @item a
  8821. Capture field order determined automatically by field flags, transfer
  8822. opposite.
  8823. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8824. basis using field flags. If no field information is available,
  8825. then this works just like @samp{u}.
  8826. @item u
  8827. Capture unknown or varying, transfer opposite.
  8828. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8829. analyzing the images and selecting the alternative that produces best
  8830. match between the fields.
  8831. @item T
  8832. Capture top-first, transfer unknown or varying.
  8833. Filter selects among @samp{t} and @samp{p} using image analysis.
  8834. @item B
  8835. Capture bottom-first, transfer unknown or varying.
  8836. Filter selects among @samp{b} and @samp{p} using image analysis.
  8837. @item A
  8838. Capture determined by field flags, transfer unknown or varying.
  8839. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8840. image analysis. If no field information is available, then this works just
  8841. like @samp{U}. This is the default mode.
  8842. @item U
  8843. Both capture and transfer unknown or varying.
  8844. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8845. @end table
  8846. @end table
  8847. @section pixdesctest
  8848. Pixel format descriptor test filter, mainly useful for internal
  8849. testing. The output video should be equal to the input video.
  8850. For example:
  8851. @example
  8852. format=monow, pixdesctest
  8853. @end example
  8854. can be used to test the monowhite pixel format descriptor definition.
  8855. @section pixscope
  8856. Display sample values of color channels. Mainly useful for checking color and levels.
  8857. The filters accept the following options:
  8858. @table @option
  8859. @item x
  8860. Set scope X position, relative offset on X axis.
  8861. @item y
  8862. Set scope Y position, relative offset on Y axis.
  8863. @item w
  8864. Set scope width.
  8865. @item h
  8866. Set scope height.
  8867. @item o
  8868. Set window opacity. This window also holds statistics about pixel area.
  8869. @item wx
  8870. Set window X position, relative offset on X axis.
  8871. @item wy
  8872. Set window Y position, relative offset on Y axis.
  8873. @end table
  8874. @section pp
  8875. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8876. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8877. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8878. Each subfilter and some options have a short and a long name that can be used
  8879. interchangeably, i.e. dr/dering are the same.
  8880. The filters accept the following options:
  8881. @table @option
  8882. @item subfilters
  8883. Set postprocessing subfilters string.
  8884. @end table
  8885. All subfilters share common options to determine their scope:
  8886. @table @option
  8887. @item a/autoq
  8888. Honor the quality commands for this subfilter.
  8889. @item c/chrom
  8890. Do chrominance filtering, too (default).
  8891. @item y/nochrom
  8892. Do luminance filtering only (no chrominance).
  8893. @item n/noluma
  8894. Do chrominance filtering only (no luminance).
  8895. @end table
  8896. These options can be appended after the subfilter name, separated by a '|'.
  8897. Available subfilters are:
  8898. @table @option
  8899. @item hb/hdeblock[|difference[|flatness]]
  8900. Horizontal deblocking filter
  8901. @table @option
  8902. @item difference
  8903. Difference factor where higher values mean more deblocking (default: @code{32}).
  8904. @item flatness
  8905. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8906. @end table
  8907. @item vb/vdeblock[|difference[|flatness]]
  8908. Vertical deblocking filter
  8909. @table @option
  8910. @item difference
  8911. Difference factor where higher values mean more deblocking (default: @code{32}).
  8912. @item flatness
  8913. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8914. @end table
  8915. @item ha/hadeblock[|difference[|flatness]]
  8916. Accurate horizontal deblocking filter
  8917. @table @option
  8918. @item difference
  8919. Difference factor where higher values mean more deblocking (default: @code{32}).
  8920. @item flatness
  8921. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8922. @end table
  8923. @item va/vadeblock[|difference[|flatness]]
  8924. Accurate vertical deblocking filter
  8925. @table @option
  8926. @item difference
  8927. Difference factor where higher values mean more deblocking (default: @code{32}).
  8928. @item flatness
  8929. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8930. @end table
  8931. @end table
  8932. The horizontal and vertical deblocking filters share the difference and
  8933. flatness values so you cannot set different horizontal and vertical
  8934. thresholds.
  8935. @table @option
  8936. @item h1/x1hdeblock
  8937. Experimental horizontal deblocking filter
  8938. @item v1/x1vdeblock
  8939. Experimental vertical deblocking filter
  8940. @item dr/dering
  8941. Deringing filter
  8942. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8943. @table @option
  8944. @item threshold1
  8945. larger -> stronger filtering
  8946. @item threshold2
  8947. larger -> stronger filtering
  8948. @item threshold3
  8949. larger -> stronger filtering
  8950. @end table
  8951. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8952. @table @option
  8953. @item f/fullyrange
  8954. Stretch luminance to @code{0-255}.
  8955. @end table
  8956. @item lb/linblenddeint
  8957. Linear blend deinterlacing filter that deinterlaces the given block by
  8958. filtering all lines with a @code{(1 2 1)} filter.
  8959. @item li/linipoldeint
  8960. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8961. linearly interpolating every second line.
  8962. @item ci/cubicipoldeint
  8963. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8964. cubically interpolating every second line.
  8965. @item md/mediandeint
  8966. Median deinterlacing filter that deinterlaces the given block by applying a
  8967. median filter to every second line.
  8968. @item fd/ffmpegdeint
  8969. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8970. second line with a @code{(-1 4 2 4 -1)} filter.
  8971. @item l5/lowpass5
  8972. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8973. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8974. @item fq/forceQuant[|quantizer]
  8975. Overrides the quantizer table from the input with the constant quantizer you
  8976. specify.
  8977. @table @option
  8978. @item quantizer
  8979. Quantizer to use
  8980. @end table
  8981. @item de/default
  8982. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8983. @item fa/fast
  8984. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8985. @item ac
  8986. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8987. @end table
  8988. @subsection Examples
  8989. @itemize
  8990. @item
  8991. Apply horizontal and vertical deblocking, deringing and automatic
  8992. brightness/contrast:
  8993. @example
  8994. pp=hb/vb/dr/al
  8995. @end example
  8996. @item
  8997. Apply default filters without brightness/contrast correction:
  8998. @example
  8999. pp=de/-al
  9000. @end example
  9001. @item
  9002. Apply default filters and temporal denoiser:
  9003. @example
  9004. pp=default/tmpnoise|1|2|3
  9005. @end example
  9006. @item
  9007. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9008. automatically depending on available CPU time:
  9009. @example
  9010. pp=hb|y/vb|a
  9011. @end example
  9012. @end itemize
  9013. @section pp7
  9014. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9015. similar to spp = 6 with 7 point DCT, where only the center sample is
  9016. used after IDCT.
  9017. The filter accepts the following options:
  9018. @table @option
  9019. @item qp
  9020. Force a constant quantization parameter. It accepts an integer in range
  9021. 0 to 63. If not set, the filter will use the QP from the video stream
  9022. (if available).
  9023. @item mode
  9024. Set thresholding mode. Available modes are:
  9025. @table @samp
  9026. @item hard
  9027. Set hard thresholding.
  9028. @item soft
  9029. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9030. @item medium
  9031. Set medium thresholding (good results, default).
  9032. @end table
  9033. @end table
  9034. @section premultiply
  9035. Apply alpha premultiply effect to input video stream using first plane
  9036. of second stream as alpha.
  9037. Both streams must have same dimensions and same pixel format.
  9038. The filter accepts the following option:
  9039. @table @option
  9040. @item planes
  9041. Set which planes will be processed, unprocessed planes will be copied.
  9042. By default value 0xf, all planes will be processed.
  9043. @item inplace
  9044. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9045. @end table
  9046. @section prewitt
  9047. Apply prewitt operator to input video stream.
  9048. The filter accepts the following option:
  9049. @table @option
  9050. @item planes
  9051. Set which planes will be processed, unprocessed planes will be copied.
  9052. By default value 0xf, all planes will be processed.
  9053. @item scale
  9054. Set value which will be multiplied with filtered result.
  9055. @item delta
  9056. Set value which will be added to filtered result.
  9057. @end table
  9058. @section pseudocolor
  9059. Alter frame colors in video with pseudocolors.
  9060. This filter accept the following options:
  9061. @table @option
  9062. @item c0
  9063. set pixel first component expression
  9064. @item c1
  9065. set pixel second component expression
  9066. @item c2
  9067. set pixel third component expression
  9068. @item c3
  9069. set pixel fourth component expression, corresponds to the alpha component
  9070. @item i
  9071. set component to use as base for altering colors
  9072. @end table
  9073. Each of them specifies the expression to use for computing the lookup table for
  9074. the corresponding pixel component values.
  9075. The expressions can contain the following constants and functions:
  9076. @table @option
  9077. @item w
  9078. @item h
  9079. The input width and height.
  9080. @item val
  9081. The input value for the pixel component.
  9082. @item ymin, umin, vmin, amin
  9083. The minimum allowed component value.
  9084. @item ymax, umax, vmax, amax
  9085. The maximum allowed component value.
  9086. @end table
  9087. All expressions default to "val".
  9088. @subsection Examples
  9089. @itemize
  9090. @item
  9091. Change too high luma values to gradient:
  9092. @example
  9093. 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'"
  9094. @end example
  9095. @end itemize
  9096. @section psnr
  9097. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9098. Ratio) between two input videos.
  9099. This filter takes in input two input videos, the first input is
  9100. considered the "main" source and is passed unchanged to the
  9101. output. The second input is used as a "reference" video for computing
  9102. the PSNR.
  9103. Both video inputs must have the same resolution and pixel format for
  9104. this filter to work correctly. Also it assumes that both inputs
  9105. have the same number of frames, which are compared one by one.
  9106. The obtained average PSNR is printed through the logging system.
  9107. The filter stores the accumulated MSE (mean squared error) of each
  9108. frame, and at the end of the processing it is averaged across all frames
  9109. equally, and the following formula is applied to obtain the PSNR:
  9110. @example
  9111. PSNR = 10*log10(MAX^2/MSE)
  9112. @end example
  9113. Where MAX is the average of the maximum values of each component of the
  9114. image.
  9115. The description of the accepted parameters follows.
  9116. @table @option
  9117. @item stats_file, f
  9118. If specified the filter will use the named file to save the PSNR of
  9119. each individual frame. When filename equals "-" the data is sent to
  9120. standard output.
  9121. @item stats_version
  9122. Specifies which version of the stats file format to use. Details of
  9123. each format are written below.
  9124. Default value is 1.
  9125. @item stats_add_max
  9126. Determines whether the max value is output to the stats log.
  9127. Default value is 0.
  9128. Requires stats_version >= 2. If this is set and stats_version < 2,
  9129. the filter will return an error.
  9130. @end table
  9131. This filter also supports the @ref{framesync} options.
  9132. The file printed if @var{stats_file} is selected, contains a sequence of
  9133. key/value pairs of the form @var{key}:@var{value} for each compared
  9134. couple of frames.
  9135. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9136. the list of per-frame-pair stats, with key value pairs following the frame
  9137. format with the following parameters:
  9138. @table @option
  9139. @item psnr_log_version
  9140. The version of the log file format. Will match @var{stats_version}.
  9141. @item fields
  9142. A comma separated list of the per-frame-pair parameters included in
  9143. the log.
  9144. @end table
  9145. A description of each shown per-frame-pair parameter follows:
  9146. @table @option
  9147. @item n
  9148. sequential number of the input frame, starting from 1
  9149. @item mse_avg
  9150. Mean Square Error pixel-by-pixel average difference of the compared
  9151. frames, averaged over all the image components.
  9152. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9153. Mean Square Error pixel-by-pixel average difference of the compared
  9154. frames for the component specified by the suffix.
  9155. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9156. Peak Signal to Noise ratio of the compared frames for the component
  9157. specified by the suffix.
  9158. @item max_avg, max_y, max_u, max_v
  9159. Maximum allowed value for each channel, and average over all
  9160. channels.
  9161. @end table
  9162. For example:
  9163. @example
  9164. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9165. [main][ref] psnr="stats_file=stats.log" [out]
  9166. @end example
  9167. On this example the input file being processed is compared with the
  9168. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9169. is stored in @file{stats.log}.
  9170. @anchor{pullup}
  9171. @section pullup
  9172. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9173. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9174. content.
  9175. The pullup filter is designed to take advantage of future context in making
  9176. its decisions. This filter is stateless in the sense that it does not lock
  9177. onto a pattern to follow, but it instead looks forward to the following
  9178. fields in order to identify matches and rebuild progressive frames.
  9179. To produce content with an even framerate, insert the fps filter after
  9180. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9181. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9182. The filter accepts the following options:
  9183. @table @option
  9184. @item jl
  9185. @item jr
  9186. @item jt
  9187. @item jb
  9188. These options set the amount of "junk" to ignore at the left, right, top, and
  9189. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9190. while top and bottom are in units of 2 lines.
  9191. The default is 8 pixels on each side.
  9192. @item sb
  9193. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9194. filter generating an occasional mismatched frame, but it may also cause an
  9195. excessive number of frames to be dropped during high motion sequences.
  9196. Conversely, setting it to -1 will make filter match fields more easily.
  9197. This may help processing of video where there is slight blurring between
  9198. the fields, but may also cause there to be interlaced frames in the output.
  9199. Default value is @code{0}.
  9200. @item mp
  9201. Set the metric plane to use. It accepts the following values:
  9202. @table @samp
  9203. @item l
  9204. Use luma plane.
  9205. @item u
  9206. Use chroma blue plane.
  9207. @item v
  9208. Use chroma red plane.
  9209. @end table
  9210. This option may be set to use chroma plane instead of the default luma plane
  9211. for doing filter's computations. This may improve accuracy on very clean
  9212. source material, but more likely will decrease accuracy, especially if there
  9213. is chroma noise (rainbow effect) or any grayscale video.
  9214. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9215. load and make pullup usable in realtime on slow machines.
  9216. @end table
  9217. For best results (without duplicated frames in the output file) it is
  9218. necessary to change the output frame rate. For example, to inverse
  9219. telecine NTSC input:
  9220. @example
  9221. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9222. @end example
  9223. @section qp
  9224. Change video quantization parameters (QP).
  9225. The filter accepts the following option:
  9226. @table @option
  9227. @item qp
  9228. Set expression for quantization parameter.
  9229. @end table
  9230. The expression is evaluated through the eval API and can contain, among others,
  9231. the following constants:
  9232. @table @var
  9233. @item known
  9234. 1 if index is not 129, 0 otherwise.
  9235. @item qp
  9236. Sequentional index starting from -129 to 128.
  9237. @end table
  9238. @subsection Examples
  9239. @itemize
  9240. @item
  9241. Some equation like:
  9242. @example
  9243. qp=2+2*sin(PI*qp)
  9244. @end example
  9245. @end itemize
  9246. @section random
  9247. Flush video frames from internal cache of frames into a random order.
  9248. No frame is discarded.
  9249. Inspired by @ref{frei0r} nervous filter.
  9250. @table @option
  9251. @item frames
  9252. Set size in number of frames of internal cache, in range from @code{2} to
  9253. @code{512}. Default is @code{30}.
  9254. @item seed
  9255. Set seed for random number generator, must be an integer included between
  9256. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9257. less than @code{0}, the filter will try to use a good random seed on a
  9258. best effort basis.
  9259. @end table
  9260. @section readeia608
  9261. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9262. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9263. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9264. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9265. @table @option
  9266. @item lavfi.readeia608.X.cc
  9267. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9268. @item lavfi.readeia608.X.line
  9269. The number of the line on which the EIA-608 data was identified and read.
  9270. @end table
  9271. This filter accepts the following options:
  9272. @table @option
  9273. @item scan_min
  9274. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9275. @item scan_max
  9276. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9277. @item mac
  9278. Set minimal acceptable amplitude change for sync codes detection.
  9279. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9280. @item spw
  9281. Set the ratio of width reserved for sync code detection.
  9282. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9283. @item mhd
  9284. Set the max peaks height difference for sync code detection.
  9285. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9286. @item mpd
  9287. Set max peaks period difference for sync code detection.
  9288. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9289. @item msd
  9290. Set the first two max start code bits differences.
  9291. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9292. @item bhd
  9293. Set the minimum ratio of bits height compared to 3rd start code bit.
  9294. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9295. @item th_w
  9296. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9297. @item th_b
  9298. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9299. @item chp
  9300. Enable checking the parity bit. In the event of a parity error, the filter will output
  9301. @code{0x00} for that character. Default is false.
  9302. @end table
  9303. @subsection Examples
  9304. @itemize
  9305. @item
  9306. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9307. @example
  9308. 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
  9309. @end example
  9310. @end itemize
  9311. @section readvitc
  9312. Read vertical interval timecode (VITC) information from the top lines of a
  9313. video frame.
  9314. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9315. timecode value, if a valid timecode has been detected. Further metadata key
  9316. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9317. timecode data has been found or not.
  9318. This filter accepts the following options:
  9319. @table @option
  9320. @item scan_max
  9321. Set the maximum number of lines to scan for VITC data. If the value is set to
  9322. @code{-1} the full video frame is scanned. Default is @code{45}.
  9323. @item thr_b
  9324. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9325. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9326. @item thr_w
  9327. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9328. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9329. @end table
  9330. @subsection Examples
  9331. @itemize
  9332. @item
  9333. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9334. draw @code{--:--:--:--} as a placeholder:
  9335. @example
  9336. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9337. @end example
  9338. @end itemize
  9339. @section remap
  9340. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9341. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9342. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9343. value for pixel will be used for destination pixel.
  9344. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9345. will have Xmap/Ymap video stream dimensions.
  9346. Xmap and Ymap input video streams are 16bit depth, single channel.
  9347. @section removegrain
  9348. The removegrain filter is a spatial denoiser for progressive video.
  9349. @table @option
  9350. @item m0
  9351. Set mode for the first plane.
  9352. @item m1
  9353. Set mode for the second plane.
  9354. @item m2
  9355. Set mode for the third plane.
  9356. @item m3
  9357. Set mode for the fourth plane.
  9358. @end table
  9359. Range of mode is from 0 to 24. Description of each mode follows:
  9360. @table @var
  9361. @item 0
  9362. Leave input plane unchanged. Default.
  9363. @item 1
  9364. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9365. @item 2
  9366. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9367. @item 3
  9368. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9369. @item 4
  9370. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9371. This is equivalent to a median filter.
  9372. @item 5
  9373. Line-sensitive clipping giving the minimal change.
  9374. @item 6
  9375. Line-sensitive clipping, intermediate.
  9376. @item 7
  9377. Line-sensitive clipping, intermediate.
  9378. @item 8
  9379. Line-sensitive clipping, intermediate.
  9380. @item 9
  9381. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9382. @item 10
  9383. Replaces the target pixel with the closest neighbour.
  9384. @item 11
  9385. [1 2 1] horizontal and vertical kernel blur.
  9386. @item 12
  9387. Same as mode 11.
  9388. @item 13
  9389. Bob mode, interpolates top field from the line where the neighbours
  9390. pixels are the closest.
  9391. @item 14
  9392. Bob mode, interpolates bottom field from the line where the neighbours
  9393. pixels are the closest.
  9394. @item 15
  9395. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9396. interpolation formula.
  9397. @item 16
  9398. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9399. interpolation formula.
  9400. @item 17
  9401. Clips the pixel with the minimum and maximum of respectively the maximum and
  9402. minimum of each pair of opposite neighbour pixels.
  9403. @item 18
  9404. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9405. the current pixel is minimal.
  9406. @item 19
  9407. Replaces the pixel with the average of its 8 neighbours.
  9408. @item 20
  9409. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9410. @item 21
  9411. Clips pixels using the averages of opposite neighbour.
  9412. @item 22
  9413. Same as mode 21 but simpler and faster.
  9414. @item 23
  9415. Small edge and halo removal, but reputed useless.
  9416. @item 24
  9417. Similar as 23.
  9418. @end table
  9419. @section removelogo
  9420. Suppress a TV station logo, using an image file to determine which
  9421. pixels comprise the logo. It works by filling in the pixels that
  9422. comprise the logo with neighboring pixels.
  9423. The filter accepts the following options:
  9424. @table @option
  9425. @item filename, f
  9426. Set the filter bitmap file, which can be any image format supported by
  9427. libavformat. The width and height of the image file must match those of the
  9428. video stream being processed.
  9429. @end table
  9430. Pixels in the provided bitmap image with a value of zero are not
  9431. considered part of the logo, non-zero pixels are considered part of
  9432. the logo. If you use white (255) for the logo and black (0) for the
  9433. rest, you will be safe. For making the filter bitmap, it is
  9434. recommended to take a screen capture of a black frame with the logo
  9435. visible, and then using a threshold filter followed by the erode
  9436. filter once or twice.
  9437. If needed, little splotches can be fixed manually. Remember that if
  9438. logo pixels are not covered, the filter quality will be much
  9439. reduced. Marking too many pixels as part of the logo does not hurt as
  9440. much, but it will increase the amount of blurring needed to cover over
  9441. the image and will destroy more information than necessary, and extra
  9442. pixels will slow things down on a large logo.
  9443. @section repeatfields
  9444. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9445. fields based on its value.
  9446. @section reverse
  9447. Reverse a video clip.
  9448. Warning: This filter requires memory to buffer the entire clip, so trimming
  9449. is suggested.
  9450. @subsection Examples
  9451. @itemize
  9452. @item
  9453. Take the first 5 seconds of a clip, and reverse it.
  9454. @example
  9455. trim=end=5,reverse
  9456. @end example
  9457. @end itemize
  9458. @section roberts
  9459. Apply roberts cross operator to input video stream.
  9460. The filter accepts the following option:
  9461. @table @option
  9462. @item planes
  9463. Set which planes will be processed, unprocessed planes will be copied.
  9464. By default value 0xf, all planes will be processed.
  9465. @item scale
  9466. Set value which will be multiplied with filtered result.
  9467. @item delta
  9468. Set value which will be added to filtered result.
  9469. @end table
  9470. @section rotate
  9471. Rotate video by an arbitrary angle expressed in radians.
  9472. The filter accepts the following options:
  9473. A description of the optional parameters follows.
  9474. @table @option
  9475. @item angle, a
  9476. Set an expression for the angle by which to rotate the input video
  9477. clockwise, expressed as a number of radians. A negative value will
  9478. result in a counter-clockwise rotation. By default it is set to "0".
  9479. This expression is evaluated for each frame.
  9480. @item out_w, ow
  9481. Set the output width expression, default value is "iw".
  9482. This expression is evaluated just once during configuration.
  9483. @item out_h, oh
  9484. Set the output height expression, default value is "ih".
  9485. This expression is evaluated just once during configuration.
  9486. @item bilinear
  9487. Enable bilinear interpolation if set to 1, a value of 0 disables
  9488. it. Default value is 1.
  9489. @item fillcolor, c
  9490. Set the color used to fill the output area not covered by the rotated
  9491. image. For the general syntax of this option, check the "Color" section in the
  9492. ffmpeg-utils manual. If the special value "none" is selected then no
  9493. background is printed (useful for example if the background is never shown).
  9494. Default value is "black".
  9495. @end table
  9496. The expressions for the angle and the output size can contain the
  9497. following constants and functions:
  9498. @table @option
  9499. @item n
  9500. sequential number of the input frame, starting from 0. It is always NAN
  9501. before the first frame is filtered.
  9502. @item t
  9503. time in seconds of the input frame, it is set to 0 when the filter is
  9504. configured. It is always NAN before the first frame is filtered.
  9505. @item hsub
  9506. @item vsub
  9507. horizontal and vertical chroma subsample values. For example for the
  9508. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9509. @item in_w, iw
  9510. @item in_h, ih
  9511. the input video width and height
  9512. @item out_w, ow
  9513. @item out_h, oh
  9514. the output width and height, that is the size of the padded area as
  9515. specified by the @var{width} and @var{height} expressions
  9516. @item rotw(a)
  9517. @item roth(a)
  9518. the minimal width/height required for completely containing the input
  9519. video rotated by @var{a} radians.
  9520. These are only available when computing the @option{out_w} and
  9521. @option{out_h} expressions.
  9522. @end table
  9523. @subsection Examples
  9524. @itemize
  9525. @item
  9526. Rotate the input by PI/6 radians clockwise:
  9527. @example
  9528. rotate=PI/6
  9529. @end example
  9530. @item
  9531. Rotate the input by PI/6 radians counter-clockwise:
  9532. @example
  9533. rotate=-PI/6
  9534. @end example
  9535. @item
  9536. Rotate the input by 45 degrees clockwise:
  9537. @example
  9538. rotate=45*PI/180
  9539. @end example
  9540. @item
  9541. Apply a constant rotation with period T, starting from an angle of PI/3:
  9542. @example
  9543. rotate=PI/3+2*PI*t/T
  9544. @end example
  9545. @item
  9546. Make the input video rotation oscillating with a period of T
  9547. seconds and an amplitude of A radians:
  9548. @example
  9549. rotate=A*sin(2*PI/T*t)
  9550. @end example
  9551. @item
  9552. Rotate the video, output size is chosen so that the whole rotating
  9553. input video is always completely contained in the output:
  9554. @example
  9555. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9556. @end example
  9557. @item
  9558. Rotate the video, reduce the output size so that no background is ever
  9559. shown:
  9560. @example
  9561. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9562. @end example
  9563. @end itemize
  9564. @subsection Commands
  9565. The filter supports the following commands:
  9566. @table @option
  9567. @item a, angle
  9568. Set the angle expression.
  9569. The command accepts the same syntax of the corresponding option.
  9570. If the specified expression is not valid, it is kept at its current
  9571. value.
  9572. @end table
  9573. @section sab
  9574. Apply Shape Adaptive Blur.
  9575. The filter accepts the following options:
  9576. @table @option
  9577. @item luma_radius, lr
  9578. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9579. value is 1.0. A greater value will result in a more blurred image, and
  9580. in slower processing.
  9581. @item luma_pre_filter_radius, lpfr
  9582. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9583. value is 1.0.
  9584. @item luma_strength, ls
  9585. Set luma maximum difference between pixels to still be considered, must
  9586. be a value in the 0.1-100.0 range, default value is 1.0.
  9587. @item chroma_radius, cr
  9588. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9589. greater value will result in a more blurred image, and in slower
  9590. processing.
  9591. @item chroma_pre_filter_radius, cpfr
  9592. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9593. @item chroma_strength, cs
  9594. Set chroma maximum difference between pixels to still be considered,
  9595. must be a value in the -0.9-100.0 range.
  9596. @end table
  9597. Each chroma option value, if not explicitly specified, is set to the
  9598. corresponding luma option value.
  9599. @anchor{scale}
  9600. @section scale
  9601. Scale (resize) the input video, using the libswscale library.
  9602. The scale filter forces the output display aspect ratio to be the same
  9603. of the input, by changing the output sample aspect ratio.
  9604. If the input image format is different from the format requested by
  9605. the next filter, the scale filter will convert the input to the
  9606. requested format.
  9607. @subsection Options
  9608. The filter accepts the following options, or any of the options
  9609. supported by the libswscale scaler.
  9610. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9611. the complete list of scaler options.
  9612. @table @option
  9613. @item width, w
  9614. @item height, h
  9615. Set the output video dimension expression. Default value is the input
  9616. dimension.
  9617. If the @var{width} or @var{w} value is 0, the input width is used for
  9618. the output. If the @var{height} or @var{h} value is 0, the input height
  9619. is used for the output.
  9620. If one and only one of the values is -n with n >= 1, the scale filter
  9621. will use a value that maintains the aspect ratio of the input image,
  9622. calculated from the other specified dimension. After that it will,
  9623. however, make sure that the calculated dimension is divisible by n and
  9624. adjust the value if necessary.
  9625. If both values are -n with n >= 1, the behavior will be identical to
  9626. both values being set to 0 as previously detailed.
  9627. See below for the list of accepted constants for use in the dimension
  9628. expression.
  9629. @item eval
  9630. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9631. @table @samp
  9632. @item init
  9633. Only evaluate expressions once during the filter initialization or when a command is processed.
  9634. @item frame
  9635. Evaluate expressions for each incoming frame.
  9636. @end table
  9637. Default value is @samp{init}.
  9638. @item interl
  9639. Set the interlacing mode. It accepts the following values:
  9640. @table @samp
  9641. @item 1
  9642. Force interlaced aware scaling.
  9643. @item 0
  9644. Do not apply interlaced scaling.
  9645. @item -1
  9646. Select interlaced aware scaling depending on whether the source frames
  9647. are flagged as interlaced or not.
  9648. @end table
  9649. Default value is @samp{0}.
  9650. @item flags
  9651. Set libswscale scaling flags. See
  9652. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9653. complete list of values. If not explicitly specified the filter applies
  9654. the default flags.
  9655. @item param0, param1
  9656. Set libswscale input parameters for scaling algorithms that need them. See
  9657. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9658. complete documentation. If not explicitly specified the filter applies
  9659. empty parameters.
  9660. @item size, s
  9661. Set the video size. For the syntax of this option, check the
  9662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9663. @item in_color_matrix
  9664. @item out_color_matrix
  9665. Set in/output YCbCr color space type.
  9666. This allows the autodetected value to be overridden as well as allows forcing
  9667. a specific value used for the output and encoder.
  9668. If not specified, the color space type depends on the pixel format.
  9669. Possible values:
  9670. @table @samp
  9671. @item auto
  9672. Choose automatically.
  9673. @item bt709
  9674. Format conforming to International Telecommunication Union (ITU)
  9675. Recommendation BT.709.
  9676. @item fcc
  9677. Set color space conforming to the United States Federal Communications
  9678. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9679. @item bt601
  9680. Set color space conforming to:
  9681. @itemize
  9682. @item
  9683. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9684. @item
  9685. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9686. @item
  9687. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9688. @end itemize
  9689. @item smpte240m
  9690. Set color space conforming to SMPTE ST 240:1999.
  9691. @end table
  9692. @item in_range
  9693. @item out_range
  9694. Set in/output YCbCr sample range.
  9695. This allows the autodetected value to be overridden as well as allows forcing
  9696. a specific value used for the output and encoder. If not specified, the
  9697. range depends on the pixel format. Possible values:
  9698. @table @samp
  9699. @item auto
  9700. Choose automatically.
  9701. @item jpeg/full/pc
  9702. Set full range (0-255 in case of 8-bit luma).
  9703. @item mpeg/tv
  9704. Set "MPEG" range (16-235 in case of 8-bit luma).
  9705. @end table
  9706. @item force_original_aspect_ratio
  9707. Enable decreasing or increasing output video width or height if necessary to
  9708. keep the original aspect ratio. Possible values:
  9709. @table @samp
  9710. @item disable
  9711. Scale the video as specified and disable this feature.
  9712. @item decrease
  9713. The output video dimensions will automatically be decreased if needed.
  9714. @item increase
  9715. The output video dimensions will automatically be increased if needed.
  9716. @end table
  9717. One useful instance of this option is that when you know a specific device's
  9718. maximum allowed resolution, you can use this to limit the output video to
  9719. that, while retaining the aspect ratio. For example, device A allows
  9720. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9721. decrease) and specifying 1280x720 to the command line makes the output
  9722. 1280x533.
  9723. Please note that this is a different thing than specifying -1 for @option{w}
  9724. or @option{h}, you still need to specify the output resolution for this option
  9725. to work.
  9726. @end table
  9727. The values of the @option{w} and @option{h} options are expressions
  9728. containing the following constants:
  9729. @table @var
  9730. @item in_w
  9731. @item in_h
  9732. The input width and height
  9733. @item iw
  9734. @item ih
  9735. These are the same as @var{in_w} and @var{in_h}.
  9736. @item out_w
  9737. @item out_h
  9738. The output (scaled) width and height
  9739. @item ow
  9740. @item oh
  9741. These are the same as @var{out_w} and @var{out_h}
  9742. @item a
  9743. The same as @var{iw} / @var{ih}
  9744. @item sar
  9745. input sample aspect ratio
  9746. @item dar
  9747. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9748. @item hsub
  9749. @item vsub
  9750. horizontal and vertical input chroma subsample values. For example for the
  9751. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9752. @item ohsub
  9753. @item ovsub
  9754. horizontal and vertical output chroma subsample values. For example for the
  9755. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9756. @end table
  9757. @subsection Examples
  9758. @itemize
  9759. @item
  9760. Scale the input video to a size of 200x100
  9761. @example
  9762. scale=w=200:h=100
  9763. @end example
  9764. This is equivalent to:
  9765. @example
  9766. scale=200:100
  9767. @end example
  9768. or:
  9769. @example
  9770. scale=200x100
  9771. @end example
  9772. @item
  9773. Specify a size abbreviation for the output size:
  9774. @example
  9775. scale=qcif
  9776. @end example
  9777. which can also be written as:
  9778. @example
  9779. scale=size=qcif
  9780. @end example
  9781. @item
  9782. Scale the input to 2x:
  9783. @example
  9784. scale=w=2*iw:h=2*ih
  9785. @end example
  9786. @item
  9787. The above is the same as:
  9788. @example
  9789. scale=2*in_w:2*in_h
  9790. @end example
  9791. @item
  9792. Scale the input to 2x with forced interlaced scaling:
  9793. @example
  9794. scale=2*iw:2*ih:interl=1
  9795. @end example
  9796. @item
  9797. Scale the input to half size:
  9798. @example
  9799. scale=w=iw/2:h=ih/2
  9800. @end example
  9801. @item
  9802. Increase the width, and set the height to the same size:
  9803. @example
  9804. scale=3/2*iw:ow
  9805. @end example
  9806. @item
  9807. Seek Greek harmony:
  9808. @example
  9809. scale=iw:1/PHI*iw
  9810. scale=ih*PHI:ih
  9811. @end example
  9812. @item
  9813. Increase the height, and set the width to 3/2 of the height:
  9814. @example
  9815. scale=w=3/2*oh:h=3/5*ih
  9816. @end example
  9817. @item
  9818. Increase the size, making the size a multiple of the chroma
  9819. subsample values:
  9820. @example
  9821. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9822. @end example
  9823. @item
  9824. Increase the width to a maximum of 500 pixels,
  9825. keeping the same aspect ratio as the input:
  9826. @example
  9827. scale=w='min(500\, iw*3/2):h=-1'
  9828. @end example
  9829. @end itemize
  9830. @subsection Commands
  9831. This filter supports the following commands:
  9832. @table @option
  9833. @item width, w
  9834. @item height, h
  9835. Set the output video dimension expression.
  9836. The command accepts the same syntax of the corresponding option.
  9837. If the specified expression is not valid, it is kept at its current
  9838. value.
  9839. @end table
  9840. @section scale_npp
  9841. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9842. format conversion on CUDA video frames. Setting the output width and height
  9843. works in the same way as for the @var{scale} filter.
  9844. The following additional options are accepted:
  9845. @table @option
  9846. @item format
  9847. The pixel format of the output CUDA frames. If set to the string "same" (the
  9848. default), the input format will be kept. Note that automatic format negotiation
  9849. and conversion is not yet supported for hardware frames
  9850. @item interp_algo
  9851. The interpolation algorithm used for resizing. One of the following:
  9852. @table @option
  9853. @item nn
  9854. Nearest neighbour.
  9855. @item linear
  9856. @item cubic
  9857. @item cubic2p_bspline
  9858. 2-parameter cubic (B=1, C=0)
  9859. @item cubic2p_catmullrom
  9860. 2-parameter cubic (B=0, C=1/2)
  9861. @item cubic2p_b05c03
  9862. 2-parameter cubic (B=1/2, C=3/10)
  9863. @item super
  9864. Supersampling
  9865. @item lanczos
  9866. @end table
  9867. @end table
  9868. @section scale2ref
  9869. Scale (resize) the input video, based on a reference video.
  9870. See the scale filter for available options, scale2ref supports the same but
  9871. uses the reference video instead of the main input as basis. scale2ref also
  9872. supports the following additional constants for the @option{w} and
  9873. @option{h} options:
  9874. @table @var
  9875. @item main_w
  9876. @item main_h
  9877. The main input video's width and height
  9878. @item main_a
  9879. The same as @var{main_w} / @var{main_h}
  9880. @item main_sar
  9881. The main input video's sample aspect ratio
  9882. @item main_dar, mdar
  9883. The main input video's display aspect ratio. Calculated from
  9884. @code{(main_w / main_h) * main_sar}.
  9885. @item main_hsub
  9886. @item main_vsub
  9887. The main input video's horizontal and vertical chroma subsample values.
  9888. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9889. is 1.
  9890. @end table
  9891. @subsection Examples
  9892. @itemize
  9893. @item
  9894. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9895. @example
  9896. 'scale2ref[b][a];[a][b]overlay'
  9897. @end example
  9898. @end itemize
  9899. @anchor{selectivecolor}
  9900. @section selectivecolor
  9901. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9902. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9903. by the "purity" of the color (that is, how saturated it already is).
  9904. This filter is similar to the Adobe Photoshop Selective Color tool.
  9905. The filter accepts the following options:
  9906. @table @option
  9907. @item correction_method
  9908. Select color correction method.
  9909. Available values are:
  9910. @table @samp
  9911. @item absolute
  9912. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9913. component value).
  9914. @item relative
  9915. Specified adjustments are relative to the original component value.
  9916. @end table
  9917. Default is @code{absolute}.
  9918. @item reds
  9919. Adjustments for red pixels (pixels where the red component is the maximum)
  9920. @item yellows
  9921. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9922. @item greens
  9923. Adjustments for green pixels (pixels where the green component is the maximum)
  9924. @item cyans
  9925. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9926. @item blues
  9927. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9928. @item magentas
  9929. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9930. @item whites
  9931. Adjustments for white pixels (pixels where all components are greater than 128)
  9932. @item neutrals
  9933. Adjustments for all pixels except pure black and pure white
  9934. @item blacks
  9935. Adjustments for black pixels (pixels where all components are lesser than 128)
  9936. @item psfile
  9937. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9938. @end table
  9939. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9940. 4 space separated floating point adjustment values in the [-1,1] range,
  9941. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9942. pixels of its range.
  9943. @subsection Examples
  9944. @itemize
  9945. @item
  9946. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9947. increase magenta by 27% in blue areas:
  9948. @example
  9949. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9950. @end example
  9951. @item
  9952. Use a Photoshop selective color preset:
  9953. @example
  9954. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9955. @end example
  9956. @end itemize
  9957. @anchor{separatefields}
  9958. @section separatefields
  9959. The @code{separatefields} takes a frame-based video input and splits
  9960. each frame into its components fields, producing a new half height clip
  9961. with twice the frame rate and twice the frame count.
  9962. This filter use field-dominance information in frame to decide which
  9963. of each pair of fields to place first in the output.
  9964. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9965. @section setdar, setsar
  9966. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9967. output video.
  9968. This is done by changing the specified Sample (aka Pixel) Aspect
  9969. Ratio, according to the following equation:
  9970. @example
  9971. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9972. @end example
  9973. Keep in mind that the @code{setdar} filter does not modify the pixel
  9974. dimensions of the video frame. Also, the display aspect ratio set by
  9975. this filter may be changed by later filters in the filterchain,
  9976. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9977. applied.
  9978. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9979. the filter output video.
  9980. Note that as a consequence of the application of this filter, the
  9981. output display aspect ratio will change according to the equation
  9982. above.
  9983. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9984. filter may be changed by later filters in the filterchain, e.g. if
  9985. another "setsar" or a "setdar" filter is applied.
  9986. It accepts the following parameters:
  9987. @table @option
  9988. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9989. Set the aspect ratio used by the filter.
  9990. The parameter can be a floating point number string, an expression, or
  9991. a string of the form @var{num}:@var{den}, where @var{num} and
  9992. @var{den} are the numerator and denominator of the aspect ratio. If
  9993. the parameter is not specified, it is assumed the value "0".
  9994. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9995. should be escaped.
  9996. @item max
  9997. Set the maximum integer value to use for expressing numerator and
  9998. denominator when reducing the expressed aspect ratio to a rational.
  9999. Default value is @code{100}.
  10000. @end table
  10001. The parameter @var{sar} is an expression containing
  10002. the following constants:
  10003. @table @option
  10004. @item E, PI, PHI
  10005. These are approximated values for the mathematical constants e
  10006. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10007. @item w, h
  10008. The input width and height.
  10009. @item a
  10010. These are the same as @var{w} / @var{h}.
  10011. @item sar
  10012. The input sample aspect ratio.
  10013. @item dar
  10014. The input display aspect ratio. It is the same as
  10015. (@var{w} / @var{h}) * @var{sar}.
  10016. @item hsub, vsub
  10017. Horizontal and vertical chroma subsample values. For example, for the
  10018. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10019. @end table
  10020. @subsection Examples
  10021. @itemize
  10022. @item
  10023. To change the display aspect ratio to 16:9, specify one of the following:
  10024. @example
  10025. setdar=dar=1.77777
  10026. setdar=dar=16/9
  10027. @end example
  10028. @item
  10029. To change the sample aspect ratio to 10:11, specify:
  10030. @example
  10031. setsar=sar=10/11
  10032. @end example
  10033. @item
  10034. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10035. 1000 in the aspect ratio reduction, use the command:
  10036. @example
  10037. setdar=ratio=16/9:max=1000
  10038. @end example
  10039. @end itemize
  10040. @anchor{setfield}
  10041. @section setfield
  10042. Force field for the output video frame.
  10043. The @code{setfield} filter marks the interlace type field for the
  10044. output frames. It does not change the input frame, but only sets the
  10045. corresponding property, which affects how the frame is treated by
  10046. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10047. The filter accepts the following options:
  10048. @table @option
  10049. @item mode
  10050. Available values are:
  10051. @table @samp
  10052. @item auto
  10053. Keep the same field property.
  10054. @item bff
  10055. Mark the frame as bottom-field-first.
  10056. @item tff
  10057. Mark the frame as top-field-first.
  10058. @item prog
  10059. Mark the frame as progressive.
  10060. @end table
  10061. @end table
  10062. @section showinfo
  10063. Show a line containing various information for each input video frame.
  10064. The input video is not modified.
  10065. The shown line contains a sequence of key/value pairs of the form
  10066. @var{key}:@var{value}.
  10067. The following values are shown in the output:
  10068. @table @option
  10069. @item n
  10070. The (sequential) number of the input frame, starting from 0.
  10071. @item pts
  10072. The Presentation TimeStamp of the input frame, expressed as a number of
  10073. time base units. The time base unit depends on the filter input pad.
  10074. @item pts_time
  10075. The Presentation TimeStamp of the input frame, expressed as a number of
  10076. seconds.
  10077. @item pos
  10078. The position of the frame in the input stream, or -1 if this information is
  10079. unavailable and/or meaningless (for example in case of synthetic video).
  10080. @item fmt
  10081. The pixel format name.
  10082. @item sar
  10083. The sample aspect ratio of the input frame, expressed in the form
  10084. @var{num}/@var{den}.
  10085. @item s
  10086. The size of the input frame. For the syntax of this option, check the
  10087. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10088. @item i
  10089. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10090. for bottom field first).
  10091. @item iskey
  10092. This is 1 if the frame is a key frame, 0 otherwise.
  10093. @item type
  10094. The picture type of the input frame ("I" for an I-frame, "P" for a
  10095. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10096. Also refer to the documentation of the @code{AVPictureType} enum and of
  10097. the @code{av_get_picture_type_char} function defined in
  10098. @file{libavutil/avutil.h}.
  10099. @item checksum
  10100. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10101. @item plane_checksum
  10102. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10103. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10104. @end table
  10105. @section showpalette
  10106. Displays the 256 colors palette of each frame. This filter is only relevant for
  10107. @var{pal8} pixel format frames.
  10108. It accepts the following option:
  10109. @table @option
  10110. @item s
  10111. Set the size of the box used to represent one palette color entry. Default is
  10112. @code{30} (for a @code{30x30} pixel box).
  10113. @end table
  10114. @section shuffleframes
  10115. Reorder and/or duplicate and/or drop video frames.
  10116. It accepts the following parameters:
  10117. @table @option
  10118. @item mapping
  10119. Set the destination indexes of input frames.
  10120. This is space or '|' separated list of indexes that maps input frames to output
  10121. frames. Number of indexes also sets maximal value that each index may have.
  10122. '-1' index have special meaning and that is to drop frame.
  10123. @end table
  10124. The first frame has the index 0. The default is to keep the input unchanged.
  10125. @subsection Examples
  10126. @itemize
  10127. @item
  10128. Swap second and third frame of every three frames of the input:
  10129. @example
  10130. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10131. @end example
  10132. @item
  10133. Swap 10th and 1st frame of every ten frames of the input:
  10134. @example
  10135. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10136. @end example
  10137. @end itemize
  10138. @section shuffleplanes
  10139. Reorder and/or duplicate video planes.
  10140. It accepts the following parameters:
  10141. @table @option
  10142. @item map0
  10143. The index of the input plane to be used as the first output plane.
  10144. @item map1
  10145. The index of the input plane to be used as the second output plane.
  10146. @item map2
  10147. The index of the input plane to be used as the third output plane.
  10148. @item map3
  10149. The index of the input plane to be used as the fourth output plane.
  10150. @end table
  10151. The first plane has the index 0. The default is to keep the input unchanged.
  10152. @subsection Examples
  10153. @itemize
  10154. @item
  10155. Swap the second and third planes of the input:
  10156. @example
  10157. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10158. @end example
  10159. @end itemize
  10160. @anchor{signalstats}
  10161. @section signalstats
  10162. Evaluate various visual metrics that assist in determining issues associated
  10163. with the digitization of analog video media.
  10164. By default the filter will log these metadata values:
  10165. @table @option
  10166. @item YMIN
  10167. Display the minimal Y value contained within the input frame. Expressed in
  10168. range of [0-255].
  10169. @item YLOW
  10170. Display the Y value at the 10% percentile within the input frame. Expressed in
  10171. range of [0-255].
  10172. @item YAVG
  10173. Display the average Y value within the input frame. Expressed in range of
  10174. [0-255].
  10175. @item YHIGH
  10176. Display the Y value at the 90% percentile within the input frame. Expressed in
  10177. range of [0-255].
  10178. @item YMAX
  10179. Display the maximum Y value contained within the input frame. Expressed in
  10180. range of [0-255].
  10181. @item UMIN
  10182. Display the minimal U value contained within the input frame. Expressed in
  10183. range of [0-255].
  10184. @item ULOW
  10185. Display the U value at the 10% percentile within the input frame. Expressed in
  10186. range of [0-255].
  10187. @item UAVG
  10188. Display the average U value within the input frame. Expressed in range of
  10189. [0-255].
  10190. @item UHIGH
  10191. Display the U value at the 90% percentile within the input frame. Expressed in
  10192. range of [0-255].
  10193. @item UMAX
  10194. Display the maximum U value contained within the input frame. Expressed in
  10195. range of [0-255].
  10196. @item VMIN
  10197. Display the minimal V value contained within the input frame. Expressed in
  10198. range of [0-255].
  10199. @item VLOW
  10200. Display the V value at the 10% percentile within the input frame. Expressed in
  10201. range of [0-255].
  10202. @item VAVG
  10203. Display the average V value within the input frame. Expressed in range of
  10204. [0-255].
  10205. @item VHIGH
  10206. Display the V value at the 90% percentile within the input frame. Expressed in
  10207. range of [0-255].
  10208. @item VMAX
  10209. Display the maximum V value contained within the input frame. Expressed in
  10210. range of [0-255].
  10211. @item SATMIN
  10212. Display the minimal saturation value contained within the input frame.
  10213. Expressed in range of [0-~181.02].
  10214. @item SATLOW
  10215. Display the saturation value at the 10% percentile within the input frame.
  10216. Expressed in range of [0-~181.02].
  10217. @item SATAVG
  10218. Display the average saturation value within the input frame. Expressed in range
  10219. of [0-~181.02].
  10220. @item SATHIGH
  10221. Display the saturation value at the 90% percentile within the input frame.
  10222. Expressed in range of [0-~181.02].
  10223. @item SATMAX
  10224. Display the maximum saturation value contained within the input frame.
  10225. Expressed in range of [0-~181.02].
  10226. @item HUEMED
  10227. Display the median value for hue within the input frame. Expressed in range of
  10228. [0-360].
  10229. @item HUEAVG
  10230. Display the average value for hue within the input frame. Expressed in range of
  10231. [0-360].
  10232. @item YDIF
  10233. Display the average of sample value difference between all values of the Y
  10234. plane in the current frame and corresponding values of the previous input frame.
  10235. Expressed in range of [0-255].
  10236. @item UDIF
  10237. Display the average of sample value difference between all values of the U
  10238. plane in the current frame and corresponding values of the previous input frame.
  10239. Expressed in range of [0-255].
  10240. @item VDIF
  10241. Display the average of sample value difference between all values of the V
  10242. plane in the current frame and corresponding values of the previous input frame.
  10243. Expressed in range of [0-255].
  10244. @item YBITDEPTH
  10245. Display bit depth of Y plane in current frame.
  10246. Expressed in range of [0-16].
  10247. @item UBITDEPTH
  10248. Display bit depth of U plane in current frame.
  10249. Expressed in range of [0-16].
  10250. @item VBITDEPTH
  10251. Display bit depth of V plane in current frame.
  10252. Expressed in range of [0-16].
  10253. @end table
  10254. The filter accepts the following options:
  10255. @table @option
  10256. @item stat
  10257. @item out
  10258. @option{stat} specify an additional form of image analysis.
  10259. @option{out} output video with the specified type of pixel highlighted.
  10260. Both options accept the following values:
  10261. @table @samp
  10262. @item tout
  10263. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10264. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10265. include the results of video dropouts, head clogs, or tape tracking issues.
  10266. @item vrep
  10267. Identify @var{vertical line repetition}. Vertical line repetition includes
  10268. similar rows of pixels within a frame. In born-digital video vertical line
  10269. repetition is common, but this pattern is uncommon in video digitized from an
  10270. analog source. When it occurs in video that results from the digitization of an
  10271. analog source it can indicate concealment from a dropout compensator.
  10272. @item brng
  10273. Identify pixels that fall outside of legal broadcast range.
  10274. @end table
  10275. @item color, c
  10276. Set the highlight color for the @option{out} option. The default color is
  10277. yellow.
  10278. @end table
  10279. @subsection Examples
  10280. @itemize
  10281. @item
  10282. Output data of various video metrics:
  10283. @example
  10284. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10285. @end example
  10286. @item
  10287. Output specific data about the minimum and maximum values of the Y plane per frame:
  10288. @example
  10289. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10290. @end example
  10291. @item
  10292. Playback video while highlighting pixels that are outside of broadcast range in red.
  10293. @example
  10294. ffplay example.mov -vf signalstats="out=brng:color=red"
  10295. @end example
  10296. @item
  10297. Playback video with signalstats metadata drawn over the frame.
  10298. @example
  10299. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10300. @end example
  10301. The contents of signalstat_drawtext.txt used in the command are:
  10302. @example
  10303. time %@{pts:hms@}
  10304. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10305. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10306. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10307. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10308. @end example
  10309. @end itemize
  10310. @anchor{signature}
  10311. @section signature
  10312. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10313. input. In this case the matching between the inputs can be calculated additionally.
  10314. The filter always passes through the first input. The signature of each stream can
  10315. be written into a file.
  10316. It accepts the following options:
  10317. @table @option
  10318. @item detectmode
  10319. Enable or disable the matching process.
  10320. Available values are:
  10321. @table @samp
  10322. @item off
  10323. Disable the calculation of a matching (default).
  10324. @item full
  10325. Calculate the matching for the whole video and output whether the whole video
  10326. matches or only parts.
  10327. @item fast
  10328. Calculate only until a matching is found or the video ends. Should be faster in
  10329. some cases.
  10330. @end table
  10331. @item nb_inputs
  10332. Set the number of inputs. The option value must be a non negative integer.
  10333. Default value is 1.
  10334. @item filename
  10335. Set the path to which the output is written. If there is more than one input,
  10336. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10337. integer), that will be replaced with the input number. If no filename is
  10338. specified, no output will be written. This is the default.
  10339. @item format
  10340. Choose the output format.
  10341. Available values are:
  10342. @table @samp
  10343. @item binary
  10344. Use the specified binary representation (default).
  10345. @item xml
  10346. Use the specified xml representation.
  10347. @end table
  10348. @item th_d
  10349. Set threshold to detect one word as similar. The option value must be an integer
  10350. greater than zero. The default value is 9000.
  10351. @item th_dc
  10352. Set threshold to detect all words as similar. The option value must be an integer
  10353. greater than zero. The default value is 60000.
  10354. @item th_xh
  10355. Set threshold to detect frames as similar. The option value must be an integer
  10356. greater than zero. The default value is 116.
  10357. @item th_di
  10358. Set the minimum length of a sequence in frames to recognize it as matching
  10359. sequence. The option value must be a non negative integer value.
  10360. The default value is 0.
  10361. @item th_it
  10362. Set the minimum relation, that matching frames to all frames must have.
  10363. The option value must be a double value between 0 and 1. The default value is 0.5.
  10364. @end table
  10365. @subsection Examples
  10366. @itemize
  10367. @item
  10368. To calculate the signature of an input video and store it in signature.bin:
  10369. @example
  10370. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10371. @end example
  10372. @item
  10373. To detect whether two videos match and store the signatures in XML format in
  10374. signature0.xml and signature1.xml:
  10375. @example
  10376. 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 -
  10377. @end example
  10378. @end itemize
  10379. @anchor{smartblur}
  10380. @section smartblur
  10381. Blur the input video without impacting the outlines.
  10382. It accepts the following options:
  10383. @table @option
  10384. @item luma_radius, lr
  10385. Set the luma radius. The option value must be a float number in
  10386. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10387. used to blur the image (slower if larger). Default value is 1.0.
  10388. @item luma_strength, ls
  10389. Set the luma strength. The option value must be a float number
  10390. in the range [-1.0,1.0] that configures the blurring. A value included
  10391. in [0.0,1.0] will blur the image whereas a value included in
  10392. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10393. @item luma_threshold, lt
  10394. Set the luma threshold used as a coefficient to determine
  10395. whether a pixel should be blurred or not. The option value must be an
  10396. integer in the range [-30,30]. A value of 0 will filter all the image,
  10397. a value included in [0,30] will filter flat areas and a value included
  10398. in [-30,0] will filter edges. Default value is 0.
  10399. @item chroma_radius, cr
  10400. Set the chroma radius. The option value must be a float number in
  10401. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10402. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10403. @item chroma_strength, cs
  10404. Set the chroma strength. The option value must be a float number
  10405. in the range [-1.0,1.0] that configures the blurring. A value included
  10406. in [0.0,1.0] will blur the image whereas a value included in
  10407. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10408. @item chroma_threshold, ct
  10409. Set the chroma threshold used as a coefficient to determine
  10410. whether a pixel should be blurred or not. The option value must be an
  10411. integer in the range [-30,30]. A value of 0 will filter all the image,
  10412. a value included in [0,30] will filter flat areas and a value included
  10413. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10414. @end table
  10415. If a chroma option is not explicitly set, the corresponding luma value
  10416. is set.
  10417. @section ssim
  10418. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10419. This filter takes in input two input videos, the first input is
  10420. considered the "main" source and is passed unchanged to the
  10421. output. The second input is used as a "reference" video for computing
  10422. the SSIM.
  10423. Both video inputs must have the same resolution and pixel format for
  10424. this filter to work correctly. Also it assumes that both inputs
  10425. have the same number of frames, which are compared one by one.
  10426. The filter stores the calculated SSIM of each frame.
  10427. The description of the accepted parameters follows.
  10428. @table @option
  10429. @item stats_file, f
  10430. If specified the filter will use the named file to save the SSIM of
  10431. each individual frame. When filename equals "-" the data is sent to
  10432. standard output.
  10433. @end table
  10434. The file printed if @var{stats_file} is selected, contains a sequence of
  10435. key/value pairs of the form @var{key}:@var{value} for each compared
  10436. couple of frames.
  10437. A description of each shown parameter follows:
  10438. @table @option
  10439. @item n
  10440. sequential number of the input frame, starting from 1
  10441. @item Y, U, V, R, G, B
  10442. SSIM of the compared frames for the component specified by the suffix.
  10443. @item All
  10444. SSIM of the compared frames for the whole frame.
  10445. @item dB
  10446. Same as above but in dB representation.
  10447. @end table
  10448. This filter also supports the @ref{framesync} options.
  10449. For example:
  10450. @example
  10451. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10452. [main][ref] ssim="stats_file=stats.log" [out]
  10453. @end example
  10454. On this example the input file being processed is compared with the
  10455. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10456. is stored in @file{stats.log}.
  10457. Another example with both psnr and ssim at same time:
  10458. @example
  10459. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10460. @end example
  10461. @section stereo3d
  10462. Convert between different stereoscopic image formats.
  10463. The filters accept the following options:
  10464. @table @option
  10465. @item in
  10466. Set stereoscopic image format of input.
  10467. Available values for input image formats are:
  10468. @table @samp
  10469. @item sbsl
  10470. side by side parallel (left eye left, right eye right)
  10471. @item sbsr
  10472. side by side crosseye (right eye left, left eye right)
  10473. @item sbs2l
  10474. side by side parallel with half width resolution
  10475. (left eye left, right eye right)
  10476. @item sbs2r
  10477. side by side crosseye with half width resolution
  10478. (right eye left, left eye right)
  10479. @item abl
  10480. above-below (left eye above, right eye below)
  10481. @item abr
  10482. above-below (right eye above, left eye below)
  10483. @item ab2l
  10484. above-below with half height resolution
  10485. (left eye above, right eye below)
  10486. @item ab2r
  10487. above-below with half height resolution
  10488. (right eye above, left eye below)
  10489. @item al
  10490. alternating frames (left eye first, right eye second)
  10491. @item ar
  10492. alternating frames (right eye first, left eye second)
  10493. @item irl
  10494. interleaved rows (left eye has top row, right eye starts on next row)
  10495. @item irr
  10496. interleaved rows (right eye has top row, left eye starts on next row)
  10497. @item icl
  10498. interleaved columns, left eye first
  10499. @item icr
  10500. interleaved columns, right eye first
  10501. Default value is @samp{sbsl}.
  10502. @end table
  10503. @item out
  10504. Set stereoscopic image format of output.
  10505. @table @samp
  10506. @item sbsl
  10507. side by side parallel (left eye left, right eye right)
  10508. @item sbsr
  10509. side by side crosseye (right eye left, left eye right)
  10510. @item sbs2l
  10511. side by side parallel with half width resolution
  10512. (left eye left, right eye right)
  10513. @item sbs2r
  10514. side by side crosseye with half width resolution
  10515. (right eye left, left eye right)
  10516. @item abl
  10517. above-below (left eye above, right eye below)
  10518. @item abr
  10519. above-below (right eye above, left eye below)
  10520. @item ab2l
  10521. above-below with half height resolution
  10522. (left eye above, right eye below)
  10523. @item ab2r
  10524. above-below with half height resolution
  10525. (right eye above, left eye below)
  10526. @item al
  10527. alternating frames (left eye first, right eye second)
  10528. @item ar
  10529. alternating frames (right eye first, left eye second)
  10530. @item irl
  10531. interleaved rows (left eye has top row, right eye starts on next row)
  10532. @item irr
  10533. interleaved rows (right eye has top row, left eye starts on next row)
  10534. @item arbg
  10535. anaglyph red/blue gray
  10536. (red filter on left eye, blue filter on right eye)
  10537. @item argg
  10538. anaglyph red/green gray
  10539. (red filter on left eye, green filter on right eye)
  10540. @item arcg
  10541. anaglyph red/cyan gray
  10542. (red filter on left eye, cyan filter on right eye)
  10543. @item arch
  10544. anaglyph red/cyan half colored
  10545. (red filter on left eye, cyan filter on right eye)
  10546. @item arcc
  10547. anaglyph red/cyan color
  10548. (red filter on left eye, cyan filter on right eye)
  10549. @item arcd
  10550. anaglyph red/cyan color optimized with the least squares projection of dubois
  10551. (red filter on left eye, cyan filter on right eye)
  10552. @item agmg
  10553. anaglyph green/magenta gray
  10554. (green filter on left eye, magenta filter on right eye)
  10555. @item agmh
  10556. anaglyph green/magenta half colored
  10557. (green filter on left eye, magenta filter on right eye)
  10558. @item agmc
  10559. anaglyph green/magenta colored
  10560. (green filter on left eye, magenta filter on right eye)
  10561. @item agmd
  10562. anaglyph green/magenta color optimized with the least squares projection of dubois
  10563. (green filter on left eye, magenta filter on right eye)
  10564. @item aybg
  10565. anaglyph yellow/blue gray
  10566. (yellow filter on left eye, blue filter on right eye)
  10567. @item aybh
  10568. anaglyph yellow/blue half colored
  10569. (yellow filter on left eye, blue filter on right eye)
  10570. @item aybc
  10571. anaglyph yellow/blue colored
  10572. (yellow filter on left eye, blue filter on right eye)
  10573. @item aybd
  10574. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10575. (yellow filter on left eye, blue filter on right eye)
  10576. @item ml
  10577. mono output (left eye only)
  10578. @item mr
  10579. mono output (right eye only)
  10580. @item chl
  10581. checkerboard, left eye first
  10582. @item chr
  10583. checkerboard, right eye first
  10584. @item icl
  10585. interleaved columns, left eye first
  10586. @item icr
  10587. interleaved columns, right eye first
  10588. @item hdmi
  10589. HDMI frame pack
  10590. @end table
  10591. Default value is @samp{arcd}.
  10592. @end table
  10593. @subsection Examples
  10594. @itemize
  10595. @item
  10596. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10597. @example
  10598. stereo3d=sbsl:aybd
  10599. @end example
  10600. @item
  10601. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10602. @example
  10603. stereo3d=abl:sbsr
  10604. @end example
  10605. @end itemize
  10606. @section streamselect, astreamselect
  10607. Select video or audio streams.
  10608. The filter accepts the following options:
  10609. @table @option
  10610. @item inputs
  10611. Set number of inputs. Default is 2.
  10612. @item map
  10613. Set input indexes to remap to outputs.
  10614. @end table
  10615. @subsection Commands
  10616. The @code{streamselect} and @code{astreamselect} filter supports the following
  10617. commands:
  10618. @table @option
  10619. @item map
  10620. Set input indexes to remap to outputs.
  10621. @end table
  10622. @subsection Examples
  10623. @itemize
  10624. @item
  10625. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10626. @example
  10627. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10628. @end example
  10629. @item
  10630. Same as above, but for audio:
  10631. @example
  10632. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10633. @end example
  10634. @end itemize
  10635. @section sobel
  10636. Apply sobel operator to input video stream.
  10637. The filter accepts the following option:
  10638. @table @option
  10639. @item planes
  10640. Set which planes will be processed, unprocessed planes will be copied.
  10641. By default value 0xf, all planes will be processed.
  10642. @item scale
  10643. Set value which will be multiplied with filtered result.
  10644. @item delta
  10645. Set value which will be added to filtered result.
  10646. @end table
  10647. @anchor{spp}
  10648. @section spp
  10649. Apply a simple postprocessing filter that compresses and decompresses the image
  10650. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10651. and average the results.
  10652. The filter accepts the following options:
  10653. @table @option
  10654. @item quality
  10655. Set quality. This option defines the number of levels for averaging. It accepts
  10656. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10657. effect. A value of @code{6} means the higher quality. For each increment of
  10658. that value the speed drops by a factor of approximately 2. Default value is
  10659. @code{3}.
  10660. @item qp
  10661. Force a constant quantization parameter. If not set, the filter will use the QP
  10662. from the video stream (if available).
  10663. @item mode
  10664. Set thresholding mode. Available modes are:
  10665. @table @samp
  10666. @item hard
  10667. Set hard thresholding (default).
  10668. @item soft
  10669. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10670. @end table
  10671. @item use_bframe_qp
  10672. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10673. option may cause flicker since the B-Frames have often larger QP. Default is
  10674. @code{0} (not enabled).
  10675. @end table
  10676. @anchor{subtitles}
  10677. @section subtitles
  10678. Draw subtitles on top of input video using the libass library.
  10679. To enable compilation of this filter you need to configure FFmpeg with
  10680. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10681. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10682. Alpha) subtitles format.
  10683. The filter accepts the following options:
  10684. @table @option
  10685. @item filename, f
  10686. Set the filename of the subtitle file to read. It must be specified.
  10687. @item original_size
  10688. Specify the size of the original video, the video for which the ASS file
  10689. was composed. For the syntax of this option, check the
  10690. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10691. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10692. correctly scale the fonts if the aspect ratio has been changed.
  10693. @item fontsdir
  10694. Set a directory path containing fonts that can be used by the filter.
  10695. These fonts will be used in addition to whatever the font provider uses.
  10696. @item charenc
  10697. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10698. useful if not UTF-8.
  10699. @item stream_index, si
  10700. Set subtitles stream index. @code{subtitles} filter only.
  10701. @item force_style
  10702. Override default style or script info parameters of the subtitles. It accepts a
  10703. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10704. @end table
  10705. If the first key is not specified, it is assumed that the first value
  10706. specifies the @option{filename}.
  10707. For example, to render the file @file{sub.srt} on top of the input
  10708. video, use the command:
  10709. @example
  10710. subtitles=sub.srt
  10711. @end example
  10712. which is equivalent to:
  10713. @example
  10714. subtitles=filename=sub.srt
  10715. @end example
  10716. To render the default subtitles stream from file @file{video.mkv}, use:
  10717. @example
  10718. subtitles=video.mkv
  10719. @end example
  10720. To render the second subtitles stream from that file, use:
  10721. @example
  10722. subtitles=video.mkv:si=1
  10723. @end example
  10724. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10725. @code{DejaVu Serif}, use:
  10726. @example
  10727. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10728. @end example
  10729. @section super2xsai
  10730. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10731. Interpolate) pixel art scaling algorithm.
  10732. Useful for enlarging pixel art images without reducing sharpness.
  10733. @section swaprect
  10734. Swap two rectangular objects in video.
  10735. This filter accepts the following options:
  10736. @table @option
  10737. @item w
  10738. Set object width.
  10739. @item h
  10740. Set object height.
  10741. @item x1
  10742. Set 1st rect x coordinate.
  10743. @item y1
  10744. Set 1st rect y coordinate.
  10745. @item x2
  10746. Set 2nd rect x coordinate.
  10747. @item y2
  10748. Set 2nd rect y coordinate.
  10749. All expressions are evaluated once for each frame.
  10750. @end table
  10751. The all options are expressions containing the following constants:
  10752. @table @option
  10753. @item w
  10754. @item h
  10755. The input width and height.
  10756. @item a
  10757. same as @var{w} / @var{h}
  10758. @item sar
  10759. input sample aspect ratio
  10760. @item dar
  10761. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10762. @item n
  10763. The number of the input frame, starting from 0.
  10764. @item t
  10765. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10766. @item pos
  10767. the position in the file of the input frame, NAN if unknown
  10768. @end table
  10769. @section swapuv
  10770. Swap U & V plane.
  10771. @section telecine
  10772. Apply telecine process to the video.
  10773. This filter accepts the following options:
  10774. @table @option
  10775. @item first_field
  10776. @table @samp
  10777. @item top, t
  10778. top field first
  10779. @item bottom, b
  10780. bottom field first
  10781. The default value is @code{top}.
  10782. @end table
  10783. @item pattern
  10784. A string of numbers representing the pulldown pattern you wish to apply.
  10785. The default value is @code{23}.
  10786. @end table
  10787. @example
  10788. Some typical patterns:
  10789. NTSC output (30i):
  10790. 27.5p: 32222
  10791. 24p: 23 (classic)
  10792. 24p: 2332 (preferred)
  10793. 20p: 33
  10794. 18p: 334
  10795. 16p: 3444
  10796. PAL output (25i):
  10797. 27.5p: 12222
  10798. 24p: 222222222223 ("Euro pulldown")
  10799. 16.67p: 33
  10800. 16p: 33333334
  10801. @end example
  10802. @section threshold
  10803. Apply threshold effect to video stream.
  10804. This filter needs four video streams to perform thresholding.
  10805. First stream is stream we are filtering.
  10806. Second stream is holding threshold values, third stream is holding min values,
  10807. and last, fourth stream is holding max values.
  10808. The filter accepts the following option:
  10809. @table @option
  10810. @item planes
  10811. Set which planes will be processed, unprocessed planes will be copied.
  10812. By default value 0xf, all planes will be processed.
  10813. @end table
  10814. For example if first stream pixel's component value is less then threshold value
  10815. of pixel component from 2nd threshold stream, third stream value will picked,
  10816. otherwise fourth stream pixel component value will be picked.
  10817. Using color source filter one can perform various types of thresholding:
  10818. @subsection Examples
  10819. @itemize
  10820. @item
  10821. Binary threshold, using gray color as threshold:
  10822. @example
  10823. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10824. @end example
  10825. @item
  10826. Inverted binary threshold, using gray color as threshold:
  10827. @example
  10828. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10829. @end example
  10830. @item
  10831. Truncate binary threshold, using gray color as threshold:
  10832. @example
  10833. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10834. @end example
  10835. @item
  10836. Threshold to zero, using gray color as threshold:
  10837. @example
  10838. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10839. @end example
  10840. @item
  10841. Inverted threshold to zero, using gray color as threshold:
  10842. @example
  10843. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10844. @end example
  10845. @end itemize
  10846. @section thumbnail
  10847. Select the most representative frame in a given sequence of consecutive frames.
  10848. The filter accepts the following options:
  10849. @table @option
  10850. @item n
  10851. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10852. will pick one of them, and then handle the next batch of @var{n} frames until
  10853. the end. Default is @code{100}.
  10854. @end table
  10855. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10856. value will result in a higher memory usage, so a high value is not recommended.
  10857. @subsection Examples
  10858. @itemize
  10859. @item
  10860. Extract one picture each 50 frames:
  10861. @example
  10862. thumbnail=50
  10863. @end example
  10864. @item
  10865. Complete example of a thumbnail creation with @command{ffmpeg}:
  10866. @example
  10867. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10868. @end example
  10869. @end itemize
  10870. @section tile
  10871. Tile several successive frames together.
  10872. The filter accepts the following options:
  10873. @table @option
  10874. @item layout
  10875. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10876. this option, check the
  10877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10878. @item nb_frames
  10879. Set the maximum number of frames to render in the given area. It must be less
  10880. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10881. the area will be used.
  10882. @item margin
  10883. Set the outer border margin in pixels.
  10884. @item padding
  10885. Set the inner border thickness (i.e. the number of pixels between frames). For
  10886. more advanced padding options (such as having different values for the edges),
  10887. refer to the pad video filter.
  10888. @item color
  10889. Specify the color of the unused area. For the syntax of this option, check the
  10890. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10891. is "black".
  10892. @end table
  10893. @subsection Examples
  10894. @itemize
  10895. @item
  10896. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10897. @example
  10898. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10899. @end example
  10900. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10901. duplicating each output frame to accommodate the originally detected frame
  10902. rate.
  10903. @item
  10904. Display @code{5} pictures in an area of @code{3x2} frames,
  10905. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10906. mixed flat and named options:
  10907. @example
  10908. tile=3x2:nb_frames=5:padding=7:margin=2
  10909. @end example
  10910. @end itemize
  10911. @section tinterlace
  10912. Perform various types of temporal field interlacing.
  10913. Frames are counted starting from 1, so the first input frame is
  10914. considered odd.
  10915. The filter accepts the following options:
  10916. @table @option
  10917. @item mode
  10918. Specify the mode of the interlacing. This option can also be specified
  10919. as a value alone. See below for a list of values for this option.
  10920. Available values are:
  10921. @table @samp
  10922. @item merge, 0
  10923. Move odd frames into the upper field, even into the lower field,
  10924. generating a double height frame at half frame rate.
  10925. @example
  10926. ------> time
  10927. Input:
  10928. Frame 1 Frame 2 Frame 3 Frame 4
  10929. 11111 22222 33333 44444
  10930. 11111 22222 33333 44444
  10931. 11111 22222 33333 44444
  10932. 11111 22222 33333 44444
  10933. Output:
  10934. 11111 33333
  10935. 22222 44444
  10936. 11111 33333
  10937. 22222 44444
  10938. 11111 33333
  10939. 22222 44444
  10940. 11111 33333
  10941. 22222 44444
  10942. @end example
  10943. @item drop_even, 1
  10944. Only output odd frames, even frames are dropped, generating a frame with
  10945. unchanged height at half frame rate.
  10946. @example
  10947. ------> time
  10948. Input:
  10949. Frame 1 Frame 2 Frame 3 Frame 4
  10950. 11111 22222 33333 44444
  10951. 11111 22222 33333 44444
  10952. 11111 22222 33333 44444
  10953. 11111 22222 33333 44444
  10954. Output:
  10955. 11111 33333
  10956. 11111 33333
  10957. 11111 33333
  10958. 11111 33333
  10959. @end example
  10960. @item drop_odd, 2
  10961. Only output even frames, odd frames are dropped, generating a frame with
  10962. unchanged height at half frame rate.
  10963. @example
  10964. ------> time
  10965. Input:
  10966. Frame 1 Frame 2 Frame 3 Frame 4
  10967. 11111 22222 33333 44444
  10968. 11111 22222 33333 44444
  10969. 11111 22222 33333 44444
  10970. 11111 22222 33333 44444
  10971. Output:
  10972. 22222 44444
  10973. 22222 44444
  10974. 22222 44444
  10975. 22222 44444
  10976. @end example
  10977. @item pad, 3
  10978. Expand each frame to full height, but pad alternate lines with black,
  10979. generating a frame with double height at the same input frame rate.
  10980. @example
  10981. ------> time
  10982. Input:
  10983. Frame 1 Frame 2 Frame 3 Frame 4
  10984. 11111 22222 33333 44444
  10985. 11111 22222 33333 44444
  10986. 11111 22222 33333 44444
  10987. 11111 22222 33333 44444
  10988. Output:
  10989. 11111 ..... 33333 .....
  10990. ..... 22222 ..... 44444
  10991. 11111 ..... 33333 .....
  10992. ..... 22222 ..... 44444
  10993. 11111 ..... 33333 .....
  10994. ..... 22222 ..... 44444
  10995. 11111 ..... 33333 .....
  10996. ..... 22222 ..... 44444
  10997. @end example
  10998. @item interleave_top, 4
  10999. Interleave the upper field from odd frames with the lower field from
  11000. even frames, generating a frame with unchanged height at half frame rate.
  11001. @example
  11002. ------> time
  11003. Input:
  11004. Frame 1 Frame 2 Frame 3 Frame 4
  11005. 11111<- 22222 33333<- 44444
  11006. 11111 22222<- 33333 44444<-
  11007. 11111<- 22222 33333<- 44444
  11008. 11111 22222<- 33333 44444<-
  11009. Output:
  11010. 11111 33333
  11011. 22222 44444
  11012. 11111 33333
  11013. 22222 44444
  11014. @end example
  11015. @item interleave_bottom, 5
  11016. Interleave the lower field from odd frames with the upper field from
  11017. even frames, generating a frame with unchanged height at half frame rate.
  11018. @example
  11019. ------> time
  11020. Input:
  11021. Frame 1 Frame 2 Frame 3 Frame 4
  11022. 11111 22222<- 33333 44444<-
  11023. 11111<- 22222 33333<- 44444
  11024. 11111 22222<- 33333 44444<-
  11025. 11111<- 22222 33333<- 44444
  11026. Output:
  11027. 22222 44444
  11028. 11111 33333
  11029. 22222 44444
  11030. 11111 33333
  11031. @end example
  11032. @item interlacex2, 6
  11033. Double frame rate with unchanged height. Frames are inserted each
  11034. containing the second temporal field from the previous input frame and
  11035. the first temporal field from the next input frame. This mode relies on
  11036. the top_field_first flag. Useful for interlaced video displays with no
  11037. field synchronisation.
  11038. @example
  11039. ------> time
  11040. Input:
  11041. Frame 1 Frame 2 Frame 3 Frame 4
  11042. 11111 22222 33333 44444
  11043. 11111 22222 33333 44444
  11044. 11111 22222 33333 44444
  11045. 11111 22222 33333 44444
  11046. Output:
  11047. 11111 22222 22222 33333 33333 44444 44444
  11048. 11111 11111 22222 22222 33333 33333 44444
  11049. 11111 22222 22222 33333 33333 44444 44444
  11050. 11111 11111 22222 22222 33333 33333 44444
  11051. @end example
  11052. @item mergex2, 7
  11053. Move odd frames into the upper field, even into the lower field,
  11054. generating a double height frame at same frame rate.
  11055. @example
  11056. ------> time
  11057. Input:
  11058. Frame 1 Frame 2 Frame 3 Frame 4
  11059. 11111 22222 33333 44444
  11060. 11111 22222 33333 44444
  11061. 11111 22222 33333 44444
  11062. 11111 22222 33333 44444
  11063. Output:
  11064. 11111 33333 33333 55555
  11065. 22222 22222 44444 44444
  11066. 11111 33333 33333 55555
  11067. 22222 22222 44444 44444
  11068. 11111 33333 33333 55555
  11069. 22222 22222 44444 44444
  11070. 11111 33333 33333 55555
  11071. 22222 22222 44444 44444
  11072. @end example
  11073. @end table
  11074. Numeric values are deprecated but are accepted for backward
  11075. compatibility reasons.
  11076. Default mode is @code{merge}.
  11077. @item flags
  11078. Specify flags influencing the filter process.
  11079. Available value for @var{flags} is:
  11080. @table @option
  11081. @item low_pass_filter, vlfp
  11082. Enable linear vertical low-pass filtering in the filter.
  11083. Vertical low-pass filtering is required when creating an interlaced
  11084. destination from a progressive source which contains high-frequency
  11085. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11086. patterning.
  11087. @item complex_filter, cvlfp
  11088. Enable complex vertical low-pass filtering.
  11089. This will slightly less reduce interlace 'twitter' and Moire
  11090. patterning but better retain detail and subjective sharpness impression.
  11091. @end table
  11092. Vertical low-pass filtering can only be enabled for @option{mode}
  11093. @var{interleave_top} and @var{interleave_bottom}.
  11094. @end table
  11095. @section tonemap
  11096. Tone map colors from different dynamic ranges.
  11097. This filter expects data in single precision floating point, as it needs to
  11098. operate on (and can output) out-of-range values. Another filter, such as
  11099. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11100. The tonemapping algorithms implemented only work on linear light, so input
  11101. data should be linearized beforehand (and possibly correctly tagged).
  11102. @example
  11103. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11104. @end example
  11105. @subsection Options
  11106. The filter accepts the following options.
  11107. @table @option
  11108. @item tonemap
  11109. Set the tone map algorithm to use.
  11110. Possible values are:
  11111. @table @var
  11112. @item none
  11113. Do not apply any tone map, only desaturate overbright pixels.
  11114. @item clip
  11115. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11116. in-range values, while distorting out-of-range values.
  11117. @item linear
  11118. Stretch the entire reference gamut to a linear multiple of the display.
  11119. @item gamma
  11120. Fit a logarithmic transfer between the tone curves.
  11121. @item reinhard
  11122. Preserve overall image brightness with a simple curve, using nonlinear
  11123. contrast, which results in flattening details and degrading color accuracy.
  11124. @item hable
  11125. Peserve both dark and bright details better than @var{reinhard}, at the cost
  11126. of slightly darkening everything. Use it when detail preservation is more
  11127. important than color and brightness accuracy.
  11128. @item mobius
  11129. Smoothly map out-of-range values, while retaining contrast and colors for
  11130. in-range material as much as possible. Use it when color accuracy is more
  11131. important than detail preservation.
  11132. @end table
  11133. Default is none.
  11134. @item param
  11135. Tune the tone mapping algorithm.
  11136. This affects the following algorithms:
  11137. @table @var
  11138. @item none
  11139. Ignored.
  11140. @item linear
  11141. Specifies the scale factor to use while stretching.
  11142. Default to 1.0.
  11143. @item gamma
  11144. Specifies the exponent of the function.
  11145. Default to 1.8.
  11146. @item clip
  11147. Specify an extra linear coefficient to multiply into the signal before clipping.
  11148. Default to 1.0.
  11149. @item reinhard
  11150. Specify the local contrast coefficient at the display peak.
  11151. Default to 0.5, which means that in-gamut values will be about half as bright
  11152. as when clipping.
  11153. @item hable
  11154. Ignored.
  11155. @item mobius
  11156. Specify the transition point from linear to mobius transform. Every value
  11157. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11158. more accurate the result will be, at the cost of losing bright details.
  11159. Default to 0.3, which due to the steep initial slope still preserves in-range
  11160. colors fairly accurately.
  11161. @end table
  11162. @item desat
  11163. Apply desaturation for highlights that exceed this level of brightness. The
  11164. higher the parameter, the more color information will be preserved. This
  11165. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11166. (smoothly) turning into white instead. This makes images feel more natural,
  11167. at the cost of reducing information about out-of-range colors.
  11168. The default of 2.0 is somewhat conservative and will mostly just apply to
  11169. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11170. This option works only if the input frame has a supported color tag.
  11171. @item peak
  11172. Override signal/nominal/reference peak with this value. Useful when the
  11173. embedded peak information in display metadata is not reliable or when tone
  11174. mapping from a lower range to a higher range.
  11175. @end table
  11176. @section transpose
  11177. Transpose rows with columns in the input video and optionally flip it.
  11178. It accepts the following parameters:
  11179. @table @option
  11180. @item dir
  11181. Specify the transposition direction.
  11182. Can assume the following values:
  11183. @table @samp
  11184. @item 0, 4, cclock_flip
  11185. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11186. @example
  11187. L.R L.l
  11188. . . -> . .
  11189. l.r R.r
  11190. @end example
  11191. @item 1, 5, clock
  11192. Rotate by 90 degrees clockwise, that is:
  11193. @example
  11194. L.R l.L
  11195. . . -> . .
  11196. l.r r.R
  11197. @end example
  11198. @item 2, 6, cclock
  11199. Rotate by 90 degrees counterclockwise, that is:
  11200. @example
  11201. L.R R.r
  11202. . . -> . .
  11203. l.r L.l
  11204. @end example
  11205. @item 3, 7, clock_flip
  11206. Rotate by 90 degrees clockwise and vertically flip, that is:
  11207. @example
  11208. L.R r.R
  11209. . . -> . .
  11210. l.r l.L
  11211. @end example
  11212. @end table
  11213. For values between 4-7, the transposition is only done if the input
  11214. video geometry is portrait and not landscape. These values are
  11215. deprecated, the @code{passthrough} option should be used instead.
  11216. Numerical values are deprecated, and should be dropped in favor of
  11217. symbolic constants.
  11218. @item passthrough
  11219. Do not apply the transposition if the input geometry matches the one
  11220. specified by the specified value. It accepts the following values:
  11221. @table @samp
  11222. @item none
  11223. Always apply transposition.
  11224. @item portrait
  11225. Preserve portrait geometry (when @var{height} >= @var{width}).
  11226. @item landscape
  11227. Preserve landscape geometry (when @var{width} >= @var{height}).
  11228. @end table
  11229. Default value is @code{none}.
  11230. @end table
  11231. For example to rotate by 90 degrees clockwise and preserve portrait
  11232. layout:
  11233. @example
  11234. transpose=dir=1:passthrough=portrait
  11235. @end example
  11236. The command above can also be specified as:
  11237. @example
  11238. transpose=1:portrait
  11239. @end example
  11240. @section trim
  11241. Trim the input so that the output contains one continuous subpart of the input.
  11242. It accepts the following parameters:
  11243. @table @option
  11244. @item start
  11245. Specify the time of the start of the kept section, i.e. the frame with the
  11246. timestamp @var{start} will be the first frame in the output.
  11247. @item end
  11248. Specify the time of the first frame that will be dropped, i.e. the frame
  11249. immediately preceding the one with the timestamp @var{end} will be the last
  11250. frame in the output.
  11251. @item start_pts
  11252. This is the same as @var{start}, except this option sets the start timestamp
  11253. in timebase units instead of seconds.
  11254. @item end_pts
  11255. This is the same as @var{end}, except this option sets the end timestamp
  11256. in timebase units instead of seconds.
  11257. @item duration
  11258. The maximum duration of the output in seconds.
  11259. @item start_frame
  11260. The number of the first frame that should be passed to the output.
  11261. @item end_frame
  11262. The number of the first frame that should be dropped.
  11263. @end table
  11264. @option{start}, @option{end}, and @option{duration} are expressed as time
  11265. duration specifications; see
  11266. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11267. for the accepted syntax.
  11268. Note that the first two sets of the start/end options and the @option{duration}
  11269. option look at the frame timestamp, while the _frame variants simply count the
  11270. frames that pass through the filter. Also note that this filter does not modify
  11271. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11272. setpts filter after the trim filter.
  11273. If multiple start or end options are set, this filter tries to be greedy and
  11274. keep all the frames that match at least one of the specified constraints. To keep
  11275. only the part that matches all the constraints at once, chain multiple trim
  11276. filters.
  11277. The defaults are such that all the input is kept. So it is possible to set e.g.
  11278. just the end values to keep everything before the specified time.
  11279. Examples:
  11280. @itemize
  11281. @item
  11282. Drop everything except the second minute of input:
  11283. @example
  11284. ffmpeg -i INPUT -vf trim=60:120
  11285. @end example
  11286. @item
  11287. Keep only the first second:
  11288. @example
  11289. ffmpeg -i INPUT -vf trim=duration=1
  11290. @end example
  11291. @end itemize
  11292. @section unpremultiply
  11293. Apply alpha unpremultiply effect to input video stream using first plane
  11294. of second stream as alpha.
  11295. Both streams must have same dimensions and same pixel format.
  11296. The filter accepts the following option:
  11297. @table @option
  11298. @item planes
  11299. Set which planes will be processed, unprocessed planes will be copied.
  11300. By default value 0xf, all planes will be processed.
  11301. If the format has 1 or 2 components, then luma is bit 0.
  11302. If the format has 3 or 4 components:
  11303. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11304. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11305. If present, the alpha channel is always the last bit.
  11306. @item inplace
  11307. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11308. @end table
  11309. @anchor{unsharp}
  11310. @section unsharp
  11311. Sharpen or blur the input video.
  11312. It accepts the following parameters:
  11313. @table @option
  11314. @item luma_msize_x, lx
  11315. Set the luma matrix horizontal size. It must be an odd integer between
  11316. 3 and 23. The default value is 5.
  11317. @item luma_msize_y, ly
  11318. Set the luma matrix vertical size. It must be an odd integer between 3
  11319. and 23. The default value is 5.
  11320. @item luma_amount, la
  11321. Set the luma effect strength. It must be a floating point number, reasonable
  11322. values lay between -1.5 and 1.5.
  11323. Negative values will blur the input video, while positive values will
  11324. sharpen it, a value of zero will disable the effect.
  11325. Default value is 1.0.
  11326. @item chroma_msize_x, cx
  11327. Set the chroma matrix horizontal size. It must be an odd integer
  11328. between 3 and 23. The default value is 5.
  11329. @item chroma_msize_y, cy
  11330. Set the chroma matrix vertical size. It must be an odd integer
  11331. between 3 and 23. The default value is 5.
  11332. @item chroma_amount, ca
  11333. Set the chroma effect strength. It must be a floating point number, reasonable
  11334. values lay between -1.5 and 1.5.
  11335. Negative values will blur the input video, while positive values will
  11336. sharpen it, a value of zero will disable the effect.
  11337. Default value is 0.0.
  11338. @item opencl
  11339. If set to 1, specify using OpenCL capabilities, only available if
  11340. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11341. @end table
  11342. All parameters are optional and default to the equivalent of the
  11343. string '5:5:1.0:5:5:0.0'.
  11344. @subsection Examples
  11345. @itemize
  11346. @item
  11347. Apply strong luma sharpen effect:
  11348. @example
  11349. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11350. @end example
  11351. @item
  11352. Apply a strong blur of both luma and chroma parameters:
  11353. @example
  11354. unsharp=7:7:-2:7:7:-2
  11355. @end example
  11356. @end itemize
  11357. @section uspp
  11358. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11359. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11360. shifts and average the results.
  11361. The way this differs from the behavior of spp is that uspp actually encodes &
  11362. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11363. DCT similar to MJPEG.
  11364. The filter accepts the following options:
  11365. @table @option
  11366. @item quality
  11367. Set quality. This option defines the number of levels for averaging. It accepts
  11368. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11369. effect. A value of @code{8} means the higher quality. For each increment of
  11370. that value the speed drops by a factor of approximately 2. Default value is
  11371. @code{3}.
  11372. @item qp
  11373. Force a constant quantization parameter. If not set, the filter will use the QP
  11374. from the video stream (if available).
  11375. @end table
  11376. @section vaguedenoiser
  11377. Apply a wavelet based denoiser.
  11378. It transforms each frame from the video input into the wavelet domain,
  11379. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11380. the obtained coefficients. It does an inverse wavelet transform after.
  11381. Due to wavelet properties, it should give a nice smoothed result, and
  11382. reduced noise, without blurring picture features.
  11383. This filter accepts the following options:
  11384. @table @option
  11385. @item threshold
  11386. The filtering strength. The higher, the more filtered the video will be.
  11387. Hard thresholding can use a higher threshold than soft thresholding
  11388. before the video looks overfiltered.
  11389. @item method
  11390. The filtering method the filter will use.
  11391. It accepts the following values:
  11392. @table @samp
  11393. @item hard
  11394. All values under the threshold will be zeroed.
  11395. @item soft
  11396. All values under the threshold will be zeroed. All values above will be
  11397. reduced by the threshold.
  11398. @item garrote
  11399. Scales or nullifies coefficients - intermediary between (more) soft and
  11400. (less) hard thresholding.
  11401. @end table
  11402. @item nsteps
  11403. Number of times, the wavelet will decompose the picture. Picture can't
  11404. be decomposed beyond a particular point (typically, 8 for a 640x480
  11405. frame - as 2^9 = 512 > 480)
  11406. @item percent
  11407. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11408. @item planes
  11409. A list of the planes to process. By default all planes are processed.
  11410. @end table
  11411. @section vectorscope
  11412. Display 2 color component values in the two dimensional graph (which is called
  11413. a vectorscope).
  11414. This filter accepts the following options:
  11415. @table @option
  11416. @item mode, m
  11417. Set vectorscope mode.
  11418. It accepts the following values:
  11419. @table @samp
  11420. @item gray
  11421. Gray values are displayed on graph, higher brightness means more pixels have
  11422. same component color value on location in graph. This is the default mode.
  11423. @item color
  11424. Gray values are displayed on graph. Surrounding pixels values which are not
  11425. present in video frame are drawn in gradient of 2 color components which are
  11426. set by option @code{x} and @code{y}. The 3rd color component is static.
  11427. @item color2
  11428. Actual color components values present in video frame are displayed on graph.
  11429. @item color3
  11430. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11431. on graph increases value of another color component, which is luminance by
  11432. default values of @code{x} and @code{y}.
  11433. @item color4
  11434. Actual colors present in video frame are displayed on graph. If two different
  11435. colors map to same position on graph then color with higher value of component
  11436. not present in graph is picked.
  11437. @item color5
  11438. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11439. component picked from radial gradient.
  11440. @end table
  11441. @item x
  11442. Set which color component will be represented on X-axis. Default is @code{1}.
  11443. @item y
  11444. Set which color component will be represented on Y-axis. Default is @code{2}.
  11445. @item intensity, i
  11446. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11447. of color component which represents frequency of (X, Y) location in graph.
  11448. @item envelope, e
  11449. @table @samp
  11450. @item none
  11451. No envelope, this is default.
  11452. @item instant
  11453. Instant envelope, even darkest single pixel will be clearly highlighted.
  11454. @item peak
  11455. Hold maximum and minimum values presented in graph over time. This way you
  11456. can still spot out of range values without constantly looking at vectorscope.
  11457. @item peak+instant
  11458. Peak and instant envelope combined together.
  11459. @end table
  11460. @item graticule, g
  11461. Set what kind of graticule to draw.
  11462. @table @samp
  11463. @item none
  11464. @item green
  11465. @item color
  11466. @end table
  11467. @item opacity, o
  11468. Set graticule opacity.
  11469. @item flags, f
  11470. Set graticule flags.
  11471. @table @samp
  11472. @item white
  11473. Draw graticule for white point.
  11474. @item black
  11475. Draw graticule for black point.
  11476. @item name
  11477. Draw color points short names.
  11478. @end table
  11479. @item bgopacity, b
  11480. Set background opacity.
  11481. @item lthreshold, l
  11482. Set low threshold for color component not represented on X or Y axis.
  11483. Values lower than this value will be ignored. Default is 0.
  11484. Note this value is multiplied with actual max possible value one pixel component
  11485. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11486. is 0.1 * 255 = 25.
  11487. @item hthreshold, h
  11488. Set high threshold for color component not represented on X or Y axis.
  11489. Values higher than this value will be ignored. Default is 1.
  11490. Note this value is multiplied with actual max possible value one pixel component
  11491. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11492. is 0.9 * 255 = 230.
  11493. @item colorspace, c
  11494. Set what kind of colorspace to use when drawing graticule.
  11495. @table @samp
  11496. @item auto
  11497. @item 601
  11498. @item 709
  11499. @end table
  11500. Default is auto.
  11501. @end table
  11502. @anchor{vidstabdetect}
  11503. @section vidstabdetect
  11504. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11505. @ref{vidstabtransform} for pass 2.
  11506. This filter generates a file with relative translation and rotation
  11507. transform information about subsequent frames, which is then used by
  11508. the @ref{vidstabtransform} filter.
  11509. To enable compilation of this filter you need to configure FFmpeg with
  11510. @code{--enable-libvidstab}.
  11511. This filter accepts the following options:
  11512. @table @option
  11513. @item result
  11514. Set the path to the file used to write the transforms information.
  11515. Default value is @file{transforms.trf}.
  11516. @item shakiness
  11517. Set how shaky the video is and how quick the camera is. It accepts an
  11518. integer in the range 1-10, a value of 1 means little shakiness, a
  11519. value of 10 means strong shakiness. Default value is 5.
  11520. @item accuracy
  11521. Set the accuracy of the detection process. It must be a value in the
  11522. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11523. accuracy. Default value is 15.
  11524. @item stepsize
  11525. Set stepsize of the search process. The region around minimum is
  11526. scanned with 1 pixel resolution. Default value is 6.
  11527. @item mincontrast
  11528. Set minimum contrast. Below this value a local measurement field is
  11529. discarded. Must be a floating point value in the range 0-1. Default
  11530. value is 0.3.
  11531. @item tripod
  11532. Set reference frame number for tripod mode.
  11533. If enabled, the motion of the frames is compared to a reference frame
  11534. in the filtered stream, identified by the specified number. The idea
  11535. is to compensate all movements in a more-or-less static scene and keep
  11536. the camera view absolutely still.
  11537. If set to 0, it is disabled. The frames are counted starting from 1.
  11538. @item show
  11539. Show fields and transforms in the resulting frames. It accepts an
  11540. integer in the range 0-2. Default value is 0, which disables any
  11541. visualization.
  11542. @end table
  11543. @subsection Examples
  11544. @itemize
  11545. @item
  11546. Use default values:
  11547. @example
  11548. vidstabdetect
  11549. @end example
  11550. @item
  11551. Analyze strongly shaky movie and put the results in file
  11552. @file{mytransforms.trf}:
  11553. @example
  11554. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11555. @end example
  11556. @item
  11557. Visualize the result of internal transformations in the resulting
  11558. video:
  11559. @example
  11560. vidstabdetect=show=1
  11561. @end example
  11562. @item
  11563. Analyze a video with medium shakiness using @command{ffmpeg}:
  11564. @example
  11565. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11566. @end example
  11567. @end itemize
  11568. @anchor{vidstabtransform}
  11569. @section vidstabtransform
  11570. Video stabilization/deshaking: pass 2 of 2,
  11571. see @ref{vidstabdetect} for pass 1.
  11572. Read a file with transform information for each frame and
  11573. apply/compensate them. Together with the @ref{vidstabdetect}
  11574. filter this can be used to deshake videos. See also
  11575. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11576. the @ref{unsharp} filter, see below.
  11577. To enable compilation of this filter you need to configure FFmpeg with
  11578. @code{--enable-libvidstab}.
  11579. @subsection Options
  11580. @table @option
  11581. @item input
  11582. Set path to the file used to read the transforms. Default value is
  11583. @file{transforms.trf}.
  11584. @item smoothing
  11585. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11586. camera movements. Default value is 10.
  11587. For example a number of 10 means that 21 frames are used (10 in the
  11588. past and 10 in the future) to smoothen the motion in the video. A
  11589. larger value leads to a smoother video, but limits the acceleration of
  11590. the camera (pan/tilt movements). 0 is a special case where a static
  11591. camera is simulated.
  11592. @item optalgo
  11593. Set the camera path optimization algorithm.
  11594. Accepted values are:
  11595. @table @samp
  11596. @item gauss
  11597. gaussian kernel low-pass filter on camera motion (default)
  11598. @item avg
  11599. averaging on transformations
  11600. @end table
  11601. @item maxshift
  11602. Set maximal number of pixels to translate frames. Default value is -1,
  11603. meaning no limit.
  11604. @item maxangle
  11605. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11606. value is -1, meaning no limit.
  11607. @item crop
  11608. Specify how to deal with borders that may be visible due to movement
  11609. compensation.
  11610. Available values are:
  11611. @table @samp
  11612. @item keep
  11613. keep image information from previous frame (default)
  11614. @item black
  11615. fill the border black
  11616. @end table
  11617. @item invert
  11618. Invert transforms if set to 1. Default value is 0.
  11619. @item relative
  11620. Consider transforms as relative to previous frame if set to 1,
  11621. absolute if set to 0. Default value is 0.
  11622. @item zoom
  11623. Set percentage to zoom. A positive value will result in a zoom-in
  11624. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11625. zoom).
  11626. @item optzoom
  11627. Set optimal zooming to avoid borders.
  11628. Accepted values are:
  11629. @table @samp
  11630. @item 0
  11631. disabled
  11632. @item 1
  11633. optimal static zoom value is determined (only very strong movements
  11634. will lead to visible borders) (default)
  11635. @item 2
  11636. optimal adaptive zoom value is determined (no borders will be
  11637. visible), see @option{zoomspeed}
  11638. @end table
  11639. Note that the value given at zoom is added to the one calculated here.
  11640. @item zoomspeed
  11641. Set percent to zoom maximally each frame (enabled when
  11642. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11643. 0.25.
  11644. @item interpol
  11645. Specify type of interpolation.
  11646. Available values are:
  11647. @table @samp
  11648. @item no
  11649. no interpolation
  11650. @item linear
  11651. linear only horizontal
  11652. @item bilinear
  11653. linear in both directions (default)
  11654. @item bicubic
  11655. cubic in both directions (slow)
  11656. @end table
  11657. @item tripod
  11658. Enable virtual tripod mode if set to 1, which is equivalent to
  11659. @code{relative=0:smoothing=0}. Default value is 0.
  11660. Use also @code{tripod} option of @ref{vidstabdetect}.
  11661. @item debug
  11662. Increase log verbosity if set to 1. Also the detected global motions
  11663. are written to the temporary file @file{global_motions.trf}. Default
  11664. value is 0.
  11665. @end table
  11666. @subsection Examples
  11667. @itemize
  11668. @item
  11669. Use @command{ffmpeg} for a typical stabilization with default values:
  11670. @example
  11671. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11672. @end example
  11673. Note the use of the @ref{unsharp} filter which is always recommended.
  11674. @item
  11675. Zoom in a bit more and load transform data from a given file:
  11676. @example
  11677. vidstabtransform=zoom=5:input="mytransforms.trf"
  11678. @end example
  11679. @item
  11680. Smoothen the video even more:
  11681. @example
  11682. vidstabtransform=smoothing=30
  11683. @end example
  11684. @end itemize
  11685. @section vflip
  11686. Flip the input video vertically.
  11687. For example, to vertically flip a video with @command{ffmpeg}:
  11688. @example
  11689. ffmpeg -i in.avi -vf "vflip" out.avi
  11690. @end example
  11691. @anchor{vignette}
  11692. @section vignette
  11693. Make or reverse a natural vignetting effect.
  11694. The filter accepts the following options:
  11695. @table @option
  11696. @item angle, a
  11697. Set lens angle expression as a number of radians.
  11698. The value is clipped in the @code{[0,PI/2]} range.
  11699. Default value: @code{"PI/5"}
  11700. @item x0
  11701. @item y0
  11702. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11703. by default.
  11704. @item mode
  11705. Set forward/backward mode.
  11706. Available modes are:
  11707. @table @samp
  11708. @item forward
  11709. The larger the distance from the central point, the darker the image becomes.
  11710. @item backward
  11711. The larger the distance from the central point, the brighter the image becomes.
  11712. This can be used to reverse a vignette effect, though there is no automatic
  11713. detection to extract the lens @option{angle} and other settings (yet). It can
  11714. also be used to create a burning effect.
  11715. @end table
  11716. Default value is @samp{forward}.
  11717. @item eval
  11718. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11719. It accepts the following values:
  11720. @table @samp
  11721. @item init
  11722. Evaluate expressions only once during the filter initialization.
  11723. @item frame
  11724. Evaluate expressions for each incoming frame. This is way slower than the
  11725. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11726. allows advanced dynamic expressions.
  11727. @end table
  11728. Default value is @samp{init}.
  11729. @item dither
  11730. Set dithering to reduce the circular banding effects. Default is @code{1}
  11731. (enabled).
  11732. @item aspect
  11733. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11734. Setting this value to the SAR of the input will make a rectangular vignetting
  11735. following the dimensions of the video.
  11736. Default is @code{1/1}.
  11737. @end table
  11738. @subsection Expressions
  11739. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11740. following parameters.
  11741. @table @option
  11742. @item w
  11743. @item h
  11744. input width and height
  11745. @item n
  11746. the number of input frame, starting from 0
  11747. @item pts
  11748. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11749. @var{TB} units, NAN if undefined
  11750. @item r
  11751. frame rate of the input video, NAN if the input frame rate is unknown
  11752. @item t
  11753. the PTS (Presentation TimeStamp) of the filtered video frame,
  11754. expressed in seconds, NAN if undefined
  11755. @item tb
  11756. time base of the input video
  11757. @end table
  11758. @subsection Examples
  11759. @itemize
  11760. @item
  11761. Apply simple strong vignetting effect:
  11762. @example
  11763. vignette=PI/4
  11764. @end example
  11765. @item
  11766. Make a flickering vignetting:
  11767. @example
  11768. vignette='PI/4+random(1)*PI/50':eval=frame
  11769. @end example
  11770. @end itemize
  11771. @section vstack
  11772. Stack input videos vertically.
  11773. All streams must be of same pixel format and of same width.
  11774. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11775. to create same output.
  11776. The filter accept the following option:
  11777. @table @option
  11778. @item inputs
  11779. Set number of input streams. Default is 2.
  11780. @item shortest
  11781. If set to 1, force the output to terminate when the shortest input
  11782. terminates. Default value is 0.
  11783. @end table
  11784. @section w3fdif
  11785. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11786. Deinterlacing Filter").
  11787. Based on the process described by Martin Weston for BBC R&D, and
  11788. implemented based on the de-interlace algorithm written by Jim
  11789. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11790. uses filter coefficients calculated by BBC R&D.
  11791. There are two sets of filter coefficients, so called "simple":
  11792. and "complex". Which set of filter coefficients is used can
  11793. be set by passing an optional parameter:
  11794. @table @option
  11795. @item filter
  11796. Set the interlacing filter coefficients. Accepts one of the following values:
  11797. @table @samp
  11798. @item simple
  11799. Simple filter coefficient set.
  11800. @item complex
  11801. More-complex filter coefficient set.
  11802. @end table
  11803. Default value is @samp{complex}.
  11804. @item deint
  11805. Specify which frames to deinterlace. Accept one of the following values:
  11806. @table @samp
  11807. @item all
  11808. Deinterlace all frames,
  11809. @item interlaced
  11810. Only deinterlace frames marked as interlaced.
  11811. @end table
  11812. Default value is @samp{all}.
  11813. @end table
  11814. @section waveform
  11815. Video waveform monitor.
  11816. The waveform monitor plots color component intensity. By default luminance
  11817. only. Each column of the waveform corresponds to a column of pixels in the
  11818. source video.
  11819. It accepts the following options:
  11820. @table @option
  11821. @item mode, m
  11822. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11823. In row mode, the graph on the left side represents color component value 0 and
  11824. the right side represents value = 255. In column mode, the top side represents
  11825. color component value = 0 and bottom side represents value = 255.
  11826. @item intensity, i
  11827. Set intensity. Smaller values are useful to find out how many values of the same
  11828. luminance are distributed across input rows/columns.
  11829. Default value is @code{0.04}. Allowed range is [0, 1].
  11830. @item mirror, r
  11831. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11832. In mirrored mode, higher values will be represented on the left
  11833. side for @code{row} mode and at the top for @code{column} mode. Default is
  11834. @code{1} (mirrored).
  11835. @item display, d
  11836. Set display mode.
  11837. It accepts the following values:
  11838. @table @samp
  11839. @item overlay
  11840. Presents information identical to that in the @code{parade}, except
  11841. that the graphs representing color components are superimposed directly
  11842. over one another.
  11843. This display mode makes it easier to spot relative differences or similarities
  11844. in overlapping areas of the color components that are supposed to be identical,
  11845. such as neutral whites, grays, or blacks.
  11846. @item stack
  11847. Display separate graph for the color components side by side in
  11848. @code{row} mode or one below the other in @code{column} mode.
  11849. @item parade
  11850. Display separate graph for the color components side by side in
  11851. @code{column} mode or one below the other in @code{row} mode.
  11852. Using this display mode makes it easy to spot color casts in the highlights
  11853. and shadows of an image, by comparing the contours of the top and the bottom
  11854. graphs of each waveform. Since whites, grays, and blacks are characterized
  11855. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11856. should display three waveforms of roughly equal width/height. If not, the
  11857. correction is easy to perform by making level adjustments the three waveforms.
  11858. @end table
  11859. Default is @code{stack}.
  11860. @item components, c
  11861. Set which color components to display. Default is 1, which means only luminance
  11862. or red color component if input is in RGB colorspace. If is set for example to
  11863. 7 it will display all 3 (if) available color components.
  11864. @item envelope, e
  11865. @table @samp
  11866. @item none
  11867. No envelope, this is default.
  11868. @item instant
  11869. Instant envelope, minimum and maximum values presented in graph will be easily
  11870. visible even with small @code{step} value.
  11871. @item peak
  11872. Hold minimum and maximum values presented in graph across time. This way you
  11873. can still spot out of range values without constantly looking at waveforms.
  11874. @item peak+instant
  11875. Peak and instant envelope combined together.
  11876. @end table
  11877. @item filter, f
  11878. @table @samp
  11879. @item lowpass
  11880. No filtering, this is default.
  11881. @item flat
  11882. Luma and chroma combined together.
  11883. @item aflat
  11884. Similar as above, but shows difference between blue and red chroma.
  11885. @item chroma
  11886. Displays only chroma.
  11887. @item color
  11888. Displays actual color value on waveform.
  11889. @item acolor
  11890. Similar as above, but with luma showing frequency of chroma values.
  11891. @end table
  11892. @item graticule, g
  11893. Set which graticule to display.
  11894. @table @samp
  11895. @item none
  11896. Do not display graticule.
  11897. @item green
  11898. Display green graticule showing legal broadcast ranges.
  11899. @end table
  11900. @item opacity, o
  11901. Set graticule opacity.
  11902. @item flags, fl
  11903. Set graticule flags.
  11904. @table @samp
  11905. @item numbers
  11906. Draw numbers above lines. By default enabled.
  11907. @item dots
  11908. Draw dots instead of lines.
  11909. @end table
  11910. @item scale, s
  11911. Set scale used for displaying graticule.
  11912. @table @samp
  11913. @item digital
  11914. @item millivolts
  11915. @item ire
  11916. @end table
  11917. Default is digital.
  11918. @item bgopacity, b
  11919. Set background opacity.
  11920. @end table
  11921. @section weave, doubleweave
  11922. The @code{weave} takes a field-based video input and join
  11923. each two sequential fields into single frame, producing a new double
  11924. height clip with half the frame rate and half the frame count.
  11925. The @code{doubleweave} works same as @code{weave} but without
  11926. halving frame rate and frame count.
  11927. It accepts the following option:
  11928. @table @option
  11929. @item first_field
  11930. Set first field. Available values are:
  11931. @table @samp
  11932. @item top, t
  11933. Set the frame as top-field-first.
  11934. @item bottom, b
  11935. Set the frame as bottom-field-first.
  11936. @end table
  11937. @end table
  11938. @subsection Examples
  11939. @itemize
  11940. @item
  11941. Interlace video using @ref{select} and @ref{separatefields} filter:
  11942. @example
  11943. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11944. @end example
  11945. @end itemize
  11946. @section xbr
  11947. Apply the xBR high-quality magnification filter which is designed for pixel
  11948. art. It follows a set of edge-detection rules, see
  11949. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11950. It accepts the following option:
  11951. @table @option
  11952. @item n
  11953. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11954. @code{3xBR} and @code{4} for @code{4xBR}.
  11955. Default is @code{3}.
  11956. @end table
  11957. @anchor{yadif}
  11958. @section yadif
  11959. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11960. filter").
  11961. It accepts the following parameters:
  11962. @table @option
  11963. @item mode
  11964. The interlacing mode to adopt. It accepts one of the following values:
  11965. @table @option
  11966. @item 0, send_frame
  11967. Output one frame for each frame.
  11968. @item 1, send_field
  11969. Output one frame for each field.
  11970. @item 2, send_frame_nospatial
  11971. Like @code{send_frame}, but it skips the spatial interlacing check.
  11972. @item 3, send_field_nospatial
  11973. Like @code{send_field}, but it skips the spatial interlacing check.
  11974. @end table
  11975. The default value is @code{send_frame}.
  11976. @item parity
  11977. The picture field parity assumed for the input interlaced video. It accepts one
  11978. of the following values:
  11979. @table @option
  11980. @item 0, tff
  11981. Assume the top field is first.
  11982. @item 1, bff
  11983. Assume the bottom field is first.
  11984. @item -1, auto
  11985. Enable automatic detection of field parity.
  11986. @end table
  11987. The default value is @code{auto}.
  11988. If the interlacing is unknown or the decoder does not export this information,
  11989. top field first will be assumed.
  11990. @item deint
  11991. Specify which frames to deinterlace. Accept one of the following
  11992. values:
  11993. @table @option
  11994. @item 0, all
  11995. Deinterlace all frames.
  11996. @item 1, interlaced
  11997. Only deinterlace frames marked as interlaced.
  11998. @end table
  11999. The default value is @code{all}.
  12000. @end table
  12001. @section zoompan
  12002. Apply Zoom & Pan effect.
  12003. This filter accepts the following options:
  12004. @table @option
  12005. @item zoom, z
  12006. Set the zoom expression. Default is 1.
  12007. @item x
  12008. @item y
  12009. Set the x and y expression. Default is 0.
  12010. @item d
  12011. Set the duration expression in number of frames.
  12012. This sets for how many number of frames effect will last for
  12013. single input image.
  12014. @item s
  12015. Set the output image size, default is 'hd720'.
  12016. @item fps
  12017. Set the output frame rate, default is '25'.
  12018. @end table
  12019. Each expression can contain the following constants:
  12020. @table @option
  12021. @item in_w, iw
  12022. Input width.
  12023. @item in_h, ih
  12024. Input height.
  12025. @item out_w, ow
  12026. Output width.
  12027. @item out_h, oh
  12028. Output height.
  12029. @item in
  12030. Input frame count.
  12031. @item on
  12032. Output frame count.
  12033. @item x
  12034. @item y
  12035. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12036. for current input frame.
  12037. @item px
  12038. @item py
  12039. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12040. not yet such frame (first input frame).
  12041. @item zoom
  12042. Last calculated zoom from 'z' expression for current input frame.
  12043. @item pzoom
  12044. Last calculated zoom of last output frame of previous input frame.
  12045. @item duration
  12046. Number of output frames for current input frame. Calculated from 'd' expression
  12047. for each input frame.
  12048. @item pduration
  12049. number of output frames created for previous input frame
  12050. @item a
  12051. Rational number: input width / input height
  12052. @item sar
  12053. sample aspect ratio
  12054. @item dar
  12055. display aspect ratio
  12056. @end table
  12057. @subsection Examples
  12058. @itemize
  12059. @item
  12060. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12061. @example
  12062. 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
  12063. @end example
  12064. @item
  12065. Zoom-in up to 1.5 and pan always at center of picture:
  12066. @example
  12067. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12068. @end example
  12069. @item
  12070. Same as above but without pausing:
  12071. @example
  12072. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12073. @end example
  12074. @end itemize
  12075. @anchor{zscale}
  12076. @section zscale
  12077. Scale (resize) the input video, using the z.lib library:
  12078. https://github.com/sekrit-twc/zimg.
  12079. The zscale filter forces the output display aspect ratio to be the same
  12080. as the input, by changing the output sample aspect ratio.
  12081. If the input image format is different from the format requested by
  12082. the next filter, the zscale filter will convert the input to the
  12083. requested format.
  12084. @subsection Options
  12085. The filter accepts the following options.
  12086. @table @option
  12087. @item width, w
  12088. @item height, h
  12089. Set the output video dimension expression. Default value is the input
  12090. dimension.
  12091. If the @var{width} or @var{w} value is 0, the input width is used for
  12092. the output. If the @var{height} or @var{h} value is 0, the input height
  12093. is used for the output.
  12094. If one and only one of the values is -n with n >= 1, the zscale filter
  12095. will use a value that maintains the aspect ratio of the input image,
  12096. calculated from the other specified dimension. After that it will,
  12097. however, make sure that the calculated dimension is divisible by n and
  12098. adjust the value if necessary.
  12099. If both values are -n with n >= 1, the behavior will be identical to
  12100. both values being set to 0 as previously detailed.
  12101. See below for the list of accepted constants for use in the dimension
  12102. expression.
  12103. @item size, s
  12104. Set the video size. For the syntax of this option, check the
  12105. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12106. @item dither, d
  12107. Set the dither type.
  12108. Possible values are:
  12109. @table @var
  12110. @item none
  12111. @item ordered
  12112. @item random
  12113. @item error_diffusion
  12114. @end table
  12115. Default is none.
  12116. @item filter, f
  12117. Set the resize filter type.
  12118. Possible values are:
  12119. @table @var
  12120. @item point
  12121. @item bilinear
  12122. @item bicubic
  12123. @item spline16
  12124. @item spline36
  12125. @item lanczos
  12126. @end table
  12127. Default is bilinear.
  12128. @item range, r
  12129. Set the color range.
  12130. Possible values are:
  12131. @table @var
  12132. @item input
  12133. @item limited
  12134. @item full
  12135. @end table
  12136. Default is same as input.
  12137. @item primaries, p
  12138. Set the color primaries.
  12139. Possible values are:
  12140. @table @var
  12141. @item input
  12142. @item 709
  12143. @item unspecified
  12144. @item 170m
  12145. @item 240m
  12146. @item 2020
  12147. @end table
  12148. Default is same as input.
  12149. @item transfer, t
  12150. Set the transfer characteristics.
  12151. Possible values are:
  12152. @table @var
  12153. @item input
  12154. @item 709
  12155. @item unspecified
  12156. @item 601
  12157. @item linear
  12158. @item 2020_10
  12159. @item 2020_12
  12160. @item smpte2084
  12161. @item iec61966-2-1
  12162. @item arib-std-b67
  12163. @end table
  12164. Default is same as input.
  12165. @item matrix, m
  12166. Set the colorspace matrix.
  12167. Possible value are:
  12168. @table @var
  12169. @item input
  12170. @item 709
  12171. @item unspecified
  12172. @item 470bg
  12173. @item 170m
  12174. @item 2020_ncl
  12175. @item 2020_cl
  12176. @end table
  12177. Default is same as input.
  12178. @item rangein, rin
  12179. Set the input color range.
  12180. Possible values are:
  12181. @table @var
  12182. @item input
  12183. @item limited
  12184. @item full
  12185. @end table
  12186. Default is same as input.
  12187. @item primariesin, pin
  12188. Set the input color primaries.
  12189. Possible values are:
  12190. @table @var
  12191. @item input
  12192. @item 709
  12193. @item unspecified
  12194. @item 170m
  12195. @item 240m
  12196. @item 2020
  12197. @end table
  12198. Default is same as input.
  12199. @item transferin, tin
  12200. Set the input transfer characteristics.
  12201. Possible values are:
  12202. @table @var
  12203. @item input
  12204. @item 709
  12205. @item unspecified
  12206. @item 601
  12207. @item linear
  12208. @item 2020_10
  12209. @item 2020_12
  12210. @end table
  12211. Default is same as input.
  12212. @item matrixin, min
  12213. Set the input colorspace matrix.
  12214. Possible value are:
  12215. @table @var
  12216. @item input
  12217. @item 709
  12218. @item unspecified
  12219. @item 470bg
  12220. @item 170m
  12221. @item 2020_ncl
  12222. @item 2020_cl
  12223. @end table
  12224. @item chromal, c
  12225. Set the output chroma location.
  12226. Possible values are:
  12227. @table @var
  12228. @item input
  12229. @item left
  12230. @item center
  12231. @item topleft
  12232. @item top
  12233. @item bottomleft
  12234. @item bottom
  12235. @end table
  12236. @item chromalin, cin
  12237. Set the input chroma location.
  12238. Possible values are:
  12239. @table @var
  12240. @item input
  12241. @item left
  12242. @item center
  12243. @item topleft
  12244. @item top
  12245. @item bottomleft
  12246. @item bottom
  12247. @end table
  12248. @item npl
  12249. Set the nominal peak luminance.
  12250. @end table
  12251. The values of the @option{w} and @option{h} options are expressions
  12252. containing the following constants:
  12253. @table @var
  12254. @item in_w
  12255. @item in_h
  12256. The input width and height
  12257. @item iw
  12258. @item ih
  12259. These are the same as @var{in_w} and @var{in_h}.
  12260. @item out_w
  12261. @item out_h
  12262. The output (scaled) width and height
  12263. @item ow
  12264. @item oh
  12265. These are the same as @var{out_w} and @var{out_h}
  12266. @item a
  12267. The same as @var{iw} / @var{ih}
  12268. @item sar
  12269. input sample aspect ratio
  12270. @item dar
  12271. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12272. @item hsub
  12273. @item vsub
  12274. horizontal and vertical input chroma subsample values. For example for the
  12275. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12276. @item ohsub
  12277. @item ovsub
  12278. horizontal and vertical output chroma subsample values. For example for the
  12279. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12280. @end table
  12281. @table @option
  12282. @end table
  12283. @c man end VIDEO FILTERS
  12284. @chapter Video Sources
  12285. @c man begin VIDEO SOURCES
  12286. Below is a description of the currently available video sources.
  12287. @section buffer
  12288. Buffer video frames, and make them available to the filter chain.
  12289. This source is mainly intended for a programmatic use, in particular
  12290. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12291. It accepts the following parameters:
  12292. @table @option
  12293. @item video_size
  12294. Specify the size (width and height) of the buffered video frames. For the
  12295. syntax of this option, check the
  12296. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12297. @item width
  12298. The input video width.
  12299. @item height
  12300. The input video height.
  12301. @item pix_fmt
  12302. A string representing the pixel format of the buffered video frames.
  12303. It may be a number corresponding to a pixel format, or a pixel format
  12304. name.
  12305. @item time_base
  12306. Specify the timebase assumed by the timestamps of the buffered frames.
  12307. @item frame_rate
  12308. Specify the frame rate expected for the video stream.
  12309. @item pixel_aspect, sar
  12310. The sample (pixel) aspect ratio of the input video.
  12311. @item sws_param
  12312. Specify the optional parameters to be used for the scale filter which
  12313. is automatically inserted when an input change is detected in the
  12314. input size or format.
  12315. @item hw_frames_ctx
  12316. When using a hardware pixel format, this should be a reference to an
  12317. AVHWFramesContext describing input frames.
  12318. @end table
  12319. For example:
  12320. @example
  12321. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12322. @end example
  12323. will instruct the source to accept video frames with size 320x240 and
  12324. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12325. square pixels (1:1 sample aspect ratio).
  12326. Since the pixel format with name "yuv410p" corresponds to the number 6
  12327. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12328. this example corresponds to:
  12329. @example
  12330. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12331. @end example
  12332. Alternatively, the options can be specified as a flat string, but this
  12333. syntax is deprecated:
  12334. @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}]
  12335. @section cellauto
  12336. Create a pattern generated by an elementary cellular automaton.
  12337. The initial state of the cellular automaton can be defined through the
  12338. @option{filename} and @option{pattern} options. If such options are
  12339. not specified an initial state is created randomly.
  12340. At each new frame a new row in the video is filled with the result of
  12341. the cellular automaton next generation. The behavior when the whole
  12342. frame is filled is defined by the @option{scroll} option.
  12343. This source accepts the following options:
  12344. @table @option
  12345. @item filename, f
  12346. Read the initial cellular automaton state, i.e. the starting row, from
  12347. the specified file.
  12348. In the file, each non-whitespace character is considered an alive
  12349. cell, a newline will terminate the row, and further characters in the
  12350. file will be ignored.
  12351. @item pattern, p
  12352. Read the initial cellular automaton state, i.e. the starting row, from
  12353. the specified string.
  12354. Each non-whitespace character in the string is considered an alive
  12355. cell, a newline will terminate the row, and further characters in the
  12356. string will be ignored.
  12357. @item rate, r
  12358. Set the video rate, that is the number of frames generated per second.
  12359. Default is 25.
  12360. @item random_fill_ratio, ratio
  12361. Set the random fill ratio for the initial cellular automaton row. It
  12362. is a floating point number value ranging from 0 to 1, defaults to
  12363. 1/PHI.
  12364. This option is ignored when a file or a pattern is specified.
  12365. @item random_seed, seed
  12366. Set the seed for filling randomly the initial row, must be an integer
  12367. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12368. set to -1, the filter will try to use a good random seed on a best
  12369. effort basis.
  12370. @item rule
  12371. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12372. Default value is 110.
  12373. @item size, s
  12374. Set the size of the output video. For the syntax of this option, check the
  12375. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12376. If @option{filename} or @option{pattern} is specified, the size is set
  12377. by default to the width of the specified initial state row, and the
  12378. height is set to @var{width} * PHI.
  12379. If @option{size} is set, it must contain the width of the specified
  12380. pattern string, and the specified pattern will be centered in the
  12381. larger row.
  12382. If a filename or a pattern string is not specified, the size value
  12383. defaults to "320x518" (used for a randomly generated initial state).
  12384. @item scroll
  12385. If set to 1, scroll the output upward when all the rows in the output
  12386. have been already filled. If set to 0, the new generated row will be
  12387. written over the top row just after the bottom row is filled.
  12388. Defaults to 1.
  12389. @item start_full, full
  12390. If set to 1, completely fill the output with generated rows before
  12391. outputting the first frame.
  12392. This is the default behavior, for disabling set the value to 0.
  12393. @item stitch
  12394. If set to 1, stitch the left and right row edges together.
  12395. This is the default behavior, for disabling set the value to 0.
  12396. @end table
  12397. @subsection Examples
  12398. @itemize
  12399. @item
  12400. Read the initial state from @file{pattern}, and specify an output of
  12401. size 200x400.
  12402. @example
  12403. cellauto=f=pattern:s=200x400
  12404. @end example
  12405. @item
  12406. Generate a random initial row with a width of 200 cells, with a fill
  12407. ratio of 2/3:
  12408. @example
  12409. cellauto=ratio=2/3:s=200x200
  12410. @end example
  12411. @item
  12412. Create a pattern generated by rule 18 starting by a single alive cell
  12413. centered on an initial row with width 100:
  12414. @example
  12415. cellauto=p=@@:s=100x400:full=0:rule=18
  12416. @end example
  12417. @item
  12418. Specify a more elaborated initial pattern:
  12419. @example
  12420. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12421. @end example
  12422. @end itemize
  12423. @anchor{coreimagesrc}
  12424. @section coreimagesrc
  12425. Video source generated on GPU using Apple's CoreImage API on OSX.
  12426. This video source is a specialized version of the @ref{coreimage} video filter.
  12427. Use a core image generator at the beginning of the applied filterchain to
  12428. generate the content.
  12429. The coreimagesrc video source accepts the following options:
  12430. @table @option
  12431. @item list_generators
  12432. List all available generators along with all their respective options as well as
  12433. possible minimum and maximum values along with the default values.
  12434. @example
  12435. list_generators=true
  12436. @end example
  12437. @item size, s
  12438. Specify the size of the sourced video. For the syntax of this option, check the
  12439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12440. The default value is @code{320x240}.
  12441. @item rate, r
  12442. Specify the frame rate of the sourced video, as the number of frames
  12443. generated per second. It has to be a string in the format
  12444. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12445. number or a valid video frame rate abbreviation. The default value is
  12446. "25".
  12447. @item sar
  12448. Set the sample aspect ratio of the sourced video.
  12449. @item duration, d
  12450. Set the duration of the sourced video. See
  12451. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12452. for the accepted syntax.
  12453. If not specified, or the expressed duration is negative, the video is
  12454. supposed to be generated forever.
  12455. @end table
  12456. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12457. A complete filterchain can be used for further processing of the
  12458. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12459. and examples for details.
  12460. @subsection Examples
  12461. @itemize
  12462. @item
  12463. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12464. given as complete and escaped command-line for Apple's standard bash shell:
  12465. @example
  12466. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12467. @end example
  12468. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12469. need for a nullsrc video source.
  12470. @end itemize
  12471. @section mandelbrot
  12472. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12473. point specified with @var{start_x} and @var{start_y}.
  12474. This source accepts the following options:
  12475. @table @option
  12476. @item end_pts
  12477. Set the terminal pts value. Default value is 400.
  12478. @item end_scale
  12479. Set the terminal scale value.
  12480. Must be a floating point value. Default value is 0.3.
  12481. @item inner
  12482. Set the inner coloring mode, that is the algorithm used to draw the
  12483. Mandelbrot fractal internal region.
  12484. It shall assume one of the following values:
  12485. @table @option
  12486. @item black
  12487. Set black mode.
  12488. @item convergence
  12489. Show time until convergence.
  12490. @item mincol
  12491. Set color based on point closest to the origin of the iterations.
  12492. @item period
  12493. Set period mode.
  12494. @end table
  12495. Default value is @var{mincol}.
  12496. @item bailout
  12497. Set the bailout value. Default value is 10.0.
  12498. @item maxiter
  12499. Set the maximum of iterations performed by the rendering
  12500. algorithm. Default value is 7189.
  12501. @item outer
  12502. Set outer coloring mode.
  12503. It shall assume one of following values:
  12504. @table @option
  12505. @item iteration_count
  12506. Set iteration cound mode.
  12507. @item normalized_iteration_count
  12508. set normalized iteration count mode.
  12509. @end table
  12510. Default value is @var{normalized_iteration_count}.
  12511. @item rate, r
  12512. Set frame rate, expressed as number of frames per second. Default
  12513. value is "25".
  12514. @item size, s
  12515. Set frame size. For the syntax of this option, check the "Video
  12516. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12517. @item start_scale
  12518. Set the initial scale value. Default value is 3.0.
  12519. @item start_x
  12520. Set the initial x position. Must be a floating point value between
  12521. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12522. @item start_y
  12523. Set the initial y position. Must be a floating point value between
  12524. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12525. @end table
  12526. @section mptestsrc
  12527. Generate various test patterns, as generated by the MPlayer test filter.
  12528. The size of the generated video is fixed, and is 256x256.
  12529. This source is useful in particular for testing encoding features.
  12530. This source accepts the following options:
  12531. @table @option
  12532. @item rate, r
  12533. Specify the frame rate of the sourced video, as the number of frames
  12534. generated per second. It has to be a string in the format
  12535. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12536. number or a valid video frame rate abbreviation. The default value is
  12537. "25".
  12538. @item duration, d
  12539. Set the duration of the sourced video. See
  12540. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12541. for the accepted syntax.
  12542. If not specified, or the expressed duration is negative, the video is
  12543. supposed to be generated forever.
  12544. @item test, t
  12545. Set the number or the name of the test to perform. Supported tests are:
  12546. @table @option
  12547. @item dc_luma
  12548. @item dc_chroma
  12549. @item freq_luma
  12550. @item freq_chroma
  12551. @item amp_luma
  12552. @item amp_chroma
  12553. @item cbp
  12554. @item mv
  12555. @item ring1
  12556. @item ring2
  12557. @item all
  12558. @end table
  12559. Default value is "all", which will cycle through the list of all tests.
  12560. @end table
  12561. Some examples:
  12562. @example
  12563. mptestsrc=t=dc_luma
  12564. @end example
  12565. will generate a "dc_luma" test pattern.
  12566. @section frei0r_src
  12567. Provide a frei0r source.
  12568. To enable compilation of this filter you need to install the frei0r
  12569. header and configure FFmpeg with @code{--enable-frei0r}.
  12570. This source accepts the following parameters:
  12571. @table @option
  12572. @item size
  12573. The size of the video to generate. For the syntax of this option, check the
  12574. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12575. @item framerate
  12576. The framerate of the generated video. It may be a string of the form
  12577. @var{num}/@var{den} or a frame rate abbreviation.
  12578. @item filter_name
  12579. The name to the frei0r source to load. For more information regarding frei0r and
  12580. how to set the parameters, read the @ref{frei0r} section in the video filters
  12581. documentation.
  12582. @item filter_params
  12583. A '|'-separated list of parameters to pass to the frei0r source.
  12584. @end table
  12585. For example, to generate a frei0r partik0l source with size 200x200
  12586. and frame rate 10 which is overlaid on the overlay filter main input:
  12587. @example
  12588. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12589. @end example
  12590. @section life
  12591. Generate a life pattern.
  12592. This source is based on a generalization of John Conway's life game.
  12593. The sourced input represents a life grid, each pixel represents a cell
  12594. which can be in one of two possible states, alive or dead. Every cell
  12595. interacts with its eight neighbours, which are the cells that are
  12596. horizontally, vertically, or diagonally adjacent.
  12597. At each interaction the grid evolves according to the adopted rule,
  12598. which specifies the number of neighbor alive cells which will make a
  12599. cell stay alive or born. The @option{rule} option allows one to specify
  12600. the rule to adopt.
  12601. This source accepts the following options:
  12602. @table @option
  12603. @item filename, f
  12604. Set the file from which to read the initial grid state. In the file,
  12605. each non-whitespace character is considered an alive cell, and newline
  12606. is used to delimit the end of each row.
  12607. If this option is not specified, the initial grid is generated
  12608. randomly.
  12609. @item rate, r
  12610. Set the video rate, that is the number of frames generated per second.
  12611. Default is 25.
  12612. @item random_fill_ratio, ratio
  12613. Set the random fill ratio for the initial random grid. It is a
  12614. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12615. It is ignored when a file is specified.
  12616. @item random_seed, seed
  12617. Set the seed for filling the initial random grid, must be an integer
  12618. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12619. set to -1, the filter will try to use a good random seed on a best
  12620. effort basis.
  12621. @item rule
  12622. Set the life rule.
  12623. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12624. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12625. @var{NS} specifies the number of alive neighbor cells which make a
  12626. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12627. which make a dead cell to become alive (i.e. to "born").
  12628. "s" and "b" can be used in place of "S" and "B", respectively.
  12629. Alternatively a rule can be specified by an 18-bits integer. The 9
  12630. high order bits are used to encode the next cell state if it is alive
  12631. for each number of neighbor alive cells, the low order bits specify
  12632. the rule for "borning" new cells. Higher order bits encode for an
  12633. higher number of neighbor cells.
  12634. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12635. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12636. Default value is "S23/B3", which is the original Conway's game of life
  12637. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12638. cells, and will born a new cell if there are three alive cells around
  12639. a dead cell.
  12640. @item size, s
  12641. Set the size of the output video. For the syntax of this option, check the
  12642. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12643. If @option{filename} is specified, the size is set by default to the
  12644. same size of the input file. If @option{size} is set, it must contain
  12645. the size specified in the input file, and the initial grid defined in
  12646. that file is centered in the larger resulting area.
  12647. If a filename is not specified, the size value defaults to "320x240"
  12648. (used for a randomly generated initial grid).
  12649. @item stitch
  12650. If set to 1, stitch the left and right grid edges together, and the
  12651. top and bottom edges also. Defaults to 1.
  12652. @item mold
  12653. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12654. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12655. value from 0 to 255.
  12656. @item life_color
  12657. Set the color of living (or new born) cells.
  12658. @item death_color
  12659. Set the color of dead cells. If @option{mold} is set, this is the first color
  12660. used to represent a dead cell.
  12661. @item mold_color
  12662. Set mold color, for definitely dead and moldy cells.
  12663. For the syntax of these 3 color options, check the "Color" section in the
  12664. ffmpeg-utils manual.
  12665. @end table
  12666. @subsection Examples
  12667. @itemize
  12668. @item
  12669. Read a grid from @file{pattern}, and center it on a grid of size
  12670. 300x300 pixels:
  12671. @example
  12672. life=f=pattern:s=300x300
  12673. @end example
  12674. @item
  12675. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12676. @example
  12677. life=ratio=2/3:s=200x200
  12678. @end example
  12679. @item
  12680. Specify a custom rule for evolving a randomly generated grid:
  12681. @example
  12682. life=rule=S14/B34
  12683. @end example
  12684. @item
  12685. Full example with slow death effect (mold) using @command{ffplay}:
  12686. @example
  12687. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12688. @end example
  12689. @end itemize
  12690. @anchor{allrgb}
  12691. @anchor{allyuv}
  12692. @anchor{color}
  12693. @anchor{haldclutsrc}
  12694. @anchor{nullsrc}
  12695. @anchor{rgbtestsrc}
  12696. @anchor{smptebars}
  12697. @anchor{smptehdbars}
  12698. @anchor{testsrc}
  12699. @anchor{testsrc2}
  12700. @anchor{yuvtestsrc}
  12701. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12702. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12703. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12704. The @code{color} source provides an uniformly colored input.
  12705. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12706. @ref{haldclut} filter.
  12707. The @code{nullsrc} source returns unprocessed video frames. It is
  12708. mainly useful to be employed in analysis / debugging tools, or as the
  12709. source for filters which ignore the input data.
  12710. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12711. detecting RGB vs BGR issues. You should see a red, green and blue
  12712. stripe from top to bottom.
  12713. The @code{smptebars} source generates a color bars pattern, based on
  12714. the SMPTE Engineering Guideline EG 1-1990.
  12715. The @code{smptehdbars} source generates a color bars pattern, based on
  12716. the SMPTE RP 219-2002.
  12717. The @code{testsrc} source generates a test video pattern, showing a
  12718. color pattern, a scrolling gradient and a timestamp. This is mainly
  12719. intended for testing purposes.
  12720. The @code{testsrc2} source is similar to testsrc, but supports more
  12721. pixel formats instead of just @code{rgb24}. This allows using it as an
  12722. input for other tests without requiring a format conversion.
  12723. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12724. see a y, cb and cr stripe from top to bottom.
  12725. The sources accept the following parameters:
  12726. @table @option
  12727. @item alpha
  12728. Specify the alpha (opacity) of the background, only available in the
  12729. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12730. 255 (fully opaque, the default).
  12731. @item color, c
  12732. Specify the color of the source, only available in the @code{color}
  12733. source. For the syntax of this option, check the "Color" section in the
  12734. ffmpeg-utils manual.
  12735. @item level
  12736. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12737. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12738. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12739. coded on a @code{1/(N*N)} scale.
  12740. @item size, s
  12741. Specify the size of the sourced video. For the syntax of this option, check the
  12742. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12743. The default value is @code{320x240}.
  12744. This option is not available with the @code{haldclutsrc} filter.
  12745. @item rate, r
  12746. Specify the frame rate of the sourced video, as the number of frames
  12747. generated per second. It has to be a string in the format
  12748. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12749. number or a valid video frame rate abbreviation. The default value is
  12750. "25".
  12751. @item sar
  12752. Set the sample aspect ratio of the sourced video.
  12753. @item duration, d
  12754. Set the duration of the sourced video. See
  12755. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12756. for the accepted syntax.
  12757. If not specified, or the expressed duration is negative, the video is
  12758. supposed to be generated forever.
  12759. @item decimals, n
  12760. Set the number of decimals to show in the timestamp, only available in the
  12761. @code{testsrc} source.
  12762. The displayed timestamp value will correspond to the original
  12763. timestamp value multiplied by the power of 10 of the specified
  12764. value. Default value is 0.
  12765. @end table
  12766. For example the following:
  12767. @example
  12768. testsrc=duration=5.3:size=qcif:rate=10
  12769. @end example
  12770. will generate a video with a duration of 5.3 seconds, with size
  12771. 176x144 and a frame rate of 10 frames per second.
  12772. The following graph description will generate a red source
  12773. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12774. frames per second.
  12775. @example
  12776. color=c=red@@0.2:s=qcif:r=10
  12777. @end example
  12778. If the input content is to be ignored, @code{nullsrc} can be used. The
  12779. following command generates noise in the luminance plane by employing
  12780. the @code{geq} filter:
  12781. @example
  12782. nullsrc=s=256x256, geq=random(1)*255:128:128
  12783. @end example
  12784. @subsection Commands
  12785. The @code{color} source supports the following commands:
  12786. @table @option
  12787. @item c, color
  12788. Set the color of the created image. Accepts the same syntax of the
  12789. corresponding @option{color} option.
  12790. @end table
  12791. @c man end VIDEO SOURCES
  12792. @chapter Video Sinks
  12793. @c man begin VIDEO SINKS
  12794. Below is a description of the currently available video sinks.
  12795. @section buffersink
  12796. Buffer video frames, and make them available to the end of the filter
  12797. graph.
  12798. This sink is mainly intended for programmatic use, in particular
  12799. through the interface defined in @file{libavfilter/buffersink.h}
  12800. or the options system.
  12801. It accepts a pointer to an AVBufferSinkContext structure, which
  12802. defines the incoming buffers' formats, to be passed as the opaque
  12803. parameter to @code{avfilter_init_filter} for initialization.
  12804. @section nullsink
  12805. Null video sink: do absolutely nothing with the input video. It is
  12806. mainly useful as a template and for use in analysis / debugging
  12807. tools.
  12808. @c man end VIDEO SINKS
  12809. @chapter Multimedia Filters
  12810. @c man begin MULTIMEDIA FILTERS
  12811. Below is a description of the currently available multimedia filters.
  12812. @section abitscope
  12813. Convert input audio to a video output, displaying the audio bit scope.
  12814. The filter accepts the following options:
  12815. @table @option
  12816. @item rate, r
  12817. Set frame rate, expressed as number of frames per second. Default
  12818. value is "25".
  12819. @item size, s
  12820. Specify the video size for the output. For the syntax of this option, check the
  12821. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12822. Default value is @code{1024x256}.
  12823. @item colors
  12824. Specify list of colors separated by space or by '|' which will be used to
  12825. draw channels. Unrecognized or missing colors will be replaced
  12826. by white color.
  12827. @end table
  12828. @section ahistogram
  12829. Convert input audio to a video output, displaying the volume histogram.
  12830. The filter accepts the following options:
  12831. @table @option
  12832. @item dmode
  12833. Specify how histogram is calculated.
  12834. It accepts the following values:
  12835. @table @samp
  12836. @item single
  12837. Use single histogram for all channels.
  12838. @item separate
  12839. Use separate histogram for each channel.
  12840. @end table
  12841. Default is @code{single}.
  12842. @item rate, r
  12843. Set frame rate, expressed as number of frames per second. Default
  12844. value is "25".
  12845. @item size, s
  12846. Specify the video size for the output. For the syntax of this option, check the
  12847. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12848. Default value is @code{hd720}.
  12849. @item scale
  12850. Set display scale.
  12851. It accepts the following values:
  12852. @table @samp
  12853. @item log
  12854. logarithmic
  12855. @item sqrt
  12856. square root
  12857. @item cbrt
  12858. cubic root
  12859. @item lin
  12860. linear
  12861. @item rlog
  12862. reverse logarithmic
  12863. @end table
  12864. Default is @code{log}.
  12865. @item ascale
  12866. Set amplitude scale.
  12867. It accepts the following values:
  12868. @table @samp
  12869. @item log
  12870. logarithmic
  12871. @item lin
  12872. linear
  12873. @end table
  12874. Default is @code{log}.
  12875. @item acount
  12876. Set how much frames to accumulate in histogram.
  12877. Defauls is 1. Setting this to -1 accumulates all frames.
  12878. @item rheight
  12879. Set histogram ratio of window height.
  12880. @item slide
  12881. Set sonogram sliding.
  12882. It accepts the following values:
  12883. @table @samp
  12884. @item replace
  12885. replace old rows with new ones.
  12886. @item scroll
  12887. scroll from top to bottom.
  12888. @end table
  12889. Default is @code{replace}.
  12890. @end table
  12891. @section aphasemeter
  12892. Convert input audio to a video output, displaying the audio phase.
  12893. The filter accepts the following options:
  12894. @table @option
  12895. @item rate, r
  12896. Set the output frame rate. Default value is @code{25}.
  12897. @item size, s
  12898. Set the video size for the output. For the syntax of this option, check the
  12899. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12900. Default value is @code{800x400}.
  12901. @item rc
  12902. @item gc
  12903. @item bc
  12904. Specify the red, green, blue contrast. Default values are @code{2},
  12905. @code{7} and @code{1}.
  12906. Allowed range is @code{[0, 255]}.
  12907. @item mpc
  12908. Set color which will be used for drawing median phase. If color is
  12909. @code{none} which is default, no median phase value will be drawn.
  12910. @item video
  12911. Enable video output. Default is enabled.
  12912. @end table
  12913. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12914. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12915. The @code{-1} means left and right channels are completely out of phase and
  12916. @code{1} means channels are in phase.
  12917. @section avectorscope
  12918. Convert input audio to a video output, representing the audio vector
  12919. scope.
  12920. The filter is used to measure the difference between channels of stereo
  12921. audio stream. A monoaural signal, consisting of identical left and right
  12922. signal, results in straight vertical line. Any stereo separation is visible
  12923. as a deviation from this line, creating a Lissajous figure.
  12924. If the straight (or deviation from it) but horizontal line appears this
  12925. indicates that the left and right channels are out of phase.
  12926. The filter accepts the following options:
  12927. @table @option
  12928. @item mode, m
  12929. Set the vectorscope mode.
  12930. Available values are:
  12931. @table @samp
  12932. @item lissajous
  12933. Lissajous rotated by 45 degrees.
  12934. @item lissajous_xy
  12935. Same as above but not rotated.
  12936. @item polar
  12937. Shape resembling half of circle.
  12938. @end table
  12939. Default value is @samp{lissajous}.
  12940. @item size, s
  12941. Set the video size for the output. For the syntax of this option, check the
  12942. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12943. Default value is @code{400x400}.
  12944. @item rate, r
  12945. Set the output frame rate. Default value is @code{25}.
  12946. @item rc
  12947. @item gc
  12948. @item bc
  12949. @item ac
  12950. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12951. @code{160}, @code{80} and @code{255}.
  12952. Allowed range is @code{[0, 255]}.
  12953. @item rf
  12954. @item gf
  12955. @item bf
  12956. @item af
  12957. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12958. @code{10}, @code{5} and @code{5}.
  12959. Allowed range is @code{[0, 255]}.
  12960. @item zoom
  12961. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12962. @item draw
  12963. Set the vectorscope drawing mode.
  12964. Available values are:
  12965. @table @samp
  12966. @item dot
  12967. Draw dot for each sample.
  12968. @item line
  12969. Draw line between previous and current sample.
  12970. @end table
  12971. Default value is @samp{dot}.
  12972. @item scale
  12973. Specify amplitude scale of audio samples.
  12974. Available values are:
  12975. @table @samp
  12976. @item lin
  12977. Linear.
  12978. @item sqrt
  12979. Square root.
  12980. @item cbrt
  12981. Cubic root.
  12982. @item log
  12983. Logarithmic.
  12984. @end table
  12985. @end table
  12986. @subsection Examples
  12987. @itemize
  12988. @item
  12989. Complete example using @command{ffplay}:
  12990. @example
  12991. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12992. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12993. @end example
  12994. @end itemize
  12995. @section bench, abench
  12996. Benchmark part of a filtergraph.
  12997. The filter accepts the following options:
  12998. @table @option
  12999. @item action
  13000. Start or stop a timer.
  13001. Available values are:
  13002. @table @samp
  13003. @item start
  13004. Get the current time, set it as frame metadata (using the key
  13005. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13006. @item stop
  13007. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13008. the input frame metadata to get the time difference. Time difference, average,
  13009. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13010. @code{min}) are then printed. The timestamps are expressed in seconds.
  13011. @end table
  13012. @end table
  13013. @subsection Examples
  13014. @itemize
  13015. @item
  13016. Benchmark @ref{selectivecolor} filter:
  13017. @example
  13018. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13019. @end example
  13020. @end itemize
  13021. @section concat
  13022. Concatenate audio and video streams, joining them together one after the
  13023. other.
  13024. The filter works on segments of synchronized video and audio streams. All
  13025. segments must have the same number of streams of each type, and that will
  13026. also be the number of streams at output.
  13027. The filter accepts the following options:
  13028. @table @option
  13029. @item n
  13030. Set the number of segments. Default is 2.
  13031. @item v
  13032. Set the number of output video streams, that is also the number of video
  13033. streams in each segment. Default is 1.
  13034. @item a
  13035. Set the number of output audio streams, that is also the number of audio
  13036. streams in each segment. Default is 0.
  13037. @item unsafe
  13038. Activate unsafe mode: do not fail if segments have a different format.
  13039. @end table
  13040. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13041. @var{a} audio outputs.
  13042. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13043. segment, in the same order as the outputs, then the inputs for the second
  13044. segment, etc.
  13045. Related streams do not always have exactly the same duration, for various
  13046. reasons including codec frame size or sloppy authoring. For that reason,
  13047. related synchronized streams (e.g. a video and its audio track) should be
  13048. concatenated at once. The concat filter will use the duration of the longest
  13049. stream in each segment (except the last one), and if necessary pad shorter
  13050. audio streams with silence.
  13051. For this filter to work correctly, all segments must start at timestamp 0.
  13052. All corresponding streams must have the same parameters in all segments; the
  13053. filtering system will automatically select a common pixel format for video
  13054. streams, and a common sample format, sample rate and channel layout for
  13055. audio streams, but other settings, such as resolution, must be converted
  13056. explicitly by the user.
  13057. Different frame rates are acceptable but will result in variable frame rate
  13058. at output; be sure to configure the output file to handle it.
  13059. @subsection Examples
  13060. @itemize
  13061. @item
  13062. Concatenate an opening, an episode and an ending, all in bilingual version
  13063. (video in stream 0, audio in streams 1 and 2):
  13064. @example
  13065. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13066. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13067. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13068. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13069. @end example
  13070. @item
  13071. Concatenate two parts, handling audio and video separately, using the
  13072. (a)movie sources, and adjusting the resolution:
  13073. @example
  13074. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13075. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13076. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13077. @end example
  13078. Note that a desync will happen at the stitch if the audio and video streams
  13079. do not have exactly the same duration in the first file.
  13080. @end itemize
  13081. @section drawgraph, adrawgraph
  13082. Draw a graph using input video or audio metadata.
  13083. It accepts the following parameters:
  13084. @table @option
  13085. @item m1
  13086. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13087. @item fg1
  13088. Set 1st foreground color expression.
  13089. @item m2
  13090. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13091. @item fg2
  13092. Set 2nd foreground color expression.
  13093. @item m3
  13094. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13095. @item fg3
  13096. Set 3rd foreground color expression.
  13097. @item m4
  13098. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13099. @item fg4
  13100. Set 4th foreground color expression.
  13101. @item min
  13102. Set minimal value of metadata value.
  13103. @item max
  13104. Set maximal value of metadata value.
  13105. @item bg
  13106. Set graph background color. Default is white.
  13107. @item mode
  13108. Set graph mode.
  13109. Available values for mode is:
  13110. @table @samp
  13111. @item bar
  13112. @item dot
  13113. @item line
  13114. @end table
  13115. Default is @code{line}.
  13116. @item slide
  13117. Set slide mode.
  13118. Available values for slide is:
  13119. @table @samp
  13120. @item frame
  13121. Draw new frame when right border is reached.
  13122. @item replace
  13123. Replace old columns with new ones.
  13124. @item scroll
  13125. Scroll from right to left.
  13126. @item rscroll
  13127. Scroll from left to right.
  13128. @item picture
  13129. Draw single picture.
  13130. @end table
  13131. Default is @code{frame}.
  13132. @item size
  13133. Set size of graph video. For the syntax of this option, check the
  13134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13135. The default value is @code{900x256}.
  13136. The foreground color expressions can use the following variables:
  13137. @table @option
  13138. @item MIN
  13139. Minimal value of metadata value.
  13140. @item MAX
  13141. Maximal value of metadata value.
  13142. @item VAL
  13143. Current metadata key value.
  13144. @end table
  13145. The color is defined as 0xAABBGGRR.
  13146. @end table
  13147. Example using metadata from @ref{signalstats} filter:
  13148. @example
  13149. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13150. @end example
  13151. Example using metadata from @ref{ebur128} filter:
  13152. @example
  13153. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13154. @end example
  13155. @anchor{ebur128}
  13156. @section ebur128
  13157. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13158. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13159. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13160. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13161. The filter also has a video output (see the @var{video} option) with a real
  13162. time graph to observe the loudness evolution. The graphic contains the logged
  13163. message mentioned above, so it is not printed anymore when this option is set,
  13164. unless the verbose logging is set. The main graphing area contains the
  13165. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13166. the momentary loudness (400 milliseconds).
  13167. More information about the Loudness Recommendation EBU R128 on
  13168. @url{http://tech.ebu.ch/loudness}.
  13169. The filter accepts the following options:
  13170. @table @option
  13171. @item video
  13172. Activate the video output. The audio stream is passed unchanged whether this
  13173. option is set or no. The video stream will be the first output stream if
  13174. activated. Default is @code{0}.
  13175. @item size
  13176. Set the video size. This option is for video only. For the syntax of this
  13177. option, check the
  13178. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13179. Default and minimum resolution is @code{640x480}.
  13180. @item meter
  13181. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13182. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13183. other integer value between this range is allowed.
  13184. @item metadata
  13185. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13186. into 100ms output frames, each of them containing various loudness information
  13187. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13188. Default is @code{0}.
  13189. @item framelog
  13190. Force the frame logging level.
  13191. Available values are:
  13192. @table @samp
  13193. @item info
  13194. information logging level
  13195. @item verbose
  13196. verbose logging level
  13197. @end table
  13198. By default, the logging level is set to @var{info}. If the @option{video} or
  13199. the @option{metadata} options are set, it switches to @var{verbose}.
  13200. @item peak
  13201. Set peak mode(s).
  13202. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13203. values are:
  13204. @table @samp
  13205. @item none
  13206. Disable any peak mode (default).
  13207. @item sample
  13208. Enable sample-peak mode.
  13209. Simple peak mode looking for the higher sample value. It logs a message
  13210. for sample-peak (identified by @code{SPK}).
  13211. @item true
  13212. Enable true-peak mode.
  13213. If enabled, the peak lookup is done on an over-sampled version of the input
  13214. stream for better peak accuracy. It logs a message for true-peak.
  13215. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13216. This mode requires a build with @code{libswresample}.
  13217. @end table
  13218. @item dualmono
  13219. Treat mono input files as "dual mono". If a mono file is intended for playback
  13220. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13221. If set to @code{true}, this option will compensate for this effect.
  13222. Multi-channel input files are not affected by this option.
  13223. @item panlaw
  13224. Set a specific pan law to be used for the measurement of dual mono files.
  13225. This parameter is optional, and has a default value of -3.01dB.
  13226. @end table
  13227. @subsection Examples
  13228. @itemize
  13229. @item
  13230. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13231. @example
  13232. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13233. @end example
  13234. @item
  13235. Run an analysis with @command{ffmpeg}:
  13236. @example
  13237. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13238. @end example
  13239. @end itemize
  13240. @section interleave, ainterleave
  13241. Temporally interleave frames from several inputs.
  13242. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13243. These filters read frames from several inputs and send the oldest
  13244. queued frame to the output.
  13245. Input streams must have well defined, monotonically increasing frame
  13246. timestamp values.
  13247. In order to submit one frame to output, these filters need to enqueue
  13248. at least one frame for each input, so they cannot work in case one
  13249. input is not yet terminated and will not receive incoming frames.
  13250. For example consider the case when one input is a @code{select} filter
  13251. which always drops input frames. The @code{interleave} filter will keep
  13252. reading from that input, but it will never be able to send new frames
  13253. to output until the input sends an end-of-stream signal.
  13254. Also, depending on inputs synchronization, the filters will drop
  13255. frames in case one input receives more frames than the other ones, and
  13256. the queue is already filled.
  13257. These filters accept the following options:
  13258. @table @option
  13259. @item nb_inputs, n
  13260. Set the number of different inputs, it is 2 by default.
  13261. @end table
  13262. @subsection Examples
  13263. @itemize
  13264. @item
  13265. Interleave frames belonging to different streams using @command{ffmpeg}:
  13266. @example
  13267. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13268. @end example
  13269. @item
  13270. Add flickering blur effect:
  13271. @example
  13272. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13273. @end example
  13274. @end itemize
  13275. @section metadata, ametadata
  13276. Manipulate frame metadata.
  13277. This filter accepts the following options:
  13278. @table @option
  13279. @item mode
  13280. Set mode of operation of the filter.
  13281. Can be one of the following:
  13282. @table @samp
  13283. @item select
  13284. If both @code{value} and @code{key} is set, select frames
  13285. which have such metadata. If only @code{key} is set, select
  13286. every frame that has such key in metadata.
  13287. @item add
  13288. Add new metadata @code{key} and @code{value}. If key is already available
  13289. do nothing.
  13290. @item modify
  13291. Modify value of already present key.
  13292. @item delete
  13293. If @code{value} is set, delete only keys that have such value.
  13294. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13295. the frame.
  13296. @item print
  13297. Print key and its value if metadata was found. If @code{key} is not set print all
  13298. metadata values available in frame.
  13299. @end table
  13300. @item key
  13301. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13302. @item value
  13303. Set metadata value which will be used. This option is mandatory for
  13304. @code{modify} and @code{add} mode.
  13305. @item function
  13306. Which function to use when comparing metadata value and @code{value}.
  13307. Can be one of following:
  13308. @table @samp
  13309. @item same_str
  13310. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13311. @item starts_with
  13312. Values are interpreted as strings, returns true if metadata value starts with
  13313. the @code{value} option string.
  13314. @item less
  13315. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13316. @item equal
  13317. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13318. @item greater
  13319. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13320. @item expr
  13321. Values are interpreted as floats, returns true if expression from option @code{expr}
  13322. evaluates to true.
  13323. @end table
  13324. @item expr
  13325. Set expression which is used when @code{function} is set to @code{expr}.
  13326. The expression is evaluated through the eval API and can contain the following
  13327. constants:
  13328. @table @option
  13329. @item VALUE1
  13330. Float representation of @code{value} from metadata key.
  13331. @item VALUE2
  13332. Float representation of @code{value} as supplied by user in @code{value} option.
  13333. @end table
  13334. @item file
  13335. If specified in @code{print} mode, output is written to the named file. Instead of
  13336. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13337. for standard output. If @code{file} option is not set, output is written to the log
  13338. with AV_LOG_INFO loglevel.
  13339. @end table
  13340. @subsection Examples
  13341. @itemize
  13342. @item
  13343. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13344. between 0 and 1.
  13345. @example
  13346. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13347. @end example
  13348. @item
  13349. Print silencedetect output to file @file{metadata.txt}.
  13350. @example
  13351. silencedetect,ametadata=mode=print:file=metadata.txt
  13352. @end example
  13353. @item
  13354. Direct all metadata to a pipe with file descriptor 4.
  13355. @example
  13356. metadata=mode=print:file='pipe\:4'
  13357. @end example
  13358. @end itemize
  13359. @section perms, aperms
  13360. Set read/write permissions for the output frames.
  13361. These filters are mainly aimed at developers to test direct path in the
  13362. following filter in the filtergraph.
  13363. The filters accept the following options:
  13364. @table @option
  13365. @item mode
  13366. Select the permissions mode.
  13367. It accepts the following values:
  13368. @table @samp
  13369. @item none
  13370. Do nothing. This is the default.
  13371. @item ro
  13372. Set all the output frames read-only.
  13373. @item rw
  13374. Set all the output frames directly writable.
  13375. @item toggle
  13376. Make the frame read-only if writable, and writable if read-only.
  13377. @item random
  13378. Set each output frame read-only or writable randomly.
  13379. @end table
  13380. @item seed
  13381. Set the seed for the @var{random} mode, must be an integer included between
  13382. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13383. @code{-1}, the filter will try to use a good random seed on a best effort
  13384. basis.
  13385. @end table
  13386. Note: in case of auto-inserted filter between the permission filter and the
  13387. following one, the permission might not be received as expected in that
  13388. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13389. perms/aperms filter can avoid this problem.
  13390. @section realtime, arealtime
  13391. Slow down filtering to match real time approximatively.
  13392. These filters will pause the filtering for a variable amount of time to
  13393. match the output rate with the input timestamps.
  13394. They are similar to the @option{re} option to @code{ffmpeg}.
  13395. They accept the following options:
  13396. @table @option
  13397. @item limit
  13398. Time limit for the pauses. Any pause longer than that will be considered
  13399. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13400. @end table
  13401. @anchor{select}
  13402. @section select, aselect
  13403. Select frames to pass in output.
  13404. This filter accepts the following options:
  13405. @table @option
  13406. @item expr, e
  13407. Set expression, which is evaluated for each input frame.
  13408. If the expression is evaluated to zero, the frame is discarded.
  13409. If the evaluation result is negative or NaN, the frame is sent to the
  13410. first output; otherwise it is sent to the output with index
  13411. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13412. For example a value of @code{1.2} corresponds to the output with index
  13413. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13414. @item outputs, n
  13415. Set the number of outputs. The output to which to send the selected
  13416. frame is based on the result of the evaluation. Default value is 1.
  13417. @end table
  13418. The expression can contain the following constants:
  13419. @table @option
  13420. @item n
  13421. The (sequential) number of the filtered frame, starting from 0.
  13422. @item selected_n
  13423. The (sequential) number of the selected frame, starting from 0.
  13424. @item prev_selected_n
  13425. The sequential number of the last selected frame. It's NAN if undefined.
  13426. @item TB
  13427. The timebase of the input timestamps.
  13428. @item pts
  13429. The PTS (Presentation TimeStamp) of the filtered video frame,
  13430. expressed in @var{TB} units. It's NAN if undefined.
  13431. @item t
  13432. The PTS of the filtered video frame,
  13433. expressed in seconds. It's NAN if undefined.
  13434. @item prev_pts
  13435. The PTS of the previously filtered video frame. It's NAN if undefined.
  13436. @item prev_selected_pts
  13437. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13438. @item prev_selected_t
  13439. The PTS of the last previously selected video frame. It's NAN if undefined.
  13440. @item start_pts
  13441. The PTS of the first video frame in the video. It's NAN if undefined.
  13442. @item start_t
  13443. The time of the first video frame in the video. It's NAN if undefined.
  13444. @item pict_type @emph{(video only)}
  13445. The type of the filtered frame. It can assume one of the following
  13446. values:
  13447. @table @option
  13448. @item I
  13449. @item P
  13450. @item B
  13451. @item S
  13452. @item SI
  13453. @item SP
  13454. @item BI
  13455. @end table
  13456. @item interlace_type @emph{(video only)}
  13457. The frame interlace type. It can assume one of the following values:
  13458. @table @option
  13459. @item PROGRESSIVE
  13460. The frame is progressive (not interlaced).
  13461. @item TOPFIRST
  13462. The frame is top-field-first.
  13463. @item BOTTOMFIRST
  13464. The frame is bottom-field-first.
  13465. @end table
  13466. @item consumed_sample_n @emph{(audio only)}
  13467. the number of selected samples before the current frame
  13468. @item samples_n @emph{(audio only)}
  13469. the number of samples in the current frame
  13470. @item sample_rate @emph{(audio only)}
  13471. the input sample rate
  13472. @item key
  13473. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13474. @item pos
  13475. the position in the file of the filtered frame, -1 if the information
  13476. is not available (e.g. for synthetic video)
  13477. @item scene @emph{(video only)}
  13478. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13479. probability for the current frame to introduce a new scene, while a higher
  13480. value means the current frame is more likely to be one (see the example below)
  13481. @item concatdec_select
  13482. The concat demuxer can select only part of a concat input file by setting an
  13483. inpoint and an outpoint, but the output packets may not be entirely contained
  13484. in the selected interval. By using this variable, it is possible to skip frames
  13485. generated by the concat demuxer which are not exactly contained in the selected
  13486. interval.
  13487. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13488. and the @var{lavf.concat.duration} packet metadata values which are also
  13489. present in the decoded frames.
  13490. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13491. start_time and either the duration metadata is missing or the frame pts is less
  13492. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13493. missing.
  13494. That basically means that an input frame is selected if its pts is within the
  13495. interval set by the concat demuxer.
  13496. @end table
  13497. The default value of the select expression is "1".
  13498. @subsection Examples
  13499. @itemize
  13500. @item
  13501. Select all frames in input:
  13502. @example
  13503. select
  13504. @end example
  13505. The example above is the same as:
  13506. @example
  13507. select=1
  13508. @end example
  13509. @item
  13510. Skip all frames:
  13511. @example
  13512. select=0
  13513. @end example
  13514. @item
  13515. Select only I-frames:
  13516. @example
  13517. select='eq(pict_type\,I)'
  13518. @end example
  13519. @item
  13520. Select one frame every 100:
  13521. @example
  13522. select='not(mod(n\,100))'
  13523. @end example
  13524. @item
  13525. Select only frames contained in the 10-20 time interval:
  13526. @example
  13527. select=between(t\,10\,20)
  13528. @end example
  13529. @item
  13530. Select only I-frames contained in the 10-20 time interval:
  13531. @example
  13532. select=between(t\,10\,20)*eq(pict_type\,I)
  13533. @end example
  13534. @item
  13535. Select frames with a minimum distance of 10 seconds:
  13536. @example
  13537. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13538. @end example
  13539. @item
  13540. Use aselect to select only audio frames with samples number > 100:
  13541. @example
  13542. aselect='gt(samples_n\,100)'
  13543. @end example
  13544. @item
  13545. Create a mosaic of the first scenes:
  13546. @example
  13547. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13548. @end example
  13549. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13550. choice.
  13551. @item
  13552. Send even and odd frames to separate outputs, and compose them:
  13553. @example
  13554. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13555. @end example
  13556. @item
  13557. Select useful frames from an ffconcat file which is using inpoints and
  13558. outpoints but where the source files are not intra frame only.
  13559. @example
  13560. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13561. @end example
  13562. @end itemize
  13563. @section sendcmd, asendcmd
  13564. Send commands to filters in the filtergraph.
  13565. These filters read commands to be sent to other filters in the
  13566. filtergraph.
  13567. @code{sendcmd} must be inserted between two video filters,
  13568. @code{asendcmd} must be inserted between two audio filters, but apart
  13569. from that they act the same way.
  13570. The specification of commands can be provided in the filter arguments
  13571. with the @var{commands} option, or in a file specified by the
  13572. @var{filename} option.
  13573. These filters accept the following options:
  13574. @table @option
  13575. @item commands, c
  13576. Set the commands to be read and sent to the other filters.
  13577. @item filename, f
  13578. Set the filename of the commands to be read and sent to the other
  13579. filters.
  13580. @end table
  13581. @subsection Commands syntax
  13582. A commands description consists of a sequence of interval
  13583. specifications, comprising a list of commands to be executed when a
  13584. particular event related to that interval occurs. The occurring event
  13585. is typically the current frame time entering or leaving a given time
  13586. interval.
  13587. An interval is specified by the following syntax:
  13588. @example
  13589. @var{START}[-@var{END}] @var{COMMANDS};
  13590. @end example
  13591. The time interval is specified by the @var{START} and @var{END} times.
  13592. @var{END} is optional and defaults to the maximum time.
  13593. The current frame time is considered within the specified interval if
  13594. it is included in the interval [@var{START}, @var{END}), that is when
  13595. the time is greater or equal to @var{START} and is lesser than
  13596. @var{END}.
  13597. @var{COMMANDS} consists of a sequence of one or more command
  13598. specifications, separated by ",", relating to that interval. The
  13599. syntax of a command specification is given by:
  13600. @example
  13601. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13602. @end example
  13603. @var{FLAGS} is optional and specifies the type of events relating to
  13604. the time interval which enable sending the specified command, and must
  13605. be a non-null sequence of identifier flags separated by "+" or "|" and
  13606. enclosed between "[" and "]".
  13607. The following flags are recognized:
  13608. @table @option
  13609. @item enter
  13610. The command is sent when the current frame timestamp enters the
  13611. specified interval. In other words, the command is sent when the
  13612. previous frame timestamp was not in the given interval, and the
  13613. current is.
  13614. @item leave
  13615. The command is sent when the current frame timestamp leaves the
  13616. specified interval. In other words, the command is sent when the
  13617. previous frame timestamp was in the given interval, and the
  13618. current is not.
  13619. @end table
  13620. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13621. assumed.
  13622. @var{TARGET} specifies the target of the command, usually the name of
  13623. the filter class or a specific filter instance name.
  13624. @var{COMMAND} specifies the name of the command for the target filter.
  13625. @var{ARG} is optional and specifies the optional list of argument for
  13626. the given @var{COMMAND}.
  13627. Between one interval specification and another, whitespaces, or
  13628. sequences of characters starting with @code{#} until the end of line,
  13629. are ignored and can be used to annotate comments.
  13630. A simplified BNF description of the commands specification syntax
  13631. follows:
  13632. @example
  13633. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13634. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13635. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13636. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13637. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13638. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13639. @end example
  13640. @subsection Examples
  13641. @itemize
  13642. @item
  13643. Specify audio tempo change at second 4:
  13644. @example
  13645. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13646. @end example
  13647. @item
  13648. Target a specific filter instance:
  13649. @example
  13650. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13651. @end example
  13652. @item
  13653. Specify a list of drawtext and hue commands in a file.
  13654. @example
  13655. # show text in the interval 5-10
  13656. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13657. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13658. # desaturate the image in the interval 15-20
  13659. 15.0-20.0 [enter] hue s 0,
  13660. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13661. [leave] hue s 1,
  13662. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13663. # apply an exponential saturation fade-out effect, starting from time 25
  13664. 25 [enter] hue s exp(25-t)
  13665. @end example
  13666. A filtergraph allowing to read and process the above command list
  13667. stored in a file @file{test.cmd}, can be specified with:
  13668. @example
  13669. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13670. @end example
  13671. @end itemize
  13672. @anchor{setpts}
  13673. @section setpts, asetpts
  13674. Change the PTS (presentation timestamp) of the input frames.
  13675. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13676. This filter accepts the following options:
  13677. @table @option
  13678. @item expr
  13679. The expression which is evaluated for each frame to construct its timestamp.
  13680. @end table
  13681. The expression is evaluated through the eval API and can contain the following
  13682. constants:
  13683. @table @option
  13684. @item FRAME_RATE
  13685. frame rate, only defined for constant frame-rate video
  13686. @item PTS
  13687. The presentation timestamp in input
  13688. @item N
  13689. The count of the input frame for video or the number of consumed samples,
  13690. not including the current frame for audio, starting from 0.
  13691. @item NB_CONSUMED_SAMPLES
  13692. The number of consumed samples, not including the current frame (only
  13693. audio)
  13694. @item NB_SAMPLES, S
  13695. The number of samples in the current frame (only audio)
  13696. @item SAMPLE_RATE, SR
  13697. The audio sample rate.
  13698. @item STARTPTS
  13699. The PTS of the first frame.
  13700. @item STARTT
  13701. the time in seconds of the first frame
  13702. @item INTERLACED
  13703. State whether the current frame is interlaced.
  13704. @item T
  13705. the time in seconds of the current frame
  13706. @item POS
  13707. original position in the file of the frame, or undefined if undefined
  13708. for the current frame
  13709. @item PREV_INPTS
  13710. The previous input PTS.
  13711. @item PREV_INT
  13712. previous input time in seconds
  13713. @item PREV_OUTPTS
  13714. The previous output PTS.
  13715. @item PREV_OUTT
  13716. previous output time in seconds
  13717. @item RTCTIME
  13718. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13719. instead.
  13720. @item RTCSTART
  13721. The wallclock (RTC) time at the start of the movie in microseconds.
  13722. @item TB
  13723. The timebase of the input timestamps.
  13724. @end table
  13725. @subsection Examples
  13726. @itemize
  13727. @item
  13728. Start counting PTS from zero
  13729. @example
  13730. setpts=PTS-STARTPTS
  13731. @end example
  13732. @item
  13733. Apply fast motion effect:
  13734. @example
  13735. setpts=0.5*PTS
  13736. @end example
  13737. @item
  13738. Apply slow motion effect:
  13739. @example
  13740. setpts=2.0*PTS
  13741. @end example
  13742. @item
  13743. Set fixed rate of 25 frames per second:
  13744. @example
  13745. setpts=N/(25*TB)
  13746. @end example
  13747. @item
  13748. Set fixed rate 25 fps with some jitter:
  13749. @example
  13750. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13751. @end example
  13752. @item
  13753. Apply an offset of 10 seconds to the input PTS:
  13754. @example
  13755. setpts=PTS+10/TB
  13756. @end example
  13757. @item
  13758. Generate timestamps from a "live source" and rebase onto the current timebase:
  13759. @example
  13760. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13761. @end example
  13762. @item
  13763. Generate timestamps by counting samples:
  13764. @example
  13765. asetpts=N/SR/TB
  13766. @end example
  13767. @end itemize
  13768. @section settb, asettb
  13769. Set the timebase to use for the output frames timestamps.
  13770. It is mainly useful for testing timebase configuration.
  13771. It accepts the following parameters:
  13772. @table @option
  13773. @item expr, tb
  13774. The expression which is evaluated into the output timebase.
  13775. @end table
  13776. The value for @option{tb} is an arithmetic expression representing a
  13777. rational. The expression can contain the constants "AVTB" (the default
  13778. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13779. audio only). Default value is "intb".
  13780. @subsection Examples
  13781. @itemize
  13782. @item
  13783. Set the timebase to 1/25:
  13784. @example
  13785. settb=expr=1/25
  13786. @end example
  13787. @item
  13788. Set the timebase to 1/10:
  13789. @example
  13790. settb=expr=0.1
  13791. @end example
  13792. @item
  13793. Set the timebase to 1001/1000:
  13794. @example
  13795. settb=1+0.001
  13796. @end example
  13797. @item
  13798. Set the timebase to 2*intb:
  13799. @example
  13800. settb=2*intb
  13801. @end example
  13802. @item
  13803. Set the default timebase value:
  13804. @example
  13805. settb=AVTB
  13806. @end example
  13807. @end itemize
  13808. @section showcqt
  13809. Convert input audio to a video output representing frequency spectrum
  13810. logarithmically using Brown-Puckette constant Q transform algorithm with
  13811. direct frequency domain coefficient calculation (but the transform itself
  13812. is not really constant Q, instead the Q factor is actually variable/clamped),
  13813. with musical tone scale, from E0 to D#10.
  13814. The filter accepts the following options:
  13815. @table @option
  13816. @item size, s
  13817. Specify the video size for the output. It must be even. For the syntax of this option,
  13818. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13819. Default value is @code{1920x1080}.
  13820. @item fps, rate, r
  13821. Set the output frame rate. Default value is @code{25}.
  13822. @item bar_h
  13823. Set the bargraph height. It must be even. Default value is @code{-1} which
  13824. computes the bargraph height automatically.
  13825. @item axis_h
  13826. Set the axis height. It must be even. Default value is @code{-1} which computes
  13827. the axis height automatically.
  13828. @item sono_h
  13829. Set the sonogram height. It must be even. Default value is @code{-1} which
  13830. computes the sonogram height automatically.
  13831. @item fullhd
  13832. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13833. instead. Default value is @code{1}.
  13834. @item sono_v, volume
  13835. Specify the sonogram volume expression. It can contain variables:
  13836. @table @option
  13837. @item bar_v
  13838. the @var{bar_v} evaluated expression
  13839. @item frequency, freq, f
  13840. the frequency where it is evaluated
  13841. @item timeclamp, tc
  13842. the value of @var{timeclamp} option
  13843. @end table
  13844. and functions:
  13845. @table @option
  13846. @item a_weighting(f)
  13847. A-weighting of equal loudness
  13848. @item b_weighting(f)
  13849. B-weighting of equal loudness
  13850. @item c_weighting(f)
  13851. C-weighting of equal loudness.
  13852. @end table
  13853. Default value is @code{16}.
  13854. @item bar_v, volume2
  13855. Specify the bargraph volume expression. It can contain variables:
  13856. @table @option
  13857. @item sono_v
  13858. the @var{sono_v} evaluated expression
  13859. @item frequency, freq, f
  13860. the frequency where it is evaluated
  13861. @item timeclamp, tc
  13862. the value of @var{timeclamp} option
  13863. @end table
  13864. and functions:
  13865. @table @option
  13866. @item a_weighting(f)
  13867. A-weighting of equal loudness
  13868. @item b_weighting(f)
  13869. B-weighting of equal loudness
  13870. @item c_weighting(f)
  13871. C-weighting of equal loudness.
  13872. @end table
  13873. Default value is @code{sono_v}.
  13874. @item sono_g, gamma
  13875. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13876. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13877. Acceptable range is @code{[1, 7]}.
  13878. @item bar_g, gamma2
  13879. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13880. @code{[1, 7]}.
  13881. @item bar_t
  13882. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13883. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13884. @item timeclamp, tc
  13885. Specify the transform timeclamp. At low frequency, there is trade-off between
  13886. accuracy in time domain and frequency domain. If timeclamp is lower,
  13887. event in time domain is represented more accurately (such as fast bass drum),
  13888. otherwise event in frequency domain is represented more accurately
  13889. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13890. @item attack
  13891. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13892. limits future samples by applying asymmetric windowing in time domain, useful
  13893. when low latency is required. Accepted range is @code{[0, 1]}.
  13894. @item basefreq
  13895. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13896. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13897. @item endfreq
  13898. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13899. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13900. @item coeffclamp
  13901. This option is deprecated and ignored.
  13902. @item tlength
  13903. Specify the transform length in time domain. Use this option to control accuracy
  13904. trade-off between time domain and frequency domain at every frequency sample.
  13905. It can contain variables:
  13906. @table @option
  13907. @item frequency, freq, f
  13908. the frequency where it is evaluated
  13909. @item timeclamp, tc
  13910. the value of @var{timeclamp} option.
  13911. @end table
  13912. Default value is @code{384*tc/(384+tc*f)}.
  13913. @item count
  13914. Specify the transform count for every video frame. Default value is @code{6}.
  13915. Acceptable range is @code{[1, 30]}.
  13916. @item fcount
  13917. Specify the transform count for every single pixel. Default value is @code{0},
  13918. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13919. @item fontfile
  13920. Specify font file for use with freetype to draw the axis. If not specified,
  13921. use embedded font. Note that drawing with font file or embedded font is not
  13922. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13923. option instead.
  13924. @item font
  13925. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13926. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13927. @item fontcolor
  13928. Specify font color expression. This is arithmetic expression that should return
  13929. integer value 0xRRGGBB. It can contain variables:
  13930. @table @option
  13931. @item frequency, freq, f
  13932. the frequency where it is evaluated
  13933. @item timeclamp, tc
  13934. the value of @var{timeclamp} option
  13935. @end table
  13936. and functions:
  13937. @table @option
  13938. @item midi(f)
  13939. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13940. @item r(x), g(x), b(x)
  13941. red, green, and blue value of intensity x.
  13942. @end table
  13943. Default value is @code{st(0, (midi(f)-59.5)/12);
  13944. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13945. r(1-ld(1)) + b(ld(1))}.
  13946. @item axisfile
  13947. Specify image file to draw the axis. This option override @var{fontfile} and
  13948. @var{fontcolor} option.
  13949. @item axis, text
  13950. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13951. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13952. Default value is @code{1}.
  13953. @item csp
  13954. Set colorspace. The accepted values are:
  13955. @table @samp
  13956. @item unspecified
  13957. Unspecified (default)
  13958. @item bt709
  13959. BT.709
  13960. @item fcc
  13961. FCC
  13962. @item bt470bg
  13963. BT.470BG or BT.601-6 625
  13964. @item smpte170m
  13965. SMPTE-170M or BT.601-6 525
  13966. @item smpte240m
  13967. SMPTE-240M
  13968. @item bt2020ncl
  13969. BT.2020 with non-constant luminance
  13970. @end table
  13971. @item cscheme
  13972. Set spectrogram color scheme. This is list of floating point values with format
  13973. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13974. The default is @code{1|0.5|0|0|0.5|1}.
  13975. @end table
  13976. @subsection Examples
  13977. @itemize
  13978. @item
  13979. Playing audio while showing the spectrum:
  13980. @example
  13981. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13982. @end example
  13983. @item
  13984. Same as above, but with frame rate 30 fps:
  13985. @example
  13986. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13987. @end example
  13988. @item
  13989. Playing at 1280x720:
  13990. @example
  13991. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13992. @end example
  13993. @item
  13994. Disable sonogram display:
  13995. @example
  13996. sono_h=0
  13997. @end example
  13998. @item
  13999. A1 and its harmonics: A1, A2, (near)E3, A3:
  14000. @example
  14001. 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),
  14002. asplit[a][out1]; [a] showcqt [out0]'
  14003. @end example
  14004. @item
  14005. Same as above, but with more accuracy in frequency domain:
  14006. @example
  14007. 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),
  14008. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14009. @end example
  14010. @item
  14011. Custom volume:
  14012. @example
  14013. bar_v=10:sono_v=bar_v*a_weighting(f)
  14014. @end example
  14015. @item
  14016. Custom gamma, now spectrum is linear to the amplitude.
  14017. @example
  14018. bar_g=2:sono_g=2
  14019. @end example
  14020. @item
  14021. Custom tlength equation:
  14022. @example
  14023. 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)))'
  14024. @end example
  14025. @item
  14026. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14027. @example
  14028. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14029. @end example
  14030. @item
  14031. Custom font using fontconfig:
  14032. @example
  14033. font='Courier New,Monospace,mono|bold'
  14034. @end example
  14035. @item
  14036. Custom frequency range with custom axis using image file:
  14037. @example
  14038. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14039. @end example
  14040. @end itemize
  14041. @section showfreqs
  14042. Convert input audio to video output representing the audio power spectrum.
  14043. Audio amplitude is on Y-axis while frequency is on X-axis.
  14044. The filter accepts the following options:
  14045. @table @option
  14046. @item size, s
  14047. Specify size of video. For the syntax of this option, check the
  14048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14049. Default is @code{1024x512}.
  14050. @item mode
  14051. Set display mode.
  14052. This set how each frequency bin will be represented.
  14053. It accepts the following values:
  14054. @table @samp
  14055. @item line
  14056. @item bar
  14057. @item dot
  14058. @end table
  14059. Default is @code{bar}.
  14060. @item ascale
  14061. Set amplitude scale.
  14062. It accepts the following values:
  14063. @table @samp
  14064. @item lin
  14065. Linear scale.
  14066. @item sqrt
  14067. Square root scale.
  14068. @item cbrt
  14069. Cubic root scale.
  14070. @item log
  14071. Logarithmic scale.
  14072. @end table
  14073. Default is @code{log}.
  14074. @item fscale
  14075. Set frequency scale.
  14076. It accepts the following values:
  14077. @table @samp
  14078. @item lin
  14079. Linear scale.
  14080. @item log
  14081. Logarithmic scale.
  14082. @item rlog
  14083. Reverse logarithmic scale.
  14084. @end table
  14085. Default is @code{lin}.
  14086. @item win_size
  14087. Set window size.
  14088. It accepts the following values:
  14089. @table @samp
  14090. @item w16
  14091. @item w32
  14092. @item w64
  14093. @item w128
  14094. @item w256
  14095. @item w512
  14096. @item w1024
  14097. @item w2048
  14098. @item w4096
  14099. @item w8192
  14100. @item w16384
  14101. @item w32768
  14102. @item w65536
  14103. @end table
  14104. Default is @code{w2048}
  14105. @item win_func
  14106. Set windowing function.
  14107. It accepts the following values:
  14108. @table @samp
  14109. @item rect
  14110. @item bartlett
  14111. @item hanning
  14112. @item hamming
  14113. @item blackman
  14114. @item welch
  14115. @item flattop
  14116. @item bharris
  14117. @item bnuttall
  14118. @item bhann
  14119. @item sine
  14120. @item nuttall
  14121. @item lanczos
  14122. @item gauss
  14123. @item tukey
  14124. @item dolph
  14125. @item cauchy
  14126. @item parzen
  14127. @item poisson
  14128. @end table
  14129. Default is @code{hanning}.
  14130. @item overlap
  14131. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14132. which means optimal overlap for selected window function will be picked.
  14133. @item averaging
  14134. Set time averaging. Setting this to 0 will display current maximal peaks.
  14135. Default is @code{1}, which means time averaging is disabled.
  14136. @item colors
  14137. Specify list of colors separated by space or by '|' which will be used to
  14138. draw channel frequencies. Unrecognized or missing colors will be replaced
  14139. by white color.
  14140. @item cmode
  14141. Set channel display mode.
  14142. It accepts the following values:
  14143. @table @samp
  14144. @item combined
  14145. @item separate
  14146. @end table
  14147. Default is @code{combined}.
  14148. @item minamp
  14149. Set minimum amplitude used in @code{log} amplitude scaler.
  14150. @end table
  14151. @anchor{showspectrum}
  14152. @section showspectrum
  14153. Convert input audio to a video output, representing the audio frequency
  14154. spectrum.
  14155. The filter accepts the following options:
  14156. @table @option
  14157. @item size, s
  14158. Specify the video size for the output. For the syntax of this option, check the
  14159. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14160. Default value is @code{640x512}.
  14161. @item slide
  14162. Specify how the spectrum should slide along the window.
  14163. It accepts the following values:
  14164. @table @samp
  14165. @item replace
  14166. the samples start again on the left when they reach the right
  14167. @item scroll
  14168. the samples scroll from right to left
  14169. @item fullframe
  14170. frames are only produced when the samples reach the right
  14171. @item rscroll
  14172. the samples scroll from left to right
  14173. @end table
  14174. Default value is @code{replace}.
  14175. @item mode
  14176. Specify display mode.
  14177. It accepts the following values:
  14178. @table @samp
  14179. @item combined
  14180. all channels are displayed in the same row
  14181. @item separate
  14182. all channels are displayed in separate rows
  14183. @end table
  14184. Default value is @samp{combined}.
  14185. @item color
  14186. Specify display color mode.
  14187. It accepts the following values:
  14188. @table @samp
  14189. @item channel
  14190. each channel is displayed in a separate color
  14191. @item intensity
  14192. each channel is displayed using the same color scheme
  14193. @item rainbow
  14194. each channel is displayed using the rainbow color scheme
  14195. @item moreland
  14196. each channel is displayed using the moreland color scheme
  14197. @item nebulae
  14198. each channel is displayed using the nebulae color scheme
  14199. @item fire
  14200. each channel is displayed using the fire color scheme
  14201. @item fiery
  14202. each channel is displayed using the fiery color scheme
  14203. @item fruit
  14204. each channel is displayed using the fruit color scheme
  14205. @item cool
  14206. each channel is displayed using the cool color scheme
  14207. @end table
  14208. Default value is @samp{channel}.
  14209. @item scale
  14210. Specify scale used for calculating intensity color values.
  14211. It accepts the following values:
  14212. @table @samp
  14213. @item lin
  14214. linear
  14215. @item sqrt
  14216. square root, default
  14217. @item cbrt
  14218. cubic root
  14219. @item log
  14220. logarithmic
  14221. @item 4thrt
  14222. 4th root
  14223. @item 5thrt
  14224. 5th root
  14225. @end table
  14226. Default value is @samp{sqrt}.
  14227. @item saturation
  14228. Set saturation modifier for displayed colors. Negative values provide
  14229. alternative color scheme. @code{0} is no saturation at all.
  14230. Saturation must be in [-10.0, 10.0] range.
  14231. Default value is @code{1}.
  14232. @item win_func
  14233. Set window function.
  14234. It accepts the following values:
  14235. @table @samp
  14236. @item rect
  14237. @item bartlett
  14238. @item hann
  14239. @item hanning
  14240. @item hamming
  14241. @item blackman
  14242. @item welch
  14243. @item flattop
  14244. @item bharris
  14245. @item bnuttall
  14246. @item bhann
  14247. @item sine
  14248. @item nuttall
  14249. @item lanczos
  14250. @item gauss
  14251. @item tukey
  14252. @item dolph
  14253. @item cauchy
  14254. @item parzen
  14255. @item poisson
  14256. @end table
  14257. Default value is @code{hann}.
  14258. @item orientation
  14259. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14260. @code{horizontal}. Default is @code{vertical}.
  14261. @item overlap
  14262. Set ratio of overlap window. Default value is @code{0}.
  14263. When value is @code{1} overlap is set to recommended size for specific
  14264. window function currently used.
  14265. @item gain
  14266. Set scale gain for calculating intensity color values.
  14267. Default value is @code{1}.
  14268. @item data
  14269. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14270. @item rotation
  14271. Set color rotation, must be in [-1.0, 1.0] range.
  14272. Default value is @code{0}.
  14273. @end table
  14274. The usage is very similar to the showwaves filter; see the examples in that
  14275. section.
  14276. @subsection Examples
  14277. @itemize
  14278. @item
  14279. Large window with logarithmic color scaling:
  14280. @example
  14281. showspectrum=s=1280x480:scale=log
  14282. @end example
  14283. @item
  14284. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14285. @example
  14286. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14287. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14288. @end example
  14289. @end itemize
  14290. @section showspectrumpic
  14291. Convert input audio to a single video frame, representing the audio frequency
  14292. spectrum.
  14293. The filter accepts the following options:
  14294. @table @option
  14295. @item size, s
  14296. Specify the video size for the output. For the syntax of this option, check the
  14297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14298. Default value is @code{4096x2048}.
  14299. @item mode
  14300. Specify display mode.
  14301. It accepts the following values:
  14302. @table @samp
  14303. @item combined
  14304. all channels are displayed in the same row
  14305. @item separate
  14306. all channels are displayed in separate rows
  14307. @end table
  14308. Default value is @samp{combined}.
  14309. @item color
  14310. Specify display color mode.
  14311. It accepts the following values:
  14312. @table @samp
  14313. @item channel
  14314. each channel is displayed in a separate color
  14315. @item intensity
  14316. each channel is displayed using the same color scheme
  14317. @item rainbow
  14318. each channel is displayed using the rainbow color scheme
  14319. @item moreland
  14320. each channel is displayed using the moreland color scheme
  14321. @item nebulae
  14322. each channel is displayed using the nebulae color scheme
  14323. @item fire
  14324. each channel is displayed using the fire color scheme
  14325. @item fiery
  14326. each channel is displayed using the fiery color scheme
  14327. @item fruit
  14328. each channel is displayed using the fruit color scheme
  14329. @item cool
  14330. each channel is displayed using the cool color scheme
  14331. @end table
  14332. Default value is @samp{intensity}.
  14333. @item scale
  14334. Specify scale used for calculating intensity color values.
  14335. It accepts the following values:
  14336. @table @samp
  14337. @item lin
  14338. linear
  14339. @item sqrt
  14340. square root, default
  14341. @item cbrt
  14342. cubic root
  14343. @item log
  14344. logarithmic
  14345. @item 4thrt
  14346. 4th root
  14347. @item 5thrt
  14348. 5th root
  14349. @end table
  14350. Default value is @samp{log}.
  14351. @item saturation
  14352. Set saturation modifier for displayed colors. Negative values provide
  14353. alternative color scheme. @code{0} is no saturation at all.
  14354. Saturation must be in [-10.0, 10.0] range.
  14355. Default value is @code{1}.
  14356. @item win_func
  14357. Set window function.
  14358. It accepts the following values:
  14359. @table @samp
  14360. @item rect
  14361. @item bartlett
  14362. @item hann
  14363. @item hanning
  14364. @item hamming
  14365. @item blackman
  14366. @item welch
  14367. @item flattop
  14368. @item bharris
  14369. @item bnuttall
  14370. @item bhann
  14371. @item sine
  14372. @item nuttall
  14373. @item lanczos
  14374. @item gauss
  14375. @item tukey
  14376. @item dolph
  14377. @item cauchy
  14378. @item parzen
  14379. @item poisson
  14380. @end table
  14381. Default value is @code{hann}.
  14382. @item orientation
  14383. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14384. @code{horizontal}. Default is @code{vertical}.
  14385. @item gain
  14386. Set scale gain for calculating intensity color values.
  14387. Default value is @code{1}.
  14388. @item legend
  14389. Draw time and frequency axes and legends. Default is enabled.
  14390. @item rotation
  14391. Set color rotation, must be in [-1.0, 1.0] range.
  14392. Default value is @code{0}.
  14393. @end table
  14394. @subsection Examples
  14395. @itemize
  14396. @item
  14397. Extract an audio spectrogram of a whole audio track
  14398. in a 1024x1024 picture using @command{ffmpeg}:
  14399. @example
  14400. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14401. @end example
  14402. @end itemize
  14403. @section showvolume
  14404. Convert input audio volume to a video output.
  14405. The filter accepts the following options:
  14406. @table @option
  14407. @item rate, r
  14408. Set video rate.
  14409. @item b
  14410. Set border width, allowed range is [0, 5]. Default is 1.
  14411. @item w
  14412. Set channel width, allowed range is [80, 8192]. Default is 400.
  14413. @item h
  14414. Set channel height, allowed range is [1, 900]. Default is 20.
  14415. @item f
  14416. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14417. @item c
  14418. Set volume color expression.
  14419. The expression can use the following variables:
  14420. @table @option
  14421. @item VOLUME
  14422. Current max volume of channel in dB.
  14423. @item PEAK
  14424. Current peak.
  14425. @item CHANNEL
  14426. Current channel number, starting from 0.
  14427. @end table
  14428. @item t
  14429. If set, displays channel names. Default is enabled.
  14430. @item v
  14431. If set, displays volume values. Default is enabled.
  14432. @item o
  14433. Set orientation, can be @code{horizontal} or @code{vertical},
  14434. default is @code{horizontal}.
  14435. @item s
  14436. Set step size, allowed range s [0, 5]. Default is 0, which means
  14437. step is disabled.
  14438. @end table
  14439. @section showwaves
  14440. Convert input audio to a video output, representing the samples waves.
  14441. The filter accepts the following options:
  14442. @table @option
  14443. @item size, s
  14444. Specify the video size for the output. For the syntax of this option, check the
  14445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14446. Default value is @code{600x240}.
  14447. @item mode
  14448. Set display mode.
  14449. Available values are:
  14450. @table @samp
  14451. @item point
  14452. Draw a point for each sample.
  14453. @item line
  14454. Draw a vertical line for each sample.
  14455. @item p2p
  14456. Draw a point for each sample and a line between them.
  14457. @item cline
  14458. Draw a centered vertical line for each sample.
  14459. @end table
  14460. Default value is @code{point}.
  14461. @item n
  14462. Set the number of samples which are printed on the same column. A
  14463. larger value will decrease the frame rate. Must be a positive
  14464. integer. This option can be set only if the value for @var{rate}
  14465. is not explicitly specified.
  14466. @item rate, r
  14467. Set the (approximate) output frame rate. This is done by setting the
  14468. option @var{n}. Default value is "25".
  14469. @item split_channels
  14470. Set if channels should be drawn separately or overlap. Default value is 0.
  14471. @item colors
  14472. Set colors separated by '|' which are going to be used for drawing of each channel.
  14473. @item scale
  14474. Set amplitude scale.
  14475. Available values are:
  14476. @table @samp
  14477. @item lin
  14478. Linear.
  14479. @item log
  14480. Logarithmic.
  14481. @item sqrt
  14482. Square root.
  14483. @item cbrt
  14484. Cubic root.
  14485. @end table
  14486. Default is linear.
  14487. @end table
  14488. @subsection Examples
  14489. @itemize
  14490. @item
  14491. Output the input file audio and the corresponding video representation
  14492. at the same time:
  14493. @example
  14494. amovie=a.mp3,asplit[out0],showwaves[out1]
  14495. @end example
  14496. @item
  14497. Create a synthetic signal and show it with showwaves, forcing a
  14498. frame rate of 30 frames per second:
  14499. @example
  14500. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14501. @end example
  14502. @end itemize
  14503. @section showwavespic
  14504. Convert input audio to a single video frame, representing the samples waves.
  14505. The filter accepts the following options:
  14506. @table @option
  14507. @item size, s
  14508. Specify the video size for the output. For the syntax of this option, check the
  14509. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14510. Default value is @code{600x240}.
  14511. @item split_channels
  14512. Set if channels should be drawn separately or overlap. Default value is 0.
  14513. @item colors
  14514. Set colors separated by '|' which are going to be used for drawing of each channel.
  14515. @item scale
  14516. Set amplitude scale.
  14517. Available values are:
  14518. @table @samp
  14519. @item lin
  14520. Linear.
  14521. @item log
  14522. Logarithmic.
  14523. @item sqrt
  14524. Square root.
  14525. @item cbrt
  14526. Cubic root.
  14527. @end table
  14528. Default is linear.
  14529. @end table
  14530. @subsection Examples
  14531. @itemize
  14532. @item
  14533. Extract a channel split representation of the wave form of a whole audio track
  14534. in a 1024x800 picture using @command{ffmpeg}:
  14535. @example
  14536. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14537. @end example
  14538. @end itemize
  14539. @section sidedata, asidedata
  14540. Delete frame side data, or select frames based on it.
  14541. This filter accepts the following options:
  14542. @table @option
  14543. @item mode
  14544. Set mode of operation of the filter.
  14545. Can be one of the following:
  14546. @table @samp
  14547. @item select
  14548. Select every frame with side data of @code{type}.
  14549. @item delete
  14550. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14551. data in the frame.
  14552. @end table
  14553. @item type
  14554. Set side data type used with all modes. Must be set for @code{select} mode. For
  14555. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14556. in @file{libavutil/frame.h}. For example, to choose
  14557. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14558. @end table
  14559. @section spectrumsynth
  14560. Sythesize audio from 2 input video spectrums, first input stream represents
  14561. magnitude across time and second represents phase across time.
  14562. The filter will transform from frequency domain as displayed in videos back
  14563. to time domain as presented in audio output.
  14564. This filter is primarily created for reversing processed @ref{showspectrum}
  14565. filter outputs, but can synthesize sound from other spectrograms too.
  14566. But in such case results are going to be poor if the phase data is not
  14567. available, because in such cases phase data need to be recreated, usually
  14568. its just recreated from random noise.
  14569. For best results use gray only output (@code{channel} color mode in
  14570. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14571. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14572. @code{data} option. Inputs videos should generally use @code{fullframe}
  14573. slide mode as that saves resources needed for decoding video.
  14574. The filter accepts the following options:
  14575. @table @option
  14576. @item sample_rate
  14577. Specify sample rate of output audio, the sample rate of audio from which
  14578. spectrum was generated may differ.
  14579. @item channels
  14580. Set number of channels represented in input video spectrums.
  14581. @item scale
  14582. Set scale which was used when generating magnitude input spectrum.
  14583. Can be @code{lin} or @code{log}. Default is @code{log}.
  14584. @item slide
  14585. Set slide which was used when generating inputs spectrums.
  14586. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14587. Default is @code{fullframe}.
  14588. @item win_func
  14589. Set window function used for resynthesis.
  14590. @item overlap
  14591. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14592. which means optimal overlap for selected window function will be picked.
  14593. @item orientation
  14594. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14595. Default is @code{vertical}.
  14596. @end table
  14597. @subsection Examples
  14598. @itemize
  14599. @item
  14600. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14601. then resynthesize videos back to audio with spectrumsynth:
  14602. @example
  14603. 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
  14604. 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
  14605. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14606. @end example
  14607. @end itemize
  14608. @section split, asplit
  14609. Split input into several identical outputs.
  14610. @code{asplit} works with audio input, @code{split} with video.
  14611. The filter accepts a single parameter which specifies the number of outputs. If
  14612. unspecified, it defaults to 2.
  14613. @subsection Examples
  14614. @itemize
  14615. @item
  14616. Create two separate outputs from the same input:
  14617. @example
  14618. [in] split [out0][out1]
  14619. @end example
  14620. @item
  14621. To create 3 or more outputs, you need to specify the number of
  14622. outputs, like in:
  14623. @example
  14624. [in] asplit=3 [out0][out1][out2]
  14625. @end example
  14626. @item
  14627. Create two separate outputs from the same input, one cropped and
  14628. one padded:
  14629. @example
  14630. [in] split [splitout1][splitout2];
  14631. [splitout1] crop=100:100:0:0 [cropout];
  14632. [splitout2] pad=200:200:100:100 [padout];
  14633. @end example
  14634. @item
  14635. Create 5 copies of the input audio with @command{ffmpeg}:
  14636. @example
  14637. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14638. @end example
  14639. @end itemize
  14640. @section zmq, azmq
  14641. Receive commands sent through a libzmq client, and forward them to
  14642. filters in the filtergraph.
  14643. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14644. must be inserted between two video filters, @code{azmq} between two
  14645. audio filters.
  14646. To enable these filters you need to install the libzmq library and
  14647. headers and configure FFmpeg with @code{--enable-libzmq}.
  14648. For more information about libzmq see:
  14649. @url{http://www.zeromq.org/}
  14650. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14651. receives messages sent through a network interface defined by the
  14652. @option{bind_address} option.
  14653. The received message must be in the form:
  14654. @example
  14655. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14656. @end example
  14657. @var{TARGET} specifies the target of the command, usually the name of
  14658. the filter class or a specific filter instance name.
  14659. @var{COMMAND} specifies the name of the command for the target filter.
  14660. @var{ARG} is optional and specifies the optional argument list for the
  14661. given @var{COMMAND}.
  14662. Upon reception, the message is processed and the corresponding command
  14663. is injected into the filtergraph. Depending on the result, the filter
  14664. will send a reply to the client, adopting the format:
  14665. @example
  14666. @var{ERROR_CODE} @var{ERROR_REASON}
  14667. @var{MESSAGE}
  14668. @end example
  14669. @var{MESSAGE} is optional.
  14670. @subsection Examples
  14671. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14672. be used to send commands processed by these filters.
  14673. Consider the following filtergraph generated by @command{ffplay}
  14674. @example
  14675. ffplay -dumpgraph 1 -f lavfi "
  14676. color=s=100x100:c=red [l];
  14677. color=s=100x100:c=blue [r];
  14678. nullsrc=s=200x100, zmq [bg];
  14679. [bg][l] overlay [bg+l];
  14680. [bg+l][r] overlay=x=100 "
  14681. @end example
  14682. To change the color of the left side of the video, the following
  14683. command can be used:
  14684. @example
  14685. echo Parsed_color_0 c yellow | tools/zmqsend
  14686. @end example
  14687. To change the right side:
  14688. @example
  14689. echo Parsed_color_1 c pink | tools/zmqsend
  14690. @end example
  14691. @c man end MULTIMEDIA FILTERS
  14692. @chapter Multimedia Sources
  14693. @c man begin MULTIMEDIA SOURCES
  14694. Below is a description of the currently available multimedia sources.
  14695. @section amovie
  14696. This is the same as @ref{movie} source, except it selects an audio
  14697. stream by default.
  14698. @anchor{movie}
  14699. @section movie
  14700. Read audio and/or video stream(s) from a movie container.
  14701. It accepts the following parameters:
  14702. @table @option
  14703. @item filename
  14704. The name of the resource to read (not necessarily a file; it can also be a
  14705. device or a stream accessed through some protocol).
  14706. @item format_name, f
  14707. Specifies the format assumed for the movie to read, and can be either
  14708. the name of a container or an input device. If not specified, the
  14709. format is guessed from @var{movie_name} or by probing.
  14710. @item seek_point, sp
  14711. Specifies the seek point in seconds. The frames will be output
  14712. starting from this seek point. The parameter is evaluated with
  14713. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14714. postfix. The default value is "0".
  14715. @item streams, s
  14716. Specifies the streams to read. Several streams can be specified,
  14717. separated by "+". The source will then have as many outputs, in the
  14718. same order. The syntax is explained in the ``Stream specifiers''
  14719. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14720. respectively the default (best suited) video and audio stream. Default
  14721. is "dv", or "da" if the filter is called as "amovie".
  14722. @item stream_index, si
  14723. Specifies the index of the video stream to read. If the value is -1,
  14724. the most suitable video stream will be automatically selected. The default
  14725. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14726. audio instead of video.
  14727. @item loop
  14728. Specifies how many times to read the stream in sequence.
  14729. If the value is 0, the stream will be looped infinitely.
  14730. Default value is "1".
  14731. Note that when the movie is looped the source timestamps are not
  14732. changed, so it will generate non monotonically increasing timestamps.
  14733. @item discontinuity
  14734. Specifies the time difference between frames above which the point is
  14735. considered a timestamp discontinuity which is removed by adjusting the later
  14736. timestamps.
  14737. @end table
  14738. It allows overlaying a second video on top of the main input of
  14739. a filtergraph, as shown in this graph:
  14740. @example
  14741. input -----------> deltapts0 --> overlay --> output
  14742. ^
  14743. |
  14744. movie --> scale--> deltapts1 -------+
  14745. @end example
  14746. @subsection Examples
  14747. @itemize
  14748. @item
  14749. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14750. on top of the input labelled "in":
  14751. @example
  14752. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14753. [in] setpts=PTS-STARTPTS [main];
  14754. [main][over] overlay=16:16 [out]
  14755. @end example
  14756. @item
  14757. Read from a video4linux2 device, and overlay it on top of the input
  14758. labelled "in":
  14759. @example
  14760. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14761. [in] setpts=PTS-STARTPTS [main];
  14762. [main][over] overlay=16:16 [out]
  14763. @end example
  14764. @item
  14765. Read the first video stream and the audio stream with id 0x81 from
  14766. dvd.vob; the video is connected to the pad named "video" and the audio is
  14767. connected to the pad named "audio":
  14768. @example
  14769. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14770. @end example
  14771. @end itemize
  14772. @subsection Commands
  14773. Both movie and amovie support the following commands:
  14774. @table @option
  14775. @item seek
  14776. Perform seek using "av_seek_frame".
  14777. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14778. @itemize
  14779. @item
  14780. @var{stream_index}: If stream_index is -1, a default
  14781. stream is selected, and @var{timestamp} is automatically converted
  14782. from AV_TIME_BASE units to the stream specific time_base.
  14783. @item
  14784. @var{timestamp}: Timestamp in AVStream.time_base units
  14785. or, if no stream is specified, in AV_TIME_BASE units.
  14786. @item
  14787. @var{flags}: Flags which select direction and seeking mode.
  14788. @end itemize
  14789. @item get_duration
  14790. Get movie duration in AV_TIME_BASE units.
  14791. @end table
  14792. @c man end MULTIMEDIA SOURCES