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.

19339 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. At least one delay greater than 0 should be provided.
  433. Unused delays will be silently ignored. If number of given delays is
  434. smaller than number of channels all remaining channels will not be delayed.
  435. If you want to delay exact number of samples, append 'S' to number.
  436. @end table
  437. @subsection Examples
  438. @itemize
  439. @item
  440. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  441. the second channel (and any other channels that may be present) unchanged.
  442. @example
  443. adelay=1500|0|500
  444. @end example
  445. @item
  446. Delay second channel by 500 samples, the third channel by 700 samples and leave
  447. the first channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=0|500S|700S
  450. @end example
  451. @end itemize
  452. @section aecho
  453. Apply echoing to the input audio.
  454. Echoes are reflected sound and can occur naturally amongst mountains
  455. (and sometimes large buildings) when talking or shouting; digital echo
  456. effects emulate this behaviour and are often used to help fill out the
  457. sound of a single instrument or vocal. The time difference between the
  458. original signal and the reflection is the @code{delay}, and the
  459. loudness of the reflected signal is the @code{decay}.
  460. Multiple echoes can have different delays and decays.
  461. A description of the accepted parameters follows.
  462. @table @option
  463. @item in_gain
  464. Set input gain of reflected signal. Default is @code{0.6}.
  465. @item out_gain
  466. Set output gain of reflected signal. Default is @code{0.3}.
  467. @item delays
  468. Set list of time intervals in milliseconds between original signal and reflections
  469. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  470. Default is @code{1000}.
  471. @item decays
  472. Set list of loudnesses of reflected signals separated by '|'.
  473. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  474. Default is @code{0.5}.
  475. @end table
  476. @subsection Examples
  477. @itemize
  478. @item
  479. Make it sound as if there are twice as many instruments as are actually playing:
  480. @example
  481. aecho=0.8:0.88:60:0.4
  482. @end example
  483. @item
  484. If delay is very short, then it sound like a (metallic) robot playing music:
  485. @example
  486. aecho=0.8:0.88:6:0.4
  487. @end example
  488. @item
  489. A longer delay will sound like an open air concert in the mountains:
  490. @example
  491. aecho=0.8:0.9:1000:0.3
  492. @end example
  493. @item
  494. Same as above but with one more mountain:
  495. @example
  496. aecho=0.8:0.9:1000|1800:0.3|0.25
  497. @end example
  498. @end itemize
  499. @section aemphasis
  500. Audio emphasis filter creates or restores material directly taken from LPs or
  501. emphased CDs with different filter curves. E.g. to store music on vinyl the
  502. signal has to be altered by a filter first to even out the disadvantages of
  503. this recording medium.
  504. Once the material is played back the inverse filter has to be applied to
  505. restore the distortion of the frequency response.
  506. The filter accepts the following options:
  507. @table @option
  508. @item level_in
  509. Set input gain.
  510. @item level_out
  511. Set output gain.
  512. @item mode
  513. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  514. use @code{production} mode. Default is @code{reproduction} mode.
  515. @item type
  516. Set filter type. Selects medium. Can be one of the following:
  517. @table @option
  518. @item col
  519. select Columbia.
  520. @item emi
  521. select EMI.
  522. @item bsi
  523. select BSI (78RPM).
  524. @item riaa
  525. select RIAA.
  526. @item cd
  527. select Compact Disc (CD).
  528. @item 50fm
  529. select 50µs (FM).
  530. @item 75fm
  531. select 75µs (FM).
  532. @item 50kf
  533. select 50µs (FM-KF).
  534. @item 75kf
  535. select 75µs (FM-KF).
  536. @end table
  537. @end table
  538. @section aeval
  539. Modify an audio signal according to the specified expressions.
  540. This filter accepts one or more expressions (one for each channel),
  541. which are evaluated and used to modify a corresponding audio signal.
  542. It accepts the following parameters:
  543. @table @option
  544. @item exprs
  545. Set the '|'-separated expressions list for each separate channel. If
  546. the number of input channels is greater than the number of
  547. expressions, the last specified expression is used for the remaining
  548. output channels.
  549. @item channel_layout, c
  550. Set output channel layout. If not specified, the channel layout is
  551. specified by the number of expressions. If set to @samp{same}, it will
  552. use by default the same input channel layout.
  553. @end table
  554. Each expression in @var{exprs} can contain the following constants and functions:
  555. @table @option
  556. @item ch
  557. channel number of the current expression
  558. @item n
  559. number of the evaluated sample, starting from 0
  560. @item s
  561. sample rate
  562. @item t
  563. time of the evaluated sample expressed in seconds
  564. @item nb_in_channels
  565. @item nb_out_channels
  566. input and output number of channels
  567. @item val(CH)
  568. the value of input channel with number @var{CH}
  569. @end table
  570. Note: this filter is slow. For faster processing you should use a
  571. dedicated filter.
  572. @subsection Examples
  573. @itemize
  574. @item
  575. Half volume:
  576. @example
  577. aeval=val(ch)/2:c=same
  578. @end example
  579. @item
  580. Invert phase of the second channel:
  581. @example
  582. aeval=val(0)|-val(1)
  583. @end example
  584. @end itemize
  585. @anchor{afade}
  586. @section afade
  587. Apply fade-in/out effect to input audio.
  588. A description of the accepted parameters follows.
  589. @table @option
  590. @item type, t
  591. Specify the effect type, can be either @code{in} for fade-in, or
  592. @code{out} for a fade-out effect. Default is @code{in}.
  593. @item start_sample, ss
  594. Specify the number of the start sample for starting to apply the fade
  595. effect. Default is 0.
  596. @item nb_samples, ns
  597. Specify the number of samples for which the fade effect has to last. At
  598. the end of the fade-in effect the output audio will have the same
  599. volume as the input audio, at the end of the fade-out transition
  600. the output audio will be silence. Default is 44100.
  601. @item start_time, st
  602. Specify the start time of the fade effect. Default is 0.
  603. The value must be specified as a time duration; see
  604. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  605. for the accepted syntax.
  606. If set this option is used instead of @var{start_sample}.
  607. @item duration, d
  608. Specify the duration of the fade effect. See
  609. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  610. for the accepted syntax.
  611. At the end of the fade-in effect the output audio will have the same
  612. volume as the input audio, at the end of the fade-out transition
  613. the output audio will be silence.
  614. By default the duration is determined by @var{nb_samples}.
  615. If set this option is used instead of @var{nb_samples}.
  616. @item curve
  617. Set curve for fade transition.
  618. It accepts the following values:
  619. @table @option
  620. @item tri
  621. select triangular, linear slope (default)
  622. @item qsin
  623. select quarter of sine wave
  624. @item hsin
  625. select half of sine wave
  626. @item esin
  627. select exponential sine wave
  628. @item log
  629. select logarithmic
  630. @item ipar
  631. select inverted parabola
  632. @item qua
  633. select quadratic
  634. @item cub
  635. select cubic
  636. @item squ
  637. select square root
  638. @item cbr
  639. select cubic root
  640. @item par
  641. select parabola
  642. @item exp
  643. select exponential
  644. @item iqsin
  645. select inverted quarter of sine wave
  646. @item ihsin
  647. select inverted half of sine wave
  648. @item dese
  649. select double-exponential seat
  650. @item desi
  651. select double-exponential sigmoid
  652. @end table
  653. @end table
  654. @subsection Examples
  655. @itemize
  656. @item
  657. Fade in first 15 seconds of audio:
  658. @example
  659. afade=t=in:ss=0:d=15
  660. @end example
  661. @item
  662. Fade out last 25 seconds of a 900 seconds audio:
  663. @example
  664. afade=t=out:st=875:d=25
  665. @end example
  666. @end itemize
  667. @section afftfilt
  668. Apply arbitrary expressions to samples in frequency domain.
  669. @table @option
  670. @item real
  671. Set frequency domain real expression for each separate channel separated
  672. by '|'. Default is "1".
  673. If the number of input channels is greater than the number of
  674. expressions, the last specified expression is used for the remaining
  675. output channels.
  676. @item imag
  677. Set frequency domain imaginary expression for each separate channel
  678. separated by '|'. If not set, @var{real} option is used.
  679. Each expression in @var{real} and @var{imag} can contain the following
  680. constants:
  681. @table @option
  682. @item sr
  683. sample rate
  684. @item b
  685. current frequency bin number
  686. @item nb
  687. number of available bins
  688. @item ch
  689. channel number of the current expression
  690. @item chs
  691. number of channels
  692. @item pts
  693. current frame pts
  694. @end table
  695. @item win_size
  696. Set window size.
  697. It accepts the following values:
  698. @table @samp
  699. @item w16
  700. @item w32
  701. @item w64
  702. @item w128
  703. @item w256
  704. @item w512
  705. @item w1024
  706. @item w2048
  707. @item w4096
  708. @item w8192
  709. @item w16384
  710. @item w32768
  711. @item w65536
  712. @end table
  713. Default is @code{w4096}
  714. @item win_func
  715. Set window function. Default is @code{hann}.
  716. @item overlap
  717. Set window overlap. If set to 1, the recommended overlap for selected
  718. window function will be picked. Default is @code{0.75}.
  719. @end table
  720. @subsection Examples
  721. @itemize
  722. @item
  723. Leave almost only low frequencies in audio:
  724. @example
  725. afftfilt="1-clip((b/nb)*b,0,1)"
  726. @end example
  727. @end itemize
  728. @section afir
  729. Apply an arbitrary Frequency Impulse Response filter.
  730. This filter is designed for applying long FIR filters,
  731. up to 30 seconds long.
  732. It can be used as component for digital crossover filters,
  733. room equalization, cross talk cancellation, wavefield synthesis,
  734. auralization, ambiophonics and ambisonics.
  735. This filter uses second stream as FIR coefficients.
  736. If second stream holds single channel, it will be used
  737. for all input channels in first stream, otherwise
  738. number of channels in second stream must be same as
  739. number of channels in first stream.
  740. It accepts the following parameters:
  741. @table @option
  742. @item dry
  743. Set dry gain. This sets input gain.
  744. @item wet
  745. Set wet gain. This sets final output gain.
  746. @item length
  747. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  748. @item again
  749. Enable applying gain measured from power of IR.
  750. @end table
  751. @subsection Examples
  752. @itemize
  753. @item
  754. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  755. @example
  756. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  757. @end example
  758. @end itemize
  759. @anchor{aformat}
  760. @section aformat
  761. Set output format constraints for the input audio. The framework will
  762. negotiate the most appropriate format to minimize conversions.
  763. It accepts the following parameters:
  764. @table @option
  765. @item sample_fmts
  766. A '|'-separated list of requested sample formats.
  767. @item sample_rates
  768. A '|'-separated list of requested sample rates.
  769. @item channel_layouts
  770. A '|'-separated list of requested channel layouts.
  771. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  772. for the required syntax.
  773. @end table
  774. If a parameter is omitted, all values are allowed.
  775. Force the output to either unsigned 8-bit or signed 16-bit stereo
  776. @example
  777. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  778. @end example
  779. @section agate
  780. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  781. processing reduces disturbing noise between useful signals.
  782. Gating is done by detecting the volume below a chosen level @var{threshold}
  783. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  784. floor is set via @var{range}. Because an exact manipulation of the signal
  785. would cause distortion of the waveform the reduction can be levelled over
  786. time. This is done by setting @var{attack} and @var{release}.
  787. @var{attack} determines how long the signal has to fall below the threshold
  788. before any reduction will occur and @var{release} sets the time the signal
  789. has to rise above the threshold to reduce the reduction again.
  790. Shorter signals than the chosen attack time will be left untouched.
  791. @table @option
  792. @item level_in
  793. Set input level before filtering.
  794. Default is 1. Allowed range is from 0.015625 to 64.
  795. @item range
  796. Set the level of gain reduction when the signal is below the threshold.
  797. Default is 0.06125. Allowed range is from 0 to 1.
  798. @item threshold
  799. If a signal rises above this level the gain reduction is released.
  800. Default is 0.125. Allowed range is from 0 to 1.
  801. @item ratio
  802. Set a ratio by which the signal is reduced.
  803. Default is 2. Allowed range is from 1 to 9000.
  804. @item attack
  805. Amount of milliseconds the signal has to rise above the threshold before gain
  806. reduction stops.
  807. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  808. @item release
  809. Amount of milliseconds the signal has to fall below the threshold before the
  810. reduction is increased again. Default is 250 milliseconds.
  811. Allowed range is from 0.01 to 9000.
  812. @item makeup
  813. Set amount of amplification of signal after processing.
  814. Default is 1. Allowed range is from 1 to 64.
  815. @item knee
  816. Curve the sharp knee around the threshold to enter gain reduction more softly.
  817. Default is 2.828427125. Allowed range is from 1 to 8.
  818. @item detection
  819. Choose if exact signal should be taken for detection or an RMS like one.
  820. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  821. @item link
  822. Choose if the average level between all channels or the louder channel affects
  823. the reduction.
  824. Default is @code{average}. Can be @code{average} or @code{maximum}.
  825. @end table
  826. @section alimiter
  827. The limiter prevents an input signal from rising over a desired threshold.
  828. This limiter uses lookahead technology to prevent your signal from distorting.
  829. It means that there is a small delay after the signal is processed. Keep in mind
  830. that the delay it produces is the attack time you set.
  831. The filter accepts the following options:
  832. @table @option
  833. @item level_in
  834. Set input gain. Default is 1.
  835. @item level_out
  836. Set output gain. Default is 1.
  837. @item limit
  838. Don't let signals above this level pass the limiter. Default is 1.
  839. @item attack
  840. The limiter will reach its attenuation level in this amount of time in
  841. milliseconds. Default is 5 milliseconds.
  842. @item release
  843. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  844. Default is 50 milliseconds.
  845. @item asc
  846. When gain reduction is always needed ASC takes care of releasing to an
  847. average reduction level rather than reaching a reduction of 0 in the release
  848. time.
  849. @item asc_level
  850. Select how much the release time is affected by ASC, 0 means nearly no changes
  851. in release time while 1 produces higher release times.
  852. @item level
  853. Auto level output signal. Default is enabled.
  854. This normalizes audio back to 0dB if enabled.
  855. @end table
  856. Depending on picked setting it is recommended to upsample input 2x or 4x times
  857. with @ref{aresample} before applying this filter.
  858. @section allpass
  859. Apply a two-pole all-pass filter with central frequency (in Hz)
  860. @var{frequency}, and filter-width @var{width}.
  861. An all-pass filter changes the audio's frequency to phase relationship
  862. without changing its frequency to amplitude relationship.
  863. The filter accepts the following options:
  864. @table @option
  865. @item frequency, f
  866. Set frequency in Hz.
  867. @item width_type, t
  868. Set method to specify band-width of filter.
  869. @table @option
  870. @item h
  871. Hz
  872. @item q
  873. Q-Factor
  874. @item o
  875. octave
  876. @item s
  877. slope
  878. @end table
  879. @item width, w
  880. Specify the band-width of a filter in width_type units.
  881. @item channels, c
  882. Specify which channels to filter, by default all available are filtered.
  883. @end table
  884. @section aloop
  885. Loop audio samples.
  886. The filter accepts the following options:
  887. @table @option
  888. @item loop
  889. Set the number of loops.
  890. @item size
  891. Set maximal number of samples.
  892. @item start
  893. Set first sample of loop.
  894. @end table
  895. @anchor{amerge}
  896. @section amerge
  897. Merge two or more audio streams into a single multi-channel stream.
  898. The filter accepts the following options:
  899. @table @option
  900. @item inputs
  901. Set the number of inputs. Default is 2.
  902. @end table
  903. If the channel layouts of the inputs are disjoint, and therefore compatible,
  904. the channel layout of the output will be set accordingly and the channels
  905. will be reordered as necessary. If the channel layouts of the inputs are not
  906. disjoint, the output will have all the channels of the first input then all
  907. the channels of the second input, in that order, and the channel layout of
  908. the output will be the default value corresponding to the total number of
  909. channels.
  910. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  911. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  912. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  913. first input, b1 is the first channel of the second input).
  914. On the other hand, if both input are in stereo, the output channels will be
  915. in the default order: a1, a2, b1, b2, and the channel layout will be
  916. arbitrarily set to 4.0, which may or may not be the expected value.
  917. All inputs must have the same sample rate, and format.
  918. If inputs do not have the same duration, the output will stop with the
  919. shortest.
  920. @subsection Examples
  921. @itemize
  922. @item
  923. Merge two mono files into a stereo stream:
  924. @example
  925. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  926. @end example
  927. @item
  928. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  929. @example
  930. 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
  931. @end example
  932. @end itemize
  933. @section amix
  934. Mixes multiple audio inputs into a single output.
  935. Note that this filter only supports float samples (the @var{amerge}
  936. and @var{pan} audio filters support many formats). If the @var{amix}
  937. input has integer samples then @ref{aresample} will be automatically
  938. inserted to perform the conversion to float samples.
  939. For example
  940. @example
  941. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  942. @end example
  943. will mix 3 input audio streams to a single output with the same duration as the
  944. first input and a dropout transition time of 3 seconds.
  945. It accepts the following parameters:
  946. @table @option
  947. @item inputs
  948. The number of inputs. If unspecified, it defaults to 2.
  949. @item duration
  950. How to determine the end-of-stream.
  951. @table @option
  952. @item longest
  953. The duration of the longest input. (default)
  954. @item shortest
  955. The duration of the shortest input.
  956. @item first
  957. The duration of the first input.
  958. @end table
  959. @item dropout_transition
  960. The transition time, in seconds, for volume renormalization when an input
  961. stream ends. The default value is 2 seconds.
  962. @end table
  963. @section anequalizer
  964. High-order parametric multiband equalizer for each channel.
  965. It accepts the following parameters:
  966. @table @option
  967. @item params
  968. This option string is in format:
  969. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  970. Each equalizer band is separated by '|'.
  971. @table @option
  972. @item chn
  973. Set channel number to which equalization will be applied.
  974. If input doesn't have that channel the entry is ignored.
  975. @item f
  976. Set central frequency for band.
  977. If input doesn't have that frequency the entry is ignored.
  978. @item w
  979. Set band width in hertz.
  980. @item g
  981. Set band gain in dB.
  982. @item t
  983. Set filter type for band, optional, can be:
  984. @table @samp
  985. @item 0
  986. Butterworth, this is default.
  987. @item 1
  988. Chebyshev type 1.
  989. @item 2
  990. Chebyshev type 2.
  991. @end table
  992. @end table
  993. @item curves
  994. With this option activated frequency response of anequalizer is displayed
  995. in video stream.
  996. @item size
  997. Set video stream size. Only useful if curves option is activated.
  998. @item mgain
  999. Set max gain that will be displayed. Only useful if curves option is activated.
  1000. Setting this to a reasonable value makes it possible to display gain which is derived from
  1001. neighbour bands which are too close to each other and thus produce higher gain
  1002. when both are activated.
  1003. @item fscale
  1004. Set frequency scale used to draw frequency response in video output.
  1005. Can be linear or logarithmic. Default is logarithmic.
  1006. @item colors
  1007. Set color for each channel curve which is going to be displayed in video stream.
  1008. This is list of color names separated by space or by '|'.
  1009. Unrecognised or missing colors will be replaced by white color.
  1010. @end table
  1011. @subsection Examples
  1012. @itemize
  1013. @item
  1014. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1015. for first 2 channels using Chebyshev type 1 filter:
  1016. @example
  1017. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1018. @end example
  1019. @end itemize
  1020. @subsection Commands
  1021. This filter supports the following commands:
  1022. @table @option
  1023. @item change
  1024. Alter existing filter parameters.
  1025. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1026. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1027. error is returned.
  1028. @var{freq} set new frequency parameter.
  1029. @var{width} set new width parameter in herz.
  1030. @var{gain} set new gain parameter in dB.
  1031. Full filter invocation with asendcmd may look like this:
  1032. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1033. @end table
  1034. @section anull
  1035. Pass the audio source unchanged to the output.
  1036. @section apad
  1037. Pad the end of an audio stream with silence.
  1038. This can be used together with @command{ffmpeg} @option{-shortest} to
  1039. extend audio streams to the same length as the video stream.
  1040. A description of the accepted options follows.
  1041. @table @option
  1042. @item packet_size
  1043. Set silence packet size. Default value is 4096.
  1044. @item pad_len
  1045. Set the number of samples of silence to add to the end. After the
  1046. value is reached, the stream is terminated. This option is mutually
  1047. exclusive with @option{whole_len}.
  1048. @item whole_len
  1049. Set the minimum total number of samples in the output audio stream. If
  1050. the value is longer than the input audio length, silence is added to
  1051. the end, until the value is reached. This option is mutually exclusive
  1052. with @option{pad_len}.
  1053. @end table
  1054. If neither the @option{pad_len} nor the @option{whole_len} option is
  1055. set, the filter will add silence to the end of the input stream
  1056. indefinitely.
  1057. @subsection Examples
  1058. @itemize
  1059. @item
  1060. Add 1024 samples of silence to the end of the input:
  1061. @example
  1062. apad=pad_len=1024
  1063. @end example
  1064. @item
  1065. Make sure the audio output will contain at least 10000 samples, pad
  1066. the input with silence if required:
  1067. @example
  1068. apad=whole_len=10000
  1069. @end example
  1070. @item
  1071. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1072. video stream will always result the shortest and will be converted
  1073. until the end in the output file when using the @option{shortest}
  1074. option:
  1075. @example
  1076. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1077. @end example
  1078. @end itemize
  1079. @section aphaser
  1080. Add a phasing effect to the input audio.
  1081. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1082. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1083. A description of the accepted parameters follows.
  1084. @table @option
  1085. @item in_gain
  1086. Set input gain. Default is 0.4.
  1087. @item out_gain
  1088. Set output gain. Default is 0.74
  1089. @item delay
  1090. Set delay in milliseconds. Default is 3.0.
  1091. @item decay
  1092. Set decay. Default is 0.4.
  1093. @item speed
  1094. Set modulation speed in Hz. Default is 0.5.
  1095. @item type
  1096. Set modulation type. Default is triangular.
  1097. It accepts the following values:
  1098. @table @samp
  1099. @item triangular, t
  1100. @item sinusoidal, s
  1101. @end table
  1102. @end table
  1103. @section apulsator
  1104. Audio pulsator is something between an autopanner and a tremolo.
  1105. But it can produce funny stereo effects as well. Pulsator changes the volume
  1106. of the left and right channel based on a LFO (low frequency oscillator) with
  1107. different waveforms and shifted phases.
  1108. This filter have the ability to define an offset between left and right
  1109. channel. An offset of 0 means that both LFO shapes match each other.
  1110. The left and right channel are altered equally - a conventional tremolo.
  1111. An offset of 50% means that the shape of the right channel is exactly shifted
  1112. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1113. an autopanner. At 1 both curves match again. Every setting in between moves the
  1114. phase shift gapless between all stages and produces some "bypassing" sounds with
  1115. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1116. the 0.5) the faster the signal passes from the left to the right speaker.
  1117. The filter accepts the following options:
  1118. @table @option
  1119. @item level_in
  1120. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1121. @item level_out
  1122. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1123. @item mode
  1124. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1125. sawup or sawdown. Default is sine.
  1126. @item amount
  1127. Set modulation. Define how much of original signal is affected by the LFO.
  1128. @item offset_l
  1129. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1130. @item offset_r
  1131. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1132. @item width
  1133. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1134. @item timing
  1135. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1136. @item bpm
  1137. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1138. is set to bpm.
  1139. @item ms
  1140. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1141. is set to ms.
  1142. @item hz
  1143. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1144. if timing is set to hz.
  1145. @end table
  1146. @anchor{aresample}
  1147. @section aresample
  1148. Resample the input audio to the specified parameters, using the
  1149. libswresample library. If none are specified then the filter will
  1150. automatically convert between its input and output.
  1151. This filter is also able to stretch/squeeze the audio data to make it match
  1152. the timestamps or to inject silence / cut out audio to make it match the
  1153. timestamps, do a combination of both or do neither.
  1154. The filter accepts the syntax
  1155. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1156. expresses a sample rate and @var{resampler_options} is a list of
  1157. @var{key}=@var{value} pairs, separated by ":". See the
  1158. @ref{Resampler Options,,the "Resampler Options" section in the
  1159. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1160. for the complete list of supported options.
  1161. @subsection Examples
  1162. @itemize
  1163. @item
  1164. Resample the input audio to 44100Hz:
  1165. @example
  1166. aresample=44100
  1167. @end example
  1168. @item
  1169. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1170. samples per second compensation:
  1171. @example
  1172. aresample=async=1000
  1173. @end example
  1174. @end itemize
  1175. @section areverse
  1176. Reverse an audio clip.
  1177. Warning: This filter requires memory to buffer the entire clip, so trimming
  1178. is suggested.
  1179. @subsection Examples
  1180. @itemize
  1181. @item
  1182. Take the first 5 seconds of a clip, and reverse it.
  1183. @example
  1184. atrim=end=5,areverse
  1185. @end example
  1186. @end itemize
  1187. @section asetnsamples
  1188. Set the number of samples per each output audio frame.
  1189. The last output packet may contain a different number of samples, as
  1190. the filter will flush all the remaining samples when the input audio
  1191. signals its end.
  1192. The filter accepts the following options:
  1193. @table @option
  1194. @item nb_out_samples, n
  1195. Set the number of frames per each output audio frame. The number is
  1196. intended as the number of samples @emph{per each channel}.
  1197. Default value is 1024.
  1198. @item pad, p
  1199. If set to 1, the filter will pad the last audio frame with zeroes, so
  1200. that the last frame will contain the same number of samples as the
  1201. previous ones. Default value is 1.
  1202. @end table
  1203. For example, to set the number of per-frame samples to 1234 and
  1204. disable padding for the last frame, use:
  1205. @example
  1206. asetnsamples=n=1234:p=0
  1207. @end example
  1208. @section asetrate
  1209. Set the sample rate without altering the PCM data.
  1210. This will result in a change of speed and pitch.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item sample_rate, r
  1214. Set the output sample rate. Default is 44100 Hz.
  1215. @end table
  1216. @section ashowinfo
  1217. Show a line containing various information for each input audio frame.
  1218. The input audio is not modified.
  1219. The shown line contains a sequence of key/value pairs of the form
  1220. @var{key}:@var{value}.
  1221. The following values are shown in the output:
  1222. @table @option
  1223. @item n
  1224. The (sequential) number of the input frame, starting from 0.
  1225. @item pts
  1226. The presentation timestamp of the input frame, in time base units; the time base
  1227. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1228. @item pts_time
  1229. The presentation timestamp of the input frame in seconds.
  1230. @item pos
  1231. position of the frame in the input stream, -1 if this information in
  1232. unavailable and/or meaningless (for example in case of synthetic audio)
  1233. @item fmt
  1234. The sample format.
  1235. @item chlayout
  1236. The channel layout.
  1237. @item rate
  1238. The sample rate for the audio frame.
  1239. @item nb_samples
  1240. The number of samples (per channel) in the frame.
  1241. @item checksum
  1242. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1243. audio, the data is treated as if all the planes were concatenated.
  1244. @item plane_checksums
  1245. A list of Adler-32 checksums for each data plane.
  1246. @end table
  1247. @anchor{astats}
  1248. @section astats
  1249. Display time domain statistical information about the audio channels.
  1250. Statistics are calculated and displayed for each audio channel and,
  1251. where applicable, an overall figure is also given.
  1252. It accepts the following option:
  1253. @table @option
  1254. @item length
  1255. Short window length in seconds, used for peak and trough RMS measurement.
  1256. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1257. @item metadata
  1258. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1259. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1260. disabled.
  1261. Available keys for each channel are:
  1262. DC_offset
  1263. Min_level
  1264. Max_level
  1265. Min_difference
  1266. Max_difference
  1267. Mean_difference
  1268. RMS_difference
  1269. Peak_level
  1270. RMS_peak
  1271. RMS_trough
  1272. Crest_factor
  1273. Flat_factor
  1274. Peak_count
  1275. Bit_depth
  1276. Dynamic_range
  1277. and for Overall:
  1278. DC_offset
  1279. Min_level
  1280. Max_level
  1281. Min_difference
  1282. Max_difference
  1283. Mean_difference
  1284. RMS_difference
  1285. Peak_level
  1286. RMS_level
  1287. RMS_peak
  1288. RMS_trough
  1289. Flat_factor
  1290. Peak_count
  1291. Bit_depth
  1292. Number_of_samples
  1293. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1294. this @code{lavfi.astats.Overall.Peak_count}.
  1295. For description what each key means read below.
  1296. @item reset
  1297. Set number of frame after which stats are going to be recalculated.
  1298. Default is disabled.
  1299. @end table
  1300. A description of each shown parameter follows:
  1301. @table @option
  1302. @item DC offset
  1303. Mean amplitude displacement from zero.
  1304. @item Min level
  1305. Minimal sample level.
  1306. @item Max level
  1307. Maximal sample level.
  1308. @item Min difference
  1309. Minimal difference between two consecutive samples.
  1310. @item Max difference
  1311. Maximal difference between two consecutive samples.
  1312. @item Mean difference
  1313. Mean difference between two consecutive samples.
  1314. The average of each difference between two consecutive samples.
  1315. @item RMS difference
  1316. Root Mean Square difference between two consecutive samples.
  1317. @item Peak level dB
  1318. @item RMS level dB
  1319. Standard peak and RMS level measured in dBFS.
  1320. @item RMS peak dB
  1321. @item RMS trough dB
  1322. Peak and trough values for RMS level measured over a short window.
  1323. @item Crest factor
  1324. Standard ratio of peak to RMS level (note: not in dB).
  1325. @item Flat factor
  1326. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1327. (i.e. either @var{Min level} or @var{Max level}).
  1328. @item Peak count
  1329. Number of occasions (not the number of samples) that the signal attained either
  1330. @var{Min level} or @var{Max level}.
  1331. @item Bit depth
  1332. Overall bit depth of audio. Number of bits used for each sample.
  1333. @item Dynamic range
  1334. Measured dynamic range of audio in dB.
  1335. @end table
  1336. @section atempo
  1337. Adjust audio tempo.
  1338. The filter accepts exactly one parameter, the audio tempo. If not
  1339. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1340. be in the [0.5, 2.0] range.
  1341. @subsection Examples
  1342. @itemize
  1343. @item
  1344. Slow down audio to 80% tempo:
  1345. @example
  1346. atempo=0.8
  1347. @end example
  1348. @item
  1349. To speed up audio to 125% tempo:
  1350. @example
  1351. atempo=1.25
  1352. @end example
  1353. @end itemize
  1354. @section atrim
  1355. Trim the input so that the output contains one continuous subpart of the input.
  1356. It accepts the following parameters:
  1357. @table @option
  1358. @item start
  1359. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1360. sample with the timestamp @var{start} will be the first sample in the output.
  1361. @item end
  1362. Specify time of the first audio sample that will be dropped, i.e. the
  1363. audio sample immediately preceding the one with the timestamp @var{end} will be
  1364. the last sample in the output.
  1365. @item start_pts
  1366. Same as @var{start}, except this option sets the start timestamp in samples
  1367. instead of seconds.
  1368. @item end_pts
  1369. Same as @var{end}, except this option sets the end timestamp in samples instead
  1370. of seconds.
  1371. @item duration
  1372. The maximum duration of the output in seconds.
  1373. @item start_sample
  1374. The number of the first sample that should be output.
  1375. @item end_sample
  1376. The number of the first sample that should be dropped.
  1377. @end table
  1378. @option{start}, @option{end}, and @option{duration} are expressed as time
  1379. duration specifications; see
  1380. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1381. Note that the first two sets of the start/end options and the @option{duration}
  1382. option look at the frame timestamp, while the _sample options simply count the
  1383. samples that pass through the filter. So start/end_pts and start/end_sample will
  1384. give different results when the timestamps are wrong, inexact or do not start at
  1385. zero. Also note that this filter does not modify the timestamps. If you wish
  1386. to have the output timestamps start at zero, insert the asetpts filter after the
  1387. atrim filter.
  1388. If multiple start or end options are set, this filter tries to be greedy and
  1389. keep all samples that match at least one of the specified constraints. To keep
  1390. only the part that matches all the constraints at once, chain multiple atrim
  1391. filters.
  1392. The defaults are such that all the input is kept. So it is possible to set e.g.
  1393. just the end values to keep everything before the specified time.
  1394. Examples:
  1395. @itemize
  1396. @item
  1397. Drop everything except the second minute of input:
  1398. @example
  1399. ffmpeg -i INPUT -af atrim=60:120
  1400. @end example
  1401. @item
  1402. Keep only the first 1000 samples:
  1403. @example
  1404. ffmpeg -i INPUT -af atrim=end_sample=1000
  1405. @end example
  1406. @end itemize
  1407. @section bandpass
  1408. Apply a two-pole Butterworth band-pass filter with central
  1409. frequency @var{frequency}, and (3dB-point) band-width width.
  1410. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1411. instead of the default: constant 0dB peak gain.
  1412. The filter roll off at 6dB per octave (20dB per decade).
  1413. The filter accepts the following options:
  1414. @table @option
  1415. @item frequency, f
  1416. Set the filter's central frequency. Default is @code{3000}.
  1417. @item csg
  1418. Constant skirt gain if set to 1. Defaults to 0.
  1419. @item width_type, t
  1420. Set method to specify band-width of filter.
  1421. @table @option
  1422. @item h
  1423. Hz
  1424. @item q
  1425. Q-Factor
  1426. @item o
  1427. octave
  1428. @item s
  1429. slope
  1430. @end table
  1431. @item width, w
  1432. Specify the band-width of a filter in width_type units.
  1433. @item channels, c
  1434. Specify which channels to filter, by default all available are filtered.
  1435. @end table
  1436. @section bandreject
  1437. Apply a two-pole Butterworth band-reject filter with central
  1438. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1439. The filter roll off at 6dB per octave (20dB per decade).
  1440. The filter accepts the following options:
  1441. @table @option
  1442. @item frequency, f
  1443. Set the filter's central frequency. Default is @code{3000}.
  1444. @item width_type, t
  1445. Set method to specify band-width of filter.
  1446. @table @option
  1447. @item h
  1448. Hz
  1449. @item q
  1450. Q-Factor
  1451. @item o
  1452. octave
  1453. @item s
  1454. slope
  1455. @end table
  1456. @item width, w
  1457. Specify the band-width of a filter in width_type units.
  1458. @item channels, c
  1459. Specify which channels to filter, by default all available are filtered.
  1460. @end table
  1461. @section bass
  1462. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1463. shelving filter with a response similar to that of a standard
  1464. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1465. The filter accepts the following options:
  1466. @table @option
  1467. @item gain, g
  1468. Give the gain at 0 Hz. Its useful range is about -20
  1469. (for a large cut) to +20 (for a large boost).
  1470. Beware of clipping when using a positive gain.
  1471. @item frequency, f
  1472. Set the filter's central frequency and so can be used
  1473. to extend or reduce the frequency range to be boosted or cut.
  1474. The default value is @code{100} Hz.
  1475. @item width_type, t
  1476. Set method to specify band-width of filter.
  1477. @table @option
  1478. @item h
  1479. Hz
  1480. @item q
  1481. Q-Factor
  1482. @item o
  1483. octave
  1484. @item s
  1485. slope
  1486. @end table
  1487. @item width, w
  1488. Determine how steep is the filter's shelf transition.
  1489. @item channels, c
  1490. Specify which channels to filter, by default all available are filtered.
  1491. @end table
  1492. @section biquad
  1493. Apply a biquad IIR filter with the given coefficients.
  1494. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1495. are the numerator and denominator coefficients respectively.
  1496. and @var{channels}, @var{c} specify which channels to filter, by default all
  1497. available are filtered.
  1498. @section bs2b
  1499. Bauer stereo to binaural transformation, which improves headphone listening of
  1500. stereo audio records.
  1501. To enable compilation of this filter you need to configure FFmpeg with
  1502. @code{--enable-libbs2b}.
  1503. It accepts the following parameters:
  1504. @table @option
  1505. @item profile
  1506. Pre-defined crossfeed level.
  1507. @table @option
  1508. @item default
  1509. Default level (fcut=700, feed=50).
  1510. @item cmoy
  1511. Chu Moy circuit (fcut=700, feed=60).
  1512. @item jmeier
  1513. Jan Meier circuit (fcut=650, feed=95).
  1514. @end table
  1515. @item fcut
  1516. Cut frequency (in Hz).
  1517. @item feed
  1518. Feed level (in Hz).
  1519. @end table
  1520. @section channelmap
  1521. Remap input channels to new locations.
  1522. It accepts the following parameters:
  1523. @table @option
  1524. @item map
  1525. Map channels from input to output. The argument is a '|'-separated list of
  1526. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1527. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1528. channel (e.g. FL for front left) or its index in the input channel layout.
  1529. @var{out_channel} is the name of the output channel or its index in the output
  1530. channel layout. If @var{out_channel} is not given then it is implicitly an
  1531. index, starting with zero and increasing by one for each mapping.
  1532. @item channel_layout
  1533. The channel layout of the output stream.
  1534. @end table
  1535. If no mapping is present, the filter will implicitly map input channels to
  1536. output channels, preserving indices.
  1537. For example, assuming a 5.1+downmix input MOV file,
  1538. @example
  1539. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1540. @end example
  1541. will create an output WAV file tagged as stereo from the downmix channels of
  1542. the input.
  1543. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1544. @example
  1545. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1546. @end example
  1547. @section channelsplit
  1548. Split each channel from an input audio stream into a separate output stream.
  1549. It accepts the following parameters:
  1550. @table @option
  1551. @item channel_layout
  1552. The channel layout of the input stream. The default is "stereo".
  1553. @end table
  1554. For example, assuming a stereo input MP3 file,
  1555. @example
  1556. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1557. @end example
  1558. will create an output Matroska file with two audio streams, one containing only
  1559. the left channel and the other the right channel.
  1560. Split a 5.1 WAV file into per-channel files:
  1561. @example
  1562. ffmpeg -i in.wav -filter_complex
  1563. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1564. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1565. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1566. side_right.wav
  1567. @end example
  1568. @section chorus
  1569. Add a chorus effect to the audio.
  1570. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1571. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1572. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1573. The modulation depth defines the range the modulated delay is played before or after
  1574. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1575. sound tuned around the original one, like in a chorus where some vocals are slightly
  1576. off key.
  1577. It accepts the following parameters:
  1578. @table @option
  1579. @item in_gain
  1580. Set input gain. Default is 0.4.
  1581. @item out_gain
  1582. Set output gain. Default is 0.4.
  1583. @item delays
  1584. Set delays. A typical delay is around 40ms to 60ms.
  1585. @item decays
  1586. Set decays.
  1587. @item speeds
  1588. Set speeds.
  1589. @item depths
  1590. Set depths.
  1591. @end table
  1592. @subsection Examples
  1593. @itemize
  1594. @item
  1595. A single delay:
  1596. @example
  1597. chorus=0.7:0.9:55:0.4:0.25:2
  1598. @end example
  1599. @item
  1600. Two delays:
  1601. @example
  1602. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1603. @end example
  1604. @item
  1605. Fuller sounding chorus with three delays:
  1606. @example
  1607. 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
  1608. @end example
  1609. @end itemize
  1610. @section compand
  1611. Compress or expand the audio's dynamic range.
  1612. It accepts the following parameters:
  1613. @table @option
  1614. @item attacks
  1615. @item decays
  1616. A list of times in seconds for each channel over which the instantaneous level
  1617. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1618. increase of volume and @var{decays} refers to decrease of volume. For most
  1619. situations, the attack time (response to the audio getting louder) should be
  1620. shorter than the decay time, because the human ear is more sensitive to sudden
  1621. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1622. a typical value for decay is 0.8 seconds.
  1623. If specified number of attacks & decays is lower than number of channels, the last
  1624. set attack/decay will be used for all remaining channels.
  1625. @item points
  1626. A list of points for the transfer function, specified in dB relative to the
  1627. maximum possible signal amplitude. Each key points list must be defined using
  1628. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1629. @code{x0/y0 x1/y1 x2/y2 ....}
  1630. The input values must be in strictly increasing order but the transfer function
  1631. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1632. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1633. function are @code{-70/-70|-60/-20|1/0}.
  1634. @item soft-knee
  1635. Set the curve radius in dB for all joints. It defaults to 0.01.
  1636. @item gain
  1637. Set the additional gain in dB to be applied at all points on the transfer
  1638. function. This allows for easy adjustment of the overall gain.
  1639. It defaults to 0.
  1640. @item volume
  1641. Set an initial volume, in dB, to be assumed for each channel when filtering
  1642. starts. This permits the user to supply a nominal level initially, so that, for
  1643. example, a very large gain is not applied to initial signal levels before the
  1644. companding has begun to operate. A typical value for audio which is initially
  1645. quiet is -90 dB. It defaults to 0.
  1646. @item delay
  1647. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1648. delayed before being fed to the volume adjuster. Specifying a delay
  1649. approximately equal to the attack/decay times allows the filter to effectively
  1650. operate in predictive rather than reactive mode. It defaults to 0.
  1651. @end table
  1652. @subsection Examples
  1653. @itemize
  1654. @item
  1655. Make music with both quiet and loud passages suitable for listening to in a
  1656. noisy environment:
  1657. @example
  1658. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1659. @end example
  1660. Another example for audio with whisper and explosion parts:
  1661. @example
  1662. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1663. @end example
  1664. @item
  1665. A noise gate for when the noise is at a lower level than the signal:
  1666. @example
  1667. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1668. @end example
  1669. @item
  1670. Here is another noise gate, this time for when the noise is at a higher level
  1671. than the signal (making it, in some ways, similar to squelch):
  1672. @example
  1673. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1674. @end example
  1675. @item
  1676. 2:1 compression starting at -6dB:
  1677. @example
  1678. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1679. @end example
  1680. @item
  1681. 2:1 compression starting at -9dB:
  1682. @example
  1683. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1684. @end example
  1685. @item
  1686. 2:1 compression starting at -12dB:
  1687. @example
  1688. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1689. @end example
  1690. @item
  1691. 2:1 compression starting at -18dB:
  1692. @example
  1693. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1694. @end example
  1695. @item
  1696. 3:1 compression starting at -15dB:
  1697. @example
  1698. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1699. @end example
  1700. @item
  1701. Compressor/Gate:
  1702. @example
  1703. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1704. @end example
  1705. @item
  1706. Expander:
  1707. @example
  1708. 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
  1709. @end example
  1710. @item
  1711. Hard limiter at -6dB:
  1712. @example
  1713. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1714. @end example
  1715. @item
  1716. Hard limiter at -12dB:
  1717. @example
  1718. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1719. @end example
  1720. @item
  1721. Hard noise gate at -35 dB:
  1722. @example
  1723. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1724. @end example
  1725. @item
  1726. Soft limiter:
  1727. @example
  1728. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1729. @end example
  1730. @end itemize
  1731. @section compensationdelay
  1732. Compensation Delay Line is a metric based delay to compensate differing
  1733. positions of microphones or speakers.
  1734. For example, you have recorded guitar with two microphones placed in
  1735. different location. Because the front of sound wave has fixed speed in
  1736. normal conditions, the phasing of microphones can vary and depends on
  1737. their location and interposition. The best sound mix can be achieved when
  1738. these microphones are in phase (synchronized). Note that distance of
  1739. ~30 cm between microphones makes one microphone to capture signal in
  1740. antiphase to another microphone. That makes the final mix sounding moody.
  1741. This filter helps to solve phasing problems by adding different delays
  1742. to each microphone track and make them synchronized.
  1743. The best result can be reached when you take one track as base and
  1744. synchronize other tracks one by one with it.
  1745. Remember that synchronization/delay tolerance depends on sample rate, too.
  1746. Higher sample rates will give more tolerance.
  1747. It accepts the following parameters:
  1748. @table @option
  1749. @item mm
  1750. Set millimeters distance. This is compensation distance for fine tuning.
  1751. Default is 0.
  1752. @item cm
  1753. Set cm distance. This is compensation distance for tightening distance setup.
  1754. Default is 0.
  1755. @item m
  1756. Set meters distance. This is compensation distance for hard distance setup.
  1757. Default is 0.
  1758. @item dry
  1759. Set dry amount. Amount of unprocessed (dry) signal.
  1760. Default is 0.
  1761. @item wet
  1762. Set wet amount. Amount of processed (wet) signal.
  1763. Default is 1.
  1764. @item temp
  1765. Set temperature degree in Celsius. This is the temperature of the environment.
  1766. Default is 20.
  1767. @end table
  1768. @section crossfeed
  1769. Apply headphone crossfeed filter.
  1770. Crossfeed is the process of blending the left and right channels of stereo
  1771. audio recording.
  1772. It is mainly used to reduce extreme stereo separation of low frequencies.
  1773. The intent is to produce more speaker like sound to the listener.
  1774. The filter accepts the following options:
  1775. @table @option
  1776. @item strength
  1777. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1778. This sets gain of low shelf filter for side part of stereo image.
  1779. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1780. @item range
  1781. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1782. This sets cut off frequency of low shelf filter. Default is cut off near
  1783. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1784. @item level_in
  1785. Set input gain. Default is 0.9.
  1786. @item level_out
  1787. Set output gain. Default is 1.
  1788. @end table
  1789. @section crystalizer
  1790. Simple algorithm to expand audio dynamic range.
  1791. The filter accepts the following options:
  1792. @table @option
  1793. @item i
  1794. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1795. (unchanged sound) to 10.0 (maximum effect).
  1796. @item c
  1797. Enable clipping. By default is enabled.
  1798. @end table
  1799. @section dcshift
  1800. Apply a DC shift to the audio.
  1801. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1802. in the recording chain) from the audio. The effect of a DC offset is reduced
  1803. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1804. a signal has a DC offset.
  1805. @table @option
  1806. @item shift
  1807. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1808. the audio.
  1809. @item limitergain
  1810. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1811. used to prevent clipping.
  1812. @end table
  1813. @section dynaudnorm
  1814. Dynamic Audio Normalizer.
  1815. This filter applies a certain amount of gain to the input audio in order
  1816. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1817. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1818. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1819. This allows for applying extra gain to the "quiet" sections of the audio
  1820. while avoiding distortions or clipping the "loud" sections. In other words:
  1821. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1822. sections, in the sense that the volume of each section is brought to the
  1823. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1824. this goal *without* applying "dynamic range compressing". It will retain 100%
  1825. of the dynamic range *within* each section of the audio file.
  1826. @table @option
  1827. @item f
  1828. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1829. Default is 500 milliseconds.
  1830. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1831. referred to as frames. This is required, because a peak magnitude has no
  1832. meaning for just a single sample value. Instead, we need to determine the
  1833. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1834. normalizer would simply use the peak magnitude of the complete file, the
  1835. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1836. frame. The length of a frame is specified in milliseconds. By default, the
  1837. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1838. been found to give good results with most files.
  1839. Note that the exact frame length, in number of samples, will be determined
  1840. automatically, based on the sampling rate of the individual input audio file.
  1841. @item g
  1842. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1843. number. Default is 31.
  1844. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1845. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1846. is specified in frames, centered around the current frame. For the sake of
  1847. simplicity, this must be an odd number. Consequently, the default value of 31
  1848. takes into account the current frame, as well as the 15 preceding frames and
  1849. the 15 subsequent frames. Using a larger window results in a stronger
  1850. smoothing effect and thus in less gain variation, i.e. slower gain
  1851. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1852. effect and thus in more gain variation, i.e. faster gain adaptation.
  1853. In other words, the more you increase this value, the more the Dynamic Audio
  1854. Normalizer will behave like a "traditional" normalization filter. On the
  1855. contrary, the more you decrease this value, the more the Dynamic Audio
  1856. Normalizer will behave like a dynamic range compressor.
  1857. @item p
  1858. Set the target peak value. This specifies the highest permissible magnitude
  1859. level for the normalized audio input. This filter will try to approach the
  1860. target peak magnitude as closely as possible, but at the same time it also
  1861. makes sure that the normalized signal will never exceed the peak magnitude.
  1862. A frame's maximum local gain factor is imposed directly by the target peak
  1863. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1864. It is not recommended to go above this value.
  1865. @item m
  1866. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1867. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1868. factor for each input frame, i.e. the maximum gain factor that does not
  1869. result in clipping or distortion. The maximum gain factor is determined by
  1870. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1871. additionally bounds the frame's maximum gain factor by a predetermined
  1872. (global) maximum gain factor. This is done in order to avoid excessive gain
  1873. factors in "silent" or almost silent frames. By default, the maximum gain
  1874. factor is 10.0, For most inputs the default value should be sufficient and
  1875. it usually is not recommended to increase this value. Though, for input
  1876. with an extremely low overall volume level, it may be necessary to allow even
  1877. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1878. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1879. Instead, a "sigmoid" threshold function will be applied. This way, the
  1880. gain factors will smoothly approach the threshold value, but never exceed that
  1881. value.
  1882. @item r
  1883. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1884. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1885. This means that the maximum local gain factor for each frame is defined
  1886. (only) by the frame's highest magnitude sample. This way, the samples can
  1887. be amplified as much as possible without exceeding the maximum signal
  1888. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1889. Normalizer can also take into account the frame's root mean square,
  1890. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1891. determine the power of a time-varying signal. It is therefore considered
  1892. that the RMS is a better approximation of the "perceived loudness" than
  1893. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1894. frames to a constant RMS value, a uniform "perceived loudness" can be
  1895. established. If a target RMS value has been specified, a frame's local gain
  1896. factor is defined as the factor that would result in exactly that RMS value.
  1897. Note, however, that the maximum local gain factor is still restricted by the
  1898. frame's highest magnitude sample, in order to prevent clipping.
  1899. @item n
  1900. Enable channels coupling. By default is enabled.
  1901. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1902. amount. This means the same gain factor will be applied to all channels, i.e.
  1903. the maximum possible gain factor is determined by the "loudest" channel.
  1904. However, in some recordings, it may happen that the volume of the different
  1905. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1906. In this case, this option can be used to disable the channel coupling. This way,
  1907. the gain factor will be determined independently for each channel, depending
  1908. only on the individual channel's highest magnitude sample. This allows for
  1909. harmonizing the volume of the different channels.
  1910. @item c
  1911. Enable DC bias correction. By default is disabled.
  1912. An audio signal (in the time domain) is a sequence of sample values.
  1913. In the Dynamic Audio Normalizer these sample values are represented in the
  1914. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1915. audio signal, or "waveform", should be centered around the zero point.
  1916. That means if we calculate the mean value of all samples in a file, or in a
  1917. single frame, then the result should be 0.0 or at least very close to that
  1918. value. If, however, there is a significant deviation of the mean value from
  1919. 0.0, in either positive or negative direction, this is referred to as a
  1920. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1921. Audio Normalizer provides optional DC bias correction.
  1922. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1923. the mean value, or "DC correction" offset, of each input frame and subtract
  1924. that value from all of the frame's sample values which ensures those samples
  1925. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1926. boundaries, the DC correction offset values will be interpolated smoothly
  1927. between neighbouring frames.
  1928. @item b
  1929. Enable alternative boundary mode. By default is disabled.
  1930. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1931. around each frame. This includes the preceding frames as well as the
  1932. subsequent frames. However, for the "boundary" frames, located at the very
  1933. beginning and at the very end of the audio file, not all neighbouring
  1934. frames are available. In particular, for the first few frames in the audio
  1935. file, the preceding frames are not known. And, similarly, for the last few
  1936. frames in the audio file, the subsequent frames are not known. Thus, the
  1937. question arises which gain factors should be assumed for the missing frames
  1938. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1939. to deal with this situation. The default boundary mode assumes a gain factor
  1940. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1941. "fade out" at the beginning and at the end of the input, respectively.
  1942. @item s
  1943. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1944. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1945. compression. This means that signal peaks will not be pruned and thus the
  1946. full dynamic range will be retained within each local neighbourhood. However,
  1947. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1948. normalization algorithm with a more "traditional" compression.
  1949. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1950. (thresholding) function. If (and only if) the compression feature is enabled,
  1951. all input frames will be processed by a soft knee thresholding function prior
  1952. to the actual normalization process. Put simply, the thresholding function is
  1953. going to prune all samples whose magnitude exceeds a certain threshold value.
  1954. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1955. value. Instead, the threshold value will be adjusted for each individual
  1956. frame.
  1957. In general, smaller parameters result in stronger compression, and vice versa.
  1958. Values below 3.0 are not recommended, because audible distortion may appear.
  1959. @end table
  1960. @section earwax
  1961. Make audio easier to listen to on headphones.
  1962. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1963. so that when listened to on headphones the stereo image is moved from
  1964. inside your head (standard for headphones) to outside and in front of
  1965. the listener (standard for speakers).
  1966. Ported from SoX.
  1967. @section equalizer
  1968. Apply a two-pole peaking equalisation (EQ) filter. With this
  1969. filter, the signal-level at and around a selected frequency can
  1970. be increased or decreased, whilst (unlike bandpass and bandreject
  1971. filters) that at all other frequencies is unchanged.
  1972. In order to produce complex equalisation curves, this filter can
  1973. be given several times, each with a different central frequency.
  1974. The filter accepts the following options:
  1975. @table @option
  1976. @item frequency, f
  1977. Set the filter's central frequency in Hz.
  1978. @item width_type, t
  1979. Set method to specify band-width of filter.
  1980. @table @option
  1981. @item h
  1982. Hz
  1983. @item q
  1984. Q-Factor
  1985. @item o
  1986. octave
  1987. @item s
  1988. slope
  1989. @end table
  1990. @item width, w
  1991. Specify the band-width of a filter in width_type units.
  1992. @item gain, g
  1993. Set the required gain or attenuation in dB.
  1994. Beware of clipping when using a positive gain.
  1995. @item channels, c
  1996. Specify which channels to filter, by default all available are filtered.
  1997. @end table
  1998. @subsection Examples
  1999. @itemize
  2000. @item
  2001. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2002. @example
  2003. equalizer=f=1000:t=h:width=200:g=-10
  2004. @end example
  2005. @item
  2006. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2007. @example
  2008. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2009. @end example
  2010. @end itemize
  2011. @section extrastereo
  2012. Linearly increases the difference between left and right channels which
  2013. adds some sort of "live" effect to playback.
  2014. The filter accepts the following options:
  2015. @table @option
  2016. @item m
  2017. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2018. (average of both channels), with 1.0 sound will be unchanged, with
  2019. -1.0 left and right channels will be swapped.
  2020. @item c
  2021. Enable clipping. By default is enabled.
  2022. @end table
  2023. @section firequalizer
  2024. Apply FIR Equalization using arbitrary frequency response.
  2025. The filter accepts the following option:
  2026. @table @option
  2027. @item gain
  2028. Set gain curve equation (in dB). The expression can contain variables:
  2029. @table @option
  2030. @item f
  2031. the evaluated frequency
  2032. @item sr
  2033. sample rate
  2034. @item ch
  2035. channel number, set to 0 when multichannels evaluation is disabled
  2036. @item chid
  2037. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2038. multichannels evaluation is disabled
  2039. @item chs
  2040. number of channels
  2041. @item chlayout
  2042. channel_layout, see libavutil/channel_layout.h
  2043. @end table
  2044. and functions:
  2045. @table @option
  2046. @item gain_interpolate(f)
  2047. interpolate gain on frequency f based on gain_entry
  2048. @item cubic_interpolate(f)
  2049. same as gain_interpolate, but smoother
  2050. @end table
  2051. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2052. @item gain_entry
  2053. Set gain entry for gain_interpolate function. The expression can
  2054. contain functions:
  2055. @table @option
  2056. @item entry(f, g)
  2057. store gain entry at frequency f with value g
  2058. @end table
  2059. This option is also available as command.
  2060. @item delay
  2061. Set filter delay in seconds. Higher value means more accurate.
  2062. Default is @code{0.01}.
  2063. @item accuracy
  2064. Set filter accuracy in Hz. Lower value means more accurate.
  2065. Default is @code{5}.
  2066. @item wfunc
  2067. Set window function. Acceptable values are:
  2068. @table @option
  2069. @item rectangular
  2070. rectangular window, useful when gain curve is already smooth
  2071. @item hann
  2072. hann window (default)
  2073. @item hamming
  2074. hamming window
  2075. @item blackman
  2076. blackman window
  2077. @item nuttall3
  2078. 3-terms continuous 1st derivative nuttall window
  2079. @item mnuttall3
  2080. minimum 3-terms discontinuous nuttall window
  2081. @item nuttall
  2082. 4-terms continuous 1st derivative nuttall window
  2083. @item bnuttall
  2084. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2085. @item bharris
  2086. blackman-harris window
  2087. @item tukey
  2088. tukey window
  2089. @end table
  2090. @item fixed
  2091. If enabled, use fixed number of audio samples. This improves speed when
  2092. filtering with large delay. Default is disabled.
  2093. @item multi
  2094. Enable multichannels evaluation on gain. Default is disabled.
  2095. @item zero_phase
  2096. Enable zero phase mode by subtracting timestamp to compensate delay.
  2097. Default is disabled.
  2098. @item scale
  2099. Set scale used by gain. Acceptable values are:
  2100. @table @option
  2101. @item linlin
  2102. linear frequency, linear gain
  2103. @item linlog
  2104. linear frequency, logarithmic (in dB) gain (default)
  2105. @item loglin
  2106. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2107. @item loglog
  2108. logarithmic frequency, logarithmic gain
  2109. @end table
  2110. @item dumpfile
  2111. Set file for dumping, suitable for gnuplot.
  2112. @item dumpscale
  2113. Set scale for dumpfile. Acceptable values are same with scale option.
  2114. Default is linlog.
  2115. @item fft2
  2116. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2117. Default is disabled.
  2118. @item min_phase
  2119. Enable minimum phase impulse response. Default is disabled.
  2120. @end table
  2121. @subsection Examples
  2122. @itemize
  2123. @item
  2124. lowpass at 1000 Hz:
  2125. @example
  2126. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2127. @end example
  2128. @item
  2129. lowpass at 1000 Hz with gain_entry:
  2130. @example
  2131. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2132. @end example
  2133. @item
  2134. custom equalization:
  2135. @example
  2136. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2137. @end example
  2138. @item
  2139. higher delay with zero phase to compensate delay:
  2140. @example
  2141. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2142. @end example
  2143. @item
  2144. lowpass on left channel, highpass on right channel:
  2145. @example
  2146. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2147. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2148. @end example
  2149. @end itemize
  2150. @section flanger
  2151. Apply a flanging effect to the audio.
  2152. The filter accepts the following options:
  2153. @table @option
  2154. @item delay
  2155. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2156. @item depth
  2157. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2158. @item regen
  2159. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2160. Default value is 0.
  2161. @item width
  2162. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2163. Default value is 71.
  2164. @item speed
  2165. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2166. @item shape
  2167. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2168. Default value is @var{sinusoidal}.
  2169. @item phase
  2170. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2171. Default value is 25.
  2172. @item interp
  2173. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2174. Default is @var{linear}.
  2175. @end table
  2176. @section hdcd
  2177. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2178. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2179. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2180. of HDCD, and detects the Transient Filter flag.
  2181. @example
  2182. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2183. @end example
  2184. When using the filter with wav, note the default encoding for wav is 16-bit,
  2185. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2186. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2187. @example
  2188. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2189. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2190. @end example
  2191. The filter accepts the following options:
  2192. @table @option
  2193. @item disable_autoconvert
  2194. Disable any automatic format conversion or resampling in the filter graph.
  2195. @item process_stereo
  2196. Process the stereo channels together. If target_gain does not match between
  2197. channels, consider it invalid and use the last valid target_gain.
  2198. @item cdt_ms
  2199. Set the code detect timer period in ms.
  2200. @item force_pe
  2201. Always extend peaks above -3dBFS even if PE isn't signaled.
  2202. @item analyze_mode
  2203. Replace audio with a solid tone and adjust the amplitude to signal some
  2204. specific aspect of the decoding process. The output file can be loaded in
  2205. an audio editor alongside the original to aid analysis.
  2206. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2207. Modes are:
  2208. @table @samp
  2209. @item 0, off
  2210. Disabled
  2211. @item 1, lle
  2212. Gain adjustment level at each sample
  2213. @item 2, pe
  2214. Samples where peak extend occurs
  2215. @item 3, cdt
  2216. Samples where the code detect timer is active
  2217. @item 4, tgm
  2218. Samples where the target gain does not match between channels
  2219. @end table
  2220. @end table
  2221. @section headphone
  2222. Apply head-related transfer functions (HRTFs) to create virtual
  2223. loudspeakers around the user for binaural listening via headphones.
  2224. The HRIRs are provided via additional streams, for each channel
  2225. one stereo input stream is needed.
  2226. The filter accepts the following options:
  2227. @table @option
  2228. @item map
  2229. Set mapping of input streams for convolution.
  2230. The argument is a '|'-separated list of channel names in order as they
  2231. are given as additional stream inputs for filter.
  2232. This also specify number of input streams. Number of input streams
  2233. must be not less than number of channels in first stream plus one.
  2234. @item gain
  2235. Set gain applied to audio. Value is in dB. Default is 0.
  2236. @item type
  2237. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2238. processing audio in time domain which is slow.
  2239. @var{freq} is processing audio in frequency domain which is fast.
  2240. Default is @var{freq}.
  2241. @item lfe
  2242. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2243. @end table
  2244. @subsection Examples
  2245. @itemize
  2246. @item
  2247. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2248. each amovie filter use stereo file with IR coefficients as input.
  2249. The files give coefficients for each position of virtual loudspeaker:
  2250. @example
  2251. 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"
  2252. output.wav
  2253. @end example
  2254. @end itemize
  2255. @section highpass
  2256. Apply a high-pass filter with 3dB point frequency.
  2257. The filter can be either single-pole, or double-pole (the default).
  2258. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2259. The filter accepts the following options:
  2260. @table @option
  2261. @item frequency, f
  2262. Set frequency in Hz. Default is 3000.
  2263. @item poles, p
  2264. Set number of poles. Default is 2.
  2265. @item width_type, t
  2266. Set method to specify band-width of filter.
  2267. @table @option
  2268. @item h
  2269. Hz
  2270. @item q
  2271. Q-Factor
  2272. @item o
  2273. octave
  2274. @item s
  2275. slope
  2276. @end table
  2277. @item width, w
  2278. Specify the band-width of a filter in width_type units.
  2279. Applies only to double-pole filter.
  2280. The default is 0.707q and gives a Butterworth response.
  2281. @item channels, c
  2282. Specify which channels to filter, by default all available are filtered.
  2283. @end table
  2284. @section join
  2285. Join multiple input streams into one multi-channel stream.
  2286. It accepts the following parameters:
  2287. @table @option
  2288. @item inputs
  2289. The number of input streams. It defaults to 2.
  2290. @item channel_layout
  2291. The desired output channel layout. It defaults to stereo.
  2292. @item map
  2293. Map channels from inputs to output. The argument is a '|'-separated list of
  2294. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2295. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2296. can be either the name of the input channel (e.g. FL for front left) or its
  2297. index in the specified input stream. @var{out_channel} is the name of the output
  2298. channel.
  2299. @end table
  2300. The filter will attempt to guess the mappings when they are not specified
  2301. explicitly. It does so by first trying to find an unused matching input channel
  2302. and if that fails it picks the first unused input channel.
  2303. Join 3 inputs (with properly set channel layouts):
  2304. @example
  2305. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2306. @end example
  2307. Build a 5.1 output from 6 single-channel streams:
  2308. @example
  2309. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2310. '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'
  2311. out
  2312. @end example
  2313. @section ladspa
  2314. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2315. To enable compilation of this filter you need to configure FFmpeg with
  2316. @code{--enable-ladspa}.
  2317. @table @option
  2318. @item file, f
  2319. Specifies the name of LADSPA plugin library to load. If the environment
  2320. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2321. each one of the directories specified by the colon separated list in
  2322. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2323. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2324. @file{/usr/lib/ladspa/}.
  2325. @item plugin, p
  2326. Specifies the plugin within the library. Some libraries contain only
  2327. one plugin, but others contain many of them. If this is not set filter
  2328. will list all available plugins within the specified library.
  2329. @item controls, c
  2330. Set the '|' separated list of controls which are zero or more floating point
  2331. values that determine the behavior of the loaded plugin (for example delay,
  2332. threshold or gain).
  2333. Controls need to be defined using the following syntax:
  2334. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2335. @var{valuei} is the value set on the @var{i}-th control.
  2336. Alternatively they can be also defined using the following syntax:
  2337. @var{value0}|@var{value1}|@var{value2}|..., where
  2338. @var{valuei} is the value set on the @var{i}-th control.
  2339. If @option{controls} is set to @code{help}, all available controls and
  2340. their valid ranges are printed.
  2341. @item sample_rate, s
  2342. Specify the sample rate, default to 44100. Only used if plugin have
  2343. zero inputs.
  2344. @item nb_samples, n
  2345. Set the number of samples per channel per each output frame, default
  2346. is 1024. Only used if plugin have zero inputs.
  2347. @item duration, d
  2348. Set the minimum duration of the sourced audio. See
  2349. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2350. for the accepted syntax.
  2351. Note that the resulting duration may be greater than the specified duration,
  2352. as the generated audio is always cut at the end of a complete frame.
  2353. If not specified, or the expressed duration is negative, the audio is
  2354. supposed to be generated forever.
  2355. Only used if plugin have zero inputs.
  2356. @end table
  2357. @subsection Examples
  2358. @itemize
  2359. @item
  2360. List all available plugins within amp (LADSPA example plugin) library:
  2361. @example
  2362. ladspa=file=amp
  2363. @end example
  2364. @item
  2365. List all available controls and their valid ranges for @code{vcf_notch}
  2366. plugin from @code{VCF} library:
  2367. @example
  2368. ladspa=f=vcf:p=vcf_notch:c=help
  2369. @end example
  2370. @item
  2371. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2372. plugin library:
  2373. @example
  2374. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2375. @end example
  2376. @item
  2377. Add reverberation to the audio using TAP-plugins
  2378. (Tom's Audio Processing plugins):
  2379. @example
  2380. ladspa=file=tap_reverb:tap_reverb
  2381. @end example
  2382. @item
  2383. Generate white noise, with 0.2 amplitude:
  2384. @example
  2385. ladspa=file=cmt:noise_source_white:c=c0=.2
  2386. @end example
  2387. @item
  2388. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2389. @code{C* Audio Plugin Suite} (CAPS) library:
  2390. @example
  2391. ladspa=file=caps:Click:c=c1=20'
  2392. @end example
  2393. @item
  2394. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2395. @example
  2396. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2397. @end example
  2398. @item
  2399. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2400. @code{SWH Plugins} collection:
  2401. @example
  2402. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2403. @end example
  2404. @item
  2405. Attenuate low frequencies using Multiband EQ from Steve Harris
  2406. @code{SWH Plugins} collection:
  2407. @example
  2408. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2409. @end example
  2410. @item
  2411. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2412. (CAPS) library:
  2413. @example
  2414. ladspa=caps:Narrower
  2415. @end example
  2416. @item
  2417. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2418. @example
  2419. ladspa=caps:White:.2
  2420. @end example
  2421. @item
  2422. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2423. @example
  2424. ladspa=caps:Fractal:c=c1=1
  2425. @end example
  2426. @item
  2427. Dynamic volume normalization using @code{VLevel} plugin:
  2428. @example
  2429. ladspa=vlevel-ladspa:vlevel_mono
  2430. @end example
  2431. @end itemize
  2432. @subsection Commands
  2433. This filter supports the following commands:
  2434. @table @option
  2435. @item cN
  2436. Modify the @var{N}-th control value.
  2437. If the specified value is not valid, it is ignored and prior one is kept.
  2438. @end table
  2439. @section loudnorm
  2440. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2441. Support for both single pass (livestreams, files) and double pass (files) modes.
  2442. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2443. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2444. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2445. The filter accepts the following options:
  2446. @table @option
  2447. @item I, i
  2448. Set integrated loudness target.
  2449. Range is -70.0 - -5.0. Default value is -24.0.
  2450. @item LRA, lra
  2451. Set loudness range target.
  2452. Range is 1.0 - 20.0. Default value is 7.0.
  2453. @item TP, tp
  2454. Set maximum true peak.
  2455. Range is -9.0 - +0.0. Default value is -2.0.
  2456. @item measured_I, measured_i
  2457. Measured IL of input file.
  2458. Range is -99.0 - +0.0.
  2459. @item measured_LRA, measured_lra
  2460. Measured LRA of input file.
  2461. Range is 0.0 - 99.0.
  2462. @item measured_TP, measured_tp
  2463. Measured true peak of input file.
  2464. Range is -99.0 - +99.0.
  2465. @item measured_thresh
  2466. Measured threshold of input file.
  2467. Range is -99.0 - +0.0.
  2468. @item offset
  2469. Set offset gain. Gain is applied before the true-peak limiter.
  2470. Range is -99.0 - +99.0. Default is +0.0.
  2471. @item linear
  2472. Normalize linearly if possible.
  2473. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2474. to be specified in order to use this mode.
  2475. Options are true or false. Default is true.
  2476. @item dual_mono
  2477. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2478. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2479. If set to @code{true}, this option will compensate for this effect.
  2480. Multi-channel input files are not affected by this option.
  2481. Options are true or false. Default is false.
  2482. @item print_format
  2483. Set print format for stats. Options are summary, json, or none.
  2484. Default value is none.
  2485. @end table
  2486. @section lowpass
  2487. Apply a low-pass filter with 3dB point frequency.
  2488. The filter can be either single-pole or double-pole (the default).
  2489. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2490. The filter accepts the following options:
  2491. @table @option
  2492. @item frequency, f
  2493. Set frequency in Hz. Default is 500.
  2494. @item poles, p
  2495. Set number of poles. Default is 2.
  2496. @item width_type, t
  2497. Set method to specify band-width of filter.
  2498. @table @option
  2499. @item h
  2500. Hz
  2501. @item q
  2502. Q-Factor
  2503. @item o
  2504. octave
  2505. @item s
  2506. slope
  2507. @end table
  2508. @item width, w
  2509. Specify the band-width of a filter in width_type units.
  2510. Applies only to double-pole filter.
  2511. The default is 0.707q and gives a Butterworth response.
  2512. @item channels, c
  2513. Specify which channels to filter, by default all available are filtered.
  2514. @end table
  2515. @subsection Examples
  2516. @itemize
  2517. @item
  2518. Lowpass only LFE channel, it LFE is not present it does nothing:
  2519. @example
  2520. lowpass=c=LFE
  2521. @end example
  2522. @end itemize
  2523. @anchor{pan}
  2524. @section pan
  2525. Mix channels with specific gain levels. The filter accepts the output
  2526. channel layout followed by a set of channels definitions.
  2527. This filter is also designed to efficiently remap the channels of an audio
  2528. stream.
  2529. The filter accepts parameters of the form:
  2530. "@var{l}|@var{outdef}|@var{outdef}|..."
  2531. @table @option
  2532. @item l
  2533. output channel layout or number of channels
  2534. @item outdef
  2535. output channel specification, of the form:
  2536. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2537. @item out_name
  2538. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2539. number (c0, c1, etc.)
  2540. @item gain
  2541. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2542. @item in_name
  2543. input channel to use, see out_name for details; it is not possible to mix
  2544. named and numbered input channels
  2545. @end table
  2546. If the `=' in a channel specification is replaced by `<', then the gains for
  2547. that specification will be renormalized so that the total is 1, thus
  2548. avoiding clipping noise.
  2549. @subsection Mixing examples
  2550. For example, if you want to down-mix from stereo to mono, but with a bigger
  2551. factor for the left channel:
  2552. @example
  2553. pan=1c|c0=0.9*c0+0.1*c1
  2554. @end example
  2555. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2556. 7-channels surround:
  2557. @example
  2558. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2559. @end example
  2560. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2561. that should be preferred (see "-ac" option) unless you have very specific
  2562. needs.
  2563. @subsection Remapping examples
  2564. The channel remapping will be effective if, and only if:
  2565. @itemize
  2566. @item gain coefficients are zeroes or ones,
  2567. @item only one input per channel output,
  2568. @end itemize
  2569. If all these conditions are satisfied, the filter will notify the user ("Pure
  2570. channel mapping detected"), and use an optimized and lossless method to do the
  2571. remapping.
  2572. For example, if you have a 5.1 source and want a stereo audio stream by
  2573. dropping the extra channels:
  2574. @example
  2575. pan="stereo| c0=FL | c1=FR"
  2576. @end example
  2577. Given the same source, you can also switch front left and front right channels
  2578. and keep the input channel layout:
  2579. @example
  2580. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2581. @end example
  2582. If the input is a stereo audio stream, you can mute the front left channel (and
  2583. still keep the stereo channel layout) with:
  2584. @example
  2585. pan="stereo|c1=c1"
  2586. @end example
  2587. Still with a stereo audio stream input, you can copy the right channel in both
  2588. front left and right:
  2589. @example
  2590. pan="stereo| c0=FR | c1=FR"
  2591. @end example
  2592. @section replaygain
  2593. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2594. outputs it unchanged.
  2595. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2596. @section resample
  2597. Convert the audio sample format, sample rate and channel layout. It is
  2598. not meant to be used directly.
  2599. @section rubberband
  2600. Apply time-stretching and pitch-shifting with librubberband.
  2601. The filter accepts the following options:
  2602. @table @option
  2603. @item tempo
  2604. Set tempo scale factor.
  2605. @item pitch
  2606. Set pitch scale factor.
  2607. @item transients
  2608. Set transients detector.
  2609. Possible values are:
  2610. @table @var
  2611. @item crisp
  2612. @item mixed
  2613. @item smooth
  2614. @end table
  2615. @item detector
  2616. Set detector.
  2617. Possible values are:
  2618. @table @var
  2619. @item compound
  2620. @item percussive
  2621. @item soft
  2622. @end table
  2623. @item phase
  2624. Set phase.
  2625. Possible values are:
  2626. @table @var
  2627. @item laminar
  2628. @item independent
  2629. @end table
  2630. @item window
  2631. Set processing window size.
  2632. Possible values are:
  2633. @table @var
  2634. @item standard
  2635. @item short
  2636. @item long
  2637. @end table
  2638. @item smoothing
  2639. Set smoothing.
  2640. Possible values are:
  2641. @table @var
  2642. @item off
  2643. @item on
  2644. @end table
  2645. @item formant
  2646. Enable formant preservation when shift pitching.
  2647. Possible values are:
  2648. @table @var
  2649. @item shifted
  2650. @item preserved
  2651. @end table
  2652. @item pitchq
  2653. Set pitch quality.
  2654. Possible values are:
  2655. @table @var
  2656. @item quality
  2657. @item speed
  2658. @item consistency
  2659. @end table
  2660. @item channels
  2661. Set channels.
  2662. Possible values are:
  2663. @table @var
  2664. @item apart
  2665. @item together
  2666. @end table
  2667. @end table
  2668. @section sidechaincompress
  2669. This filter acts like normal compressor but has the ability to compress
  2670. detected signal using second input signal.
  2671. It needs two input streams and returns one output stream.
  2672. First input stream will be processed depending on second stream signal.
  2673. The filtered signal then can be filtered with other filters in later stages of
  2674. processing. See @ref{pan} and @ref{amerge} filter.
  2675. The filter accepts the following options:
  2676. @table @option
  2677. @item level_in
  2678. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2679. @item threshold
  2680. If a signal of second stream raises above this level it will affect the gain
  2681. reduction of first stream.
  2682. By default is 0.125. Range is between 0.00097563 and 1.
  2683. @item ratio
  2684. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2685. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2686. Default is 2. Range is between 1 and 20.
  2687. @item attack
  2688. Amount of milliseconds the signal has to rise above the threshold before gain
  2689. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2690. @item release
  2691. Amount of milliseconds the signal has to fall below the threshold before
  2692. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2693. @item makeup
  2694. Set the amount by how much signal will be amplified after processing.
  2695. Default is 1. Range is from 1 to 64.
  2696. @item knee
  2697. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2698. Default is 2.82843. Range is between 1 and 8.
  2699. @item link
  2700. Choose if the @code{average} level between all channels of side-chain stream
  2701. or the louder(@code{maximum}) channel of side-chain stream affects the
  2702. reduction. Default is @code{average}.
  2703. @item detection
  2704. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2705. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2706. @item level_sc
  2707. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2708. @item mix
  2709. How much to use compressed signal in output. Default is 1.
  2710. Range is between 0 and 1.
  2711. @end table
  2712. @subsection Examples
  2713. @itemize
  2714. @item
  2715. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2716. depending on the signal of 2nd input and later compressed signal to be
  2717. merged with 2nd input:
  2718. @example
  2719. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2720. @end example
  2721. @end itemize
  2722. @section sidechaingate
  2723. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2724. filter the detected signal before sending it to the gain reduction stage.
  2725. Normally a gate uses the full range signal to detect a level above the
  2726. threshold.
  2727. For example: If you cut all lower frequencies from your sidechain signal
  2728. the gate will decrease the volume of your track only if not enough highs
  2729. appear. With this technique you are able to reduce the resonation of a
  2730. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2731. guitar.
  2732. It needs two input streams and returns one output stream.
  2733. First input stream will be processed depending on second stream signal.
  2734. The filter accepts the following options:
  2735. @table @option
  2736. @item level_in
  2737. Set input level before filtering.
  2738. Default is 1. Allowed range is from 0.015625 to 64.
  2739. @item range
  2740. Set the level of gain reduction when the signal is below the threshold.
  2741. Default is 0.06125. Allowed range is from 0 to 1.
  2742. @item threshold
  2743. If a signal rises above this level the gain reduction is released.
  2744. Default is 0.125. Allowed range is from 0 to 1.
  2745. @item ratio
  2746. Set a ratio about which the signal is reduced.
  2747. Default is 2. Allowed range is from 1 to 9000.
  2748. @item attack
  2749. Amount of milliseconds the signal has to rise above the threshold before gain
  2750. reduction stops.
  2751. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2752. @item release
  2753. Amount of milliseconds the signal has to fall below the threshold before the
  2754. reduction is increased again. Default is 250 milliseconds.
  2755. Allowed range is from 0.01 to 9000.
  2756. @item makeup
  2757. Set amount of amplification of signal after processing.
  2758. Default is 1. Allowed range is from 1 to 64.
  2759. @item knee
  2760. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2761. Default is 2.828427125. Allowed range is from 1 to 8.
  2762. @item detection
  2763. Choose if exact signal should be taken for detection or an RMS like one.
  2764. Default is rms. Can be peak or rms.
  2765. @item link
  2766. Choose if the average level between all channels or the louder channel affects
  2767. the reduction.
  2768. Default is average. Can be average or maximum.
  2769. @item level_sc
  2770. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2771. @end table
  2772. @section silencedetect
  2773. Detect silence in an audio stream.
  2774. This filter logs a message when it detects that the input audio volume is less
  2775. or equal to a noise tolerance value for a duration greater or equal to the
  2776. minimum detected noise duration.
  2777. The printed times and duration are expressed in seconds.
  2778. The filter accepts the following options:
  2779. @table @option
  2780. @item duration, d
  2781. Set silence duration until notification (default is 2 seconds).
  2782. @item noise, n
  2783. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2784. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2785. @end table
  2786. @subsection Examples
  2787. @itemize
  2788. @item
  2789. Detect 5 seconds of silence with -50dB noise tolerance:
  2790. @example
  2791. silencedetect=n=-50dB:d=5
  2792. @end example
  2793. @item
  2794. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2795. tolerance in @file{silence.mp3}:
  2796. @example
  2797. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2798. @end example
  2799. @end itemize
  2800. @section silenceremove
  2801. Remove silence from the beginning, middle or end of the audio.
  2802. The filter accepts the following options:
  2803. @table @option
  2804. @item start_periods
  2805. This value is used to indicate if audio should be trimmed at beginning of
  2806. the audio. A value of zero indicates no silence should be trimmed from the
  2807. beginning. When specifying a non-zero value, it trims audio up until it
  2808. finds non-silence. Normally, when trimming silence from beginning of audio
  2809. the @var{start_periods} will be @code{1} but it can be increased to higher
  2810. values to trim all audio up to specific count of non-silence periods.
  2811. Default value is @code{0}.
  2812. @item start_duration
  2813. Specify the amount of time that non-silence must be detected before it stops
  2814. trimming audio. By increasing the duration, bursts of noises can be treated
  2815. as silence and trimmed off. Default value is @code{0}.
  2816. @item start_threshold
  2817. This indicates what sample value should be treated as silence. For digital
  2818. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2819. you may wish to increase the value to account for background noise.
  2820. Can be specified in dB (in case "dB" is appended to the specified value)
  2821. or amplitude ratio. Default value is @code{0}.
  2822. @item stop_periods
  2823. Set the count for trimming silence from the end of audio.
  2824. To remove silence from the middle of a file, specify a @var{stop_periods}
  2825. that is negative. This value is then treated as a positive value and is
  2826. used to indicate the effect should restart processing as specified by
  2827. @var{start_periods}, making it suitable for removing periods of silence
  2828. in the middle of the audio.
  2829. Default value is @code{0}.
  2830. @item stop_duration
  2831. Specify a duration of silence that must exist before audio is not copied any
  2832. more. By specifying a higher duration, silence that is wanted can be left in
  2833. the audio.
  2834. Default value is @code{0}.
  2835. @item stop_threshold
  2836. This is the same as @option{start_threshold} but for trimming silence from
  2837. the end of audio.
  2838. Can be specified in dB (in case "dB" is appended to the specified value)
  2839. or amplitude ratio. Default value is @code{0}.
  2840. @item leave_silence
  2841. This indicates that @var{stop_duration} length of audio should be left intact
  2842. at the beginning of each period of silence.
  2843. For example, if you want to remove long pauses between words but do not want
  2844. to remove the pauses completely. Default value is @code{0}.
  2845. @item detection
  2846. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2847. and works better with digital silence which is exactly 0.
  2848. Default value is @code{rms}.
  2849. @item window
  2850. Set ratio used to calculate size of window for detecting silence.
  2851. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2852. @end table
  2853. @subsection Examples
  2854. @itemize
  2855. @item
  2856. The following example shows how this filter can be used to start a recording
  2857. that does not contain the delay at the start which usually occurs between
  2858. pressing the record button and the start of the performance:
  2859. @example
  2860. silenceremove=1:5:0.02
  2861. @end example
  2862. @item
  2863. Trim all silence encountered from beginning to end where there is more than 1
  2864. second of silence in audio:
  2865. @example
  2866. silenceremove=0:0:0:-1:1:-90dB
  2867. @end example
  2868. @end itemize
  2869. @section sofalizer
  2870. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2871. loudspeakers around the user for binaural listening via headphones (audio
  2872. formats up to 9 channels supported).
  2873. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2874. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2875. Austrian Academy of Sciences.
  2876. To enable compilation of this filter you need to configure FFmpeg with
  2877. @code{--enable-libmysofa}.
  2878. The filter accepts the following options:
  2879. @table @option
  2880. @item sofa
  2881. Set the SOFA file used for rendering.
  2882. @item gain
  2883. Set gain applied to audio. Value is in dB. Default is 0.
  2884. @item rotation
  2885. Set rotation of virtual loudspeakers in deg. Default is 0.
  2886. @item elevation
  2887. Set elevation of virtual speakers in deg. Default is 0.
  2888. @item radius
  2889. Set distance in meters between loudspeakers and the listener with near-field
  2890. HRTFs. Default is 1.
  2891. @item type
  2892. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2893. processing audio in time domain which is slow.
  2894. @var{freq} is processing audio in frequency domain which is fast.
  2895. Default is @var{freq}.
  2896. @item speakers
  2897. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2898. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2899. Each virtual loudspeaker is described with short channel name following with
  2900. azimuth and elevation in degreees.
  2901. Each virtual loudspeaker description is separated by '|'.
  2902. For example to override front left and front right channel positions use:
  2903. 'speakers=FL 45 15|FR 345 15'.
  2904. Descriptions with unrecognised channel names are ignored.
  2905. @item lfegain
  2906. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2907. @end table
  2908. @subsection Examples
  2909. @itemize
  2910. @item
  2911. Using ClubFritz6 sofa file:
  2912. @example
  2913. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2914. @end example
  2915. @item
  2916. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2917. @example
  2918. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2919. @end example
  2920. @item
  2921. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2922. and also with custom gain:
  2923. @example
  2924. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2925. @end example
  2926. @end itemize
  2927. @section stereotools
  2928. This filter has some handy utilities to manage stereo signals, for converting
  2929. M/S stereo recordings to L/R signal while having control over the parameters
  2930. or spreading the stereo image of master track.
  2931. The filter accepts the following options:
  2932. @table @option
  2933. @item level_in
  2934. Set input level before filtering for both channels. Defaults is 1.
  2935. Allowed range is from 0.015625 to 64.
  2936. @item level_out
  2937. Set output level after filtering for both channels. Defaults is 1.
  2938. Allowed range is from 0.015625 to 64.
  2939. @item balance_in
  2940. Set input balance between both channels. Default is 0.
  2941. Allowed range is from -1 to 1.
  2942. @item balance_out
  2943. Set output balance between both channels. Default is 0.
  2944. Allowed range is from -1 to 1.
  2945. @item softclip
  2946. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2947. clipping. Disabled by default.
  2948. @item mutel
  2949. Mute the left channel. Disabled by default.
  2950. @item muter
  2951. Mute the right channel. Disabled by default.
  2952. @item phasel
  2953. Change the phase of the left channel. Disabled by default.
  2954. @item phaser
  2955. Change the phase of the right channel. Disabled by default.
  2956. @item mode
  2957. Set stereo mode. Available values are:
  2958. @table @samp
  2959. @item lr>lr
  2960. Left/Right to Left/Right, this is default.
  2961. @item lr>ms
  2962. Left/Right to Mid/Side.
  2963. @item ms>lr
  2964. Mid/Side to Left/Right.
  2965. @item lr>ll
  2966. Left/Right to Left/Left.
  2967. @item lr>rr
  2968. Left/Right to Right/Right.
  2969. @item lr>l+r
  2970. Left/Right to Left + Right.
  2971. @item lr>rl
  2972. Left/Right to Right/Left.
  2973. @item ms>ll
  2974. Mid/Side to Left/Left.
  2975. @item ms>rr
  2976. Mid/Side to Right/Right.
  2977. @end table
  2978. @item slev
  2979. Set level of side signal. Default is 1.
  2980. Allowed range is from 0.015625 to 64.
  2981. @item sbal
  2982. Set balance of side signal. Default is 0.
  2983. Allowed range is from -1 to 1.
  2984. @item mlev
  2985. Set level of the middle signal. Default is 1.
  2986. Allowed range is from 0.015625 to 64.
  2987. @item mpan
  2988. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2989. @item base
  2990. Set stereo base between mono and inversed channels. Default is 0.
  2991. Allowed range is from -1 to 1.
  2992. @item delay
  2993. Set delay in milliseconds how much to delay left from right channel and
  2994. vice versa. Default is 0. Allowed range is from -20 to 20.
  2995. @item sclevel
  2996. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2997. @item phase
  2998. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2999. @item bmode_in, bmode_out
  3000. Set balance mode for balance_in/balance_out option.
  3001. Can be one of the following:
  3002. @table @samp
  3003. @item balance
  3004. Classic balance mode. Attenuate one channel at time.
  3005. Gain is raised up to 1.
  3006. @item amplitude
  3007. Similar as classic mode above but gain is raised up to 2.
  3008. @item power
  3009. Equal power distribution, from -6dB to +6dB range.
  3010. @end table
  3011. @end table
  3012. @subsection Examples
  3013. @itemize
  3014. @item
  3015. Apply karaoke like effect:
  3016. @example
  3017. stereotools=mlev=0.015625
  3018. @end example
  3019. @item
  3020. Convert M/S signal to L/R:
  3021. @example
  3022. "stereotools=mode=ms>lr"
  3023. @end example
  3024. @end itemize
  3025. @section stereowiden
  3026. This filter enhance the stereo effect by suppressing signal common to both
  3027. channels and by delaying the signal of left into right and vice versa,
  3028. thereby widening the stereo effect.
  3029. The filter accepts the following options:
  3030. @table @option
  3031. @item delay
  3032. Time in milliseconds of the delay of left signal into right and vice versa.
  3033. Default is 20 milliseconds.
  3034. @item feedback
  3035. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3036. effect of left signal in right output and vice versa which gives widening
  3037. effect. Default is 0.3.
  3038. @item crossfeed
  3039. Cross feed of left into right with inverted phase. This helps in suppressing
  3040. the mono. If the value is 1 it will cancel all the signal common to both
  3041. channels. Default is 0.3.
  3042. @item drymix
  3043. Set level of input signal of original channel. Default is 0.8.
  3044. @end table
  3045. @section superequalizer
  3046. Apply 18 band equalizer.
  3047. The filter accepts the following options:
  3048. @table @option
  3049. @item 1b
  3050. Set 65Hz band gain.
  3051. @item 2b
  3052. Set 92Hz band gain.
  3053. @item 3b
  3054. Set 131Hz band gain.
  3055. @item 4b
  3056. Set 185Hz band gain.
  3057. @item 5b
  3058. Set 262Hz band gain.
  3059. @item 6b
  3060. Set 370Hz band gain.
  3061. @item 7b
  3062. Set 523Hz band gain.
  3063. @item 8b
  3064. Set 740Hz band gain.
  3065. @item 9b
  3066. Set 1047Hz band gain.
  3067. @item 10b
  3068. Set 1480Hz band gain.
  3069. @item 11b
  3070. Set 2093Hz band gain.
  3071. @item 12b
  3072. Set 2960Hz band gain.
  3073. @item 13b
  3074. Set 4186Hz band gain.
  3075. @item 14b
  3076. Set 5920Hz band gain.
  3077. @item 15b
  3078. Set 8372Hz band gain.
  3079. @item 16b
  3080. Set 11840Hz band gain.
  3081. @item 17b
  3082. Set 16744Hz band gain.
  3083. @item 18b
  3084. Set 20000Hz band gain.
  3085. @end table
  3086. @section surround
  3087. Apply audio surround upmix filter.
  3088. This filter allows to produce multichannel output from audio stream.
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item chl_out
  3092. Set output channel layout. By default, this is @var{5.1}.
  3093. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3094. for the required syntax.
  3095. @item chl_in
  3096. Set input channel layout. By default, this is @var{stereo}.
  3097. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3098. for the required syntax.
  3099. @item level_in
  3100. Set input volume level. By default, this is @var{1}.
  3101. @item level_out
  3102. Set output volume level. By default, this is @var{1}.
  3103. @item lfe
  3104. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3105. @item lfe_low
  3106. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3107. @item lfe_high
  3108. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3109. @item fc_in
  3110. Set front center input volume. By default, this is @var{1}.
  3111. @item fc_out
  3112. Set front center output volume. By default, this is @var{1}.
  3113. @item lfe_in
  3114. Set LFE input volume. By default, this is @var{1}.
  3115. @item lfe_out
  3116. Set LFE output volume. By default, this is @var{1}.
  3117. @end table
  3118. @section treble
  3119. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3120. shelving filter with a response similar to that of a standard
  3121. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3122. The filter accepts the following options:
  3123. @table @option
  3124. @item gain, g
  3125. Give the gain at whichever is the lower of ~22 kHz and the
  3126. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3127. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3128. @item frequency, f
  3129. Set the filter's central frequency and so can be used
  3130. to extend or reduce the frequency range to be boosted or cut.
  3131. The default value is @code{3000} Hz.
  3132. @item width_type, t
  3133. Set method to specify band-width of filter.
  3134. @table @option
  3135. @item h
  3136. Hz
  3137. @item q
  3138. Q-Factor
  3139. @item o
  3140. octave
  3141. @item s
  3142. slope
  3143. @end table
  3144. @item width, w
  3145. Determine how steep is the filter's shelf transition.
  3146. @item channels, c
  3147. Specify which channels to filter, by default all available are filtered.
  3148. @end table
  3149. @section tremolo
  3150. Sinusoidal amplitude modulation.
  3151. The filter accepts the following options:
  3152. @table @option
  3153. @item f
  3154. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3155. (20 Hz or lower) will result in a tremolo effect.
  3156. This filter may also be used as a ring modulator by specifying
  3157. a modulation frequency higher than 20 Hz.
  3158. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3159. @item d
  3160. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3161. Default value is 0.5.
  3162. @end table
  3163. @section vibrato
  3164. Sinusoidal phase modulation.
  3165. The filter accepts the following options:
  3166. @table @option
  3167. @item f
  3168. Modulation frequency in Hertz.
  3169. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3170. @item d
  3171. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3172. Default value is 0.5.
  3173. @end table
  3174. @section volume
  3175. Adjust the input audio volume.
  3176. It accepts the following parameters:
  3177. @table @option
  3178. @item volume
  3179. Set audio volume expression.
  3180. Output values are clipped to the maximum value.
  3181. The output audio volume is given by the relation:
  3182. @example
  3183. @var{output_volume} = @var{volume} * @var{input_volume}
  3184. @end example
  3185. The default value for @var{volume} is "1.0".
  3186. @item precision
  3187. This parameter represents the mathematical precision.
  3188. It determines which input sample formats will be allowed, which affects the
  3189. precision of the volume scaling.
  3190. @table @option
  3191. @item fixed
  3192. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3193. @item float
  3194. 32-bit floating-point; this limits input sample format to FLT. (default)
  3195. @item double
  3196. 64-bit floating-point; this limits input sample format to DBL.
  3197. @end table
  3198. @item replaygain
  3199. Choose the behaviour on encountering ReplayGain side data in input frames.
  3200. @table @option
  3201. @item drop
  3202. Remove ReplayGain side data, ignoring its contents (the default).
  3203. @item ignore
  3204. Ignore ReplayGain side data, but leave it in the frame.
  3205. @item track
  3206. Prefer the track gain, if present.
  3207. @item album
  3208. Prefer the album gain, if present.
  3209. @end table
  3210. @item replaygain_preamp
  3211. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3212. Default value for @var{replaygain_preamp} is 0.0.
  3213. @item eval
  3214. Set when the volume expression is evaluated.
  3215. It accepts the following values:
  3216. @table @samp
  3217. @item once
  3218. only evaluate expression once during the filter initialization, or
  3219. when the @samp{volume} command is sent
  3220. @item frame
  3221. evaluate expression for each incoming frame
  3222. @end table
  3223. Default value is @samp{once}.
  3224. @end table
  3225. The volume expression can contain the following parameters.
  3226. @table @option
  3227. @item n
  3228. frame number (starting at zero)
  3229. @item nb_channels
  3230. number of channels
  3231. @item nb_consumed_samples
  3232. number of samples consumed by the filter
  3233. @item nb_samples
  3234. number of samples in the current frame
  3235. @item pos
  3236. original frame position in the file
  3237. @item pts
  3238. frame PTS
  3239. @item sample_rate
  3240. sample rate
  3241. @item startpts
  3242. PTS at start of stream
  3243. @item startt
  3244. time at start of stream
  3245. @item t
  3246. frame time
  3247. @item tb
  3248. timestamp timebase
  3249. @item volume
  3250. last set volume value
  3251. @end table
  3252. Note that when @option{eval} is set to @samp{once} only the
  3253. @var{sample_rate} and @var{tb} variables are available, all other
  3254. variables will evaluate to NAN.
  3255. @subsection Commands
  3256. This filter supports the following commands:
  3257. @table @option
  3258. @item volume
  3259. Modify the volume expression.
  3260. The command accepts the same syntax of the corresponding option.
  3261. If the specified expression is not valid, it is kept at its current
  3262. value.
  3263. @item replaygain_noclip
  3264. Prevent clipping by limiting the gain applied.
  3265. Default value for @var{replaygain_noclip} is 1.
  3266. @end table
  3267. @subsection Examples
  3268. @itemize
  3269. @item
  3270. Halve the input audio volume:
  3271. @example
  3272. volume=volume=0.5
  3273. volume=volume=1/2
  3274. volume=volume=-6.0206dB
  3275. @end example
  3276. In all the above example the named key for @option{volume} can be
  3277. omitted, for example like in:
  3278. @example
  3279. volume=0.5
  3280. @end example
  3281. @item
  3282. Increase input audio power by 6 decibels using fixed-point precision:
  3283. @example
  3284. volume=volume=6dB:precision=fixed
  3285. @end example
  3286. @item
  3287. Fade volume after time 10 with an annihilation period of 5 seconds:
  3288. @example
  3289. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3290. @end example
  3291. @end itemize
  3292. @section volumedetect
  3293. Detect the volume of the input video.
  3294. The filter has no parameters. The input is not modified. Statistics about
  3295. the volume will be printed in the log when the input stream end is reached.
  3296. In particular it will show the mean volume (root mean square), maximum
  3297. volume (on a per-sample basis), and the beginning of a histogram of the
  3298. registered volume values (from the maximum value to a cumulated 1/1000 of
  3299. the samples).
  3300. All volumes are in decibels relative to the maximum PCM value.
  3301. @subsection Examples
  3302. Here is an excerpt of the output:
  3303. @example
  3304. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3305. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3306. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3307. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3308. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3309. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3310. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3311. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3312. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3313. @end example
  3314. It means that:
  3315. @itemize
  3316. @item
  3317. The mean square energy is approximately -27 dB, or 10^-2.7.
  3318. @item
  3319. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3320. @item
  3321. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3322. @end itemize
  3323. In other words, raising the volume by +4 dB does not cause any clipping,
  3324. raising it by +5 dB causes clipping for 6 samples, etc.
  3325. @c man end AUDIO FILTERS
  3326. @chapter Audio Sources
  3327. @c man begin AUDIO SOURCES
  3328. Below is a description of the currently available audio sources.
  3329. @section abuffer
  3330. Buffer audio frames, and make them available to the filter chain.
  3331. This source is mainly intended for a programmatic use, in particular
  3332. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3333. It accepts the following parameters:
  3334. @table @option
  3335. @item time_base
  3336. The timebase which will be used for timestamps of submitted frames. It must be
  3337. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3338. @item sample_rate
  3339. The sample rate of the incoming audio buffers.
  3340. @item sample_fmt
  3341. The sample format of the incoming audio buffers.
  3342. Either a sample format name or its corresponding integer representation from
  3343. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3344. @item channel_layout
  3345. The channel layout of the incoming audio buffers.
  3346. Either a channel layout name from channel_layout_map in
  3347. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3348. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3349. @item channels
  3350. The number of channels of the incoming audio buffers.
  3351. If both @var{channels} and @var{channel_layout} are specified, then they
  3352. must be consistent.
  3353. @end table
  3354. @subsection Examples
  3355. @example
  3356. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3357. @end example
  3358. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3359. Since the sample format with name "s16p" corresponds to the number
  3360. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3361. equivalent to:
  3362. @example
  3363. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3364. @end example
  3365. @section aevalsrc
  3366. Generate an audio signal specified by an expression.
  3367. This source accepts in input one or more expressions (one for each
  3368. channel), which are evaluated and used to generate a corresponding
  3369. audio signal.
  3370. This source accepts the following options:
  3371. @table @option
  3372. @item exprs
  3373. Set the '|'-separated expressions list for each separate channel. In case the
  3374. @option{channel_layout} option is not specified, the selected channel layout
  3375. depends on the number of provided expressions. Otherwise the last
  3376. specified expression is applied to the remaining output channels.
  3377. @item channel_layout, c
  3378. Set the channel layout. The number of channels in the specified layout
  3379. must be equal to the number of specified expressions.
  3380. @item duration, d
  3381. Set the minimum duration of the sourced audio. See
  3382. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3383. for the accepted syntax.
  3384. Note that the resulting duration may be greater than the specified
  3385. duration, as the generated audio is always cut at the end of a
  3386. complete frame.
  3387. If not specified, or the expressed duration is negative, the audio is
  3388. supposed to be generated forever.
  3389. @item nb_samples, n
  3390. Set the number of samples per channel per each output frame,
  3391. default to 1024.
  3392. @item sample_rate, s
  3393. Specify the sample rate, default to 44100.
  3394. @end table
  3395. Each expression in @var{exprs} can contain the following constants:
  3396. @table @option
  3397. @item n
  3398. number of the evaluated sample, starting from 0
  3399. @item t
  3400. time of the evaluated sample expressed in seconds, starting from 0
  3401. @item s
  3402. sample rate
  3403. @end table
  3404. @subsection Examples
  3405. @itemize
  3406. @item
  3407. Generate silence:
  3408. @example
  3409. aevalsrc=0
  3410. @end example
  3411. @item
  3412. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3413. 8000 Hz:
  3414. @example
  3415. aevalsrc="sin(440*2*PI*t):s=8000"
  3416. @end example
  3417. @item
  3418. Generate a two channels signal, specify the channel layout (Front
  3419. Center + Back Center) explicitly:
  3420. @example
  3421. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3422. @end example
  3423. @item
  3424. Generate white noise:
  3425. @example
  3426. aevalsrc="-2+random(0)"
  3427. @end example
  3428. @item
  3429. Generate an amplitude modulated signal:
  3430. @example
  3431. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3432. @end example
  3433. @item
  3434. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3435. @example
  3436. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3437. @end example
  3438. @end itemize
  3439. @section anullsrc
  3440. The null audio source, return unprocessed audio frames. It is mainly useful
  3441. as a template and to be employed in analysis / debugging tools, or as
  3442. the source for filters which ignore the input data (for example the sox
  3443. synth filter).
  3444. This source accepts the following options:
  3445. @table @option
  3446. @item channel_layout, cl
  3447. Specifies the channel layout, and can be either an integer or a string
  3448. representing a channel layout. The default value of @var{channel_layout}
  3449. is "stereo".
  3450. Check the channel_layout_map definition in
  3451. @file{libavutil/channel_layout.c} for the mapping between strings and
  3452. channel layout values.
  3453. @item sample_rate, r
  3454. Specifies the sample rate, and defaults to 44100.
  3455. @item nb_samples, n
  3456. Set the number of samples per requested frames.
  3457. @end table
  3458. @subsection Examples
  3459. @itemize
  3460. @item
  3461. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3462. @example
  3463. anullsrc=r=48000:cl=4
  3464. @end example
  3465. @item
  3466. Do the same operation with a more obvious syntax:
  3467. @example
  3468. anullsrc=r=48000:cl=mono
  3469. @end example
  3470. @end itemize
  3471. All the parameters need to be explicitly defined.
  3472. @section flite
  3473. Synthesize a voice utterance using the libflite library.
  3474. To enable compilation of this filter you need to configure FFmpeg with
  3475. @code{--enable-libflite}.
  3476. Note that the flite library is not thread-safe.
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item list_voices
  3480. If set to 1, list the names of the available voices and exit
  3481. immediately. Default value is 0.
  3482. @item nb_samples, n
  3483. Set the maximum number of samples per frame. Default value is 512.
  3484. @item textfile
  3485. Set the filename containing the text to speak.
  3486. @item text
  3487. Set the text to speak.
  3488. @item voice, v
  3489. Set the voice to use for the speech synthesis. Default value is
  3490. @code{kal}. See also the @var{list_voices} option.
  3491. @end table
  3492. @subsection Examples
  3493. @itemize
  3494. @item
  3495. Read from file @file{speech.txt}, and synthesize the text using the
  3496. standard flite voice:
  3497. @example
  3498. flite=textfile=speech.txt
  3499. @end example
  3500. @item
  3501. Read the specified text selecting the @code{slt} voice:
  3502. @example
  3503. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3504. @end example
  3505. @item
  3506. Input text to ffmpeg:
  3507. @example
  3508. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3509. @end example
  3510. @item
  3511. Make @file{ffplay} speak the specified text, using @code{flite} and
  3512. the @code{lavfi} device:
  3513. @example
  3514. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3515. @end example
  3516. @end itemize
  3517. For more information about libflite, check:
  3518. @url{http://www.speech.cs.cmu.edu/flite/}
  3519. @section anoisesrc
  3520. Generate a noise audio signal.
  3521. The filter accepts the following options:
  3522. @table @option
  3523. @item sample_rate, r
  3524. Specify the sample rate. Default value is 48000 Hz.
  3525. @item amplitude, a
  3526. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3527. is 1.0.
  3528. @item duration, d
  3529. Specify the duration of the generated audio stream. Not specifying this option
  3530. results in noise with an infinite length.
  3531. @item color, colour, c
  3532. Specify the color of noise. Available noise colors are white, pink, brown,
  3533. blue and violet. Default color is white.
  3534. @item seed, s
  3535. Specify a value used to seed the PRNG.
  3536. @item nb_samples, n
  3537. Set the number of samples per each output frame, default is 1024.
  3538. @end table
  3539. @subsection Examples
  3540. @itemize
  3541. @item
  3542. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3543. @example
  3544. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3545. @end example
  3546. @end itemize
  3547. @section sine
  3548. Generate an audio signal made of a sine wave with amplitude 1/8.
  3549. The audio signal is bit-exact.
  3550. The filter accepts the following options:
  3551. @table @option
  3552. @item frequency, f
  3553. Set the carrier frequency. Default is 440 Hz.
  3554. @item beep_factor, b
  3555. Enable a periodic beep every second with frequency @var{beep_factor} times
  3556. the carrier frequency. Default is 0, meaning the beep is disabled.
  3557. @item sample_rate, r
  3558. Specify the sample rate, default is 44100.
  3559. @item duration, d
  3560. Specify the duration of the generated audio stream.
  3561. @item samples_per_frame
  3562. Set the number of samples per output frame.
  3563. The expression can contain the following constants:
  3564. @table @option
  3565. @item n
  3566. The (sequential) number of the output audio frame, starting from 0.
  3567. @item pts
  3568. The PTS (Presentation TimeStamp) of the output audio frame,
  3569. expressed in @var{TB} units.
  3570. @item t
  3571. The PTS of the output audio frame, expressed in seconds.
  3572. @item TB
  3573. The timebase of the output audio frames.
  3574. @end table
  3575. Default is @code{1024}.
  3576. @end table
  3577. @subsection Examples
  3578. @itemize
  3579. @item
  3580. Generate a simple 440 Hz sine wave:
  3581. @example
  3582. sine
  3583. @end example
  3584. @item
  3585. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3586. @example
  3587. sine=220:4:d=5
  3588. sine=f=220:b=4:d=5
  3589. sine=frequency=220:beep_factor=4:duration=5
  3590. @end example
  3591. @item
  3592. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3593. pattern:
  3594. @example
  3595. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3596. @end example
  3597. @end itemize
  3598. @c man end AUDIO SOURCES
  3599. @chapter Audio Sinks
  3600. @c man begin AUDIO SINKS
  3601. Below is a description of the currently available audio sinks.
  3602. @section abuffersink
  3603. Buffer audio frames, and make them available to the end of filter chain.
  3604. This sink is mainly intended for programmatic use, in particular
  3605. through the interface defined in @file{libavfilter/buffersink.h}
  3606. or the options system.
  3607. It accepts a pointer to an AVABufferSinkContext structure, which
  3608. defines the incoming buffers' formats, to be passed as the opaque
  3609. parameter to @code{avfilter_init_filter} for initialization.
  3610. @section anullsink
  3611. Null audio sink; do absolutely nothing with the input audio. It is
  3612. mainly useful as a template and for use in analysis / debugging
  3613. tools.
  3614. @c man end AUDIO SINKS
  3615. @chapter Video Filters
  3616. @c man begin VIDEO FILTERS
  3617. When you configure your FFmpeg build, you can disable any of the
  3618. existing filters using @code{--disable-filters}.
  3619. The configure output will show the video filters included in your
  3620. build.
  3621. Below is a description of the currently available video filters.
  3622. @section alphaextract
  3623. Extract the alpha component from the input as a grayscale video. This
  3624. is especially useful with the @var{alphamerge} filter.
  3625. @section alphamerge
  3626. Add or replace the alpha component of the primary input with the
  3627. grayscale value of a second input. This is intended for use with
  3628. @var{alphaextract} to allow the transmission or storage of frame
  3629. sequences that have alpha in a format that doesn't support an alpha
  3630. channel.
  3631. For example, to reconstruct full frames from a normal YUV-encoded video
  3632. and a separate video created with @var{alphaextract}, you might use:
  3633. @example
  3634. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3635. @end example
  3636. Since this filter is designed for reconstruction, it operates on frame
  3637. sequences without considering timestamps, and terminates when either
  3638. input reaches end of stream. This will cause problems if your encoding
  3639. pipeline drops frames. If you're trying to apply an image as an
  3640. overlay to a video stream, consider the @var{overlay} filter instead.
  3641. @section ass
  3642. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3643. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3644. Substation Alpha) subtitles files.
  3645. This filter accepts the following option in addition to the common options from
  3646. the @ref{subtitles} filter:
  3647. @table @option
  3648. @item shaping
  3649. Set the shaping engine
  3650. Available values are:
  3651. @table @samp
  3652. @item auto
  3653. The default libass shaping engine, which is the best available.
  3654. @item simple
  3655. Fast, font-agnostic shaper that can do only substitutions
  3656. @item complex
  3657. Slower shaper using OpenType for substitutions and positioning
  3658. @end table
  3659. The default is @code{auto}.
  3660. @end table
  3661. @section atadenoise
  3662. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3663. The filter accepts the following options:
  3664. @table @option
  3665. @item 0a
  3666. Set threshold A for 1st plane. Default is 0.02.
  3667. Valid range is 0 to 0.3.
  3668. @item 0b
  3669. Set threshold B for 1st plane. Default is 0.04.
  3670. Valid range is 0 to 5.
  3671. @item 1a
  3672. Set threshold A for 2nd plane. Default is 0.02.
  3673. Valid range is 0 to 0.3.
  3674. @item 1b
  3675. Set threshold B for 2nd plane. Default is 0.04.
  3676. Valid range is 0 to 5.
  3677. @item 2a
  3678. Set threshold A for 3rd plane. Default is 0.02.
  3679. Valid range is 0 to 0.3.
  3680. @item 2b
  3681. Set threshold B for 3rd plane. Default is 0.04.
  3682. Valid range is 0 to 5.
  3683. Threshold A is designed to react on abrupt changes in the input signal and
  3684. threshold B is designed to react on continuous changes in the input signal.
  3685. @item s
  3686. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3687. number in range [5, 129].
  3688. @item p
  3689. Set what planes of frame filter will use for averaging. Default is all.
  3690. @end table
  3691. @section avgblur
  3692. Apply average blur filter.
  3693. The filter accepts the following options:
  3694. @table @option
  3695. @item sizeX
  3696. Set horizontal kernel size.
  3697. @item planes
  3698. Set which planes to filter. By default all planes are filtered.
  3699. @item sizeY
  3700. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3701. Default is @code{0}.
  3702. @end table
  3703. @section bbox
  3704. Compute the bounding box for the non-black pixels in the input frame
  3705. luminance plane.
  3706. This filter computes the bounding box containing all the pixels with a
  3707. luminance value greater than the minimum allowed value.
  3708. The parameters describing the bounding box are printed on the filter
  3709. log.
  3710. The filter accepts the following option:
  3711. @table @option
  3712. @item min_val
  3713. Set the minimal luminance value. Default is @code{16}.
  3714. @end table
  3715. @section bitplanenoise
  3716. Show and measure bit plane noise.
  3717. The filter accepts the following options:
  3718. @table @option
  3719. @item bitplane
  3720. Set which plane to analyze. Default is @code{1}.
  3721. @item filter
  3722. Filter out noisy pixels from @code{bitplane} set above.
  3723. Default is disabled.
  3724. @end table
  3725. @section blackdetect
  3726. Detect video intervals that are (almost) completely black. Can be
  3727. useful to detect chapter transitions, commercials, or invalid
  3728. recordings. Output lines contains the time for the start, end and
  3729. duration of the detected black interval expressed in seconds.
  3730. In order to display the output lines, you need to set the loglevel at
  3731. least to the AV_LOG_INFO value.
  3732. The filter accepts the following options:
  3733. @table @option
  3734. @item black_min_duration, d
  3735. Set the minimum detected black duration expressed in seconds. It must
  3736. be a non-negative floating point number.
  3737. Default value is 2.0.
  3738. @item picture_black_ratio_th, pic_th
  3739. Set the threshold for considering a picture "black".
  3740. Express the minimum value for the ratio:
  3741. @example
  3742. @var{nb_black_pixels} / @var{nb_pixels}
  3743. @end example
  3744. for which a picture is considered black.
  3745. Default value is 0.98.
  3746. @item pixel_black_th, pix_th
  3747. Set the threshold for considering a pixel "black".
  3748. The threshold expresses the maximum pixel luminance value for which a
  3749. pixel is considered "black". The provided value is scaled according to
  3750. the following equation:
  3751. @example
  3752. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3753. @end example
  3754. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3755. the input video format, the range is [0-255] for YUV full-range
  3756. formats and [16-235] for YUV non full-range formats.
  3757. Default value is 0.10.
  3758. @end table
  3759. The following example sets the maximum pixel threshold to the minimum
  3760. value, and detects only black intervals of 2 or more seconds:
  3761. @example
  3762. blackdetect=d=2:pix_th=0.00
  3763. @end example
  3764. @section blackframe
  3765. Detect frames that are (almost) completely black. Can be useful to
  3766. detect chapter transitions or commercials. Output lines consist of
  3767. the frame number of the detected frame, the percentage of blackness,
  3768. the position in the file if known or -1 and the timestamp in seconds.
  3769. In order to display the output lines, you need to set the loglevel at
  3770. least to the AV_LOG_INFO value.
  3771. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3772. The value represents the percentage of pixels in the picture that
  3773. are below the threshold value.
  3774. It accepts the following parameters:
  3775. @table @option
  3776. @item amount
  3777. The percentage of the pixels that have to be below the threshold; it defaults to
  3778. @code{98}.
  3779. @item threshold, thresh
  3780. The threshold below which a pixel value is considered black; it defaults to
  3781. @code{32}.
  3782. @end table
  3783. @section blend, tblend
  3784. Blend two video frames into each other.
  3785. The @code{blend} filter takes two input streams and outputs one
  3786. stream, the first input is the "top" layer and second input is
  3787. "bottom" layer. By default, the output terminates when the longest input terminates.
  3788. The @code{tblend} (time blend) filter takes two consecutive frames
  3789. from one single stream, and outputs the result obtained by blending
  3790. the new frame on top of the old frame.
  3791. A description of the accepted options follows.
  3792. @table @option
  3793. @item c0_mode
  3794. @item c1_mode
  3795. @item c2_mode
  3796. @item c3_mode
  3797. @item all_mode
  3798. Set blend mode for specific pixel component or all pixel components in case
  3799. of @var{all_mode}. Default value is @code{normal}.
  3800. Available values for component modes are:
  3801. @table @samp
  3802. @item addition
  3803. @item grainmerge
  3804. @item and
  3805. @item average
  3806. @item burn
  3807. @item darken
  3808. @item difference
  3809. @item grainextract
  3810. @item divide
  3811. @item dodge
  3812. @item freeze
  3813. @item exclusion
  3814. @item extremity
  3815. @item glow
  3816. @item hardlight
  3817. @item hardmix
  3818. @item heat
  3819. @item lighten
  3820. @item linearlight
  3821. @item multiply
  3822. @item multiply128
  3823. @item negation
  3824. @item normal
  3825. @item or
  3826. @item overlay
  3827. @item phoenix
  3828. @item pinlight
  3829. @item reflect
  3830. @item screen
  3831. @item softlight
  3832. @item subtract
  3833. @item vividlight
  3834. @item xor
  3835. @end table
  3836. @item c0_opacity
  3837. @item c1_opacity
  3838. @item c2_opacity
  3839. @item c3_opacity
  3840. @item all_opacity
  3841. Set blend opacity for specific pixel component or all pixel components in case
  3842. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3843. @item c0_expr
  3844. @item c1_expr
  3845. @item c2_expr
  3846. @item c3_expr
  3847. @item all_expr
  3848. Set blend expression for specific pixel component or all pixel components in case
  3849. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3850. The expressions can use the following variables:
  3851. @table @option
  3852. @item N
  3853. The sequential number of the filtered frame, starting from @code{0}.
  3854. @item X
  3855. @item Y
  3856. the coordinates of the current sample
  3857. @item W
  3858. @item H
  3859. the width and height of currently filtered plane
  3860. @item SW
  3861. @item SH
  3862. Width and height scale depending on the currently filtered plane. It is the
  3863. ratio between the corresponding luma plane number of pixels and the current
  3864. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3865. @code{0.5,0.5} for chroma planes.
  3866. @item T
  3867. Time of the current frame, expressed in seconds.
  3868. @item TOP, A
  3869. Value of pixel component at current location for first video frame (top layer).
  3870. @item BOTTOM, B
  3871. Value of pixel component at current location for second video frame (bottom layer).
  3872. @end table
  3873. @end table
  3874. The @code{blend} filter also supports the @ref{framesync} options.
  3875. @subsection Examples
  3876. @itemize
  3877. @item
  3878. Apply transition from bottom layer to top layer in first 10 seconds:
  3879. @example
  3880. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3881. @end example
  3882. @item
  3883. Apply 1x1 checkerboard effect:
  3884. @example
  3885. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3886. @end example
  3887. @item
  3888. Apply uncover left effect:
  3889. @example
  3890. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3891. @end example
  3892. @item
  3893. Apply uncover down effect:
  3894. @example
  3895. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3896. @end example
  3897. @item
  3898. Apply uncover up-left effect:
  3899. @example
  3900. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3901. @end example
  3902. @item
  3903. Split diagonally video and shows top and bottom layer on each side:
  3904. @example
  3905. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3906. @end example
  3907. @item
  3908. Display differences between the current and the previous frame:
  3909. @example
  3910. tblend=all_mode=grainextract
  3911. @end example
  3912. @end itemize
  3913. @section boxblur
  3914. Apply a boxblur algorithm to the input video.
  3915. It accepts the following parameters:
  3916. @table @option
  3917. @item luma_radius, lr
  3918. @item luma_power, lp
  3919. @item chroma_radius, cr
  3920. @item chroma_power, cp
  3921. @item alpha_radius, ar
  3922. @item alpha_power, ap
  3923. @end table
  3924. A description of the accepted options follows.
  3925. @table @option
  3926. @item luma_radius, lr
  3927. @item chroma_radius, cr
  3928. @item alpha_radius, ar
  3929. Set an expression for the box radius in pixels used for blurring the
  3930. corresponding input plane.
  3931. The radius value must be a non-negative number, and must not be
  3932. greater than the value of the expression @code{min(w,h)/2} for the
  3933. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3934. planes.
  3935. Default value for @option{luma_radius} is "2". If not specified,
  3936. @option{chroma_radius} and @option{alpha_radius} default to the
  3937. corresponding value set for @option{luma_radius}.
  3938. The expressions can contain the following constants:
  3939. @table @option
  3940. @item w
  3941. @item h
  3942. The input width and height in pixels.
  3943. @item cw
  3944. @item ch
  3945. The input chroma image width and height in pixels.
  3946. @item hsub
  3947. @item vsub
  3948. The horizontal and vertical chroma subsample values. For example, for the
  3949. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3950. @end table
  3951. @item luma_power, lp
  3952. @item chroma_power, cp
  3953. @item alpha_power, ap
  3954. Specify how many times the boxblur filter is applied to the
  3955. corresponding plane.
  3956. Default value for @option{luma_power} is 2. If not specified,
  3957. @option{chroma_power} and @option{alpha_power} default to the
  3958. corresponding value set for @option{luma_power}.
  3959. A value of 0 will disable the effect.
  3960. @end table
  3961. @subsection Examples
  3962. @itemize
  3963. @item
  3964. Apply a boxblur filter with the luma, chroma, and alpha radii
  3965. set to 2:
  3966. @example
  3967. boxblur=luma_radius=2:luma_power=1
  3968. boxblur=2:1
  3969. @end example
  3970. @item
  3971. Set the luma radius to 2, and alpha and chroma radius to 0:
  3972. @example
  3973. boxblur=2:1:cr=0:ar=0
  3974. @end example
  3975. @item
  3976. Set the luma and chroma radii to a fraction of the video dimension:
  3977. @example
  3978. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3979. @end example
  3980. @end itemize
  3981. @section bwdif
  3982. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3983. Deinterlacing Filter").
  3984. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3985. interpolation algorithms.
  3986. It accepts the following parameters:
  3987. @table @option
  3988. @item mode
  3989. The interlacing mode to adopt. It accepts one of the following values:
  3990. @table @option
  3991. @item 0, send_frame
  3992. Output one frame for each frame.
  3993. @item 1, send_field
  3994. Output one frame for each field.
  3995. @end table
  3996. The default value is @code{send_field}.
  3997. @item parity
  3998. The picture field parity assumed for the input interlaced video. It accepts one
  3999. of the following values:
  4000. @table @option
  4001. @item 0, tff
  4002. Assume the top field is first.
  4003. @item 1, bff
  4004. Assume the bottom field is first.
  4005. @item -1, auto
  4006. Enable automatic detection of field parity.
  4007. @end table
  4008. The default value is @code{auto}.
  4009. If the interlacing is unknown or the decoder does not export this information,
  4010. top field first will be assumed.
  4011. @item deint
  4012. Specify which frames to deinterlace. Accept one of the following
  4013. values:
  4014. @table @option
  4015. @item 0, all
  4016. Deinterlace all frames.
  4017. @item 1, interlaced
  4018. Only deinterlace frames marked as interlaced.
  4019. @end table
  4020. The default value is @code{all}.
  4021. @end table
  4022. @section chromakey
  4023. YUV colorspace color/chroma keying.
  4024. The filter accepts the following options:
  4025. @table @option
  4026. @item color
  4027. The color which will be replaced with transparency.
  4028. @item similarity
  4029. Similarity percentage with the key color.
  4030. 0.01 matches only the exact key color, while 1.0 matches everything.
  4031. @item blend
  4032. Blend percentage.
  4033. 0.0 makes pixels either fully transparent, or not transparent at all.
  4034. Higher values result in semi-transparent pixels, with a higher transparency
  4035. the more similar the pixels color is to the key color.
  4036. @item yuv
  4037. Signals that the color passed is already in YUV instead of RGB.
  4038. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4039. This can be used to pass exact YUV values as hexadecimal numbers.
  4040. @end table
  4041. @subsection Examples
  4042. @itemize
  4043. @item
  4044. Make every green pixel in the input image transparent:
  4045. @example
  4046. ffmpeg -i input.png -vf chromakey=green out.png
  4047. @end example
  4048. @item
  4049. Overlay a greenscreen-video on top of a static black background.
  4050. @example
  4051. 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
  4052. @end example
  4053. @end itemize
  4054. @section ciescope
  4055. Display CIE color diagram with pixels overlaid onto it.
  4056. The filter accepts the following options:
  4057. @table @option
  4058. @item system
  4059. Set color system.
  4060. @table @samp
  4061. @item ntsc, 470m
  4062. @item ebu, 470bg
  4063. @item smpte
  4064. @item 240m
  4065. @item apple
  4066. @item widergb
  4067. @item cie1931
  4068. @item rec709, hdtv
  4069. @item uhdtv, rec2020
  4070. @end table
  4071. @item cie
  4072. Set CIE system.
  4073. @table @samp
  4074. @item xyy
  4075. @item ucs
  4076. @item luv
  4077. @end table
  4078. @item gamuts
  4079. Set what gamuts to draw.
  4080. See @code{system} option for available values.
  4081. @item size, s
  4082. Set ciescope size, by default set to 512.
  4083. @item intensity, i
  4084. Set intensity used to map input pixel values to CIE diagram.
  4085. @item contrast
  4086. Set contrast used to draw tongue colors that are out of active color system gamut.
  4087. @item corrgamma
  4088. Correct gamma displayed on scope, by default enabled.
  4089. @item showwhite
  4090. Show white point on CIE diagram, by default disabled.
  4091. @item gamma
  4092. Set input gamma. Used only with XYZ input color space.
  4093. @end table
  4094. @section codecview
  4095. Visualize information exported by some codecs.
  4096. Some codecs can export information through frames using side-data or other
  4097. means. For example, some MPEG based codecs export motion vectors through the
  4098. @var{export_mvs} flag in the codec @option{flags2} option.
  4099. The filter accepts the following option:
  4100. @table @option
  4101. @item mv
  4102. Set motion vectors to visualize.
  4103. Available flags for @var{mv} are:
  4104. @table @samp
  4105. @item pf
  4106. forward predicted MVs of P-frames
  4107. @item bf
  4108. forward predicted MVs of B-frames
  4109. @item bb
  4110. backward predicted MVs of B-frames
  4111. @end table
  4112. @item qp
  4113. Display quantization parameters using the chroma planes.
  4114. @item mv_type, mvt
  4115. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4116. Available flags for @var{mv_type} are:
  4117. @table @samp
  4118. @item fp
  4119. forward predicted MVs
  4120. @item bp
  4121. backward predicted MVs
  4122. @end table
  4123. @item frame_type, ft
  4124. Set frame type to visualize motion vectors of.
  4125. Available flags for @var{frame_type} are:
  4126. @table @samp
  4127. @item if
  4128. intra-coded frames (I-frames)
  4129. @item pf
  4130. predicted frames (P-frames)
  4131. @item bf
  4132. bi-directionally predicted frames (B-frames)
  4133. @end table
  4134. @end table
  4135. @subsection Examples
  4136. @itemize
  4137. @item
  4138. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4139. @example
  4140. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4141. @end example
  4142. @item
  4143. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4144. @example
  4145. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4146. @end example
  4147. @end itemize
  4148. @section colorbalance
  4149. Modify intensity of primary colors (red, green and blue) of input frames.
  4150. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4151. regions for the red-cyan, green-magenta or blue-yellow balance.
  4152. A positive adjustment value shifts the balance towards the primary color, a negative
  4153. value towards the complementary color.
  4154. The filter accepts the following options:
  4155. @table @option
  4156. @item rs
  4157. @item gs
  4158. @item bs
  4159. Adjust red, green and blue shadows (darkest pixels).
  4160. @item rm
  4161. @item gm
  4162. @item bm
  4163. Adjust red, green and blue midtones (medium pixels).
  4164. @item rh
  4165. @item gh
  4166. @item bh
  4167. Adjust red, green and blue highlights (brightest pixels).
  4168. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4169. @end table
  4170. @subsection Examples
  4171. @itemize
  4172. @item
  4173. Add red color cast to shadows:
  4174. @example
  4175. colorbalance=rs=.3
  4176. @end example
  4177. @end itemize
  4178. @section colorkey
  4179. RGB colorspace color keying.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item color
  4183. The color which will be replaced with transparency.
  4184. @item similarity
  4185. Similarity percentage with the key color.
  4186. 0.01 matches only the exact key color, while 1.0 matches everything.
  4187. @item blend
  4188. Blend percentage.
  4189. 0.0 makes pixels either fully transparent, or not transparent at all.
  4190. Higher values result in semi-transparent pixels, with a higher transparency
  4191. the more similar the pixels color is to the key color.
  4192. @end table
  4193. @subsection Examples
  4194. @itemize
  4195. @item
  4196. Make every green pixel in the input image transparent:
  4197. @example
  4198. ffmpeg -i input.png -vf colorkey=green out.png
  4199. @end example
  4200. @item
  4201. Overlay a greenscreen-video on top of a static background image.
  4202. @example
  4203. 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
  4204. @end example
  4205. @end itemize
  4206. @section colorlevels
  4207. Adjust video input frames using levels.
  4208. The filter accepts the following options:
  4209. @table @option
  4210. @item rimin
  4211. @item gimin
  4212. @item bimin
  4213. @item aimin
  4214. Adjust red, green, blue and alpha input black point.
  4215. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4216. @item rimax
  4217. @item gimax
  4218. @item bimax
  4219. @item aimax
  4220. Adjust red, green, blue and alpha input white point.
  4221. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4222. Input levels are used to lighten highlights (bright tones), darken shadows
  4223. (dark tones), change the balance of bright and dark tones.
  4224. @item romin
  4225. @item gomin
  4226. @item bomin
  4227. @item aomin
  4228. Adjust red, green, blue and alpha output black point.
  4229. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4230. @item romax
  4231. @item gomax
  4232. @item bomax
  4233. @item aomax
  4234. Adjust red, green, blue and alpha output white point.
  4235. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4236. Output levels allows manual selection of a constrained output level range.
  4237. @end table
  4238. @subsection Examples
  4239. @itemize
  4240. @item
  4241. Make video output darker:
  4242. @example
  4243. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4244. @end example
  4245. @item
  4246. Increase contrast:
  4247. @example
  4248. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4249. @end example
  4250. @item
  4251. Make video output lighter:
  4252. @example
  4253. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4254. @end example
  4255. @item
  4256. Increase brightness:
  4257. @example
  4258. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4259. @end example
  4260. @end itemize
  4261. @section colorchannelmixer
  4262. Adjust video input frames by re-mixing color channels.
  4263. This filter modifies a color channel by adding the values associated to
  4264. the other channels of the same pixels. For example if the value to
  4265. modify is red, the output value will be:
  4266. @example
  4267. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4268. @end example
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item rr
  4272. @item rg
  4273. @item rb
  4274. @item ra
  4275. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4276. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4277. @item gr
  4278. @item gg
  4279. @item gb
  4280. @item ga
  4281. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4282. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4283. @item br
  4284. @item bg
  4285. @item bb
  4286. @item ba
  4287. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4288. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4289. @item ar
  4290. @item ag
  4291. @item ab
  4292. @item aa
  4293. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4294. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4295. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4296. @end table
  4297. @subsection Examples
  4298. @itemize
  4299. @item
  4300. Convert source to grayscale:
  4301. @example
  4302. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4303. @end example
  4304. @item
  4305. Simulate sepia tones:
  4306. @example
  4307. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4308. @end example
  4309. @end itemize
  4310. @section colormatrix
  4311. Convert color matrix.
  4312. The filter accepts the following options:
  4313. @table @option
  4314. @item src
  4315. @item dst
  4316. Specify the source and destination color matrix. Both values must be
  4317. specified.
  4318. The accepted values are:
  4319. @table @samp
  4320. @item bt709
  4321. BT.709
  4322. @item fcc
  4323. FCC
  4324. @item bt601
  4325. BT.601
  4326. @item bt470
  4327. BT.470
  4328. @item bt470bg
  4329. BT.470BG
  4330. @item smpte170m
  4331. SMPTE-170M
  4332. @item smpte240m
  4333. SMPTE-240M
  4334. @item bt2020
  4335. BT.2020
  4336. @end table
  4337. @end table
  4338. For example to convert from BT.601 to SMPTE-240M, use the command:
  4339. @example
  4340. colormatrix=bt601:smpte240m
  4341. @end example
  4342. @section colorspace
  4343. Convert colorspace, transfer characteristics or color primaries.
  4344. Input video needs to have an even size.
  4345. The filter accepts the following options:
  4346. @table @option
  4347. @anchor{all}
  4348. @item all
  4349. Specify all color properties at once.
  4350. The accepted values are:
  4351. @table @samp
  4352. @item bt470m
  4353. BT.470M
  4354. @item bt470bg
  4355. BT.470BG
  4356. @item bt601-6-525
  4357. BT.601-6 525
  4358. @item bt601-6-625
  4359. BT.601-6 625
  4360. @item bt709
  4361. BT.709
  4362. @item smpte170m
  4363. SMPTE-170M
  4364. @item smpte240m
  4365. SMPTE-240M
  4366. @item bt2020
  4367. BT.2020
  4368. @end table
  4369. @anchor{space}
  4370. @item space
  4371. Specify output colorspace.
  4372. The accepted values are:
  4373. @table @samp
  4374. @item bt709
  4375. BT.709
  4376. @item fcc
  4377. FCC
  4378. @item bt470bg
  4379. BT.470BG or BT.601-6 625
  4380. @item smpte170m
  4381. SMPTE-170M or BT.601-6 525
  4382. @item smpte240m
  4383. SMPTE-240M
  4384. @item ycgco
  4385. YCgCo
  4386. @item bt2020ncl
  4387. BT.2020 with non-constant luminance
  4388. @end table
  4389. @anchor{trc}
  4390. @item trc
  4391. Specify output transfer characteristics.
  4392. The accepted values are:
  4393. @table @samp
  4394. @item bt709
  4395. BT.709
  4396. @item bt470m
  4397. BT.470M
  4398. @item bt470bg
  4399. BT.470BG
  4400. @item gamma22
  4401. Constant gamma of 2.2
  4402. @item gamma28
  4403. Constant gamma of 2.8
  4404. @item smpte170m
  4405. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4406. @item smpte240m
  4407. SMPTE-240M
  4408. @item srgb
  4409. SRGB
  4410. @item iec61966-2-1
  4411. iec61966-2-1
  4412. @item iec61966-2-4
  4413. iec61966-2-4
  4414. @item xvycc
  4415. xvycc
  4416. @item bt2020-10
  4417. BT.2020 for 10-bits content
  4418. @item bt2020-12
  4419. BT.2020 for 12-bits content
  4420. @end table
  4421. @anchor{primaries}
  4422. @item primaries
  4423. Specify output color primaries.
  4424. The accepted values are:
  4425. @table @samp
  4426. @item bt709
  4427. BT.709
  4428. @item bt470m
  4429. BT.470M
  4430. @item bt470bg
  4431. BT.470BG or BT.601-6 625
  4432. @item smpte170m
  4433. SMPTE-170M or BT.601-6 525
  4434. @item smpte240m
  4435. SMPTE-240M
  4436. @item film
  4437. film
  4438. @item smpte431
  4439. SMPTE-431
  4440. @item smpte432
  4441. SMPTE-432
  4442. @item bt2020
  4443. BT.2020
  4444. @item jedec-p22
  4445. JEDEC P22 phosphors
  4446. @end table
  4447. @anchor{range}
  4448. @item range
  4449. Specify output color range.
  4450. The accepted values are:
  4451. @table @samp
  4452. @item tv
  4453. TV (restricted) range
  4454. @item mpeg
  4455. MPEG (restricted) range
  4456. @item pc
  4457. PC (full) range
  4458. @item jpeg
  4459. JPEG (full) range
  4460. @end table
  4461. @item format
  4462. Specify output color format.
  4463. The accepted values are:
  4464. @table @samp
  4465. @item yuv420p
  4466. YUV 4:2:0 planar 8-bits
  4467. @item yuv420p10
  4468. YUV 4:2:0 planar 10-bits
  4469. @item yuv420p12
  4470. YUV 4:2:0 planar 12-bits
  4471. @item yuv422p
  4472. YUV 4:2:2 planar 8-bits
  4473. @item yuv422p10
  4474. YUV 4:2:2 planar 10-bits
  4475. @item yuv422p12
  4476. YUV 4:2:2 planar 12-bits
  4477. @item yuv444p
  4478. YUV 4:4:4 planar 8-bits
  4479. @item yuv444p10
  4480. YUV 4:4:4 planar 10-bits
  4481. @item yuv444p12
  4482. YUV 4:4:4 planar 12-bits
  4483. @end table
  4484. @item fast
  4485. Do a fast conversion, which skips gamma/primary correction. This will take
  4486. significantly less CPU, but will be mathematically incorrect. To get output
  4487. compatible with that produced by the colormatrix filter, use fast=1.
  4488. @item dither
  4489. Specify dithering mode.
  4490. The accepted values are:
  4491. @table @samp
  4492. @item none
  4493. No dithering
  4494. @item fsb
  4495. Floyd-Steinberg dithering
  4496. @end table
  4497. @item wpadapt
  4498. Whitepoint adaptation mode.
  4499. The accepted values are:
  4500. @table @samp
  4501. @item bradford
  4502. Bradford whitepoint adaptation
  4503. @item vonkries
  4504. von Kries whitepoint adaptation
  4505. @item identity
  4506. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4507. @end table
  4508. @item iall
  4509. Override all input properties at once. Same accepted values as @ref{all}.
  4510. @item ispace
  4511. Override input colorspace. Same accepted values as @ref{space}.
  4512. @item iprimaries
  4513. Override input color primaries. Same accepted values as @ref{primaries}.
  4514. @item itrc
  4515. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4516. @item irange
  4517. Override input color range. Same accepted values as @ref{range}.
  4518. @end table
  4519. The filter converts the transfer characteristics, color space and color
  4520. primaries to the specified user values. The output value, if not specified,
  4521. is set to a default value based on the "all" property. If that property is
  4522. also not specified, the filter will log an error. The output color range and
  4523. format default to the same value as the input color range and format. The
  4524. input transfer characteristics, color space, color primaries and color range
  4525. should be set on the input data. If any of these are missing, the filter will
  4526. log an error and no conversion will take place.
  4527. For example to convert the input to SMPTE-240M, use the command:
  4528. @example
  4529. colorspace=smpte240m
  4530. @end example
  4531. @section convolution
  4532. Apply convolution 3x3 or 5x5 filter.
  4533. The filter accepts the following options:
  4534. @table @option
  4535. @item 0m
  4536. @item 1m
  4537. @item 2m
  4538. @item 3m
  4539. Set matrix for each plane.
  4540. Matrix is sequence of 9 or 25 signed integers.
  4541. @item 0rdiv
  4542. @item 1rdiv
  4543. @item 2rdiv
  4544. @item 3rdiv
  4545. Set multiplier for calculated value for each plane.
  4546. @item 0bias
  4547. @item 1bias
  4548. @item 2bias
  4549. @item 3bias
  4550. Set bias for each plane. This value is added to the result of the multiplication.
  4551. Useful for making the overall image brighter or darker. Default is 0.0.
  4552. @end table
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Apply sharpen:
  4557. @example
  4558. 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"
  4559. @end example
  4560. @item
  4561. Apply blur:
  4562. @example
  4563. 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"
  4564. @end example
  4565. @item
  4566. Apply edge enhance:
  4567. @example
  4568. 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"
  4569. @end example
  4570. @item
  4571. Apply edge detect:
  4572. @example
  4573. 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"
  4574. @end example
  4575. @item
  4576. Apply laplacian edge detector which includes diagonals:
  4577. @example
  4578. 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"
  4579. @end example
  4580. @item
  4581. Apply emboss:
  4582. @example
  4583. 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"
  4584. @end example
  4585. @end itemize
  4586. @section copy
  4587. Copy the input video source unchanged to the output. This is mainly useful for
  4588. testing purposes.
  4589. @anchor{coreimage}
  4590. @section coreimage
  4591. Video filtering on GPU using Apple's CoreImage API on OSX.
  4592. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4593. processed by video hardware. However, software-based OpenGL implementations
  4594. exist which means there is no guarantee for hardware processing. It depends on
  4595. the respective OSX.
  4596. There are many filters and image generators provided by Apple that come with a
  4597. large variety of options. The filter has to be referenced by its name along
  4598. with its options.
  4599. The coreimage filter accepts the following options:
  4600. @table @option
  4601. @item list_filters
  4602. List all available filters and generators along with all their respective
  4603. options as well as possible minimum and maximum values along with the default
  4604. values.
  4605. @example
  4606. list_filters=true
  4607. @end example
  4608. @item filter
  4609. Specify all filters by their respective name and options.
  4610. Use @var{list_filters} to determine all valid filter names and options.
  4611. Numerical options are specified by a float value and are automatically clamped
  4612. to their respective value range. Vector and color options have to be specified
  4613. by a list of space separated float values. Character escaping has to be done.
  4614. A special option name @code{default} is available to use default options for a
  4615. filter.
  4616. It is required to specify either @code{default} or at least one of the filter options.
  4617. All omitted options are used with their default values.
  4618. The syntax of the filter string is as follows:
  4619. @example
  4620. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4621. @end example
  4622. @item output_rect
  4623. Specify a rectangle where the output of the filter chain is copied into the
  4624. input image. It is given by a list of space separated float values:
  4625. @example
  4626. output_rect=x\ y\ width\ height
  4627. @end example
  4628. If not given, the output rectangle equals the dimensions of the input image.
  4629. The output rectangle is automatically cropped at the borders of the input
  4630. image. Negative values are valid for each component.
  4631. @example
  4632. output_rect=25\ 25\ 100\ 100
  4633. @end example
  4634. @end table
  4635. Several filters can be chained for successive processing without GPU-HOST
  4636. transfers allowing for fast processing of complex filter chains.
  4637. Currently, only filters with zero (generators) or exactly one (filters) input
  4638. image and one output image are supported. Also, transition filters are not yet
  4639. usable as intended.
  4640. Some filters generate output images with additional padding depending on the
  4641. respective filter kernel. The padding is automatically removed to ensure the
  4642. filter output has the same size as the input image.
  4643. For image generators, the size of the output image is determined by the
  4644. previous output image of the filter chain or the input image of the whole
  4645. filterchain, respectively. The generators do not use the pixel information of
  4646. this image to generate their output. However, the generated output is
  4647. blended onto this image, resulting in partial or complete coverage of the
  4648. output image.
  4649. The @ref{coreimagesrc} video source can be used for generating input images
  4650. which are directly fed into the filter chain. By using it, providing input
  4651. images by another video source or an input video is not required.
  4652. @subsection Examples
  4653. @itemize
  4654. @item
  4655. List all filters available:
  4656. @example
  4657. coreimage=list_filters=true
  4658. @end example
  4659. @item
  4660. Use the CIBoxBlur filter with default options to blur an image:
  4661. @example
  4662. coreimage=filter=CIBoxBlur@@default
  4663. @end example
  4664. @item
  4665. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4666. its center at 100x100 and a radius of 50 pixels:
  4667. @example
  4668. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4669. @end example
  4670. @item
  4671. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4672. given as complete and escaped command-line for Apple's standard bash shell:
  4673. @example
  4674. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4675. @end example
  4676. @end itemize
  4677. @section crop
  4678. Crop the input video to given dimensions.
  4679. It accepts the following parameters:
  4680. @table @option
  4681. @item w, out_w
  4682. The width of the output video. It defaults to @code{iw}.
  4683. This expression is evaluated only once during the filter
  4684. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4685. @item h, out_h
  4686. The height of the output video. It defaults to @code{ih}.
  4687. This expression is evaluated only once during the filter
  4688. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4689. @item x
  4690. The horizontal position, in the input video, of the left edge of the output
  4691. video. It defaults to @code{(in_w-out_w)/2}.
  4692. This expression is evaluated per-frame.
  4693. @item y
  4694. The vertical position, in the input video, of the top edge of the output video.
  4695. It defaults to @code{(in_h-out_h)/2}.
  4696. This expression is evaluated per-frame.
  4697. @item keep_aspect
  4698. If set to 1 will force the output display aspect ratio
  4699. to be the same of the input, by changing the output sample aspect
  4700. ratio. It defaults to 0.
  4701. @item exact
  4702. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4703. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4704. It defaults to 0.
  4705. @end table
  4706. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4707. expressions containing the following constants:
  4708. @table @option
  4709. @item x
  4710. @item y
  4711. The computed values for @var{x} and @var{y}. They are evaluated for
  4712. each new frame.
  4713. @item in_w
  4714. @item in_h
  4715. The input width and height.
  4716. @item iw
  4717. @item ih
  4718. These are the same as @var{in_w} and @var{in_h}.
  4719. @item out_w
  4720. @item out_h
  4721. The output (cropped) width and height.
  4722. @item ow
  4723. @item oh
  4724. These are the same as @var{out_w} and @var{out_h}.
  4725. @item a
  4726. same as @var{iw} / @var{ih}
  4727. @item sar
  4728. input sample aspect ratio
  4729. @item dar
  4730. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4731. @item hsub
  4732. @item vsub
  4733. horizontal and vertical chroma subsample values. For example for the
  4734. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4735. @item n
  4736. The number of the input frame, starting from 0.
  4737. @item pos
  4738. the position in the file of the input frame, NAN if unknown
  4739. @item t
  4740. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4741. @end table
  4742. The expression for @var{out_w} may depend on the value of @var{out_h},
  4743. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4744. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4745. evaluated after @var{out_w} and @var{out_h}.
  4746. The @var{x} and @var{y} parameters specify the expressions for the
  4747. position of the top-left corner of the output (non-cropped) area. They
  4748. are evaluated for each frame. If the evaluated value is not valid, it
  4749. is approximated to the nearest valid value.
  4750. The expression for @var{x} may depend on @var{y}, and the expression
  4751. for @var{y} may depend on @var{x}.
  4752. @subsection Examples
  4753. @itemize
  4754. @item
  4755. Crop area with size 100x100 at position (12,34).
  4756. @example
  4757. crop=100:100:12:34
  4758. @end example
  4759. Using named options, the example above becomes:
  4760. @example
  4761. crop=w=100:h=100:x=12:y=34
  4762. @end example
  4763. @item
  4764. Crop the central input area with size 100x100:
  4765. @example
  4766. crop=100:100
  4767. @end example
  4768. @item
  4769. Crop the central input area with size 2/3 of the input video:
  4770. @example
  4771. crop=2/3*in_w:2/3*in_h
  4772. @end example
  4773. @item
  4774. Crop the input video central square:
  4775. @example
  4776. crop=out_w=in_h
  4777. crop=in_h
  4778. @end example
  4779. @item
  4780. Delimit the rectangle with the top-left corner placed at position
  4781. 100:100 and the right-bottom corner corresponding to the right-bottom
  4782. corner of the input image.
  4783. @example
  4784. crop=in_w-100:in_h-100:100:100
  4785. @end example
  4786. @item
  4787. Crop 10 pixels from the left and right borders, and 20 pixels from
  4788. the top and bottom borders
  4789. @example
  4790. crop=in_w-2*10:in_h-2*20
  4791. @end example
  4792. @item
  4793. Keep only the bottom right quarter of the input image:
  4794. @example
  4795. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4796. @end example
  4797. @item
  4798. Crop height for getting Greek harmony:
  4799. @example
  4800. crop=in_w:1/PHI*in_w
  4801. @end example
  4802. @item
  4803. Apply trembling effect:
  4804. @example
  4805. 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)
  4806. @end example
  4807. @item
  4808. Apply erratic camera effect depending on timestamp:
  4809. @example
  4810. 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)"
  4811. @end example
  4812. @item
  4813. Set x depending on the value of y:
  4814. @example
  4815. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4816. @end example
  4817. @end itemize
  4818. @subsection Commands
  4819. This filter supports the following commands:
  4820. @table @option
  4821. @item w, out_w
  4822. @item h, out_h
  4823. @item x
  4824. @item y
  4825. Set width/height of the output video and the horizontal/vertical position
  4826. in the input video.
  4827. The command accepts the same syntax of the corresponding option.
  4828. If the specified expression is not valid, it is kept at its current
  4829. value.
  4830. @end table
  4831. @section cropdetect
  4832. Auto-detect the crop size.
  4833. It calculates the necessary cropping parameters and prints the
  4834. recommended parameters via the logging system. The detected dimensions
  4835. correspond to the non-black area of the input video.
  4836. It accepts the following parameters:
  4837. @table @option
  4838. @item limit
  4839. Set higher black value threshold, which can be optionally specified
  4840. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4841. value greater to the set value is considered non-black. It defaults to 24.
  4842. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4843. on the bitdepth of the pixel format.
  4844. @item round
  4845. The value which the width/height should be divisible by. It defaults to
  4846. 16. The offset is automatically adjusted to center the video. Use 2 to
  4847. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4848. encoding to most video codecs.
  4849. @item reset_count, reset
  4850. Set the counter that determines after how many frames cropdetect will
  4851. reset the previously detected largest video area and start over to
  4852. detect the current optimal crop area. Default value is 0.
  4853. This can be useful when channel logos distort the video area. 0
  4854. indicates 'never reset', and returns the largest area encountered during
  4855. playback.
  4856. @end table
  4857. @anchor{curves}
  4858. @section curves
  4859. Apply color adjustments using curves.
  4860. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4861. component (red, green and blue) has its values defined by @var{N} key points
  4862. tied from each other using a smooth curve. The x-axis represents the pixel
  4863. values from the input frame, and the y-axis the new pixel values to be set for
  4864. the output frame.
  4865. By default, a component curve is defined by the two points @var{(0;0)} and
  4866. @var{(1;1)}. This creates a straight line where each original pixel value is
  4867. "adjusted" to its own value, which means no change to the image.
  4868. The filter allows you to redefine these two points and add some more. A new
  4869. curve (using a natural cubic spline interpolation) will be define to pass
  4870. smoothly through all these new coordinates. The new defined points needs to be
  4871. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4872. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4873. the vector spaces, the values will be clipped accordingly.
  4874. The filter accepts the following options:
  4875. @table @option
  4876. @item preset
  4877. Select one of the available color presets. This option can be used in addition
  4878. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4879. options takes priority on the preset values.
  4880. Available presets are:
  4881. @table @samp
  4882. @item none
  4883. @item color_negative
  4884. @item cross_process
  4885. @item darker
  4886. @item increase_contrast
  4887. @item lighter
  4888. @item linear_contrast
  4889. @item medium_contrast
  4890. @item negative
  4891. @item strong_contrast
  4892. @item vintage
  4893. @end table
  4894. Default is @code{none}.
  4895. @item master, m
  4896. Set the master key points. These points will define a second pass mapping. It
  4897. is sometimes called a "luminance" or "value" mapping. It can be used with
  4898. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4899. post-processing LUT.
  4900. @item red, r
  4901. Set the key points for the red component.
  4902. @item green, g
  4903. Set the key points for the green component.
  4904. @item blue, b
  4905. Set the key points for the blue component.
  4906. @item all
  4907. Set the key points for all components (not including master).
  4908. Can be used in addition to the other key points component
  4909. options. In this case, the unset component(s) will fallback on this
  4910. @option{all} setting.
  4911. @item psfile
  4912. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4913. @item plot
  4914. Save Gnuplot script of the curves in specified file.
  4915. @end table
  4916. To avoid some filtergraph syntax conflicts, each key points list need to be
  4917. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4918. @subsection Examples
  4919. @itemize
  4920. @item
  4921. Increase slightly the middle level of blue:
  4922. @example
  4923. curves=blue='0/0 0.5/0.58 1/1'
  4924. @end example
  4925. @item
  4926. Vintage effect:
  4927. @example
  4928. 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'
  4929. @end example
  4930. Here we obtain the following coordinates for each components:
  4931. @table @var
  4932. @item red
  4933. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4934. @item green
  4935. @code{(0;0) (0.50;0.48) (1;1)}
  4936. @item blue
  4937. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4938. @end table
  4939. @item
  4940. The previous example can also be achieved with the associated built-in preset:
  4941. @example
  4942. curves=preset=vintage
  4943. @end example
  4944. @item
  4945. Or simply:
  4946. @example
  4947. curves=vintage
  4948. @end example
  4949. @item
  4950. Use a Photoshop preset and redefine the points of the green component:
  4951. @example
  4952. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4953. @end example
  4954. @item
  4955. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4956. and @command{gnuplot}:
  4957. @example
  4958. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4959. gnuplot -p /tmp/curves.plt
  4960. @end example
  4961. @end itemize
  4962. @section datascope
  4963. Video data analysis filter.
  4964. This filter shows hexadecimal pixel values of part of video.
  4965. The filter accepts the following options:
  4966. @table @option
  4967. @item size, s
  4968. Set output video size.
  4969. @item x
  4970. Set x offset from where to pick pixels.
  4971. @item y
  4972. Set y offset from where to pick pixels.
  4973. @item mode
  4974. Set scope mode, can be one of the following:
  4975. @table @samp
  4976. @item mono
  4977. Draw hexadecimal pixel values with white color on black background.
  4978. @item color
  4979. Draw hexadecimal pixel values with input video pixel color on black
  4980. background.
  4981. @item color2
  4982. Draw hexadecimal pixel values on color background picked from input video,
  4983. the text color is picked in such way so its always visible.
  4984. @end table
  4985. @item axis
  4986. Draw rows and columns numbers on left and top of video.
  4987. @item opacity
  4988. Set background opacity.
  4989. @end table
  4990. @section dctdnoiz
  4991. Denoise frames using 2D DCT (frequency domain filtering).
  4992. This filter is not designed for real time.
  4993. The filter accepts the following options:
  4994. @table @option
  4995. @item sigma, s
  4996. Set the noise sigma constant.
  4997. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4998. coefficient (absolute value) below this threshold with be dropped.
  4999. If you need a more advanced filtering, see @option{expr}.
  5000. Default is @code{0}.
  5001. @item overlap
  5002. Set number overlapping pixels for each block. Since the filter can be slow, you
  5003. may want to reduce this value, at the cost of a less effective filter and the
  5004. risk of various artefacts.
  5005. If the overlapping value doesn't permit processing the whole input width or
  5006. height, a warning will be displayed and according borders won't be denoised.
  5007. Default value is @var{blocksize}-1, which is the best possible setting.
  5008. @item expr, e
  5009. Set the coefficient factor expression.
  5010. For each coefficient of a DCT block, this expression will be evaluated as a
  5011. multiplier value for the coefficient.
  5012. If this is option is set, the @option{sigma} option will be ignored.
  5013. The absolute value of the coefficient can be accessed through the @var{c}
  5014. variable.
  5015. @item n
  5016. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5017. @var{blocksize}, which is the width and height of the processed blocks.
  5018. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5019. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5020. on the speed processing. Also, a larger block size does not necessarily means a
  5021. better de-noising.
  5022. @end table
  5023. @subsection Examples
  5024. Apply a denoise with a @option{sigma} of @code{4.5}:
  5025. @example
  5026. dctdnoiz=4.5
  5027. @end example
  5028. The same operation can be achieved using the expression system:
  5029. @example
  5030. dctdnoiz=e='gte(c, 4.5*3)'
  5031. @end example
  5032. Violent denoise using a block size of @code{16x16}:
  5033. @example
  5034. dctdnoiz=15:n=4
  5035. @end example
  5036. @section deband
  5037. Remove banding artifacts from input video.
  5038. It works by replacing banded pixels with average value of referenced pixels.
  5039. The filter accepts the following options:
  5040. @table @option
  5041. @item 1thr
  5042. @item 2thr
  5043. @item 3thr
  5044. @item 4thr
  5045. Set banding detection threshold for each plane. Default is 0.02.
  5046. Valid range is 0.00003 to 0.5.
  5047. If difference between current pixel and reference pixel is less than threshold,
  5048. it will be considered as banded.
  5049. @item range, r
  5050. Banding detection range in pixels. Default is 16. If positive, random number
  5051. in range 0 to set value will be used. If negative, exact absolute value
  5052. will be used.
  5053. The range defines square of four pixels around current pixel.
  5054. @item direction, d
  5055. Set direction in radians from which four pixel will be compared. If positive,
  5056. random direction from 0 to set direction will be picked. If negative, exact of
  5057. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5058. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5059. column.
  5060. @item blur, b
  5061. If enabled, current pixel is compared with average value of all four
  5062. surrounding pixels. The default is enabled. If disabled current pixel is
  5063. compared with all four surrounding pixels. The pixel is considered banded
  5064. if only all four differences with surrounding pixels are less than threshold.
  5065. @item coupling, c
  5066. If enabled, current pixel is changed if and only if all pixel components are banded,
  5067. e.g. banding detection threshold is triggered for all color components.
  5068. The default is disabled.
  5069. @end table
  5070. @anchor{decimate}
  5071. @section decimate
  5072. Drop duplicated frames at regular intervals.
  5073. The filter accepts the following options:
  5074. @table @option
  5075. @item cycle
  5076. Set the number of frames from which one will be dropped. Setting this to
  5077. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5078. Default is @code{5}.
  5079. @item dupthresh
  5080. Set the threshold for duplicate detection. If the difference metric for a frame
  5081. is less than or equal to this value, then it is declared as duplicate. Default
  5082. is @code{1.1}
  5083. @item scthresh
  5084. Set scene change threshold. Default is @code{15}.
  5085. @item blockx
  5086. @item blocky
  5087. Set the size of the x and y-axis blocks used during metric calculations.
  5088. Larger blocks give better noise suppression, but also give worse detection of
  5089. small movements. Must be a power of two. Default is @code{32}.
  5090. @item ppsrc
  5091. Mark main input as a pre-processed input and activate clean source input
  5092. stream. This allows the input to be pre-processed with various filters to help
  5093. the metrics calculation while keeping the frame selection lossless. When set to
  5094. @code{1}, the first stream is for the pre-processed input, and the second
  5095. stream is the clean source from where the kept frames are chosen. Default is
  5096. @code{0}.
  5097. @item chroma
  5098. Set whether or not chroma is considered in the metric calculations. Default is
  5099. @code{1}.
  5100. @end table
  5101. @section deflate
  5102. Apply deflate effect to the video.
  5103. This filter replaces the pixel by the local(3x3) average by taking into account
  5104. only values lower than the pixel.
  5105. It accepts the following options:
  5106. @table @option
  5107. @item threshold0
  5108. @item threshold1
  5109. @item threshold2
  5110. @item threshold3
  5111. Limit the maximum change for each plane, default is 65535.
  5112. If 0, plane will remain unchanged.
  5113. @end table
  5114. @section deflicker
  5115. Remove temporal frame luminance variations.
  5116. It accepts the following options:
  5117. @table @option
  5118. @item size, s
  5119. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5120. @item mode, m
  5121. Set averaging mode to smooth temporal luminance variations.
  5122. Available values are:
  5123. @table @samp
  5124. @item am
  5125. Arithmetic mean
  5126. @item gm
  5127. Geometric mean
  5128. @item hm
  5129. Harmonic mean
  5130. @item qm
  5131. Quadratic mean
  5132. @item cm
  5133. Cubic mean
  5134. @item pm
  5135. Power mean
  5136. @item median
  5137. Median
  5138. @end table
  5139. @item bypass
  5140. Do not actually modify frame. Useful when one only wants metadata.
  5141. @end table
  5142. @section dejudder
  5143. Remove judder produced by partially interlaced telecined content.
  5144. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5145. source was partially telecined content then the output of @code{pullup,dejudder}
  5146. will have a variable frame rate. May change the recorded frame rate of the
  5147. container. Aside from that change, this filter will not affect constant frame
  5148. rate video.
  5149. The option available in this filter is:
  5150. @table @option
  5151. @item cycle
  5152. Specify the length of the window over which the judder repeats.
  5153. Accepts any integer greater than 1. Useful values are:
  5154. @table @samp
  5155. @item 4
  5156. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5157. @item 5
  5158. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5159. @item 20
  5160. If a mixture of the two.
  5161. @end table
  5162. The default is @samp{4}.
  5163. @end table
  5164. @section delogo
  5165. Suppress a TV station logo by a simple interpolation of the surrounding
  5166. pixels. Just set a rectangle covering the logo and watch it disappear
  5167. (and sometimes something even uglier appear - your mileage may vary).
  5168. It accepts the following parameters:
  5169. @table @option
  5170. @item x
  5171. @item y
  5172. Specify the top left corner coordinates of the logo. They must be
  5173. specified.
  5174. @item w
  5175. @item h
  5176. Specify the width and height of the logo to clear. They must be
  5177. specified.
  5178. @item band, t
  5179. Specify the thickness of the fuzzy edge of the rectangle (added to
  5180. @var{w} and @var{h}). The default value is 1. This option is
  5181. deprecated, setting higher values should no longer be necessary and
  5182. is not recommended.
  5183. @item show
  5184. When set to 1, a green rectangle is drawn on the screen to simplify
  5185. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5186. The default value is 0.
  5187. The rectangle is drawn on the outermost pixels which will be (partly)
  5188. replaced with interpolated values. The values of the next pixels
  5189. immediately outside this rectangle in each direction will be used to
  5190. compute the interpolated pixel values inside the rectangle.
  5191. @end table
  5192. @subsection Examples
  5193. @itemize
  5194. @item
  5195. Set a rectangle covering the area with top left corner coordinates 0,0
  5196. and size 100x77, and a band of size 10:
  5197. @example
  5198. delogo=x=0:y=0:w=100:h=77:band=10
  5199. @end example
  5200. @end itemize
  5201. @section deshake
  5202. Attempt to fix small changes in horizontal and/or vertical shift. This
  5203. filter helps remove camera shake from hand-holding a camera, bumping a
  5204. tripod, moving on a vehicle, etc.
  5205. The filter accepts the following options:
  5206. @table @option
  5207. @item x
  5208. @item y
  5209. @item w
  5210. @item h
  5211. Specify a rectangular area where to limit the search for motion
  5212. vectors.
  5213. If desired the search for motion vectors can be limited to a
  5214. rectangular area of the frame defined by its top left corner, width
  5215. and height. These parameters have the same meaning as the drawbox
  5216. filter which can be used to visualise the position of the bounding
  5217. box.
  5218. This is useful when simultaneous movement of subjects within the frame
  5219. might be confused for camera motion by the motion vector search.
  5220. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5221. then the full frame is used. This allows later options to be set
  5222. without specifying the bounding box for the motion vector search.
  5223. Default - search the whole frame.
  5224. @item rx
  5225. @item ry
  5226. Specify the maximum extent of movement in x and y directions in the
  5227. range 0-64 pixels. Default 16.
  5228. @item edge
  5229. Specify how to generate pixels to fill blanks at the edge of the
  5230. frame. Available values are:
  5231. @table @samp
  5232. @item blank, 0
  5233. Fill zeroes at blank locations
  5234. @item original, 1
  5235. Original image at blank locations
  5236. @item clamp, 2
  5237. Extruded edge value at blank locations
  5238. @item mirror, 3
  5239. Mirrored edge at blank locations
  5240. @end table
  5241. Default value is @samp{mirror}.
  5242. @item blocksize
  5243. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5244. default 8.
  5245. @item contrast
  5246. Specify the contrast threshold for blocks. Only blocks with more than
  5247. the specified contrast (difference between darkest and lightest
  5248. pixels) will be considered. Range 1-255, default 125.
  5249. @item search
  5250. Specify the search strategy. Available values are:
  5251. @table @samp
  5252. @item exhaustive, 0
  5253. Set exhaustive search
  5254. @item less, 1
  5255. Set less exhaustive search.
  5256. @end table
  5257. Default value is @samp{exhaustive}.
  5258. @item filename
  5259. If set then a detailed log of the motion search is written to the
  5260. specified file.
  5261. @item opencl
  5262. If set to 1, specify using OpenCL capabilities, only available if
  5263. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5264. @end table
  5265. @section detelecine
  5266. Apply an exact inverse of the telecine operation. It requires a predefined
  5267. pattern specified using the pattern option which must be the same as that passed
  5268. to the telecine filter.
  5269. This filter accepts the following options:
  5270. @table @option
  5271. @item first_field
  5272. @table @samp
  5273. @item top, t
  5274. top field first
  5275. @item bottom, b
  5276. bottom field first
  5277. The default value is @code{top}.
  5278. @end table
  5279. @item pattern
  5280. A string of numbers representing the pulldown pattern you wish to apply.
  5281. The default value is @code{23}.
  5282. @item start_frame
  5283. A number representing position of the first frame with respect to the telecine
  5284. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5285. @end table
  5286. @section dilation
  5287. Apply dilation effect to the video.
  5288. This filter replaces the pixel by the local(3x3) maximum.
  5289. It accepts the following options:
  5290. @table @option
  5291. @item threshold0
  5292. @item threshold1
  5293. @item threshold2
  5294. @item threshold3
  5295. Limit the maximum change for each plane, default is 65535.
  5296. If 0, plane will remain unchanged.
  5297. @item coordinates
  5298. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5299. pixels are used.
  5300. Flags to local 3x3 coordinates maps like this:
  5301. 1 2 3
  5302. 4 5
  5303. 6 7 8
  5304. @end table
  5305. @section displace
  5306. Displace pixels as indicated by second and third input stream.
  5307. It takes three input streams and outputs one stream, the first input is the
  5308. source, and second and third input are displacement maps.
  5309. The second input specifies how much to displace pixels along the
  5310. x-axis, while the third input specifies how much to displace pixels
  5311. along the y-axis.
  5312. If one of displacement map streams terminates, last frame from that
  5313. displacement map will be used.
  5314. Note that once generated, displacements maps can be reused over and over again.
  5315. A description of the accepted options follows.
  5316. @table @option
  5317. @item edge
  5318. Set displace behavior for pixels that are out of range.
  5319. Available values are:
  5320. @table @samp
  5321. @item blank
  5322. Missing pixels are replaced by black pixels.
  5323. @item smear
  5324. Adjacent pixels will spread out to replace missing pixels.
  5325. @item wrap
  5326. Out of range pixels are wrapped so they point to pixels of other side.
  5327. @end table
  5328. Default is @samp{smear}.
  5329. @end table
  5330. @subsection Examples
  5331. @itemize
  5332. @item
  5333. Add ripple effect to rgb input of video size hd720:
  5334. @example
  5335. 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
  5336. @end example
  5337. @item
  5338. Add wave effect to rgb input of video size hd720:
  5339. @example
  5340. 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
  5341. @end example
  5342. @end itemize
  5343. @section drawbox
  5344. Draw a colored box on the input image.
  5345. It accepts the following parameters:
  5346. @table @option
  5347. @item x
  5348. @item y
  5349. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5350. @item width, w
  5351. @item height, h
  5352. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5353. the input width and height. It defaults to 0.
  5354. @item color, c
  5355. Specify the color of the box to write. For the general syntax of this option,
  5356. check the "Color" section in the ffmpeg-utils manual. If the special
  5357. value @code{invert} is used, the box edge color is the same as the
  5358. video with inverted luma.
  5359. @item thickness, t
  5360. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5361. See below for the list of accepted constants.
  5362. @end table
  5363. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5364. following constants:
  5365. @table @option
  5366. @item dar
  5367. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5368. @item hsub
  5369. @item vsub
  5370. horizontal and vertical chroma subsample values. For example for the
  5371. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5372. @item in_h, ih
  5373. @item in_w, iw
  5374. The input width and height.
  5375. @item sar
  5376. The input sample aspect ratio.
  5377. @item x
  5378. @item y
  5379. The x and y offset coordinates where the box is drawn.
  5380. @item w
  5381. @item h
  5382. The width and height of the drawn box.
  5383. @item t
  5384. The thickness of the drawn box.
  5385. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5386. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5387. @end table
  5388. @subsection Examples
  5389. @itemize
  5390. @item
  5391. Draw a black box around the edge of the input image:
  5392. @example
  5393. drawbox
  5394. @end example
  5395. @item
  5396. Draw a box with color red and an opacity of 50%:
  5397. @example
  5398. drawbox=10:20:200:60:red@@0.5
  5399. @end example
  5400. The previous example can be specified as:
  5401. @example
  5402. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5403. @end example
  5404. @item
  5405. Fill the box with pink color:
  5406. @example
  5407. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5408. @end example
  5409. @item
  5410. Draw a 2-pixel red 2.40:1 mask:
  5411. @example
  5412. 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
  5413. @end example
  5414. @end itemize
  5415. @section drawgrid
  5416. Draw a grid on the input image.
  5417. It accepts the following parameters:
  5418. @table @option
  5419. @item x
  5420. @item y
  5421. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5422. @item width, w
  5423. @item height, h
  5424. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5425. input width and height, respectively, minus @code{thickness}, so image gets
  5426. framed. Default to 0.
  5427. @item color, c
  5428. Specify the color of the grid. For the general syntax of this option,
  5429. check the "Color" section in the ffmpeg-utils manual. If the special
  5430. value @code{invert} is used, the grid color is the same as the
  5431. video with inverted luma.
  5432. @item thickness, t
  5433. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5434. See below for the list of accepted constants.
  5435. @end table
  5436. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5437. following constants:
  5438. @table @option
  5439. @item dar
  5440. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5441. @item hsub
  5442. @item vsub
  5443. horizontal and vertical chroma subsample values. For example for the
  5444. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5445. @item in_h, ih
  5446. @item in_w, iw
  5447. The input grid cell width and height.
  5448. @item sar
  5449. The input sample aspect ratio.
  5450. @item x
  5451. @item y
  5452. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5453. @item w
  5454. @item h
  5455. The width and height of the drawn cell.
  5456. @item t
  5457. The thickness of the drawn cell.
  5458. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5459. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5460. @end table
  5461. @subsection Examples
  5462. @itemize
  5463. @item
  5464. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5465. @example
  5466. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5467. @end example
  5468. @item
  5469. Draw a white 3x3 grid with an opacity of 50%:
  5470. @example
  5471. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5472. @end example
  5473. @end itemize
  5474. @anchor{drawtext}
  5475. @section drawtext
  5476. Draw a text string or text from a specified file on top of a video, using the
  5477. libfreetype library.
  5478. To enable compilation of this filter, you need to configure FFmpeg with
  5479. @code{--enable-libfreetype}.
  5480. To enable default font fallback and the @var{font} option you need to
  5481. configure FFmpeg with @code{--enable-libfontconfig}.
  5482. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5483. @code{--enable-libfribidi}.
  5484. @subsection Syntax
  5485. It accepts the following parameters:
  5486. @table @option
  5487. @item box
  5488. Used to draw a box around text using the background color.
  5489. The value must be either 1 (enable) or 0 (disable).
  5490. The default value of @var{box} is 0.
  5491. @item boxborderw
  5492. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5493. The default value of @var{boxborderw} is 0.
  5494. @item boxcolor
  5495. The color to be used for drawing box around text. For the syntax of this
  5496. option, check the "Color" section in the ffmpeg-utils manual.
  5497. The default value of @var{boxcolor} is "white".
  5498. @item line_spacing
  5499. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5500. The default value of @var{line_spacing} is 0.
  5501. @item borderw
  5502. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5503. The default value of @var{borderw} is 0.
  5504. @item bordercolor
  5505. Set the color to be used for drawing border around text. For the syntax of this
  5506. option, check the "Color" section in the ffmpeg-utils manual.
  5507. The default value of @var{bordercolor} is "black".
  5508. @item expansion
  5509. Select how the @var{text} is expanded. Can be either @code{none},
  5510. @code{strftime} (deprecated) or
  5511. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5512. below for details.
  5513. @item basetime
  5514. Set a start time for the count. Value is in microseconds. Only applied
  5515. in the deprecated strftime expansion mode. To emulate in normal expansion
  5516. mode use the @code{pts} function, supplying the start time (in seconds)
  5517. as the second argument.
  5518. @item fix_bounds
  5519. If true, check and fix text coords to avoid clipping.
  5520. @item fontcolor
  5521. The color to be used for drawing fonts. For the syntax of this option, check
  5522. the "Color" section in the ffmpeg-utils manual.
  5523. The default value of @var{fontcolor} is "black".
  5524. @item fontcolor_expr
  5525. String which is expanded the same way as @var{text} to obtain dynamic
  5526. @var{fontcolor} value. By default this option has empty value and is not
  5527. processed. When this option is set, it overrides @var{fontcolor} option.
  5528. @item font
  5529. The font family to be used for drawing text. By default Sans.
  5530. @item fontfile
  5531. The font file to be used for drawing text. The path must be included.
  5532. This parameter is mandatory if the fontconfig support is disabled.
  5533. @item alpha
  5534. Draw the text applying alpha blending. The value can
  5535. be a number between 0.0 and 1.0.
  5536. The expression accepts the same variables @var{x, y} as well.
  5537. The default value is 1.
  5538. Please see @var{fontcolor_expr}.
  5539. @item fontsize
  5540. The font size to be used for drawing text.
  5541. The default value of @var{fontsize} is 16.
  5542. @item text_shaping
  5543. If set to 1, attempt to shape the text (for example, reverse the order of
  5544. right-to-left text and join Arabic characters) before drawing it.
  5545. Otherwise, just draw the text exactly as given.
  5546. By default 1 (if supported).
  5547. @item ft_load_flags
  5548. The flags to be used for loading the fonts.
  5549. The flags map the corresponding flags supported by libfreetype, and are
  5550. a combination of the following values:
  5551. @table @var
  5552. @item default
  5553. @item no_scale
  5554. @item no_hinting
  5555. @item render
  5556. @item no_bitmap
  5557. @item vertical_layout
  5558. @item force_autohint
  5559. @item crop_bitmap
  5560. @item pedantic
  5561. @item ignore_global_advance_width
  5562. @item no_recurse
  5563. @item ignore_transform
  5564. @item monochrome
  5565. @item linear_design
  5566. @item no_autohint
  5567. @end table
  5568. Default value is "default".
  5569. For more information consult the documentation for the FT_LOAD_*
  5570. libfreetype flags.
  5571. @item shadowcolor
  5572. The color to be used for drawing a shadow behind the drawn text. For the
  5573. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5574. The default value of @var{shadowcolor} is "black".
  5575. @item shadowx
  5576. @item shadowy
  5577. The x and y offsets for the text shadow position with respect to the
  5578. position of the text. They can be either positive or negative
  5579. values. The default value for both is "0".
  5580. @item start_number
  5581. The starting frame number for the n/frame_num variable. The default value
  5582. is "0".
  5583. @item tabsize
  5584. The size in number of spaces to use for rendering the tab.
  5585. Default value is 4.
  5586. @item timecode
  5587. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5588. format. It can be used with or without text parameter. @var{timecode_rate}
  5589. option must be specified.
  5590. @item timecode_rate, rate, r
  5591. Set the timecode frame rate (timecode only).
  5592. @item tc24hmax
  5593. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5594. Default is 0 (disabled).
  5595. @item text
  5596. The text string to be drawn. The text must be a sequence of UTF-8
  5597. encoded characters.
  5598. This parameter is mandatory if no file is specified with the parameter
  5599. @var{textfile}.
  5600. @item textfile
  5601. A text file containing text to be drawn. The text must be a sequence
  5602. of UTF-8 encoded characters.
  5603. This parameter is mandatory if no text string is specified with the
  5604. parameter @var{text}.
  5605. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5606. @item reload
  5607. If set to 1, the @var{textfile} will be reloaded before each frame.
  5608. Be sure to update it atomically, or it may be read partially, or even fail.
  5609. @item x
  5610. @item y
  5611. The expressions which specify the offsets where text will be drawn
  5612. within the video frame. They are relative to the top/left border of the
  5613. output image.
  5614. The default value of @var{x} and @var{y} is "0".
  5615. See below for the list of accepted constants and functions.
  5616. @end table
  5617. The parameters for @var{x} and @var{y} are expressions containing the
  5618. following constants and functions:
  5619. @table @option
  5620. @item dar
  5621. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5622. @item hsub
  5623. @item vsub
  5624. horizontal and vertical chroma subsample values. For example for the
  5625. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5626. @item line_h, lh
  5627. the height of each text line
  5628. @item main_h, h, H
  5629. the input height
  5630. @item main_w, w, W
  5631. the input width
  5632. @item max_glyph_a, ascent
  5633. the maximum distance from the baseline to the highest/upper grid
  5634. coordinate used to place a glyph outline point, for all the rendered
  5635. glyphs.
  5636. It is a positive value, due to the grid's orientation with the Y axis
  5637. upwards.
  5638. @item max_glyph_d, descent
  5639. the maximum distance from the baseline to the lowest grid coordinate
  5640. used to place a glyph outline point, for all the rendered glyphs.
  5641. This is a negative value, due to the grid's orientation, with the Y axis
  5642. upwards.
  5643. @item max_glyph_h
  5644. maximum glyph height, that is the maximum height for all the glyphs
  5645. contained in the rendered text, it is equivalent to @var{ascent} -
  5646. @var{descent}.
  5647. @item max_glyph_w
  5648. maximum glyph width, that is the maximum width for all the glyphs
  5649. contained in the rendered text
  5650. @item n
  5651. the number of input frame, starting from 0
  5652. @item rand(min, max)
  5653. return a random number included between @var{min} and @var{max}
  5654. @item sar
  5655. The input sample aspect ratio.
  5656. @item t
  5657. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5658. @item text_h, th
  5659. the height of the rendered text
  5660. @item text_w, tw
  5661. the width of the rendered text
  5662. @item x
  5663. @item y
  5664. the x and y offset coordinates where the text is drawn.
  5665. These parameters allow the @var{x} and @var{y} expressions to refer
  5666. each other, so you can for example specify @code{y=x/dar}.
  5667. @end table
  5668. @anchor{drawtext_expansion}
  5669. @subsection Text expansion
  5670. If @option{expansion} is set to @code{strftime},
  5671. the filter recognizes strftime() sequences in the provided text and
  5672. expands them accordingly. Check the documentation of strftime(). This
  5673. feature is deprecated.
  5674. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5675. If @option{expansion} is set to @code{normal} (which is the default),
  5676. the following expansion mechanism is used.
  5677. The backslash character @samp{\}, followed by any character, always expands to
  5678. the second character.
  5679. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5680. braces is a function name, possibly followed by arguments separated by ':'.
  5681. If the arguments contain special characters or delimiters (':' or '@}'),
  5682. they should be escaped.
  5683. Note that they probably must also be escaped as the value for the
  5684. @option{text} option in the filter argument string and as the filter
  5685. argument in the filtergraph description, and possibly also for the shell,
  5686. that makes up to four levels of escaping; using a text file avoids these
  5687. problems.
  5688. The following functions are available:
  5689. @table @command
  5690. @item expr, e
  5691. The expression evaluation result.
  5692. It must take one argument specifying the expression to be evaluated,
  5693. which accepts the same constants and functions as the @var{x} and
  5694. @var{y} values. Note that not all constants should be used, for
  5695. example the text size is not known when evaluating the expression, so
  5696. the constants @var{text_w} and @var{text_h} will have an undefined
  5697. value.
  5698. @item expr_int_format, eif
  5699. Evaluate the expression's value and output as formatted integer.
  5700. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5701. The second argument specifies the output format. Allowed values are @samp{x},
  5702. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5703. @code{printf} function.
  5704. The third parameter is optional and sets the number of positions taken by the output.
  5705. It can be used to add padding with zeros from the left.
  5706. @item gmtime
  5707. The time at which the filter is running, expressed in UTC.
  5708. It can accept an argument: a strftime() format string.
  5709. @item localtime
  5710. The time at which the filter is running, expressed in the local time zone.
  5711. It can accept an argument: a strftime() format string.
  5712. @item metadata
  5713. Frame metadata. Takes one or two arguments.
  5714. The first argument is mandatory and specifies the metadata key.
  5715. The second argument is optional and specifies a default value, used when the
  5716. metadata key is not found or empty.
  5717. @item n, frame_num
  5718. The frame number, starting from 0.
  5719. @item pict_type
  5720. A 1 character description of the current picture type.
  5721. @item pts
  5722. The timestamp of the current frame.
  5723. It can take up to three arguments.
  5724. The first argument is the format of the timestamp; it defaults to @code{flt}
  5725. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5726. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5727. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5728. @code{localtime} stands for the timestamp of the frame formatted as
  5729. local time zone time.
  5730. The second argument is an offset added to the timestamp.
  5731. If the format is set to @code{localtime} or @code{gmtime},
  5732. a third argument may be supplied: a strftime() format string.
  5733. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5734. @end table
  5735. @subsection Examples
  5736. @itemize
  5737. @item
  5738. Draw "Test Text" with font FreeSerif, using the default values for the
  5739. optional parameters.
  5740. @example
  5741. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5742. @end example
  5743. @item
  5744. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5745. and y=50 (counting from the top-left corner of the screen), text is
  5746. yellow with a red box around it. Both the text and the box have an
  5747. opacity of 20%.
  5748. @example
  5749. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5750. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5751. @end example
  5752. Note that the double quotes are not necessary if spaces are not used
  5753. within the parameter list.
  5754. @item
  5755. Show the text at the center of the video frame:
  5756. @example
  5757. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5758. @end example
  5759. @item
  5760. Show the text at a random position, switching to a new position every 30 seconds:
  5761. @example
  5762. 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)"
  5763. @end example
  5764. @item
  5765. Show a text line sliding from right to left in the last row of the video
  5766. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5767. with no newlines.
  5768. @example
  5769. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5770. @end example
  5771. @item
  5772. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5773. @example
  5774. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5775. @end example
  5776. @item
  5777. Draw a single green letter "g", at the center of the input video.
  5778. The glyph baseline is placed at half screen height.
  5779. @example
  5780. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5781. @end example
  5782. @item
  5783. Show text for 1 second every 3 seconds:
  5784. @example
  5785. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5786. @end example
  5787. @item
  5788. Use fontconfig to set the font. Note that the colons need to be escaped.
  5789. @example
  5790. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5791. @end example
  5792. @item
  5793. Print the date of a real-time encoding (see strftime(3)):
  5794. @example
  5795. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5796. @end example
  5797. @item
  5798. Show text fading in and out (appearing/disappearing):
  5799. @example
  5800. #!/bin/sh
  5801. DS=1.0 # display start
  5802. DE=10.0 # display end
  5803. FID=1.5 # fade in duration
  5804. FOD=5 # fade out duration
  5805. 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 @}"
  5806. @end example
  5807. @item
  5808. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5809. and the @option{fontsize} value are included in the @option{y} offset.
  5810. @example
  5811. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5812. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5813. @end example
  5814. @end itemize
  5815. For more information about libfreetype, check:
  5816. @url{http://www.freetype.org/}.
  5817. For more information about fontconfig, check:
  5818. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5819. For more information about libfribidi, check:
  5820. @url{http://fribidi.org/}.
  5821. @section edgedetect
  5822. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5823. The filter accepts the following options:
  5824. @table @option
  5825. @item low
  5826. @item high
  5827. Set low and high threshold values used by the Canny thresholding
  5828. algorithm.
  5829. The high threshold selects the "strong" edge pixels, which are then
  5830. connected through 8-connectivity with the "weak" edge pixels selected
  5831. by the low threshold.
  5832. @var{low} and @var{high} threshold values must be chosen in the range
  5833. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5834. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5835. is @code{50/255}.
  5836. @item mode
  5837. Define the drawing mode.
  5838. @table @samp
  5839. @item wires
  5840. Draw white/gray wires on black background.
  5841. @item colormix
  5842. Mix the colors to create a paint/cartoon effect.
  5843. @end table
  5844. Default value is @var{wires}.
  5845. @end table
  5846. @subsection Examples
  5847. @itemize
  5848. @item
  5849. Standard edge detection with custom values for the hysteresis thresholding:
  5850. @example
  5851. edgedetect=low=0.1:high=0.4
  5852. @end example
  5853. @item
  5854. Painting effect without thresholding:
  5855. @example
  5856. edgedetect=mode=colormix:high=0
  5857. @end example
  5858. @end itemize
  5859. @section eq
  5860. Set brightness, contrast, saturation and approximate gamma adjustment.
  5861. The filter accepts the following options:
  5862. @table @option
  5863. @item contrast
  5864. Set the contrast expression. The value must be a float value in range
  5865. @code{-2.0} to @code{2.0}. The default value is "1".
  5866. @item brightness
  5867. Set the brightness expression. The value must be a float value in
  5868. range @code{-1.0} to @code{1.0}. The default value is "0".
  5869. @item saturation
  5870. Set the saturation expression. The value must be a float in
  5871. range @code{0.0} to @code{3.0}. The default value is "1".
  5872. @item gamma
  5873. Set the gamma expression. The value must be a float in range
  5874. @code{0.1} to @code{10.0}. The default value is "1".
  5875. @item gamma_r
  5876. Set the gamma expression for red. The value must be a float in
  5877. range @code{0.1} to @code{10.0}. The default value is "1".
  5878. @item gamma_g
  5879. Set the gamma expression for green. The value must be a float in range
  5880. @code{0.1} to @code{10.0}. The default value is "1".
  5881. @item gamma_b
  5882. Set the gamma expression for blue. The value must be a float in range
  5883. @code{0.1} to @code{10.0}. The default value is "1".
  5884. @item gamma_weight
  5885. Set the gamma weight expression. It can be used to reduce the effect
  5886. of a high gamma value on bright image areas, e.g. keep them from
  5887. getting overamplified and just plain white. The value must be a float
  5888. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5889. gamma correction all the way down while @code{1.0} leaves it at its
  5890. full strength. Default is "1".
  5891. @item eval
  5892. Set when the expressions for brightness, contrast, saturation and
  5893. gamma expressions are evaluated.
  5894. It accepts the following values:
  5895. @table @samp
  5896. @item init
  5897. only evaluate expressions once during the filter initialization or
  5898. when a command is processed
  5899. @item frame
  5900. evaluate expressions for each incoming frame
  5901. @end table
  5902. Default value is @samp{init}.
  5903. @end table
  5904. The expressions accept the following parameters:
  5905. @table @option
  5906. @item n
  5907. frame count of the input frame starting from 0
  5908. @item pos
  5909. byte position of the corresponding packet in the input file, NAN if
  5910. unspecified
  5911. @item r
  5912. frame rate of the input video, NAN if the input frame rate is unknown
  5913. @item t
  5914. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5915. @end table
  5916. @subsection Commands
  5917. The filter supports the following commands:
  5918. @table @option
  5919. @item contrast
  5920. Set the contrast expression.
  5921. @item brightness
  5922. Set the brightness expression.
  5923. @item saturation
  5924. Set the saturation expression.
  5925. @item gamma
  5926. Set the gamma expression.
  5927. @item gamma_r
  5928. Set the gamma_r expression.
  5929. @item gamma_g
  5930. Set gamma_g expression.
  5931. @item gamma_b
  5932. Set gamma_b expression.
  5933. @item gamma_weight
  5934. Set gamma_weight expression.
  5935. The command accepts the same syntax of the corresponding option.
  5936. If the specified expression is not valid, it is kept at its current
  5937. value.
  5938. @end table
  5939. @section erosion
  5940. Apply erosion effect to the video.
  5941. This filter replaces the pixel by the local(3x3) minimum.
  5942. It accepts the following options:
  5943. @table @option
  5944. @item threshold0
  5945. @item threshold1
  5946. @item threshold2
  5947. @item threshold3
  5948. Limit the maximum change for each plane, default is 65535.
  5949. If 0, plane will remain unchanged.
  5950. @item coordinates
  5951. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5952. pixels are used.
  5953. Flags to local 3x3 coordinates maps like this:
  5954. 1 2 3
  5955. 4 5
  5956. 6 7 8
  5957. @end table
  5958. @section extractplanes
  5959. Extract color channel components from input video stream into
  5960. separate grayscale video streams.
  5961. The filter accepts the following option:
  5962. @table @option
  5963. @item planes
  5964. Set plane(s) to extract.
  5965. Available values for planes are:
  5966. @table @samp
  5967. @item y
  5968. @item u
  5969. @item v
  5970. @item a
  5971. @item r
  5972. @item g
  5973. @item b
  5974. @end table
  5975. Choosing planes not available in the input will result in an error.
  5976. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5977. with @code{y}, @code{u}, @code{v} planes at same time.
  5978. @end table
  5979. @subsection Examples
  5980. @itemize
  5981. @item
  5982. Extract luma, u and v color channel component from input video frame
  5983. into 3 grayscale outputs:
  5984. @example
  5985. 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
  5986. @end example
  5987. @end itemize
  5988. @section elbg
  5989. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5990. For each input image, the filter will compute the optimal mapping from
  5991. the input to the output given the codebook length, that is the number
  5992. of distinct output colors.
  5993. This filter accepts the following options.
  5994. @table @option
  5995. @item codebook_length, l
  5996. Set codebook length. The value must be a positive integer, and
  5997. represents the number of distinct output colors. Default value is 256.
  5998. @item nb_steps, n
  5999. Set the maximum number of iterations to apply for computing the optimal
  6000. mapping. The higher the value the better the result and the higher the
  6001. computation time. Default value is 1.
  6002. @item seed, s
  6003. Set a random seed, must be an integer included between 0 and
  6004. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6005. will try to use a good random seed on a best effort basis.
  6006. @item pal8
  6007. Set pal8 output pixel format. This option does not work with codebook
  6008. length greater than 256.
  6009. @end table
  6010. @section fade
  6011. Apply a fade-in/out effect to the input video.
  6012. It accepts the following parameters:
  6013. @table @option
  6014. @item type, t
  6015. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6016. effect.
  6017. Default is @code{in}.
  6018. @item start_frame, s
  6019. Specify the number of the frame to start applying the fade
  6020. effect at. Default is 0.
  6021. @item nb_frames, n
  6022. The number of frames that the fade effect lasts. At the end of the
  6023. fade-in effect, the output video will have the same intensity as the input video.
  6024. At the end of the fade-out transition, the output video will be filled with the
  6025. selected @option{color}.
  6026. Default is 25.
  6027. @item alpha
  6028. If set to 1, fade only alpha channel, if one exists on the input.
  6029. Default value is 0.
  6030. @item start_time, st
  6031. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6032. effect. If both start_frame and start_time are specified, the fade will start at
  6033. whichever comes last. Default is 0.
  6034. @item duration, d
  6035. The number of seconds for which the fade effect has to last. At the end of the
  6036. fade-in effect the output video will have the same intensity as the input video,
  6037. at the end of the fade-out transition the output video will be filled with the
  6038. selected @option{color}.
  6039. If both duration and nb_frames are specified, duration is used. Default is 0
  6040. (nb_frames is used by default).
  6041. @item color, c
  6042. Specify the color of the fade. Default is "black".
  6043. @end table
  6044. @subsection Examples
  6045. @itemize
  6046. @item
  6047. Fade in the first 30 frames of video:
  6048. @example
  6049. fade=in:0:30
  6050. @end example
  6051. The command above is equivalent to:
  6052. @example
  6053. fade=t=in:s=0:n=30
  6054. @end example
  6055. @item
  6056. Fade out the last 45 frames of a 200-frame video:
  6057. @example
  6058. fade=out:155:45
  6059. fade=type=out:start_frame=155:nb_frames=45
  6060. @end example
  6061. @item
  6062. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6063. @example
  6064. fade=in:0:25, fade=out:975:25
  6065. @end example
  6066. @item
  6067. Make the first 5 frames yellow, then fade in from frame 5-24:
  6068. @example
  6069. fade=in:5:20:color=yellow
  6070. @end example
  6071. @item
  6072. Fade in alpha over first 25 frames of video:
  6073. @example
  6074. fade=in:0:25:alpha=1
  6075. @end example
  6076. @item
  6077. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6078. @example
  6079. fade=t=in:st=5.5:d=0.5
  6080. @end example
  6081. @end itemize
  6082. @section fftfilt
  6083. Apply arbitrary expressions to samples in frequency domain
  6084. @table @option
  6085. @item dc_Y
  6086. Adjust the dc value (gain) of the luma plane of the image. The filter
  6087. accepts an integer value in range @code{0} to @code{1000}. The default
  6088. value is set to @code{0}.
  6089. @item dc_U
  6090. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6091. filter accepts an integer value in range @code{0} to @code{1000}. The
  6092. default value is set to @code{0}.
  6093. @item dc_V
  6094. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6095. filter accepts an integer value in range @code{0} to @code{1000}. The
  6096. default value is set to @code{0}.
  6097. @item weight_Y
  6098. Set the frequency domain weight expression for the luma plane.
  6099. @item weight_U
  6100. Set the frequency domain weight expression for the 1st chroma plane.
  6101. @item weight_V
  6102. Set the frequency domain weight expression for the 2nd chroma plane.
  6103. The filter accepts the following variables:
  6104. @item X
  6105. @item Y
  6106. The coordinates of the current sample.
  6107. @item W
  6108. @item H
  6109. The width and height of the image.
  6110. @end table
  6111. @subsection Examples
  6112. @itemize
  6113. @item
  6114. High-pass:
  6115. @example
  6116. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6117. @end example
  6118. @item
  6119. Low-pass:
  6120. @example
  6121. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6122. @end example
  6123. @item
  6124. Sharpen:
  6125. @example
  6126. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6127. @end example
  6128. @item
  6129. Blur:
  6130. @example
  6131. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6132. @end example
  6133. @end itemize
  6134. @section field
  6135. Extract a single field from an interlaced image using stride
  6136. arithmetic to avoid wasting CPU time. The output frames are marked as
  6137. non-interlaced.
  6138. The filter accepts the following options:
  6139. @table @option
  6140. @item type
  6141. Specify whether to extract the top (if the value is @code{0} or
  6142. @code{top}) or the bottom field (if the value is @code{1} or
  6143. @code{bottom}).
  6144. @end table
  6145. @section fieldhint
  6146. Create new frames by copying the top and bottom fields from surrounding frames
  6147. supplied as numbers by the hint file.
  6148. @table @option
  6149. @item hint
  6150. Set file containing hints: absolute/relative frame numbers.
  6151. There must be one line for each frame in a clip. Each line must contain two
  6152. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6153. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6154. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6155. for @code{relative} mode. First number tells from which frame to pick up top
  6156. field and second number tells from which frame to pick up bottom field.
  6157. If optionally followed by @code{+} output frame will be marked as interlaced,
  6158. else if followed by @code{-} output frame will be marked as progressive, else
  6159. it will be marked same as input frame.
  6160. If line starts with @code{#} or @code{;} that line is skipped.
  6161. @item mode
  6162. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6163. @end table
  6164. Example of first several lines of @code{hint} file for @code{relative} mode:
  6165. @example
  6166. 0,0 - # first frame
  6167. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6168. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6169. 1,0 -
  6170. 0,0 -
  6171. 0,0 -
  6172. 1,0 -
  6173. 1,0 -
  6174. 1,0 -
  6175. 0,0 -
  6176. 0,0 -
  6177. 1,0 -
  6178. 1,0 -
  6179. 1,0 -
  6180. 0,0 -
  6181. @end example
  6182. @section fieldmatch
  6183. Field matching filter for inverse telecine. It is meant to reconstruct the
  6184. progressive frames from a telecined stream. The filter does not drop duplicated
  6185. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6186. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6187. The separation of the field matching and the decimation is notably motivated by
  6188. the possibility of inserting a de-interlacing filter fallback between the two.
  6189. If the source has mixed telecined and real interlaced content,
  6190. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6191. But these remaining combed frames will be marked as interlaced, and thus can be
  6192. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6193. In addition to the various configuration options, @code{fieldmatch} can take an
  6194. optional second stream, activated through the @option{ppsrc} option. If
  6195. enabled, the frames reconstruction will be based on the fields and frames from
  6196. this second stream. This allows the first input to be pre-processed in order to
  6197. help the various algorithms of the filter, while keeping the output lossless
  6198. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6199. or brightness/contrast adjustments can help.
  6200. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6201. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6202. which @code{fieldmatch} is based on. While the semantic and usage are very
  6203. close, some behaviour and options names can differ.
  6204. The @ref{decimate} filter currently only works for constant frame rate input.
  6205. If your input has mixed telecined (30fps) and progressive content with a lower
  6206. framerate like 24fps use the following filterchain to produce the necessary cfr
  6207. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6208. The filter accepts the following options:
  6209. @table @option
  6210. @item order
  6211. Specify the assumed field order of the input stream. Available values are:
  6212. @table @samp
  6213. @item auto
  6214. Auto detect parity (use FFmpeg's internal parity value).
  6215. @item bff
  6216. Assume bottom field first.
  6217. @item tff
  6218. Assume top field first.
  6219. @end table
  6220. Note that it is sometimes recommended not to trust the parity announced by the
  6221. stream.
  6222. Default value is @var{auto}.
  6223. @item mode
  6224. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6225. sense that it won't risk creating jerkiness due to duplicate frames when
  6226. possible, but if there are bad edits or blended fields it will end up
  6227. outputting combed frames when a good match might actually exist. On the other
  6228. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6229. but will almost always find a good frame if there is one. The other values are
  6230. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6231. jerkiness and creating duplicate frames versus finding good matches in sections
  6232. with bad edits, orphaned fields, blended fields, etc.
  6233. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6234. Available values are:
  6235. @table @samp
  6236. @item pc
  6237. 2-way matching (p/c)
  6238. @item pc_n
  6239. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6240. @item pc_u
  6241. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6242. @item pc_n_ub
  6243. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6244. still combed (p/c + n + u/b)
  6245. @item pcn
  6246. 3-way matching (p/c/n)
  6247. @item pcn_ub
  6248. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6249. detected as combed (p/c/n + u/b)
  6250. @end table
  6251. The parenthesis at the end indicate the matches that would be used for that
  6252. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6253. @var{top}).
  6254. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6255. the slowest.
  6256. Default value is @var{pc_n}.
  6257. @item ppsrc
  6258. Mark the main input stream as a pre-processed input, and enable the secondary
  6259. input stream as the clean source to pick the fields from. See the filter
  6260. introduction for more details. It is similar to the @option{clip2} feature from
  6261. VFM/TFM.
  6262. Default value is @code{0} (disabled).
  6263. @item field
  6264. Set the field to match from. It is recommended to set this to the same value as
  6265. @option{order} unless you experience matching failures with that setting. In
  6266. certain circumstances changing the field that is used to match from can have a
  6267. large impact on matching performance. Available values are:
  6268. @table @samp
  6269. @item auto
  6270. Automatic (same value as @option{order}).
  6271. @item bottom
  6272. Match from the bottom field.
  6273. @item top
  6274. Match from the top field.
  6275. @end table
  6276. Default value is @var{auto}.
  6277. @item mchroma
  6278. Set whether or not chroma is included during the match comparisons. In most
  6279. cases it is recommended to leave this enabled. You should set this to @code{0}
  6280. only if your clip has bad chroma problems such as heavy rainbowing or other
  6281. artifacts. Setting this to @code{0} could also be used to speed things up at
  6282. the cost of some accuracy.
  6283. Default value is @code{1}.
  6284. @item y0
  6285. @item y1
  6286. These define an exclusion band which excludes the lines between @option{y0} and
  6287. @option{y1} from being included in the field matching decision. An exclusion
  6288. band can be used to ignore subtitles, a logo, or other things that may
  6289. interfere with the matching. @option{y0} sets the starting scan line and
  6290. @option{y1} sets the ending line; all lines in between @option{y0} and
  6291. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6292. @option{y0} and @option{y1} to the same value will disable the feature.
  6293. @option{y0} and @option{y1} defaults to @code{0}.
  6294. @item scthresh
  6295. Set the scene change detection threshold as a percentage of maximum change on
  6296. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6297. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6298. @option{scthresh} is @code{[0.0, 100.0]}.
  6299. Default value is @code{12.0}.
  6300. @item combmatch
  6301. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6302. account the combed scores of matches when deciding what match to use as the
  6303. final match. Available values are:
  6304. @table @samp
  6305. @item none
  6306. No final matching based on combed scores.
  6307. @item sc
  6308. Combed scores are only used when a scene change is detected.
  6309. @item full
  6310. Use combed scores all the time.
  6311. @end table
  6312. Default is @var{sc}.
  6313. @item combdbg
  6314. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6315. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6316. Available values are:
  6317. @table @samp
  6318. @item none
  6319. No forced calculation.
  6320. @item pcn
  6321. Force p/c/n calculations.
  6322. @item pcnub
  6323. Force p/c/n/u/b calculations.
  6324. @end table
  6325. Default value is @var{none}.
  6326. @item cthresh
  6327. This is the area combing threshold used for combed frame detection. This
  6328. essentially controls how "strong" or "visible" combing must be to be detected.
  6329. Larger values mean combing must be more visible and smaller values mean combing
  6330. can be less visible or strong and still be detected. Valid settings are from
  6331. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6332. be detected as combed). This is basically a pixel difference value. A good
  6333. range is @code{[8, 12]}.
  6334. Default value is @code{9}.
  6335. @item chroma
  6336. Sets whether or not chroma is considered in the combed frame decision. Only
  6337. disable this if your source has chroma problems (rainbowing, etc.) that are
  6338. causing problems for the combed frame detection with chroma enabled. Actually,
  6339. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6340. where there is chroma only combing in the source.
  6341. Default value is @code{0}.
  6342. @item blockx
  6343. @item blocky
  6344. Respectively set the x-axis and y-axis size of the window used during combed
  6345. frame detection. This has to do with the size of the area in which
  6346. @option{combpel} pixels are required to be detected as combed for a frame to be
  6347. declared combed. See the @option{combpel} parameter description for more info.
  6348. Possible values are any number that is a power of 2 starting at 4 and going up
  6349. to 512.
  6350. Default value is @code{16}.
  6351. @item combpel
  6352. The number of combed pixels inside any of the @option{blocky} by
  6353. @option{blockx} size blocks on the frame for the frame to be detected as
  6354. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6355. setting controls "how much" combing there must be in any localized area (a
  6356. window defined by the @option{blockx} and @option{blocky} settings) on the
  6357. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6358. which point no frames will ever be detected as combed). This setting is known
  6359. as @option{MI} in TFM/VFM vocabulary.
  6360. Default value is @code{80}.
  6361. @end table
  6362. @anchor{p/c/n/u/b meaning}
  6363. @subsection p/c/n/u/b meaning
  6364. @subsubsection p/c/n
  6365. We assume the following telecined stream:
  6366. @example
  6367. Top fields: 1 2 2 3 4
  6368. Bottom fields: 1 2 3 4 4
  6369. @end example
  6370. The numbers correspond to the progressive frame the fields relate to. Here, the
  6371. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6372. When @code{fieldmatch} is configured to run a matching from bottom
  6373. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6374. @example
  6375. Input stream:
  6376. T 1 2 2 3 4
  6377. B 1 2 3 4 4 <-- matching reference
  6378. Matches: c c n n c
  6379. Output stream:
  6380. T 1 2 3 4 4
  6381. B 1 2 3 4 4
  6382. @end example
  6383. As a result of the field matching, we can see that some frames get duplicated.
  6384. To perform a complete inverse telecine, you need to rely on a decimation filter
  6385. after this operation. See for instance the @ref{decimate} filter.
  6386. The same operation now matching from top fields (@option{field}=@var{top})
  6387. looks like this:
  6388. @example
  6389. Input stream:
  6390. T 1 2 2 3 4 <-- matching reference
  6391. B 1 2 3 4 4
  6392. Matches: c c p p c
  6393. Output stream:
  6394. T 1 2 2 3 4
  6395. B 1 2 2 3 4
  6396. @end example
  6397. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6398. basically, they refer to the frame and field of the opposite parity:
  6399. @itemize
  6400. @item @var{p} matches the field of the opposite parity in the previous frame
  6401. @item @var{c} matches the field of the opposite parity in the current frame
  6402. @item @var{n} matches the field of the opposite parity in the next frame
  6403. @end itemize
  6404. @subsubsection u/b
  6405. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6406. from the opposite parity flag. In the following examples, we assume that we are
  6407. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6408. 'x' is placed above and below each matched fields.
  6409. With bottom matching (@option{field}=@var{bottom}):
  6410. @example
  6411. Match: c p n b u
  6412. x x x x x
  6413. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6414. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6415. x x x x x
  6416. Output frames:
  6417. 2 1 2 2 2
  6418. 2 2 2 1 3
  6419. @end example
  6420. With top matching (@option{field}=@var{top}):
  6421. @example
  6422. Match: c p n b u
  6423. x x x x x
  6424. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6425. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6426. x x x x x
  6427. Output frames:
  6428. 2 2 2 1 2
  6429. 2 1 3 2 2
  6430. @end example
  6431. @subsection Examples
  6432. Simple IVTC of a top field first telecined stream:
  6433. @example
  6434. fieldmatch=order=tff:combmatch=none, decimate
  6435. @end example
  6436. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6437. @example
  6438. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6439. @end example
  6440. @section fieldorder
  6441. Transform the field order of the input video.
  6442. It accepts the following parameters:
  6443. @table @option
  6444. @item order
  6445. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6446. for bottom field first.
  6447. @end table
  6448. The default value is @samp{tff}.
  6449. The transformation is done by shifting the picture content up or down
  6450. by one line, and filling the remaining line with appropriate picture content.
  6451. This method is consistent with most broadcast field order converters.
  6452. If the input video is not flagged as being interlaced, or it is already
  6453. flagged as being of the required output field order, then this filter does
  6454. not alter the incoming video.
  6455. It is very useful when converting to or from PAL DV material,
  6456. which is bottom field first.
  6457. For example:
  6458. @example
  6459. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6460. @end example
  6461. @section fifo, afifo
  6462. Buffer input images and send them when they are requested.
  6463. It is mainly useful when auto-inserted by the libavfilter
  6464. framework.
  6465. It does not take parameters.
  6466. @section find_rect
  6467. Find a rectangular object
  6468. It accepts the following options:
  6469. @table @option
  6470. @item object
  6471. Filepath of the object image, needs to be in gray8.
  6472. @item threshold
  6473. Detection threshold, default is 0.5.
  6474. @item mipmaps
  6475. Number of mipmaps, default is 3.
  6476. @item xmin, ymin, xmax, ymax
  6477. Specifies the rectangle in which to search.
  6478. @end table
  6479. @subsection Examples
  6480. @itemize
  6481. @item
  6482. Generate a representative palette of a given video using @command{ffmpeg}:
  6483. @example
  6484. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6485. @end example
  6486. @end itemize
  6487. @section cover_rect
  6488. Cover a rectangular object
  6489. It accepts the following options:
  6490. @table @option
  6491. @item cover
  6492. Filepath of the optional cover image, needs to be in yuv420.
  6493. @item mode
  6494. Set covering mode.
  6495. It accepts the following values:
  6496. @table @samp
  6497. @item cover
  6498. cover it by the supplied image
  6499. @item blur
  6500. cover it by interpolating the surrounding pixels
  6501. @end table
  6502. Default value is @var{blur}.
  6503. @end table
  6504. @subsection Examples
  6505. @itemize
  6506. @item
  6507. Generate a representative palette of a given video using @command{ffmpeg}:
  6508. @example
  6509. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6510. @end example
  6511. @end itemize
  6512. @section floodfill
  6513. Flood area with values of same pixel components with another values.
  6514. It accepts the following options:
  6515. @table @option
  6516. @item x
  6517. Set pixel x coordinate.
  6518. @item y
  6519. Set pixel y coordinate.
  6520. @item s0
  6521. Set source #0 component value.
  6522. @item s1
  6523. Set source #1 component value.
  6524. @item s2
  6525. Set source #2 component value.
  6526. @item s3
  6527. Set source #3 component value.
  6528. @item d0
  6529. Set destination #0 component value.
  6530. @item d1
  6531. Set destination #1 component value.
  6532. @item d2
  6533. Set destination #2 component value.
  6534. @item d3
  6535. Set destination #3 component value.
  6536. @end table
  6537. @anchor{format}
  6538. @section format
  6539. Convert the input video to one of the specified pixel formats.
  6540. Libavfilter will try to pick one that is suitable as input to
  6541. the next filter.
  6542. It accepts the following parameters:
  6543. @table @option
  6544. @item pix_fmts
  6545. A '|'-separated list of pixel format names, such as
  6546. "pix_fmts=yuv420p|monow|rgb24".
  6547. @end table
  6548. @subsection Examples
  6549. @itemize
  6550. @item
  6551. Convert the input video to the @var{yuv420p} format
  6552. @example
  6553. format=pix_fmts=yuv420p
  6554. @end example
  6555. Convert the input video to any of the formats in the list
  6556. @example
  6557. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6558. @end example
  6559. @end itemize
  6560. @anchor{fps}
  6561. @section fps
  6562. Convert the video to specified constant frame rate by duplicating or dropping
  6563. frames as necessary.
  6564. It accepts the following parameters:
  6565. @table @option
  6566. @item fps
  6567. The desired output frame rate. The default is @code{25}.
  6568. @item round
  6569. Rounding method.
  6570. Possible values are:
  6571. @table @option
  6572. @item zero
  6573. zero round towards 0
  6574. @item inf
  6575. round away from 0
  6576. @item down
  6577. round towards -infinity
  6578. @item up
  6579. round towards +infinity
  6580. @item near
  6581. round to nearest
  6582. @end table
  6583. The default is @code{near}.
  6584. @item start_time
  6585. Assume the first PTS should be the given value, in seconds. This allows for
  6586. padding/trimming at the start of stream. By default, no assumption is made
  6587. about the first frame's expected PTS, so no padding or trimming is done.
  6588. For example, this could be set to 0 to pad the beginning with duplicates of
  6589. the first frame if a video stream starts after the audio stream or to trim any
  6590. frames with a negative PTS.
  6591. @end table
  6592. Alternatively, the options can be specified as a flat string:
  6593. @var{fps}[:@var{round}].
  6594. See also the @ref{setpts} filter.
  6595. @subsection Examples
  6596. @itemize
  6597. @item
  6598. A typical usage in order to set the fps to 25:
  6599. @example
  6600. fps=fps=25
  6601. @end example
  6602. @item
  6603. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6604. @example
  6605. fps=fps=film:round=near
  6606. @end example
  6607. @end itemize
  6608. @section framepack
  6609. Pack two different video streams into a stereoscopic video, setting proper
  6610. metadata on supported codecs. The two views should have the same size and
  6611. framerate and processing will stop when the shorter video ends. Please note
  6612. that you may conveniently adjust view properties with the @ref{scale} and
  6613. @ref{fps} filters.
  6614. It accepts the following parameters:
  6615. @table @option
  6616. @item format
  6617. The desired packing format. Supported values are:
  6618. @table @option
  6619. @item sbs
  6620. The views are next to each other (default).
  6621. @item tab
  6622. The views are on top of each other.
  6623. @item lines
  6624. The views are packed by line.
  6625. @item columns
  6626. The views are packed by column.
  6627. @item frameseq
  6628. The views are temporally interleaved.
  6629. @end table
  6630. @end table
  6631. Some examples:
  6632. @example
  6633. # Convert left and right views into a frame-sequential video
  6634. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6635. # Convert views into a side-by-side video with the same output resolution as the input
  6636. 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
  6637. @end example
  6638. @section framerate
  6639. Change the frame rate by interpolating new video output frames from the source
  6640. frames.
  6641. This filter is not designed to function correctly with interlaced media. If
  6642. you wish to change the frame rate of interlaced media then you are required
  6643. to deinterlace before this filter and re-interlace after this filter.
  6644. A description of the accepted options follows.
  6645. @table @option
  6646. @item fps
  6647. Specify the output frames per second. This option can also be specified
  6648. as a value alone. The default is @code{50}.
  6649. @item interp_start
  6650. Specify the start of a range where the output frame will be created as a
  6651. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6652. the default is @code{15}.
  6653. @item interp_end
  6654. Specify the end of a range where the output frame will be created as a
  6655. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6656. the default is @code{240}.
  6657. @item scene
  6658. Specify the level at which a scene change is detected as a value between
  6659. 0 and 100 to indicate a new scene; a low value reflects a low
  6660. probability for the current frame to introduce a new scene, while a higher
  6661. value means the current frame is more likely to be one.
  6662. The default is @code{7}.
  6663. @item flags
  6664. Specify flags influencing the filter process.
  6665. Available value for @var{flags} is:
  6666. @table @option
  6667. @item scene_change_detect, scd
  6668. Enable scene change detection using the value of the option @var{scene}.
  6669. This flag is enabled by default.
  6670. @end table
  6671. @end table
  6672. @section framestep
  6673. Select one frame every N-th frame.
  6674. This filter accepts the following option:
  6675. @table @option
  6676. @item step
  6677. Select frame after every @code{step} frames.
  6678. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6679. @end table
  6680. @anchor{frei0r}
  6681. @section frei0r
  6682. Apply a frei0r effect to the input video.
  6683. To enable the compilation of this filter, you need to install the frei0r
  6684. header and configure FFmpeg with @code{--enable-frei0r}.
  6685. It accepts the following parameters:
  6686. @table @option
  6687. @item filter_name
  6688. The name of the frei0r effect to load. If the environment variable
  6689. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6690. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6691. Otherwise, the standard frei0r paths are searched, in this order:
  6692. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6693. @file{/usr/lib/frei0r-1/}.
  6694. @item filter_params
  6695. A '|'-separated list of parameters to pass to the frei0r effect.
  6696. @end table
  6697. A frei0r effect parameter can be a boolean (its value is either
  6698. "y" or "n"), a double, a color (specified as
  6699. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6700. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6701. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6702. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6703. The number and types of parameters depend on the loaded effect. If an
  6704. effect parameter is not specified, the default value is set.
  6705. @subsection Examples
  6706. @itemize
  6707. @item
  6708. Apply the distort0r effect, setting the first two double parameters:
  6709. @example
  6710. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6711. @end example
  6712. @item
  6713. Apply the colordistance effect, taking a color as the first parameter:
  6714. @example
  6715. frei0r=colordistance:0.2/0.3/0.4
  6716. frei0r=colordistance:violet
  6717. frei0r=colordistance:0x112233
  6718. @end example
  6719. @item
  6720. Apply the perspective effect, specifying the top left and top right image
  6721. positions:
  6722. @example
  6723. frei0r=perspective:0.2/0.2|0.8/0.2
  6724. @end example
  6725. @end itemize
  6726. For more information, see
  6727. @url{http://frei0r.dyne.org}
  6728. @section fspp
  6729. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6730. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6731. processing filter, one of them is performed once per block, not per pixel.
  6732. This allows for much higher speed.
  6733. The filter accepts the following options:
  6734. @table @option
  6735. @item quality
  6736. Set quality. This option defines the number of levels for averaging. It accepts
  6737. an integer in the range 4-5. Default value is @code{4}.
  6738. @item qp
  6739. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6740. If not set, the filter will use the QP from the video stream (if available).
  6741. @item strength
  6742. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6743. more details but also more artifacts, while higher values make the image smoother
  6744. but also blurrier. Default value is @code{0} − PSNR optimal.
  6745. @item use_bframe_qp
  6746. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6747. option may cause flicker since the B-Frames have often larger QP. Default is
  6748. @code{0} (not enabled).
  6749. @end table
  6750. @section gblur
  6751. Apply Gaussian blur filter.
  6752. The filter accepts the following options:
  6753. @table @option
  6754. @item sigma
  6755. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6756. @item steps
  6757. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6758. @item planes
  6759. Set which planes to filter. By default all planes are filtered.
  6760. @item sigmaV
  6761. Set vertical sigma, if negative it will be same as @code{sigma}.
  6762. Default is @code{-1}.
  6763. @end table
  6764. @section geq
  6765. The filter accepts the following options:
  6766. @table @option
  6767. @item lum_expr, lum
  6768. Set the luminance expression.
  6769. @item cb_expr, cb
  6770. Set the chrominance blue expression.
  6771. @item cr_expr, cr
  6772. Set the chrominance red expression.
  6773. @item alpha_expr, a
  6774. Set the alpha expression.
  6775. @item red_expr, r
  6776. Set the red expression.
  6777. @item green_expr, g
  6778. Set the green expression.
  6779. @item blue_expr, b
  6780. Set the blue expression.
  6781. @end table
  6782. The colorspace is selected according to the specified options. If one
  6783. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6784. options is specified, the filter will automatically select a YCbCr
  6785. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6786. @option{blue_expr} options is specified, it will select an RGB
  6787. colorspace.
  6788. If one of the chrominance expression is not defined, it falls back on the other
  6789. one. If no alpha expression is specified it will evaluate to opaque value.
  6790. If none of chrominance expressions are specified, they will evaluate
  6791. to the luminance expression.
  6792. The expressions can use the following variables and functions:
  6793. @table @option
  6794. @item N
  6795. The sequential number of the filtered frame, starting from @code{0}.
  6796. @item X
  6797. @item Y
  6798. The coordinates of the current sample.
  6799. @item W
  6800. @item H
  6801. The width and height of the image.
  6802. @item SW
  6803. @item SH
  6804. Width and height scale depending on the currently filtered plane. It is the
  6805. ratio between the corresponding luma plane number of pixels and the current
  6806. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6807. @code{0.5,0.5} for chroma planes.
  6808. @item T
  6809. Time of the current frame, expressed in seconds.
  6810. @item p(x, y)
  6811. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6812. plane.
  6813. @item lum(x, y)
  6814. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6815. plane.
  6816. @item cb(x, y)
  6817. Return the value of the pixel at location (@var{x},@var{y}) of the
  6818. blue-difference chroma plane. Return 0 if there is no such plane.
  6819. @item cr(x, y)
  6820. Return the value of the pixel at location (@var{x},@var{y}) of the
  6821. red-difference chroma plane. Return 0 if there is no such plane.
  6822. @item r(x, y)
  6823. @item g(x, y)
  6824. @item b(x, y)
  6825. Return the value of the pixel at location (@var{x},@var{y}) of the
  6826. red/green/blue component. Return 0 if there is no such component.
  6827. @item alpha(x, y)
  6828. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6829. plane. Return 0 if there is no such plane.
  6830. @end table
  6831. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6832. automatically clipped to the closer edge.
  6833. @subsection Examples
  6834. @itemize
  6835. @item
  6836. Flip the image horizontally:
  6837. @example
  6838. geq=p(W-X\,Y)
  6839. @end example
  6840. @item
  6841. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6842. wavelength of 100 pixels:
  6843. @example
  6844. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6845. @end example
  6846. @item
  6847. Generate a fancy enigmatic moving light:
  6848. @example
  6849. 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
  6850. @end example
  6851. @item
  6852. Generate a quick emboss effect:
  6853. @example
  6854. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6855. @end example
  6856. @item
  6857. Modify RGB components depending on pixel position:
  6858. @example
  6859. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6860. @end example
  6861. @item
  6862. Create a radial gradient that is the same size as the input (also see
  6863. the @ref{vignette} filter):
  6864. @example
  6865. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6866. @end example
  6867. @end itemize
  6868. @section gradfun
  6869. Fix the banding artifacts that are sometimes introduced into nearly flat
  6870. regions by truncation to 8-bit color depth.
  6871. Interpolate the gradients that should go where the bands are, and
  6872. dither them.
  6873. It is designed for playback only. Do not use it prior to
  6874. lossy compression, because compression tends to lose the dither and
  6875. bring back the bands.
  6876. It accepts the following parameters:
  6877. @table @option
  6878. @item strength
  6879. The maximum amount by which the filter will change any one pixel. This is also
  6880. the threshold for detecting nearly flat regions. Acceptable values range from
  6881. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6882. valid range.
  6883. @item radius
  6884. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6885. gradients, but also prevents the filter from modifying the pixels near detailed
  6886. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6887. values will be clipped to the valid range.
  6888. @end table
  6889. Alternatively, the options can be specified as a flat string:
  6890. @var{strength}[:@var{radius}]
  6891. @subsection Examples
  6892. @itemize
  6893. @item
  6894. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6895. @example
  6896. gradfun=3.5:8
  6897. @end example
  6898. @item
  6899. Specify radius, omitting the strength (which will fall-back to the default
  6900. value):
  6901. @example
  6902. gradfun=radius=8
  6903. @end example
  6904. @end itemize
  6905. @anchor{haldclut}
  6906. @section haldclut
  6907. Apply a Hald CLUT to a video stream.
  6908. First input is the video stream to process, and second one is the Hald CLUT.
  6909. The Hald CLUT input can be a simple picture or a complete video stream.
  6910. The filter accepts the following options:
  6911. @table @option
  6912. @item shortest
  6913. Force termination when the shortest input terminates. Default is @code{0}.
  6914. @item repeatlast
  6915. Continue applying the last CLUT after the end of the stream. A value of
  6916. @code{0} disable the filter after the last frame of the CLUT is reached.
  6917. Default is @code{1}.
  6918. @end table
  6919. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6920. filters share the same internals).
  6921. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6922. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6923. @subsection Workflow examples
  6924. @subsubsection Hald CLUT video stream
  6925. Generate an identity Hald CLUT stream altered with various effects:
  6926. @example
  6927. 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
  6928. @end example
  6929. Note: make sure you use a lossless codec.
  6930. Then use it with @code{haldclut} to apply it on some random stream:
  6931. @example
  6932. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6933. @end example
  6934. The Hald CLUT will be applied to the 10 first seconds (duration of
  6935. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6936. to the remaining frames of the @code{mandelbrot} stream.
  6937. @subsubsection Hald CLUT with preview
  6938. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6939. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6940. biggest possible square starting at the top left of the picture. The remaining
  6941. padding pixels (bottom or right) will be ignored. This area can be used to add
  6942. a preview of the Hald CLUT.
  6943. Typically, the following generated Hald CLUT will be supported by the
  6944. @code{haldclut} filter:
  6945. @example
  6946. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6947. pad=iw+320 [padded_clut];
  6948. smptebars=s=320x256, split [a][b];
  6949. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6950. [main][b] overlay=W-320" -frames:v 1 clut.png
  6951. @end example
  6952. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6953. bars are displayed on the right-top, and below the same color bars processed by
  6954. the color changes.
  6955. Then, the effect of this Hald CLUT can be visualized with:
  6956. @example
  6957. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6958. @end example
  6959. @section hflip
  6960. Flip the input video horizontally.
  6961. For example, to horizontally flip the input video with @command{ffmpeg}:
  6962. @example
  6963. ffmpeg -i in.avi -vf "hflip" out.avi
  6964. @end example
  6965. @section histeq
  6966. This filter applies a global color histogram equalization on a
  6967. per-frame basis.
  6968. It can be used to correct video that has a compressed range of pixel
  6969. intensities. The filter redistributes the pixel intensities to
  6970. equalize their distribution across the intensity range. It may be
  6971. viewed as an "automatically adjusting contrast filter". This filter is
  6972. useful only for correcting degraded or poorly captured source
  6973. video.
  6974. The filter accepts the following options:
  6975. @table @option
  6976. @item strength
  6977. Determine the amount of equalization to be applied. As the strength
  6978. is reduced, the distribution of pixel intensities more-and-more
  6979. approaches that of the input frame. The value must be a float number
  6980. in the range [0,1] and defaults to 0.200.
  6981. @item intensity
  6982. Set the maximum intensity that can generated and scale the output
  6983. values appropriately. The strength should be set as desired and then
  6984. the intensity can be limited if needed to avoid washing-out. The value
  6985. must be a float number in the range [0,1] and defaults to 0.210.
  6986. @item antibanding
  6987. Set the antibanding level. If enabled the filter will randomly vary
  6988. the luminance of output pixels by a small amount to avoid banding of
  6989. the histogram. Possible values are @code{none}, @code{weak} or
  6990. @code{strong}. It defaults to @code{none}.
  6991. @end table
  6992. @section histogram
  6993. Compute and draw a color distribution histogram for the input video.
  6994. The computed histogram is a representation of the color component
  6995. distribution in an image.
  6996. Standard histogram displays the color components distribution in an image.
  6997. Displays color graph for each color component. Shows distribution of
  6998. the Y, U, V, A or R, G, B components, depending on input format, in the
  6999. current frame. Below each graph a color component scale meter is shown.
  7000. The filter accepts the following options:
  7001. @table @option
  7002. @item level_height
  7003. Set height of level. Default value is @code{200}.
  7004. Allowed range is [50, 2048].
  7005. @item scale_height
  7006. Set height of color scale. Default value is @code{12}.
  7007. Allowed range is [0, 40].
  7008. @item display_mode
  7009. Set display mode.
  7010. It accepts the following values:
  7011. @table @samp
  7012. @item stack
  7013. Per color component graphs are placed below each other.
  7014. @item parade
  7015. Per color component graphs are placed side by side.
  7016. @item overlay
  7017. Presents information identical to that in the @code{parade}, except
  7018. that the graphs representing color components are superimposed directly
  7019. over one another.
  7020. @end table
  7021. Default is @code{stack}.
  7022. @item levels_mode
  7023. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7024. Default is @code{linear}.
  7025. @item components
  7026. Set what color components to display.
  7027. Default is @code{7}.
  7028. @item fgopacity
  7029. Set foreground opacity. Default is @code{0.7}.
  7030. @item bgopacity
  7031. Set background opacity. Default is @code{0.5}.
  7032. @end table
  7033. @subsection Examples
  7034. @itemize
  7035. @item
  7036. Calculate and draw histogram:
  7037. @example
  7038. ffplay -i input -vf histogram
  7039. @end example
  7040. @end itemize
  7041. @anchor{hqdn3d}
  7042. @section hqdn3d
  7043. This is a high precision/quality 3d denoise filter. It aims to reduce
  7044. image noise, producing smooth images and making still images really
  7045. still. It should enhance compressibility.
  7046. It accepts the following optional parameters:
  7047. @table @option
  7048. @item luma_spatial
  7049. A non-negative floating point number which specifies spatial luma strength.
  7050. It defaults to 4.0.
  7051. @item chroma_spatial
  7052. A non-negative floating point number which specifies spatial chroma strength.
  7053. It defaults to 3.0*@var{luma_spatial}/4.0.
  7054. @item luma_tmp
  7055. A floating point number which specifies luma temporal strength. It defaults to
  7056. 6.0*@var{luma_spatial}/4.0.
  7057. @item chroma_tmp
  7058. A floating point number which specifies chroma temporal strength. It defaults to
  7059. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7060. @end table
  7061. @section hwdownload
  7062. Download hardware frames to system memory.
  7063. The input must be in hardware frames, and the output a non-hardware format.
  7064. Not all formats will be supported on the output - it may be necessary to insert
  7065. an additional @option{format} filter immediately following in the graph to get
  7066. the output in a supported format.
  7067. @section hwmap
  7068. Map hardware frames to system memory or to another device.
  7069. This filter has several different modes of operation; which one is used depends
  7070. on the input and output formats:
  7071. @itemize
  7072. @item
  7073. Hardware frame input, normal frame output
  7074. Map the input frames to system memory and pass them to the output. If the
  7075. original hardware frame is later required (for example, after overlaying
  7076. something else on part of it), the @option{hwmap} filter can be used again
  7077. in the next mode to retrieve it.
  7078. @item
  7079. Normal frame input, hardware frame output
  7080. If the input is actually a software-mapped hardware frame, then unmap it -
  7081. that is, return the original hardware frame.
  7082. Otherwise, a device must be provided. Create new hardware surfaces on that
  7083. device for the output, then map them back to the software format at the input
  7084. and give those frames to the preceding filter. This will then act like the
  7085. @option{hwupload} filter, but may be able to avoid an additional copy when
  7086. the input is already in a compatible format.
  7087. @item
  7088. Hardware frame input and output
  7089. A device must be supplied for the output, either directly or with the
  7090. @option{derive_device} option. The input and output devices must be of
  7091. different types and compatible - the exact meaning of this is
  7092. system-dependent, but typically it means that they must refer to the same
  7093. underlying hardware context (for example, refer to the same graphics card).
  7094. If the input frames were originally created on the output device, then unmap
  7095. to retrieve the original frames.
  7096. Otherwise, map the frames to the output device - create new hardware frames
  7097. on the output corresponding to the frames on the input.
  7098. @end itemize
  7099. The following additional parameters are accepted:
  7100. @table @option
  7101. @item mode
  7102. Set the frame mapping mode. Some combination of:
  7103. @table @var
  7104. @item read
  7105. The mapped frame should be readable.
  7106. @item write
  7107. The mapped frame should be writeable.
  7108. @item overwrite
  7109. The mapping will always overwrite the entire frame.
  7110. This may improve performance in some cases, as the original contents of the
  7111. frame need not be loaded.
  7112. @item direct
  7113. The mapping must not involve any copying.
  7114. Indirect mappings to copies of frames are created in some cases where either
  7115. direct mapping is not possible or it would have unexpected properties.
  7116. Setting this flag ensures that the mapping is direct and will fail if that is
  7117. not possible.
  7118. @end table
  7119. Defaults to @var{read+write} if not specified.
  7120. @item derive_device @var{type}
  7121. Rather than using the device supplied at initialisation, instead derive a new
  7122. device of type @var{type} from the device the input frames exist on.
  7123. @item reverse
  7124. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7125. and map them back to the source. This may be necessary in some cases where
  7126. a mapping in one direction is required but only the opposite direction is
  7127. supported by the devices being used.
  7128. This option is dangerous - it may break the preceding filter in undefined
  7129. ways if there are any additional constraints on that filter's output.
  7130. Do not use it without fully understanding the implications of its use.
  7131. @end table
  7132. @section hwupload
  7133. Upload system memory frames to hardware surfaces.
  7134. The device to upload to must be supplied when the filter is initialised. If
  7135. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7136. option.
  7137. @anchor{hwupload_cuda}
  7138. @section hwupload_cuda
  7139. Upload system memory frames to a CUDA device.
  7140. It accepts the following optional parameters:
  7141. @table @option
  7142. @item device
  7143. The number of the CUDA device to use
  7144. @end table
  7145. @section hqx
  7146. Apply a high-quality magnification filter designed for pixel art. This filter
  7147. was originally created by Maxim Stepin.
  7148. It accepts the following option:
  7149. @table @option
  7150. @item n
  7151. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7152. @code{hq3x} and @code{4} for @code{hq4x}.
  7153. Default is @code{3}.
  7154. @end table
  7155. @section hstack
  7156. Stack input videos horizontally.
  7157. All streams must be of same pixel format and of same height.
  7158. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7159. to create same output.
  7160. The filter accept the following option:
  7161. @table @option
  7162. @item inputs
  7163. Set number of input streams. Default is 2.
  7164. @item shortest
  7165. If set to 1, force the output to terminate when the shortest input
  7166. terminates. Default value is 0.
  7167. @end table
  7168. @section hue
  7169. Modify the hue and/or the saturation of the input.
  7170. It accepts the following parameters:
  7171. @table @option
  7172. @item h
  7173. Specify the hue angle as a number of degrees. It accepts an expression,
  7174. and defaults to "0".
  7175. @item s
  7176. Specify the saturation in the [-10,10] range. It accepts an expression and
  7177. defaults to "1".
  7178. @item H
  7179. Specify the hue angle as a number of radians. It accepts an
  7180. expression, and defaults to "0".
  7181. @item b
  7182. Specify the brightness in the [-10,10] range. It accepts an expression and
  7183. defaults to "0".
  7184. @end table
  7185. @option{h} and @option{H} are mutually exclusive, and can't be
  7186. specified at the same time.
  7187. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7188. expressions containing the following constants:
  7189. @table @option
  7190. @item n
  7191. frame count of the input frame starting from 0
  7192. @item pts
  7193. presentation timestamp of the input frame expressed in time base units
  7194. @item r
  7195. frame rate of the input video, NAN if the input frame rate is unknown
  7196. @item t
  7197. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7198. @item tb
  7199. time base of the input video
  7200. @end table
  7201. @subsection Examples
  7202. @itemize
  7203. @item
  7204. Set the hue to 90 degrees and the saturation to 1.0:
  7205. @example
  7206. hue=h=90:s=1
  7207. @end example
  7208. @item
  7209. Same command but expressing the hue in radians:
  7210. @example
  7211. hue=H=PI/2:s=1
  7212. @end example
  7213. @item
  7214. Rotate hue and make the saturation swing between 0
  7215. and 2 over a period of 1 second:
  7216. @example
  7217. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7218. @end example
  7219. @item
  7220. Apply a 3 seconds saturation fade-in effect starting at 0:
  7221. @example
  7222. hue="s=min(t/3\,1)"
  7223. @end example
  7224. The general fade-in expression can be written as:
  7225. @example
  7226. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7227. @end example
  7228. @item
  7229. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7230. @example
  7231. hue="s=max(0\, min(1\, (8-t)/3))"
  7232. @end example
  7233. The general fade-out expression can be written as:
  7234. @example
  7235. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7236. @end example
  7237. @end itemize
  7238. @subsection Commands
  7239. This filter supports the following commands:
  7240. @table @option
  7241. @item b
  7242. @item s
  7243. @item h
  7244. @item H
  7245. Modify the hue and/or the saturation and/or brightness of the input video.
  7246. The command accepts the same syntax of the corresponding option.
  7247. If the specified expression is not valid, it is kept at its current
  7248. value.
  7249. @end table
  7250. @section hysteresis
  7251. Grow first stream into second stream by connecting components.
  7252. This makes it possible to build more robust edge masks.
  7253. This filter accepts the following options:
  7254. @table @option
  7255. @item planes
  7256. Set which planes will be processed as bitmap, unprocessed planes will be
  7257. copied from first stream.
  7258. By default value 0xf, all planes will be processed.
  7259. @item threshold
  7260. Set threshold which is used in filtering. If pixel component value is higher than
  7261. this value filter algorithm for connecting components is activated.
  7262. By default value is 0.
  7263. @end table
  7264. @section idet
  7265. Detect video interlacing type.
  7266. This filter tries to detect if the input frames are interlaced, progressive,
  7267. top or bottom field first. It will also try to detect fields that are
  7268. repeated between adjacent frames (a sign of telecine).
  7269. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7270. Multiple frame detection incorporates the classification history of previous frames.
  7271. The filter will log these metadata values:
  7272. @table @option
  7273. @item single.current_frame
  7274. Detected type of current frame using single-frame detection. One of:
  7275. ``tff'' (top field first), ``bff'' (bottom field first),
  7276. ``progressive'', or ``undetermined''
  7277. @item single.tff
  7278. Cumulative number of frames detected as top field first using single-frame detection.
  7279. @item multiple.tff
  7280. Cumulative number of frames detected as top field first using multiple-frame detection.
  7281. @item single.bff
  7282. Cumulative number of frames detected as bottom field first using single-frame detection.
  7283. @item multiple.current_frame
  7284. Detected type of current frame using multiple-frame detection. One of:
  7285. ``tff'' (top field first), ``bff'' (bottom field first),
  7286. ``progressive'', or ``undetermined''
  7287. @item multiple.bff
  7288. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7289. @item single.progressive
  7290. Cumulative number of frames detected as progressive using single-frame detection.
  7291. @item multiple.progressive
  7292. Cumulative number of frames detected as progressive using multiple-frame detection.
  7293. @item single.undetermined
  7294. Cumulative number of frames that could not be classified using single-frame detection.
  7295. @item multiple.undetermined
  7296. Cumulative number of frames that could not be classified using multiple-frame detection.
  7297. @item repeated.current_frame
  7298. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7299. @item repeated.neither
  7300. Cumulative number of frames with no repeated field.
  7301. @item repeated.top
  7302. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7303. @item repeated.bottom
  7304. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7305. @end table
  7306. The filter accepts the following options:
  7307. @table @option
  7308. @item intl_thres
  7309. Set interlacing threshold.
  7310. @item prog_thres
  7311. Set progressive threshold.
  7312. @item rep_thres
  7313. Threshold for repeated field detection.
  7314. @item half_life
  7315. Number of frames after which a given frame's contribution to the
  7316. statistics is halved (i.e., it contributes only 0.5 to its
  7317. classification). The default of 0 means that all frames seen are given
  7318. full weight of 1.0 forever.
  7319. @item analyze_interlaced_flag
  7320. When this is not 0 then idet will use the specified number of frames to determine
  7321. if the interlaced flag is accurate, it will not count undetermined frames.
  7322. If the flag is found to be accurate it will be used without any further
  7323. computations, if it is found to be inaccurate it will be cleared without any
  7324. further computations. This allows inserting the idet filter as a low computational
  7325. method to clean up the interlaced flag
  7326. @end table
  7327. @section il
  7328. Deinterleave or interleave fields.
  7329. This filter allows one to process interlaced images fields without
  7330. deinterlacing them. Deinterleaving splits the input frame into 2
  7331. fields (so called half pictures). Odd lines are moved to the top
  7332. half of the output image, even lines to the bottom half.
  7333. You can process (filter) them independently and then re-interleave them.
  7334. The filter accepts the following options:
  7335. @table @option
  7336. @item luma_mode, l
  7337. @item chroma_mode, c
  7338. @item alpha_mode, a
  7339. Available values for @var{luma_mode}, @var{chroma_mode} and
  7340. @var{alpha_mode} are:
  7341. @table @samp
  7342. @item none
  7343. Do nothing.
  7344. @item deinterleave, d
  7345. Deinterleave fields, placing one above the other.
  7346. @item interleave, i
  7347. Interleave fields. Reverse the effect of deinterleaving.
  7348. @end table
  7349. Default value is @code{none}.
  7350. @item luma_swap, ls
  7351. @item chroma_swap, cs
  7352. @item alpha_swap, as
  7353. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7354. @end table
  7355. @section inflate
  7356. Apply inflate effect to the video.
  7357. This filter replaces the pixel by the local(3x3) average by taking into account
  7358. only values higher than the pixel.
  7359. It accepts the following options:
  7360. @table @option
  7361. @item threshold0
  7362. @item threshold1
  7363. @item threshold2
  7364. @item threshold3
  7365. Limit the maximum change for each plane, default is 65535.
  7366. If 0, plane will remain unchanged.
  7367. @end table
  7368. @section interlace
  7369. Simple interlacing filter from progressive contents. This interleaves upper (or
  7370. lower) lines from odd frames with lower (or upper) lines from even frames,
  7371. halving the frame rate and preserving image height.
  7372. @example
  7373. Original Original New Frame
  7374. Frame 'j' Frame 'j+1' (tff)
  7375. ========== =========== ==================
  7376. Line 0 --------------------> Frame 'j' Line 0
  7377. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7378. Line 2 ---------------------> Frame 'j' Line 2
  7379. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7380. ... ... ...
  7381. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7382. @end example
  7383. It accepts the following optional parameters:
  7384. @table @option
  7385. @item scan
  7386. This determines whether the interlaced frame is taken from the even
  7387. (tff - default) or odd (bff) lines of the progressive frame.
  7388. @item lowpass
  7389. Vertical lowpass filter to avoid twitter interlacing and
  7390. reduce moire patterns.
  7391. @table @samp
  7392. @item 0, off
  7393. Disable vertical lowpass filter
  7394. @item 1, linear
  7395. Enable linear filter (default)
  7396. @item 2, complex
  7397. Enable complex filter. This will slightly less reduce twitter and moire
  7398. but better retain detail and subjective sharpness impression.
  7399. @end table
  7400. @end table
  7401. @section kerndeint
  7402. Deinterlace input video by applying Donald Graft's adaptive kernel
  7403. deinterling. Work on interlaced parts of a video to produce
  7404. progressive frames.
  7405. The description of the accepted parameters follows.
  7406. @table @option
  7407. @item thresh
  7408. Set the threshold which affects the filter's tolerance when
  7409. determining if a pixel line must be processed. It must be an integer
  7410. in the range [0,255] and defaults to 10. A value of 0 will result in
  7411. applying the process on every pixels.
  7412. @item map
  7413. Paint pixels exceeding the threshold value to white if set to 1.
  7414. Default is 0.
  7415. @item order
  7416. Set the fields order. Swap fields if set to 1, leave fields alone if
  7417. 0. Default is 0.
  7418. @item sharp
  7419. Enable additional sharpening if set to 1. Default is 0.
  7420. @item twoway
  7421. Enable twoway sharpening if set to 1. Default is 0.
  7422. @end table
  7423. @subsection Examples
  7424. @itemize
  7425. @item
  7426. Apply default values:
  7427. @example
  7428. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7429. @end example
  7430. @item
  7431. Enable additional sharpening:
  7432. @example
  7433. kerndeint=sharp=1
  7434. @end example
  7435. @item
  7436. Paint processed pixels in white:
  7437. @example
  7438. kerndeint=map=1
  7439. @end example
  7440. @end itemize
  7441. @section lenscorrection
  7442. Correct radial lens distortion
  7443. This filter can be used to correct for radial distortion as can result from the use
  7444. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7445. one can use tools available for example as part of opencv or simply trial-and-error.
  7446. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7447. and extract the k1 and k2 coefficients from the resulting matrix.
  7448. Note that effectively the same filter is available in the open-source tools Krita and
  7449. Digikam from the KDE project.
  7450. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7451. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7452. brightness distribution, so you may want to use both filters together in certain
  7453. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7454. be applied before or after lens correction.
  7455. @subsection Options
  7456. The filter accepts the following options:
  7457. @table @option
  7458. @item cx
  7459. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7460. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7461. width.
  7462. @item cy
  7463. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7464. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7465. height.
  7466. @item k1
  7467. Coefficient of the quadratic correction term. 0.5 means no correction.
  7468. @item k2
  7469. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7470. @end table
  7471. The formula that generates the correction is:
  7472. @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)
  7473. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7474. distances from the focal point in the source and target images, respectively.
  7475. @section libvmaf
  7476. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7477. score between two input videos.
  7478. This filter takes two input videos.
  7479. Both video inputs must have the same resolution and pixel format for
  7480. this filter to work correctly. Also it assumes that both inputs
  7481. have the same number of frames, which are compared one by one.
  7482. The obtained average VMAF score is printed through the logging system.
  7483. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7484. After installing the library it can be enabled using:
  7485. @code{./configure --enable-libvmaf}.
  7486. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7487. On the below examples the input file @file{main.mpg} being processed is
  7488. compared with the reference file @file{ref.mpg}.
  7489. The filter has following options:
  7490. @table @option
  7491. @item model_path
  7492. Set the model path which is to be used for SVM.
  7493. Default value: @code{"vmaf_v0.6.1.pkl"}
  7494. @item log_path
  7495. Set the file path to be used to store logs.
  7496. @item log_fmt
  7497. Set the format of the log file (xml or json).
  7498. @item enable_transform
  7499. Enables transform for computing vmaf.
  7500. @item phone_model
  7501. Invokes the phone model which will generate VMAF scores higher than in the
  7502. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7503. @item psnr
  7504. Enables computing psnr along with vmaf.
  7505. @item ssim
  7506. Enables computing ssim along with vmaf.
  7507. @item ms_ssim
  7508. Enables computing ms_ssim along with vmaf.
  7509. @item pool
  7510. Set the pool method to be used for computing vmaf.
  7511. @end table
  7512. This filter also supports the @ref{framesync} options.
  7513. For example:
  7514. @example
  7515. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7516. @end example
  7517. Example with options:
  7518. @example
  7519. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7520. @end example
  7521. @section limiter
  7522. Limits the pixel components values to the specified range [min, max].
  7523. The filter accepts the following options:
  7524. @table @option
  7525. @item min
  7526. Lower bound. Defaults to the lowest allowed value for the input.
  7527. @item max
  7528. Upper bound. Defaults to the highest allowed value for the input.
  7529. @item planes
  7530. Specify which planes will be processed. Defaults to all available.
  7531. @end table
  7532. @section loop
  7533. Loop video frames.
  7534. The filter accepts the following options:
  7535. @table @option
  7536. @item loop
  7537. Set the number of loops.
  7538. @item size
  7539. Set maximal size in number of frames.
  7540. @item start
  7541. Set first frame of loop.
  7542. @end table
  7543. @anchor{lut3d}
  7544. @section lut3d
  7545. Apply a 3D LUT to an input video.
  7546. The filter accepts the following options:
  7547. @table @option
  7548. @item file
  7549. Set the 3D LUT file name.
  7550. Currently supported formats:
  7551. @table @samp
  7552. @item 3dl
  7553. AfterEffects
  7554. @item cube
  7555. Iridas
  7556. @item dat
  7557. DaVinci
  7558. @item m3d
  7559. Pandora
  7560. @end table
  7561. @item interp
  7562. Select interpolation mode.
  7563. Available values are:
  7564. @table @samp
  7565. @item nearest
  7566. Use values from the nearest defined point.
  7567. @item trilinear
  7568. Interpolate values using the 8 points defining a cube.
  7569. @item tetrahedral
  7570. Interpolate values using a tetrahedron.
  7571. @end table
  7572. @end table
  7573. This filter also supports the @ref{framesync} options.
  7574. @section lumakey
  7575. Turn certain luma values into transparency.
  7576. The filter accepts the following options:
  7577. @table @option
  7578. @item threshold
  7579. Set the luma which will be used as base for transparency.
  7580. Default value is @code{0}.
  7581. @item tolerance
  7582. Set the range of luma values to be keyed out.
  7583. Default value is @code{0}.
  7584. @item softness
  7585. Set the range of softness. Default value is @code{0}.
  7586. Use this to control gradual transition from zero to full transparency.
  7587. @end table
  7588. @section lut, lutrgb, lutyuv
  7589. Compute a look-up table for binding each pixel component input value
  7590. to an output value, and apply it to the input video.
  7591. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7592. to an RGB input video.
  7593. These filters accept the following parameters:
  7594. @table @option
  7595. @item c0
  7596. set first pixel component expression
  7597. @item c1
  7598. set second pixel component expression
  7599. @item c2
  7600. set third pixel component expression
  7601. @item c3
  7602. set fourth pixel component expression, corresponds to the alpha component
  7603. @item r
  7604. set red component expression
  7605. @item g
  7606. set green component expression
  7607. @item b
  7608. set blue component expression
  7609. @item a
  7610. alpha component expression
  7611. @item y
  7612. set Y/luminance component expression
  7613. @item u
  7614. set U/Cb component expression
  7615. @item v
  7616. set V/Cr component expression
  7617. @end table
  7618. Each of them specifies the expression to use for computing the lookup table for
  7619. the corresponding pixel component values.
  7620. The exact component associated to each of the @var{c*} options depends on the
  7621. format in input.
  7622. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7623. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7624. The expressions can contain the following constants and functions:
  7625. @table @option
  7626. @item w
  7627. @item h
  7628. The input width and height.
  7629. @item val
  7630. The input value for the pixel component.
  7631. @item clipval
  7632. The input value, clipped to the @var{minval}-@var{maxval} range.
  7633. @item maxval
  7634. The maximum value for the pixel component.
  7635. @item minval
  7636. The minimum value for the pixel component.
  7637. @item negval
  7638. The negated value for the pixel component value, clipped to the
  7639. @var{minval}-@var{maxval} range; it corresponds to the expression
  7640. "maxval-clipval+minval".
  7641. @item clip(val)
  7642. The computed value in @var{val}, clipped to the
  7643. @var{minval}-@var{maxval} range.
  7644. @item gammaval(gamma)
  7645. The computed gamma correction value of the pixel component value,
  7646. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7647. expression
  7648. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7649. @end table
  7650. All expressions default to "val".
  7651. @subsection Examples
  7652. @itemize
  7653. @item
  7654. Negate input video:
  7655. @example
  7656. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7657. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7658. @end example
  7659. The above is the same as:
  7660. @example
  7661. lutrgb="r=negval:g=negval:b=negval"
  7662. lutyuv="y=negval:u=negval:v=negval"
  7663. @end example
  7664. @item
  7665. Negate luminance:
  7666. @example
  7667. lutyuv=y=negval
  7668. @end example
  7669. @item
  7670. Remove chroma components, turning the video into a graytone image:
  7671. @example
  7672. lutyuv="u=128:v=128"
  7673. @end example
  7674. @item
  7675. Apply a luma burning effect:
  7676. @example
  7677. lutyuv="y=2*val"
  7678. @end example
  7679. @item
  7680. Remove green and blue components:
  7681. @example
  7682. lutrgb="g=0:b=0"
  7683. @end example
  7684. @item
  7685. Set a constant alpha channel value on input:
  7686. @example
  7687. format=rgba,lutrgb=a="maxval-minval/2"
  7688. @end example
  7689. @item
  7690. Correct luminance gamma by a factor of 0.5:
  7691. @example
  7692. lutyuv=y=gammaval(0.5)
  7693. @end example
  7694. @item
  7695. Discard least significant bits of luma:
  7696. @example
  7697. lutyuv=y='bitand(val, 128+64+32)'
  7698. @end example
  7699. @item
  7700. Technicolor like effect:
  7701. @example
  7702. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7703. @end example
  7704. @end itemize
  7705. @section lut2, tlut2
  7706. The @code{lut2} filter takes two input streams and outputs one
  7707. stream.
  7708. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7709. from one single stream.
  7710. This filter accepts the following parameters:
  7711. @table @option
  7712. @item c0
  7713. set first pixel component expression
  7714. @item c1
  7715. set second pixel component expression
  7716. @item c2
  7717. set third pixel component expression
  7718. @item c3
  7719. set fourth pixel component expression, corresponds to the alpha component
  7720. @end table
  7721. Each of them specifies the expression to use for computing the lookup table for
  7722. the corresponding pixel component values.
  7723. The exact component associated to each of the @var{c*} options depends on the
  7724. format in inputs.
  7725. The expressions can contain the following constants:
  7726. @table @option
  7727. @item w
  7728. @item h
  7729. The input width and height.
  7730. @item x
  7731. The first input value for the pixel component.
  7732. @item y
  7733. The second input value for the pixel component.
  7734. @item bdx
  7735. The first input video bit depth.
  7736. @item bdy
  7737. The second input video bit depth.
  7738. @end table
  7739. All expressions default to "x".
  7740. @subsection Examples
  7741. @itemize
  7742. @item
  7743. Highlight differences between two RGB video streams:
  7744. @example
  7745. 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)'
  7746. @end example
  7747. @item
  7748. Highlight differences between two YUV video streams:
  7749. @example
  7750. 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)'
  7751. @end example
  7752. @item
  7753. Show max difference between two video streams:
  7754. @example
  7755. 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)))'
  7756. @end example
  7757. @end itemize
  7758. @section maskedclamp
  7759. Clamp the first input stream with the second input and third input stream.
  7760. Returns the value of first stream to be between second input
  7761. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7762. This filter accepts the following options:
  7763. @table @option
  7764. @item undershoot
  7765. Default value is @code{0}.
  7766. @item overshoot
  7767. Default value is @code{0}.
  7768. @item planes
  7769. Set which planes will be processed as bitmap, unprocessed planes will be
  7770. copied from first stream.
  7771. By default value 0xf, all planes will be processed.
  7772. @end table
  7773. @section maskedmerge
  7774. Merge the first input stream with the second input stream using per pixel
  7775. weights in the third input stream.
  7776. A value of 0 in the third stream pixel component means that pixel component
  7777. from first stream is returned unchanged, while maximum value (eg. 255 for
  7778. 8-bit videos) means that pixel component from second stream is returned
  7779. unchanged. Intermediate values define the amount of merging between both
  7780. input stream's pixel components.
  7781. This filter accepts the following options:
  7782. @table @option
  7783. @item planes
  7784. Set which planes will be processed as bitmap, unprocessed planes will be
  7785. copied from first stream.
  7786. By default value 0xf, all planes will be processed.
  7787. @end table
  7788. @section mcdeint
  7789. Apply motion-compensation deinterlacing.
  7790. It needs one field per frame as input and must thus be used together
  7791. with yadif=1/3 or equivalent.
  7792. This filter accepts the following options:
  7793. @table @option
  7794. @item mode
  7795. Set the deinterlacing mode.
  7796. It accepts one of the following values:
  7797. @table @samp
  7798. @item fast
  7799. @item medium
  7800. @item slow
  7801. use iterative motion estimation
  7802. @item extra_slow
  7803. like @samp{slow}, but use multiple reference frames.
  7804. @end table
  7805. Default value is @samp{fast}.
  7806. @item parity
  7807. Set the picture field parity assumed for the input video. It must be
  7808. one of the following values:
  7809. @table @samp
  7810. @item 0, tff
  7811. assume top field first
  7812. @item 1, bff
  7813. assume bottom field first
  7814. @end table
  7815. Default value is @samp{bff}.
  7816. @item qp
  7817. Set per-block quantization parameter (QP) used by the internal
  7818. encoder.
  7819. Higher values should result in a smoother motion vector field but less
  7820. optimal individual vectors. Default value is 1.
  7821. @end table
  7822. @section mergeplanes
  7823. Merge color channel components from several video streams.
  7824. The filter accepts up to 4 input streams, and merge selected input
  7825. planes to the output video.
  7826. This filter accepts the following options:
  7827. @table @option
  7828. @item mapping
  7829. Set input to output plane mapping. Default is @code{0}.
  7830. The mappings is specified as a bitmap. It should be specified as a
  7831. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7832. mapping for the first plane of the output stream. 'A' sets the number of
  7833. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7834. corresponding input to use (from 0 to 3). The rest of the mappings is
  7835. similar, 'Bb' describes the mapping for the output stream second
  7836. plane, 'Cc' describes the mapping for the output stream third plane and
  7837. 'Dd' describes the mapping for the output stream fourth plane.
  7838. @item format
  7839. Set output pixel format. Default is @code{yuva444p}.
  7840. @end table
  7841. @subsection Examples
  7842. @itemize
  7843. @item
  7844. Merge three gray video streams of same width and height into single video stream:
  7845. @example
  7846. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7847. @end example
  7848. @item
  7849. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7850. @example
  7851. [a0][a1]mergeplanes=0x00010210:yuva444p
  7852. @end example
  7853. @item
  7854. Swap Y and A plane in yuva444p stream:
  7855. @example
  7856. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7857. @end example
  7858. @item
  7859. Swap U and V plane in yuv420p stream:
  7860. @example
  7861. format=yuv420p,mergeplanes=0x000201:yuv420p
  7862. @end example
  7863. @item
  7864. Cast a rgb24 clip to yuv444p:
  7865. @example
  7866. format=rgb24,mergeplanes=0x000102:yuv444p
  7867. @end example
  7868. @end itemize
  7869. @section mestimate
  7870. Estimate and export motion vectors using block matching algorithms.
  7871. Motion vectors are stored in frame side data to be used by other filters.
  7872. This filter accepts the following options:
  7873. @table @option
  7874. @item method
  7875. Specify the motion estimation method. Accepts one of the following values:
  7876. @table @samp
  7877. @item esa
  7878. Exhaustive search algorithm.
  7879. @item tss
  7880. Three step search algorithm.
  7881. @item tdls
  7882. Two dimensional logarithmic search algorithm.
  7883. @item ntss
  7884. New three step search algorithm.
  7885. @item fss
  7886. Four step search algorithm.
  7887. @item ds
  7888. Diamond search algorithm.
  7889. @item hexbs
  7890. Hexagon-based search algorithm.
  7891. @item epzs
  7892. Enhanced predictive zonal search algorithm.
  7893. @item umh
  7894. Uneven multi-hexagon search algorithm.
  7895. @end table
  7896. Default value is @samp{esa}.
  7897. @item mb_size
  7898. Macroblock size. Default @code{16}.
  7899. @item search_param
  7900. Search parameter. Default @code{7}.
  7901. @end table
  7902. @section midequalizer
  7903. Apply Midway Image Equalization effect using two video streams.
  7904. Midway Image Equalization adjusts a pair of images to have the same
  7905. histogram, while maintaining their dynamics as much as possible. It's
  7906. useful for e.g. matching exposures from a pair of stereo cameras.
  7907. This filter has two inputs and one output, which must be of same pixel format, but
  7908. may be of different sizes. The output of filter is first input adjusted with
  7909. midway histogram of both inputs.
  7910. This filter accepts the following option:
  7911. @table @option
  7912. @item planes
  7913. Set which planes to process. Default is @code{15}, which is all available planes.
  7914. @end table
  7915. @section minterpolate
  7916. Convert the video to specified frame rate using motion interpolation.
  7917. This filter accepts the following options:
  7918. @table @option
  7919. @item fps
  7920. 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}.
  7921. @item mi_mode
  7922. Motion interpolation mode. Following values are accepted:
  7923. @table @samp
  7924. @item dup
  7925. Duplicate previous or next frame for interpolating new ones.
  7926. @item blend
  7927. Blend source frames. Interpolated frame is mean of previous and next frames.
  7928. @item mci
  7929. Motion compensated interpolation. Following options are effective when this mode is selected:
  7930. @table @samp
  7931. @item mc_mode
  7932. Motion compensation mode. Following values are accepted:
  7933. @table @samp
  7934. @item obmc
  7935. Overlapped block motion compensation.
  7936. @item aobmc
  7937. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7938. @end table
  7939. Default mode is @samp{obmc}.
  7940. @item me_mode
  7941. Motion estimation mode. Following values are accepted:
  7942. @table @samp
  7943. @item bidir
  7944. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7945. @item bilat
  7946. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7947. @end table
  7948. Default mode is @samp{bilat}.
  7949. @item me
  7950. The algorithm to be used for motion estimation. Following values are accepted:
  7951. @table @samp
  7952. @item esa
  7953. Exhaustive search algorithm.
  7954. @item tss
  7955. Three step search algorithm.
  7956. @item tdls
  7957. Two dimensional logarithmic search algorithm.
  7958. @item ntss
  7959. New three step search algorithm.
  7960. @item fss
  7961. Four step search algorithm.
  7962. @item ds
  7963. Diamond search algorithm.
  7964. @item hexbs
  7965. Hexagon-based search algorithm.
  7966. @item epzs
  7967. Enhanced predictive zonal search algorithm.
  7968. @item umh
  7969. Uneven multi-hexagon search algorithm.
  7970. @end table
  7971. Default algorithm is @samp{epzs}.
  7972. @item mb_size
  7973. Macroblock size. Default @code{16}.
  7974. @item search_param
  7975. Motion estimation search parameter. Default @code{32}.
  7976. @item vsbmc
  7977. 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).
  7978. @end table
  7979. @end table
  7980. @item scd
  7981. 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:
  7982. @table @samp
  7983. @item none
  7984. Disable scene change detection.
  7985. @item fdiff
  7986. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7987. @end table
  7988. Default method is @samp{fdiff}.
  7989. @item scd_threshold
  7990. Scene change detection threshold. Default is @code{5.0}.
  7991. @end table
  7992. @section mpdecimate
  7993. Drop frames that do not differ greatly from the previous frame in
  7994. order to reduce frame rate.
  7995. The main use of this filter is for very-low-bitrate encoding
  7996. (e.g. streaming over dialup modem), but it could in theory be used for
  7997. fixing movies that were inverse-telecined incorrectly.
  7998. A description of the accepted options follows.
  7999. @table @option
  8000. @item max
  8001. Set the maximum number of consecutive frames which can be dropped (if
  8002. positive), or the minimum interval between dropped frames (if
  8003. negative). If the value is 0, the frame is dropped unregarding the
  8004. number of previous sequentially dropped frames.
  8005. Default value is 0.
  8006. @item hi
  8007. @item lo
  8008. @item frac
  8009. Set the dropping threshold values.
  8010. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8011. represent actual pixel value differences, so a threshold of 64
  8012. corresponds to 1 unit of difference for each pixel, or the same spread
  8013. out differently over the block.
  8014. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8015. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8016. meaning the whole image) differ by more than a threshold of @option{lo}.
  8017. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8018. 64*5, and default value for @option{frac} is 0.33.
  8019. @end table
  8020. @section negate
  8021. Negate input video.
  8022. It accepts an integer in input; if non-zero it negates the
  8023. alpha component (if available). The default value in input is 0.
  8024. @section nlmeans
  8025. Denoise frames using Non-Local Means algorithm.
  8026. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8027. context similarity is defined by comparing their surrounding patches of size
  8028. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8029. around the pixel.
  8030. Note that the research area defines centers for patches, which means some
  8031. patches will be made of pixels outside that research area.
  8032. The filter accepts the following options.
  8033. @table @option
  8034. @item s
  8035. Set denoising strength.
  8036. @item p
  8037. Set patch size.
  8038. @item pc
  8039. Same as @option{p} but for chroma planes.
  8040. The default value is @var{0} and means automatic.
  8041. @item r
  8042. Set research size.
  8043. @item rc
  8044. Same as @option{r} but for chroma planes.
  8045. The default value is @var{0} and means automatic.
  8046. @end table
  8047. @section nnedi
  8048. Deinterlace video using neural network edge directed interpolation.
  8049. This filter accepts the following options:
  8050. @table @option
  8051. @item weights
  8052. Mandatory option, without binary file filter can not work.
  8053. Currently file can be found here:
  8054. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8055. @item deint
  8056. Set which frames to deinterlace, by default it is @code{all}.
  8057. Can be @code{all} or @code{interlaced}.
  8058. @item field
  8059. Set mode of operation.
  8060. Can be one of the following:
  8061. @table @samp
  8062. @item af
  8063. Use frame flags, both fields.
  8064. @item a
  8065. Use frame flags, single field.
  8066. @item t
  8067. Use top field only.
  8068. @item b
  8069. Use bottom field only.
  8070. @item tf
  8071. Use both fields, top first.
  8072. @item bf
  8073. Use both fields, bottom first.
  8074. @end table
  8075. @item planes
  8076. Set which planes to process, by default filter process all frames.
  8077. @item nsize
  8078. Set size of local neighborhood around each pixel, used by the predictor neural
  8079. network.
  8080. Can be one of the following:
  8081. @table @samp
  8082. @item s8x6
  8083. @item s16x6
  8084. @item s32x6
  8085. @item s48x6
  8086. @item s8x4
  8087. @item s16x4
  8088. @item s32x4
  8089. @end table
  8090. @item nns
  8091. Set the number of neurons in predicctor neural network.
  8092. Can be one of the following:
  8093. @table @samp
  8094. @item n16
  8095. @item n32
  8096. @item n64
  8097. @item n128
  8098. @item n256
  8099. @end table
  8100. @item qual
  8101. Controls the number of different neural network predictions that are blended
  8102. together to compute the final output value. Can be @code{fast}, default or
  8103. @code{slow}.
  8104. @item etype
  8105. Set which set of weights to use in the predictor.
  8106. Can be one of the following:
  8107. @table @samp
  8108. @item a
  8109. weights trained to minimize absolute error
  8110. @item s
  8111. weights trained to minimize squared error
  8112. @end table
  8113. @item pscrn
  8114. Controls whether or not the prescreener neural network is used to decide
  8115. which pixels should be processed by the predictor neural network and which
  8116. can be handled by simple cubic interpolation.
  8117. The prescreener is trained to know whether cubic interpolation will be
  8118. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8119. The computational complexity of the prescreener nn is much less than that of
  8120. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8121. using the prescreener generally results in much faster processing.
  8122. The prescreener is pretty accurate, so the difference between using it and not
  8123. using it is almost always unnoticeable.
  8124. Can be one of the following:
  8125. @table @samp
  8126. @item none
  8127. @item original
  8128. @item new
  8129. @end table
  8130. Default is @code{new}.
  8131. @item fapprox
  8132. Set various debugging flags.
  8133. @end table
  8134. @section noformat
  8135. Force libavfilter not to use any of the specified pixel formats for the
  8136. input to the next filter.
  8137. It accepts the following parameters:
  8138. @table @option
  8139. @item pix_fmts
  8140. A '|'-separated list of pixel format names, such as
  8141. apix_fmts=yuv420p|monow|rgb24".
  8142. @end table
  8143. @subsection Examples
  8144. @itemize
  8145. @item
  8146. Force libavfilter to use a format different from @var{yuv420p} for the
  8147. input to the vflip filter:
  8148. @example
  8149. noformat=pix_fmts=yuv420p,vflip
  8150. @end example
  8151. @item
  8152. Convert the input video to any of the formats not contained in the list:
  8153. @example
  8154. noformat=yuv420p|yuv444p|yuv410p
  8155. @end example
  8156. @end itemize
  8157. @section noise
  8158. Add noise on video input frame.
  8159. The filter accepts the following options:
  8160. @table @option
  8161. @item all_seed
  8162. @item c0_seed
  8163. @item c1_seed
  8164. @item c2_seed
  8165. @item c3_seed
  8166. Set noise seed for specific pixel component or all pixel components in case
  8167. of @var{all_seed}. Default value is @code{123457}.
  8168. @item all_strength, alls
  8169. @item c0_strength, c0s
  8170. @item c1_strength, c1s
  8171. @item c2_strength, c2s
  8172. @item c3_strength, c3s
  8173. Set noise strength for specific pixel component or all pixel components in case
  8174. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8175. @item all_flags, allf
  8176. @item c0_flags, c0f
  8177. @item c1_flags, c1f
  8178. @item c2_flags, c2f
  8179. @item c3_flags, c3f
  8180. Set pixel component flags or set flags for all components if @var{all_flags}.
  8181. Available values for component flags are:
  8182. @table @samp
  8183. @item a
  8184. averaged temporal noise (smoother)
  8185. @item p
  8186. mix random noise with a (semi)regular pattern
  8187. @item t
  8188. temporal noise (noise pattern changes between frames)
  8189. @item u
  8190. uniform noise (gaussian otherwise)
  8191. @end table
  8192. @end table
  8193. @subsection Examples
  8194. Add temporal and uniform noise to input video:
  8195. @example
  8196. noise=alls=20:allf=t+u
  8197. @end example
  8198. @section null
  8199. Pass the video source unchanged to the output.
  8200. @section ocr
  8201. Optical Character Recognition
  8202. This filter uses Tesseract for optical character recognition.
  8203. It accepts the following options:
  8204. @table @option
  8205. @item datapath
  8206. Set datapath to tesseract data. Default is to use whatever was
  8207. set at installation.
  8208. @item language
  8209. Set language, default is "eng".
  8210. @item whitelist
  8211. Set character whitelist.
  8212. @item blacklist
  8213. Set character blacklist.
  8214. @end table
  8215. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8216. @section ocv
  8217. Apply a video transform using libopencv.
  8218. To enable this filter, install the libopencv library and headers and
  8219. configure FFmpeg with @code{--enable-libopencv}.
  8220. It accepts the following parameters:
  8221. @table @option
  8222. @item filter_name
  8223. The name of the libopencv filter to apply.
  8224. @item filter_params
  8225. The parameters to pass to the libopencv filter. If not specified, the default
  8226. values are assumed.
  8227. @end table
  8228. Refer to the official libopencv documentation for more precise
  8229. information:
  8230. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8231. Several libopencv filters are supported; see the following subsections.
  8232. @anchor{dilate}
  8233. @subsection dilate
  8234. Dilate an image by using a specific structuring element.
  8235. It corresponds to the libopencv function @code{cvDilate}.
  8236. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8237. @var{struct_el} represents a structuring element, and has the syntax:
  8238. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8239. @var{cols} and @var{rows} represent the number of columns and rows of
  8240. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8241. point, and @var{shape} the shape for the structuring element. @var{shape}
  8242. must be "rect", "cross", "ellipse", or "custom".
  8243. If the value for @var{shape} is "custom", it must be followed by a
  8244. string of the form "=@var{filename}". The file with name
  8245. @var{filename} is assumed to represent a binary image, with each
  8246. printable character corresponding to a bright pixel. When a custom
  8247. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8248. or columns and rows of the read file are assumed instead.
  8249. The default value for @var{struct_el} is "3x3+0x0/rect".
  8250. @var{nb_iterations} specifies the number of times the transform is
  8251. applied to the image, and defaults to 1.
  8252. Some examples:
  8253. @example
  8254. # Use the default values
  8255. ocv=dilate
  8256. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8257. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8258. # Read the shape from the file diamond.shape, iterating two times.
  8259. # The file diamond.shape may contain a pattern of characters like this
  8260. # *
  8261. # ***
  8262. # *****
  8263. # ***
  8264. # *
  8265. # The specified columns and rows are ignored
  8266. # but the anchor point coordinates are not
  8267. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8268. @end example
  8269. @subsection erode
  8270. Erode an image by using a specific structuring element.
  8271. It corresponds to the libopencv function @code{cvErode}.
  8272. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8273. with the same syntax and semantics as the @ref{dilate} filter.
  8274. @subsection smooth
  8275. Smooth the input video.
  8276. The filter takes the following parameters:
  8277. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8278. @var{type} is the type of smooth filter to apply, and must be one of
  8279. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8280. or "bilateral". The default value is "gaussian".
  8281. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8282. depend on the smooth type. @var{param1} and
  8283. @var{param2} accept integer positive values or 0. @var{param3} and
  8284. @var{param4} accept floating point values.
  8285. The default value for @var{param1} is 3. The default value for the
  8286. other parameters is 0.
  8287. These parameters correspond to the parameters assigned to the
  8288. libopencv function @code{cvSmooth}.
  8289. @section oscilloscope
  8290. 2D Video Oscilloscope.
  8291. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8292. It accepts the following parameters:
  8293. @table @option
  8294. @item x
  8295. Set scope center x position.
  8296. @item y
  8297. Set scope center y position.
  8298. @item s
  8299. Set scope size, relative to frame diagonal.
  8300. @item t
  8301. Set scope tilt/rotation.
  8302. @item o
  8303. Set trace opacity.
  8304. @item tx
  8305. Set trace center x position.
  8306. @item ty
  8307. Set trace center y position.
  8308. @item tw
  8309. Set trace width, relative to width of frame.
  8310. @item th
  8311. Set trace height, relative to height of frame.
  8312. @item c
  8313. Set which components to trace. By default it traces first three components.
  8314. @item g
  8315. Draw trace grid. By default is enabled.
  8316. @item st
  8317. Draw some statistics. By default is enabled.
  8318. @item sc
  8319. Draw scope. By default is enabled.
  8320. @end table
  8321. @subsection Examples
  8322. @itemize
  8323. @item
  8324. Inspect full first row of video frame.
  8325. @example
  8326. oscilloscope=x=0.5:y=0:s=1
  8327. @end example
  8328. @item
  8329. Inspect full last row of video frame.
  8330. @example
  8331. oscilloscope=x=0.5:y=1:s=1
  8332. @end example
  8333. @item
  8334. Inspect full 5th line of video frame of height 1080.
  8335. @example
  8336. oscilloscope=x=0.5:y=5/1080:s=1
  8337. @end example
  8338. @item
  8339. Inspect full last column of video frame.
  8340. @example
  8341. oscilloscope=x=1:y=0.5:s=1:t=1
  8342. @end example
  8343. @end itemize
  8344. @anchor{overlay}
  8345. @section overlay
  8346. Overlay one video on top of another.
  8347. It takes two inputs and has one output. The first input is the "main"
  8348. video on which the second input is overlaid.
  8349. It accepts the following parameters:
  8350. A description of the accepted options follows.
  8351. @table @option
  8352. @item x
  8353. @item y
  8354. Set the expression for the x and y coordinates of the overlaid video
  8355. on the main video. Default value is "0" for both expressions. In case
  8356. the expression is invalid, it is set to a huge value (meaning that the
  8357. overlay will not be displayed within the output visible area).
  8358. @item eval
  8359. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8360. It accepts the following values:
  8361. @table @samp
  8362. @item init
  8363. only evaluate expressions once during the filter initialization or
  8364. when a command is processed
  8365. @item frame
  8366. evaluate expressions for each incoming frame
  8367. @end table
  8368. Default value is @samp{frame}.
  8369. @item format
  8370. Set the format for the output video.
  8371. It accepts the following values:
  8372. @table @samp
  8373. @item yuv420
  8374. force YUV420 output
  8375. @item yuv422
  8376. force YUV422 output
  8377. @item yuv444
  8378. force YUV444 output
  8379. @item rgb
  8380. force packed RGB output
  8381. @item gbrp
  8382. force planar RGB output
  8383. @item auto
  8384. automatically pick format
  8385. @end table
  8386. Default value is @samp{yuv420}.
  8387. @end table
  8388. The @option{x}, and @option{y} expressions can contain the following
  8389. parameters.
  8390. @table @option
  8391. @item main_w, W
  8392. @item main_h, H
  8393. The main input width and height.
  8394. @item overlay_w, w
  8395. @item overlay_h, h
  8396. The overlay input width and height.
  8397. @item x
  8398. @item y
  8399. The computed values for @var{x} and @var{y}. They are evaluated for
  8400. each new frame.
  8401. @item hsub
  8402. @item vsub
  8403. horizontal and vertical chroma subsample values of the output
  8404. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8405. @var{vsub} is 1.
  8406. @item n
  8407. the number of input frame, starting from 0
  8408. @item pos
  8409. the position in the file of the input frame, NAN if unknown
  8410. @item t
  8411. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8412. @end table
  8413. This filter also supports the @ref{framesync} options.
  8414. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8415. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8416. when @option{eval} is set to @samp{init}.
  8417. Be aware that frames are taken from each input video in timestamp
  8418. order, hence, if their initial timestamps differ, it is a good idea
  8419. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8420. have them begin in the same zero timestamp, as the example for
  8421. the @var{movie} filter does.
  8422. You can chain together more overlays but you should test the
  8423. efficiency of such approach.
  8424. @subsection Commands
  8425. This filter supports the following commands:
  8426. @table @option
  8427. @item x
  8428. @item y
  8429. Modify the x and y of the overlay input.
  8430. The command accepts the same syntax of the corresponding option.
  8431. If the specified expression is not valid, it is kept at its current
  8432. value.
  8433. @end table
  8434. @subsection Examples
  8435. @itemize
  8436. @item
  8437. Draw the overlay at 10 pixels from the bottom right corner of the main
  8438. video:
  8439. @example
  8440. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8441. @end example
  8442. Using named options the example above becomes:
  8443. @example
  8444. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8445. @end example
  8446. @item
  8447. Insert a transparent PNG logo in the bottom left corner of the input,
  8448. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8449. @example
  8450. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8451. @end example
  8452. @item
  8453. Insert 2 different transparent PNG logos (second logo on bottom
  8454. right corner) using the @command{ffmpeg} tool:
  8455. @example
  8456. 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
  8457. @end example
  8458. @item
  8459. Add a transparent color layer on top of the main video; @code{WxH}
  8460. must specify the size of the main input to the overlay filter:
  8461. @example
  8462. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8463. @end example
  8464. @item
  8465. Play an original video and a filtered version (here with the deshake
  8466. filter) side by side using the @command{ffplay} tool:
  8467. @example
  8468. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8469. @end example
  8470. The above command is the same as:
  8471. @example
  8472. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8473. @end example
  8474. @item
  8475. Make a sliding overlay appearing from the left to the right top part of the
  8476. screen starting since time 2:
  8477. @example
  8478. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8479. @end example
  8480. @item
  8481. Compose output by putting two input videos side to side:
  8482. @example
  8483. ffmpeg -i left.avi -i right.avi -filter_complex "
  8484. nullsrc=size=200x100 [background];
  8485. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8486. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8487. [background][left] overlay=shortest=1 [background+left];
  8488. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8489. "
  8490. @end example
  8491. @item
  8492. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8493. @example
  8494. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8495. -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]'
  8496. masked.avi
  8497. @end example
  8498. @item
  8499. Chain several overlays in cascade:
  8500. @example
  8501. nullsrc=s=200x200 [bg];
  8502. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8503. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8504. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8505. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8506. [in3] null, [mid2] overlay=100:100 [out0]
  8507. @end example
  8508. @end itemize
  8509. @section owdenoise
  8510. Apply Overcomplete Wavelet denoiser.
  8511. The filter accepts the following options:
  8512. @table @option
  8513. @item depth
  8514. Set depth.
  8515. Larger depth values will denoise lower frequency components more, but
  8516. slow down filtering.
  8517. Must be an int in the range 8-16, default is @code{8}.
  8518. @item luma_strength, ls
  8519. Set luma strength.
  8520. Must be a double value in the range 0-1000, default is @code{1.0}.
  8521. @item chroma_strength, cs
  8522. Set chroma strength.
  8523. Must be a double value in the range 0-1000, default is @code{1.0}.
  8524. @end table
  8525. @anchor{pad}
  8526. @section pad
  8527. Add paddings to the input image, and place the original input at the
  8528. provided @var{x}, @var{y} coordinates.
  8529. It accepts the following parameters:
  8530. @table @option
  8531. @item width, w
  8532. @item height, h
  8533. Specify an expression for the size of the output image with the
  8534. paddings added. If the value for @var{width} or @var{height} is 0, the
  8535. corresponding input size is used for the output.
  8536. The @var{width} expression can reference the value set by the
  8537. @var{height} expression, and vice versa.
  8538. The default value of @var{width} and @var{height} is 0.
  8539. @item x
  8540. @item y
  8541. Specify the offsets to place the input image at within the padded area,
  8542. with respect to the top/left border of the output image.
  8543. The @var{x} expression can reference the value set by the @var{y}
  8544. expression, and vice versa.
  8545. The default value of @var{x} and @var{y} is 0.
  8546. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8547. so the input image is centered on the padded area.
  8548. @item color
  8549. Specify the color of the padded area. For the syntax of this option,
  8550. check the "Color" section in the ffmpeg-utils manual.
  8551. The default value of @var{color} is "black".
  8552. @item eval
  8553. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8554. It accepts the following values:
  8555. @table @samp
  8556. @item init
  8557. Only evaluate expressions once during the filter initialization or when
  8558. a command is processed.
  8559. @item frame
  8560. Evaluate expressions for each incoming frame.
  8561. @end table
  8562. Default value is @samp{init}.
  8563. @item aspect
  8564. Pad to aspect instead to a resolution.
  8565. @end table
  8566. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8567. options are expressions containing the following constants:
  8568. @table @option
  8569. @item in_w
  8570. @item in_h
  8571. The input video width and height.
  8572. @item iw
  8573. @item ih
  8574. These are the same as @var{in_w} and @var{in_h}.
  8575. @item out_w
  8576. @item out_h
  8577. The output width and height (the size of the padded area), as
  8578. specified by the @var{width} and @var{height} expressions.
  8579. @item ow
  8580. @item oh
  8581. These are the same as @var{out_w} and @var{out_h}.
  8582. @item x
  8583. @item y
  8584. The x and y offsets as specified by the @var{x} and @var{y}
  8585. expressions, or NAN if not yet specified.
  8586. @item a
  8587. same as @var{iw} / @var{ih}
  8588. @item sar
  8589. input sample aspect ratio
  8590. @item dar
  8591. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8592. @item hsub
  8593. @item vsub
  8594. The horizontal and vertical chroma subsample values. For example for the
  8595. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8596. @end table
  8597. @subsection Examples
  8598. @itemize
  8599. @item
  8600. Add paddings with the color "violet" to the input video. The output video
  8601. size is 640x480, and the top-left corner of the input video is placed at
  8602. column 0, row 40
  8603. @example
  8604. pad=640:480:0:40:violet
  8605. @end example
  8606. The example above is equivalent to the following command:
  8607. @example
  8608. pad=width=640:height=480:x=0:y=40:color=violet
  8609. @end example
  8610. @item
  8611. Pad the input to get an output with dimensions increased by 3/2,
  8612. and put the input video at the center of the padded area:
  8613. @example
  8614. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8615. @end example
  8616. @item
  8617. Pad the input to get a squared output with size equal to the maximum
  8618. value between the input width and height, and put the input video at
  8619. the center of the padded area:
  8620. @example
  8621. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8622. @end example
  8623. @item
  8624. Pad the input to get a final w/h ratio of 16:9:
  8625. @example
  8626. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8627. @end example
  8628. @item
  8629. In case of anamorphic video, in order to set the output display aspect
  8630. correctly, it is necessary to use @var{sar} in the expression,
  8631. according to the relation:
  8632. @example
  8633. (ih * X / ih) * sar = output_dar
  8634. X = output_dar / sar
  8635. @end example
  8636. Thus the previous example needs to be modified to:
  8637. @example
  8638. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8639. @end example
  8640. @item
  8641. Double the output size and put the input video in the bottom-right
  8642. corner of the output padded area:
  8643. @example
  8644. pad="2*iw:2*ih:ow-iw:oh-ih"
  8645. @end example
  8646. @end itemize
  8647. @anchor{palettegen}
  8648. @section palettegen
  8649. Generate one palette for a whole video stream.
  8650. It accepts the following options:
  8651. @table @option
  8652. @item max_colors
  8653. Set the maximum number of colors to quantize in the palette.
  8654. Note: the palette will still contain 256 colors; the unused palette entries
  8655. will be black.
  8656. @item reserve_transparent
  8657. Create a palette of 255 colors maximum and reserve the last one for
  8658. transparency. Reserving the transparency color is useful for GIF optimization.
  8659. If not set, the maximum of colors in the palette will be 256. You probably want
  8660. to disable this option for a standalone image.
  8661. Set by default.
  8662. @item stats_mode
  8663. Set statistics mode.
  8664. It accepts the following values:
  8665. @table @samp
  8666. @item full
  8667. Compute full frame histograms.
  8668. @item diff
  8669. Compute histograms only for the part that differs from previous frame. This
  8670. might be relevant to give more importance to the moving part of your input if
  8671. the background is static.
  8672. @item single
  8673. Compute new histogram for each frame.
  8674. @end table
  8675. Default value is @var{full}.
  8676. @end table
  8677. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8678. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8679. color quantization of the palette. This information is also visible at
  8680. @var{info} logging level.
  8681. @subsection Examples
  8682. @itemize
  8683. @item
  8684. Generate a representative palette of a given video using @command{ffmpeg}:
  8685. @example
  8686. ffmpeg -i input.mkv -vf palettegen palette.png
  8687. @end example
  8688. @end itemize
  8689. @section paletteuse
  8690. Use a palette to downsample an input video stream.
  8691. The filter takes two inputs: one video stream and a palette. The palette must
  8692. be a 256 pixels image.
  8693. It accepts the following options:
  8694. @table @option
  8695. @item dither
  8696. Select dithering mode. Available algorithms are:
  8697. @table @samp
  8698. @item bayer
  8699. Ordered 8x8 bayer dithering (deterministic)
  8700. @item heckbert
  8701. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8702. Note: this dithering is sometimes considered "wrong" and is included as a
  8703. reference.
  8704. @item floyd_steinberg
  8705. Floyd and Steingberg dithering (error diffusion)
  8706. @item sierra2
  8707. Frankie Sierra dithering v2 (error diffusion)
  8708. @item sierra2_4a
  8709. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8710. @end table
  8711. Default is @var{sierra2_4a}.
  8712. @item bayer_scale
  8713. When @var{bayer} dithering is selected, this option defines the scale of the
  8714. pattern (how much the crosshatch pattern is visible). A low value means more
  8715. visible pattern for less banding, and higher value means less visible pattern
  8716. at the cost of more banding.
  8717. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8718. @item diff_mode
  8719. If set, define the zone to process
  8720. @table @samp
  8721. @item rectangle
  8722. Only the changing rectangle will be reprocessed. This is similar to GIF
  8723. cropping/offsetting compression mechanism. This option can be useful for speed
  8724. if only a part of the image is changing, and has use cases such as limiting the
  8725. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8726. moving scene (it leads to more deterministic output if the scene doesn't change
  8727. much, and as a result less moving noise and better GIF compression).
  8728. @end table
  8729. Default is @var{none}.
  8730. @item new
  8731. Take new palette for each output frame.
  8732. @end table
  8733. @subsection Examples
  8734. @itemize
  8735. @item
  8736. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8737. using @command{ffmpeg}:
  8738. @example
  8739. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8740. @end example
  8741. @end itemize
  8742. @section perspective
  8743. Correct perspective of video not recorded perpendicular to the screen.
  8744. A description of the accepted parameters follows.
  8745. @table @option
  8746. @item x0
  8747. @item y0
  8748. @item x1
  8749. @item y1
  8750. @item x2
  8751. @item y2
  8752. @item x3
  8753. @item y3
  8754. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8755. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8756. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8757. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8758. then the corners of the source will be sent to the specified coordinates.
  8759. The expressions can use the following variables:
  8760. @table @option
  8761. @item W
  8762. @item H
  8763. the width and height of video frame.
  8764. @item in
  8765. Input frame count.
  8766. @item on
  8767. Output frame count.
  8768. @end table
  8769. @item interpolation
  8770. Set interpolation for perspective correction.
  8771. It accepts the following values:
  8772. @table @samp
  8773. @item linear
  8774. @item cubic
  8775. @end table
  8776. Default value is @samp{linear}.
  8777. @item sense
  8778. Set interpretation of coordinate options.
  8779. It accepts the following values:
  8780. @table @samp
  8781. @item 0, source
  8782. Send point in the source specified by the given coordinates to
  8783. the corners of the destination.
  8784. @item 1, destination
  8785. Send the corners of the source to the point in the destination specified
  8786. by the given coordinates.
  8787. Default value is @samp{source}.
  8788. @end table
  8789. @item eval
  8790. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8791. It accepts the following values:
  8792. @table @samp
  8793. @item init
  8794. only evaluate expressions once during the filter initialization or
  8795. when a command is processed
  8796. @item frame
  8797. evaluate expressions for each incoming frame
  8798. @end table
  8799. Default value is @samp{init}.
  8800. @end table
  8801. @section phase
  8802. Delay interlaced video by one field time so that the field order changes.
  8803. The intended use is to fix PAL movies that have been captured with the
  8804. opposite field order to the film-to-video transfer.
  8805. A description of the accepted parameters follows.
  8806. @table @option
  8807. @item mode
  8808. Set phase mode.
  8809. It accepts the following values:
  8810. @table @samp
  8811. @item t
  8812. Capture field order top-first, transfer bottom-first.
  8813. Filter will delay the bottom field.
  8814. @item b
  8815. Capture field order bottom-first, transfer top-first.
  8816. Filter will delay the top field.
  8817. @item p
  8818. Capture and transfer with the same field order. This mode only exists
  8819. for the documentation of the other options to refer to, but if you
  8820. actually select it, the filter will faithfully do nothing.
  8821. @item a
  8822. Capture field order determined automatically by field flags, transfer
  8823. opposite.
  8824. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8825. basis using field flags. If no field information is available,
  8826. then this works just like @samp{u}.
  8827. @item u
  8828. Capture unknown or varying, transfer opposite.
  8829. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8830. analyzing the images and selecting the alternative that produces best
  8831. match between the fields.
  8832. @item T
  8833. Capture top-first, transfer unknown or varying.
  8834. Filter selects among @samp{t} and @samp{p} using image analysis.
  8835. @item B
  8836. Capture bottom-first, transfer unknown or varying.
  8837. Filter selects among @samp{b} and @samp{p} using image analysis.
  8838. @item A
  8839. Capture determined by field flags, transfer unknown or varying.
  8840. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8841. image analysis. If no field information is available, then this works just
  8842. like @samp{U}. This is the default mode.
  8843. @item U
  8844. Both capture and transfer unknown or varying.
  8845. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8846. @end table
  8847. @end table
  8848. @section pixdesctest
  8849. Pixel format descriptor test filter, mainly useful for internal
  8850. testing. The output video should be equal to the input video.
  8851. For example:
  8852. @example
  8853. format=monow, pixdesctest
  8854. @end example
  8855. can be used to test the monowhite pixel format descriptor definition.
  8856. @section pixscope
  8857. Display sample values of color channels. Mainly useful for checking color and levels.
  8858. The filters accept the following options:
  8859. @table @option
  8860. @item x
  8861. Set scope X position, relative offset on X axis.
  8862. @item y
  8863. Set scope Y position, relative offset on Y axis.
  8864. @item w
  8865. Set scope width.
  8866. @item h
  8867. Set scope height.
  8868. @item o
  8869. Set window opacity. This window also holds statistics about pixel area.
  8870. @item wx
  8871. Set window X position, relative offset on X axis.
  8872. @item wy
  8873. Set window Y position, relative offset on Y axis.
  8874. @end table
  8875. @section pp
  8876. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8877. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8878. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8879. Each subfilter and some options have a short and a long name that can be used
  8880. interchangeably, i.e. dr/dering are the same.
  8881. The filters accept the following options:
  8882. @table @option
  8883. @item subfilters
  8884. Set postprocessing subfilters string.
  8885. @end table
  8886. All subfilters share common options to determine their scope:
  8887. @table @option
  8888. @item a/autoq
  8889. Honor the quality commands for this subfilter.
  8890. @item c/chrom
  8891. Do chrominance filtering, too (default).
  8892. @item y/nochrom
  8893. Do luminance filtering only (no chrominance).
  8894. @item n/noluma
  8895. Do chrominance filtering only (no luminance).
  8896. @end table
  8897. These options can be appended after the subfilter name, separated by a '|'.
  8898. Available subfilters are:
  8899. @table @option
  8900. @item hb/hdeblock[|difference[|flatness]]
  8901. Horizontal deblocking filter
  8902. @table @option
  8903. @item difference
  8904. Difference factor where higher values mean more deblocking (default: @code{32}).
  8905. @item flatness
  8906. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8907. @end table
  8908. @item vb/vdeblock[|difference[|flatness]]
  8909. Vertical deblocking filter
  8910. @table @option
  8911. @item difference
  8912. Difference factor where higher values mean more deblocking (default: @code{32}).
  8913. @item flatness
  8914. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8915. @end table
  8916. @item ha/hadeblock[|difference[|flatness]]
  8917. Accurate horizontal deblocking filter
  8918. @table @option
  8919. @item difference
  8920. Difference factor where higher values mean more deblocking (default: @code{32}).
  8921. @item flatness
  8922. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8923. @end table
  8924. @item va/vadeblock[|difference[|flatness]]
  8925. Accurate vertical deblocking filter
  8926. @table @option
  8927. @item difference
  8928. Difference factor where higher values mean more deblocking (default: @code{32}).
  8929. @item flatness
  8930. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8931. @end table
  8932. @end table
  8933. The horizontal and vertical deblocking filters share the difference and
  8934. flatness values so you cannot set different horizontal and vertical
  8935. thresholds.
  8936. @table @option
  8937. @item h1/x1hdeblock
  8938. Experimental horizontal deblocking filter
  8939. @item v1/x1vdeblock
  8940. Experimental vertical deblocking filter
  8941. @item dr/dering
  8942. Deringing filter
  8943. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8944. @table @option
  8945. @item threshold1
  8946. larger -> stronger filtering
  8947. @item threshold2
  8948. larger -> stronger filtering
  8949. @item threshold3
  8950. larger -> stronger filtering
  8951. @end table
  8952. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8953. @table @option
  8954. @item f/fullyrange
  8955. Stretch luminance to @code{0-255}.
  8956. @end table
  8957. @item lb/linblenddeint
  8958. Linear blend deinterlacing filter that deinterlaces the given block by
  8959. filtering all lines with a @code{(1 2 1)} filter.
  8960. @item li/linipoldeint
  8961. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8962. linearly interpolating every second line.
  8963. @item ci/cubicipoldeint
  8964. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8965. cubically interpolating every second line.
  8966. @item md/mediandeint
  8967. Median deinterlacing filter that deinterlaces the given block by applying a
  8968. median filter to every second line.
  8969. @item fd/ffmpegdeint
  8970. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8971. second line with a @code{(-1 4 2 4 -1)} filter.
  8972. @item l5/lowpass5
  8973. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8974. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8975. @item fq/forceQuant[|quantizer]
  8976. Overrides the quantizer table from the input with the constant quantizer you
  8977. specify.
  8978. @table @option
  8979. @item quantizer
  8980. Quantizer to use
  8981. @end table
  8982. @item de/default
  8983. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8984. @item fa/fast
  8985. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8986. @item ac
  8987. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8988. @end table
  8989. @subsection Examples
  8990. @itemize
  8991. @item
  8992. Apply horizontal and vertical deblocking, deringing and automatic
  8993. brightness/contrast:
  8994. @example
  8995. pp=hb/vb/dr/al
  8996. @end example
  8997. @item
  8998. Apply default filters without brightness/contrast correction:
  8999. @example
  9000. pp=de/-al
  9001. @end example
  9002. @item
  9003. Apply default filters and temporal denoiser:
  9004. @example
  9005. pp=default/tmpnoise|1|2|3
  9006. @end example
  9007. @item
  9008. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9009. automatically depending on available CPU time:
  9010. @example
  9011. pp=hb|y/vb|a
  9012. @end example
  9013. @end itemize
  9014. @section pp7
  9015. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9016. similar to spp = 6 with 7 point DCT, where only the center sample is
  9017. used after IDCT.
  9018. The filter accepts the following options:
  9019. @table @option
  9020. @item qp
  9021. Force a constant quantization parameter. It accepts an integer in range
  9022. 0 to 63. If not set, the filter will use the QP from the video stream
  9023. (if available).
  9024. @item mode
  9025. Set thresholding mode. Available modes are:
  9026. @table @samp
  9027. @item hard
  9028. Set hard thresholding.
  9029. @item soft
  9030. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9031. @item medium
  9032. Set medium thresholding (good results, default).
  9033. @end table
  9034. @end table
  9035. @section premultiply
  9036. Apply alpha premultiply effect to input video stream using first plane
  9037. of second stream as alpha.
  9038. Both streams must have same dimensions and same pixel format.
  9039. The filter accepts the following option:
  9040. @table @option
  9041. @item planes
  9042. Set which planes will be processed, unprocessed planes will be copied.
  9043. By default value 0xf, all planes will be processed.
  9044. @item inplace
  9045. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9046. @end table
  9047. @section prewitt
  9048. Apply prewitt operator to input video stream.
  9049. The filter accepts the following option:
  9050. @table @option
  9051. @item planes
  9052. Set which planes will be processed, unprocessed planes will be copied.
  9053. By default value 0xf, all planes will be processed.
  9054. @item scale
  9055. Set value which will be multiplied with filtered result.
  9056. @item delta
  9057. Set value which will be added to filtered result.
  9058. @end table
  9059. @section pseudocolor
  9060. Alter frame colors in video with pseudocolors.
  9061. This filter accept the following options:
  9062. @table @option
  9063. @item c0
  9064. set pixel first component expression
  9065. @item c1
  9066. set pixel second component expression
  9067. @item c2
  9068. set pixel third component expression
  9069. @item c3
  9070. set pixel fourth component expression, corresponds to the alpha component
  9071. @item i
  9072. set component to use as base for altering colors
  9073. @end table
  9074. Each of them specifies the expression to use for computing the lookup table for
  9075. the corresponding pixel component values.
  9076. The expressions can contain the following constants and functions:
  9077. @table @option
  9078. @item w
  9079. @item h
  9080. The input width and height.
  9081. @item val
  9082. The input value for the pixel component.
  9083. @item ymin, umin, vmin, amin
  9084. The minimum allowed component value.
  9085. @item ymax, umax, vmax, amax
  9086. The maximum allowed component value.
  9087. @end table
  9088. All expressions default to "val".
  9089. @subsection Examples
  9090. @itemize
  9091. @item
  9092. Change too high luma values to gradient:
  9093. @example
  9094. 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'"
  9095. @end example
  9096. @end itemize
  9097. @section psnr
  9098. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9099. Ratio) between two input videos.
  9100. This filter takes in input two input videos, the first input is
  9101. considered the "main" source and is passed unchanged to the
  9102. output. The second input is used as a "reference" video for computing
  9103. the PSNR.
  9104. Both video inputs must have the same resolution and pixel format for
  9105. this filter to work correctly. Also it assumes that both inputs
  9106. have the same number of frames, which are compared one by one.
  9107. The obtained average PSNR is printed through the logging system.
  9108. The filter stores the accumulated MSE (mean squared error) of each
  9109. frame, and at the end of the processing it is averaged across all frames
  9110. equally, and the following formula is applied to obtain the PSNR:
  9111. @example
  9112. PSNR = 10*log10(MAX^2/MSE)
  9113. @end example
  9114. Where MAX is the average of the maximum values of each component of the
  9115. image.
  9116. The description of the accepted parameters follows.
  9117. @table @option
  9118. @item stats_file, f
  9119. If specified the filter will use the named file to save the PSNR of
  9120. each individual frame. When filename equals "-" the data is sent to
  9121. standard output.
  9122. @item stats_version
  9123. Specifies which version of the stats file format to use. Details of
  9124. each format are written below.
  9125. Default value is 1.
  9126. @item stats_add_max
  9127. Determines whether the max value is output to the stats log.
  9128. Default value is 0.
  9129. Requires stats_version >= 2. If this is set and stats_version < 2,
  9130. the filter will return an error.
  9131. @end table
  9132. This filter also supports the @ref{framesync} options.
  9133. The file printed if @var{stats_file} is selected, contains a sequence of
  9134. key/value pairs of the form @var{key}:@var{value} for each compared
  9135. couple of frames.
  9136. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9137. the list of per-frame-pair stats, with key value pairs following the frame
  9138. format with the following parameters:
  9139. @table @option
  9140. @item psnr_log_version
  9141. The version of the log file format. Will match @var{stats_version}.
  9142. @item fields
  9143. A comma separated list of the per-frame-pair parameters included in
  9144. the log.
  9145. @end table
  9146. A description of each shown per-frame-pair parameter follows:
  9147. @table @option
  9148. @item n
  9149. sequential number of the input frame, starting from 1
  9150. @item mse_avg
  9151. Mean Square Error pixel-by-pixel average difference of the compared
  9152. frames, averaged over all the image components.
  9153. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9154. Mean Square Error pixel-by-pixel average difference of the compared
  9155. frames for the component specified by the suffix.
  9156. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9157. Peak Signal to Noise ratio of the compared frames for the component
  9158. specified by the suffix.
  9159. @item max_avg, max_y, max_u, max_v
  9160. Maximum allowed value for each channel, and average over all
  9161. channels.
  9162. @end table
  9163. For example:
  9164. @example
  9165. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9166. [main][ref] psnr="stats_file=stats.log" [out]
  9167. @end example
  9168. On this example the input file being processed is compared with the
  9169. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9170. is stored in @file{stats.log}.
  9171. @anchor{pullup}
  9172. @section pullup
  9173. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9174. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9175. content.
  9176. The pullup filter is designed to take advantage of future context in making
  9177. its decisions. This filter is stateless in the sense that it does not lock
  9178. onto a pattern to follow, but it instead looks forward to the following
  9179. fields in order to identify matches and rebuild progressive frames.
  9180. To produce content with an even framerate, insert the fps filter after
  9181. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9182. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9183. The filter accepts the following options:
  9184. @table @option
  9185. @item jl
  9186. @item jr
  9187. @item jt
  9188. @item jb
  9189. These options set the amount of "junk" to ignore at the left, right, top, and
  9190. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9191. while top and bottom are in units of 2 lines.
  9192. The default is 8 pixels on each side.
  9193. @item sb
  9194. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9195. filter generating an occasional mismatched frame, but it may also cause an
  9196. excessive number of frames to be dropped during high motion sequences.
  9197. Conversely, setting it to -1 will make filter match fields more easily.
  9198. This may help processing of video where there is slight blurring between
  9199. the fields, but may also cause there to be interlaced frames in the output.
  9200. Default value is @code{0}.
  9201. @item mp
  9202. Set the metric plane to use. It accepts the following values:
  9203. @table @samp
  9204. @item l
  9205. Use luma plane.
  9206. @item u
  9207. Use chroma blue plane.
  9208. @item v
  9209. Use chroma red plane.
  9210. @end table
  9211. This option may be set to use chroma plane instead of the default luma plane
  9212. for doing filter's computations. This may improve accuracy on very clean
  9213. source material, but more likely will decrease accuracy, especially if there
  9214. is chroma noise (rainbow effect) or any grayscale video.
  9215. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9216. load and make pullup usable in realtime on slow machines.
  9217. @end table
  9218. For best results (without duplicated frames in the output file) it is
  9219. necessary to change the output frame rate. For example, to inverse
  9220. telecine NTSC input:
  9221. @example
  9222. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9223. @end example
  9224. @section qp
  9225. Change video quantization parameters (QP).
  9226. The filter accepts the following option:
  9227. @table @option
  9228. @item qp
  9229. Set expression for quantization parameter.
  9230. @end table
  9231. The expression is evaluated through the eval API and can contain, among others,
  9232. the following constants:
  9233. @table @var
  9234. @item known
  9235. 1 if index is not 129, 0 otherwise.
  9236. @item qp
  9237. Sequentional index starting from -129 to 128.
  9238. @end table
  9239. @subsection Examples
  9240. @itemize
  9241. @item
  9242. Some equation like:
  9243. @example
  9244. qp=2+2*sin(PI*qp)
  9245. @end example
  9246. @end itemize
  9247. @section random
  9248. Flush video frames from internal cache of frames into a random order.
  9249. No frame is discarded.
  9250. Inspired by @ref{frei0r} nervous filter.
  9251. @table @option
  9252. @item frames
  9253. Set size in number of frames of internal cache, in range from @code{2} to
  9254. @code{512}. Default is @code{30}.
  9255. @item seed
  9256. Set seed for random number generator, must be an integer included between
  9257. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9258. less than @code{0}, the filter will try to use a good random seed on a
  9259. best effort basis.
  9260. @end table
  9261. @section readeia608
  9262. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9263. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9264. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9265. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9266. @table @option
  9267. @item lavfi.readeia608.X.cc
  9268. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9269. @item lavfi.readeia608.X.line
  9270. The number of the line on which the EIA-608 data was identified and read.
  9271. @end table
  9272. This filter accepts the following options:
  9273. @table @option
  9274. @item scan_min
  9275. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9276. @item scan_max
  9277. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9278. @item mac
  9279. Set minimal acceptable amplitude change for sync codes detection.
  9280. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9281. @item spw
  9282. Set the ratio of width reserved for sync code detection.
  9283. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9284. @item mhd
  9285. Set the max peaks height difference for sync code detection.
  9286. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9287. @item mpd
  9288. Set max peaks period difference for sync code detection.
  9289. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9290. @item msd
  9291. Set the first two max start code bits differences.
  9292. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9293. @item bhd
  9294. Set the minimum ratio of bits height compared to 3rd start code bit.
  9295. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9296. @item th_w
  9297. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9298. @item th_b
  9299. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9300. @item chp
  9301. Enable checking the parity bit. In the event of a parity error, the filter will output
  9302. @code{0x00} for that character. Default is false.
  9303. @end table
  9304. @subsection Examples
  9305. @itemize
  9306. @item
  9307. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9308. @example
  9309. 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
  9310. @end example
  9311. @end itemize
  9312. @section readvitc
  9313. Read vertical interval timecode (VITC) information from the top lines of a
  9314. video frame.
  9315. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9316. timecode value, if a valid timecode has been detected. Further metadata key
  9317. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9318. timecode data has been found or not.
  9319. This filter accepts the following options:
  9320. @table @option
  9321. @item scan_max
  9322. Set the maximum number of lines to scan for VITC data. If the value is set to
  9323. @code{-1} the full video frame is scanned. Default is @code{45}.
  9324. @item thr_b
  9325. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9326. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9327. @item thr_w
  9328. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9329. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9330. @end table
  9331. @subsection Examples
  9332. @itemize
  9333. @item
  9334. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9335. draw @code{--:--:--:--} as a placeholder:
  9336. @example
  9337. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9338. @end example
  9339. @end itemize
  9340. @section remap
  9341. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9342. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9343. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9344. value for pixel will be used for destination pixel.
  9345. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9346. will have Xmap/Ymap video stream dimensions.
  9347. Xmap and Ymap input video streams are 16bit depth, single channel.
  9348. @section removegrain
  9349. The removegrain filter is a spatial denoiser for progressive video.
  9350. @table @option
  9351. @item m0
  9352. Set mode for the first plane.
  9353. @item m1
  9354. Set mode for the second plane.
  9355. @item m2
  9356. Set mode for the third plane.
  9357. @item m3
  9358. Set mode for the fourth plane.
  9359. @end table
  9360. Range of mode is from 0 to 24. Description of each mode follows:
  9361. @table @var
  9362. @item 0
  9363. Leave input plane unchanged. Default.
  9364. @item 1
  9365. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9366. @item 2
  9367. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9368. @item 3
  9369. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9370. @item 4
  9371. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9372. This is equivalent to a median filter.
  9373. @item 5
  9374. Line-sensitive clipping giving the minimal change.
  9375. @item 6
  9376. Line-sensitive clipping, intermediate.
  9377. @item 7
  9378. Line-sensitive clipping, intermediate.
  9379. @item 8
  9380. Line-sensitive clipping, intermediate.
  9381. @item 9
  9382. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9383. @item 10
  9384. Replaces the target pixel with the closest neighbour.
  9385. @item 11
  9386. [1 2 1] horizontal and vertical kernel blur.
  9387. @item 12
  9388. Same as mode 11.
  9389. @item 13
  9390. Bob mode, interpolates top field from the line where the neighbours
  9391. pixels are the closest.
  9392. @item 14
  9393. Bob mode, interpolates bottom field from the line where the neighbours
  9394. pixels are the closest.
  9395. @item 15
  9396. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9397. interpolation formula.
  9398. @item 16
  9399. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9400. interpolation formula.
  9401. @item 17
  9402. Clips the pixel with the minimum and maximum of respectively the maximum and
  9403. minimum of each pair of opposite neighbour pixels.
  9404. @item 18
  9405. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9406. the current pixel is minimal.
  9407. @item 19
  9408. Replaces the pixel with the average of its 8 neighbours.
  9409. @item 20
  9410. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9411. @item 21
  9412. Clips pixels using the averages of opposite neighbour.
  9413. @item 22
  9414. Same as mode 21 but simpler and faster.
  9415. @item 23
  9416. Small edge and halo removal, but reputed useless.
  9417. @item 24
  9418. Similar as 23.
  9419. @end table
  9420. @section removelogo
  9421. Suppress a TV station logo, using an image file to determine which
  9422. pixels comprise the logo. It works by filling in the pixels that
  9423. comprise the logo with neighboring pixels.
  9424. The filter accepts the following options:
  9425. @table @option
  9426. @item filename, f
  9427. Set the filter bitmap file, which can be any image format supported by
  9428. libavformat. The width and height of the image file must match those of the
  9429. video stream being processed.
  9430. @end table
  9431. Pixels in the provided bitmap image with a value of zero are not
  9432. considered part of the logo, non-zero pixels are considered part of
  9433. the logo. If you use white (255) for the logo and black (0) for the
  9434. rest, you will be safe. For making the filter bitmap, it is
  9435. recommended to take a screen capture of a black frame with the logo
  9436. visible, and then using a threshold filter followed by the erode
  9437. filter once or twice.
  9438. If needed, little splotches can be fixed manually. Remember that if
  9439. logo pixels are not covered, the filter quality will be much
  9440. reduced. Marking too many pixels as part of the logo does not hurt as
  9441. much, but it will increase the amount of blurring needed to cover over
  9442. the image and will destroy more information than necessary, and extra
  9443. pixels will slow things down on a large logo.
  9444. @section repeatfields
  9445. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9446. fields based on its value.
  9447. @section reverse
  9448. Reverse a video clip.
  9449. Warning: This filter requires memory to buffer the entire clip, so trimming
  9450. is suggested.
  9451. @subsection Examples
  9452. @itemize
  9453. @item
  9454. Take the first 5 seconds of a clip, and reverse it.
  9455. @example
  9456. trim=end=5,reverse
  9457. @end example
  9458. @end itemize
  9459. @section roberts
  9460. Apply roberts cross operator to input video stream.
  9461. The filter accepts the following option:
  9462. @table @option
  9463. @item planes
  9464. Set which planes will be processed, unprocessed planes will be copied.
  9465. By default value 0xf, all planes will be processed.
  9466. @item scale
  9467. Set value which will be multiplied with filtered result.
  9468. @item delta
  9469. Set value which will be added to filtered result.
  9470. @end table
  9471. @section rotate
  9472. Rotate video by an arbitrary angle expressed in radians.
  9473. The filter accepts the following options:
  9474. A description of the optional parameters follows.
  9475. @table @option
  9476. @item angle, a
  9477. Set an expression for the angle by which to rotate the input video
  9478. clockwise, expressed as a number of radians. A negative value will
  9479. result in a counter-clockwise rotation. By default it is set to "0".
  9480. This expression is evaluated for each frame.
  9481. @item out_w, ow
  9482. Set the output width expression, default value is "iw".
  9483. This expression is evaluated just once during configuration.
  9484. @item out_h, oh
  9485. Set the output height expression, default value is "ih".
  9486. This expression is evaluated just once during configuration.
  9487. @item bilinear
  9488. Enable bilinear interpolation if set to 1, a value of 0 disables
  9489. it. Default value is 1.
  9490. @item fillcolor, c
  9491. Set the color used to fill the output area not covered by the rotated
  9492. image. For the general syntax of this option, check the "Color" section in the
  9493. ffmpeg-utils manual. If the special value "none" is selected then no
  9494. background is printed (useful for example if the background is never shown).
  9495. Default value is "black".
  9496. @end table
  9497. The expressions for the angle and the output size can contain the
  9498. following constants and functions:
  9499. @table @option
  9500. @item n
  9501. sequential number of the input frame, starting from 0. It is always NAN
  9502. before the first frame is filtered.
  9503. @item t
  9504. time in seconds of the input frame, it is set to 0 when the filter is
  9505. configured. It is always NAN before the first frame is filtered.
  9506. @item hsub
  9507. @item vsub
  9508. horizontal and vertical chroma subsample values. For example for the
  9509. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9510. @item in_w, iw
  9511. @item in_h, ih
  9512. the input video width and height
  9513. @item out_w, ow
  9514. @item out_h, oh
  9515. the output width and height, that is the size of the padded area as
  9516. specified by the @var{width} and @var{height} expressions
  9517. @item rotw(a)
  9518. @item roth(a)
  9519. the minimal width/height required for completely containing the input
  9520. video rotated by @var{a} radians.
  9521. These are only available when computing the @option{out_w} and
  9522. @option{out_h} expressions.
  9523. @end table
  9524. @subsection Examples
  9525. @itemize
  9526. @item
  9527. Rotate the input by PI/6 radians clockwise:
  9528. @example
  9529. rotate=PI/6
  9530. @end example
  9531. @item
  9532. Rotate the input by PI/6 radians counter-clockwise:
  9533. @example
  9534. rotate=-PI/6
  9535. @end example
  9536. @item
  9537. Rotate the input by 45 degrees clockwise:
  9538. @example
  9539. rotate=45*PI/180
  9540. @end example
  9541. @item
  9542. Apply a constant rotation with period T, starting from an angle of PI/3:
  9543. @example
  9544. rotate=PI/3+2*PI*t/T
  9545. @end example
  9546. @item
  9547. Make the input video rotation oscillating with a period of T
  9548. seconds and an amplitude of A radians:
  9549. @example
  9550. rotate=A*sin(2*PI/T*t)
  9551. @end example
  9552. @item
  9553. Rotate the video, output size is chosen so that the whole rotating
  9554. input video is always completely contained in the output:
  9555. @example
  9556. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9557. @end example
  9558. @item
  9559. Rotate the video, reduce the output size so that no background is ever
  9560. shown:
  9561. @example
  9562. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9563. @end example
  9564. @end itemize
  9565. @subsection Commands
  9566. The filter supports the following commands:
  9567. @table @option
  9568. @item a, angle
  9569. Set the angle expression.
  9570. The command accepts the same syntax of the corresponding option.
  9571. If the specified expression is not valid, it is kept at its current
  9572. value.
  9573. @end table
  9574. @section sab
  9575. Apply Shape Adaptive Blur.
  9576. The filter accepts the following options:
  9577. @table @option
  9578. @item luma_radius, lr
  9579. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9580. value is 1.0. A greater value will result in a more blurred image, and
  9581. in slower processing.
  9582. @item luma_pre_filter_radius, lpfr
  9583. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9584. value is 1.0.
  9585. @item luma_strength, ls
  9586. Set luma maximum difference between pixels to still be considered, must
  9587. be a value in the 0.1-100.0 range, default value is 1.0.
  9588. @item chroma_radius, cr
  9589. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9590. greater value will result in a more blurred image, and in slower
  9591. processing.
  9592. @item chroma_pre_filter_radius, cpfr
  9593. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9594. @item chroma_strength, cs
  9595. Set chroma maximum difference between pixels to still be considered,
  9596. must be a value in the -0.9-100.0 range.
  9597. @end table
  9598. Each chroma option value, if not explicitly specified, is set to the
  9599. corresponding luma option value.
  9600. @anchor{scale}
  9601. @section scale
  9602. Scale (resize) the input video, using the libswscale library.
  9603. The scale filter forces the output display aspect ratio to be the same
  9604. of the input, by changing the output sample aspect ratio.
  9605. If the input image format is different from the format requested by
  9606. the next filter, the scale filter will convert the input to the
  9607. requested format.
  9608. @subsection Options
  9609. The filter accepts the following options, or any of the options
  9610. supported by the libswscale scaler.
  9611. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9612. the complete list of scaler options.
  9613. @table @option
  9614. @item width, w
  9615. @item height, h
  9616. Set the output video dimension expression. Default value is the input
  9617. dimension.
  9618. If the @var{width} or @var{w} value is 0, the input width is used for
  9619. the output. If the @var{height} or @var{h} value is 0, the input height
  9620. is used for the output.
  9621. If one and only one of the values is -n with n >= 1, the scale filter
  9622. will use a value that maintains the aspect ratio of the input image,
  9623. calculated from the other specified dimension. After that it will,
  9624. however, make sure that the calculated dimension is divisible by n and
  9625. adjust the value if necessary.
  9626. If both values are -n with n >= 1, the behavior will be identical to
  9627. both values being set to 0 as previously detailed.
  9628. See below for the list of accepted constants for use in the dimension
  9629. expression.
  9630. @item eval
  9631. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9632. @table @samp
  9633. @item init
  9634. Only evaluate expressions once during the filter initialization or when a command is processed.
  9635. @item frame
  9636. Evaluate expressions for each incoming frame.
  9637. @end table
  9638. Default value is @samp{init}.
  9639. @item interl
  9640. Set the interlacing mode. It accepts the following values:
  9641. @table @samp
  9642. @item 1
  9643. Force interlaced aware scaling.
  9644. @item 0
  9645. Do not apply interlaced scaling.
  9646. @item -1
  9647. Select interlaced aware scaling depending on whether the source frames
  9648. are flagged as interlaced or not.
  9649. @end table
  9650. Default value is @samp{0}.
  9651. @item flags
  9652. Set libswscale scaling flags. See
  9653. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9654. complete list of values. If not explicitly specified the filter applies
  9655. the default flags.
  9656. @item param0, param1
  9657. Set libswscale input parameters for scaling algorithms that need them. See
  9658. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9659. complete documentation. If not explicitly specified the filter applies
  9660. empty parameters.
  9661. @item size, s
  9662. Set the video size. For the syntax of this option, check the
  9663. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9664. @item in_color_matrix
  9665. @item out_color_matrix
  9666. Set in/output YCbCr color space type.
  9667. This allows the autodetected value to be overridden as well as allows forcing
  9668. a specific value used for the output and encoder.
  9669. If not specified, the color space type depends on the pixel format.
  9670. Possible values:
  9671. @table @samp
  9672. @item auto
  9673. Choose automatically.
  9674. @item bt709
  9675. Format conforming to International Telecommunication Union (ITU)
  9676. Recommendation BT.709.
  9677. @item fcc
  9678. Set color space conforming to the United States Federal Communications
  9679. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9680. @item bt601
  9681. Set color space conforming to:
  9682. @itemize
  9683. @item
  9684. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9685. @item
  9686. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9687. @item
  9688. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9689. @end itemize
  9690. @item smpte240m
  9691. Set color space conforming to SMPTE ST 240:1999.
  9692. @end table
  9693. @item in_range
  9694. @item out_range
  9695. Set in/output YCbCr sample range.
  9696. This allows the autodetected value to be overridden as well as allows forcing
  9697. a specific value used for the output and encoder. If not specified, the
  9698. range depends on the pixel format. Possible values:
  9699. @table @samp
  9700. @item auto
  9701. Choose automatically.
  9702. @item jpeg/full/pc
  9703. Set full range (0-255 in case of 8-bit luma).
  9704. @item mpeg/tv
  9705. Set "MPEG" range (16-235 in case of 8-bit luma).
  9706. @end table
  9707. @item force_original_aspect_ratio
  9708. Enable decreasing or increasing output video width or height if necessary to
  9709. keep the original aspect ratio. Possible values:
  9710. @table @samp
  9711. @item disable
  9712. Scale the video as specified and disable this feature.
  9713. @item decrease
  9714. The output video dimensions will automatically be decreased if needed.
  9715. @item increase
  9716. The output video dimensions will automatically be increased if needed.
  9717. @end table
  9718. One useful instance of this option is that when you know a specific device's
  9719. maximum allowed resolution, you can use this to limit the output video to
  9720. that, while retaining the aspect ratio. For example, device A allows
  9721. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9722. decrease) and specifying 1280x720 to the command line makes the output
  9723. 1280x533.
  9724. Please note that this is a different thing than specifying -1 for @option{w}
  9725. or @option{h}, you still need to specify the output resolution for this option
  9726. to work.
  9727. @end table
  9728. The values of the @option{w} and @option{h} options are expressions
  9729. containing the following constants:
  9730. @table @var
  9731. @item in_w
  9732. @item in_h
  9733. The input width and height
  9734. @item iw
  9735. @item ih
  9736. These are the same as @var{in_w} and @var{in_h}.
  9737. @item out_w
  9738. @item out_h
  9739. The output (scaled) width and height
  9740. @item ow
  9741. @item oh
  9742. These are the same as @var{out_w} and @var{out_h}
  9743. @item a
  9744. The same as @var{iw} / @var{ih}
  9745. @item sar
  9746. input sample aspect ratio
  9747. @item dar
  9748. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9749. @item hsub
  9750. @item vsub
  9751. horizontal and vertical input chroma subsample values. For example for the
  9752. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9753. @item ohsub
  9754. @item ovsub
  9755. horizontal and vertical output chroma subsample values. For example for the
  9756. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9757. @end table
  9758. @subsection Examples
  9759. @itemize
  9760. @item
  9761. Scale the input video to a size of 200x100
  9762. @example
  9763. scale=w=200:h=100
  9764. @end example
  9765. This is equivalent to:
  9766. @example
  9767. scale=200:100
  9768. @end example
  9769. or:
  9770. @example
  9771. scale=200x100
  9772. @end example
  9773. @item
  9774. Specify a size abbreviation for the output size:
  9775. @example
  9776. scale=qcif
  9777. @end example
  9778. which can also be written as:
  9779. @example
  9780. scale=size=qcif
  9781. @end example
  9782. @item
  9783. Scale the input to 2x:
  9784. @example
  9785. scale=w=2*iw:h=2*ih
  9786. @end example
  9787. @item
  9788. The above is the same as:
  9789. @example
  9790. scale=2*in_w:2*in_h
  9791. @end example
  9792. @item
  9793. Scale the input to 2x with forced interlaced scaling:
  9794. @example
  9795. scale=2*iw:2*ih:interl=1
  9796. @end example
  9797. @item
  9798. Scale the input to half size:
  9799. @example
  9800. scale=w=iw/2:h=ih/2
  9801. @end example
  9802. @item
  9803. Increase the width, and set the height to the same size:
  9804. @example
  9805. scale=3/2*iw:ow
  9806. @end example
  9807. @item
  9808. Seek Greek harmony:
  9809. @example
  9810. scale=iw:1/PHI*iw
  9811. scale=ih*PHI:ih
  9812. @end example
  9813. @item
  9814. Increase the height, and set the width to 3/2 of the height:
  9815. @example
  9816. scale=w=3/2*oh:h=3/5*ih
  9817. @end example
  9818. @item
  9819. Increase the size, making the size a multiple of the chroma
  9820. subsample values:
  9821. @example
  9822. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9823. @end example
  9824. @item
  9825. Increase the width to a maximum of 500 pixels,
  9826. keeping the same aspect ratio as the input:
  9827. @example
  9828. scale=w='min(500\, iw*3/2):h=-1'
  9829. @end example
  9830. @end itemize
  9831. @subsection Commands
  9832. This filter supports the following commands:
  9833. @table @option
  9834. @item width, w
  9835. @item height, h
  9836. Set the output video dimension expression.
  9837. The command accepts the same syntax of the corresponding option.
  9838. If the specified expression is not valid, it is kept at its current
  9839. value.
  9840. @end table
  9841. @section scale_npp
  9842. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9843. format conversion on CUDA video frames. Setting the output width and height
  9844. works in the same way as for the @var{scale} filter.
  9845. The following additional options are accepted:
  9846. @table @option
  9847. @item format
  9848. The pixel format of the output CUDA frames. If set to the string "same" (the
  9849. default), the input format will be kept. Note that automatic format negotiation
  9850. and conversion is not yet supported for hardware frames
  9851. @item interp_algo
  9852. The interpolation algorithm used for resizing. One of the following:
  9853. @table @option
  9854. @item nn
  9855. Nearest neighbour.
  9856. @item linear
  9857. @item cubic
  9858. @item cubic2p_bspline
  9859. 2-parameter cubic (B=1, C=0)
  9860. @item cubic2p_catmullrom
  9861. 2-parameter cubic (B=0, C=1/2)
  9862. @item cubic2p_b05c03
  9863. 2-parameter cubic (B=1/2, C=3/10)
  9864. @item super
  9865. Supersampling
  9866. @item lanczos
  9867. @end table
  9868. @end table
  9869. @section scale2ref
  9870. Scale (resize) the input video, based on a reference video.
  9871. See the scale filter for available options, scale2ref supports the same but
  9872. uses the reference video instead of the main input as basis. scale2ref also
  9873. supports the following additional constants for the @option{w} and
  9874. @option{h} options:
  9875. @table @var
  9876. @item main_w
  9877. @item main_h
  9878. The main input video's width and height
  9879. @item main_a
  9880. The same as @var{main_w} / @var{main_h}
  9881. @item main_sar
  9882. The main input video's sample aspect ratio
  9883. @item main_dar, mdar
  9884. The main input video's display aspect ratio. Calculated from
  9885. @code{(main_w / main_h) * main_sar}.
  9886. @item main_hsub
  9887. @item main_vsub
  9888. The main input video's horizontal and vertical chroma subsample values.
  9889. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9890. is 1.
  9891. @end table
  9892. @subsection Examples
  9893. @itemize
  9894. @item
  9895. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9896. @example
  9897. 'scale2ref[b][a];[a][b]overlay'
  9898. @end example
  9899. @end itemize
  9900. @anchor{selectivecolor}
  9901. @section selectivecolor
  9902. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9903. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9904. by the "purity" of the color (that is, how saturated it already is).
  9905. This filter is similar to the Adobe Photoshop Selective Color tool.
  9906. The filter accepts the following options:
  9907. @table @option
  9908. @item correction_method
  9909. Select color correction method.
  9910. Available values are:
  9911. @table @samp
  9912. @item absolute
  9913. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9914. component value).
  9915. @item relative
  9916. Specified adjustments are relative to the original component value.
  9917. @end table
  9918. Default is @code{absolute}.
  9919. @item reds
  9920. Adjustments for red pixels (pixels where the red component is the maximum)
  9921. @item yellows
  9922. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9923. @item greens
  9924. Adjustments for green pixels (pixels where the green component is the maximum)
  9925. @item cyans
  9926. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9927. @item blues
  9928. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9929. @item magentas
  9930. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9931. @item whites
  9932. Adjustments for white pixels (pixels where all components are greater than 128)
  9933. @item neutrals
  9934. Adjustments for all pixels except pure black and pure white
  9935. @item blacks
  9936. Adjustments for black pixels (pixels where all components are lesser than 128)
  9937. @item psfile
  9938. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9939. @end table
  9940. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9941. 4 space separated floating point adjustment values in the [-1,1] range,
  9942. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9943. pixels of its range.
  9944. @subsection Examples
  9945. @itemize
  9946. @item
  9947. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9948. increase magenta by 27% in blue areas:
  9949. @example
  9950. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9951. @end example
  9952. @item
  9953. Use a Photoshop selective color preset:
  9954. @example
  9955. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9956. @end example
  9957. @end itemize
  9958. @anchor{separatefields}
  9959. @section separatefields
  9960. The @code{separatefields} takes a frame-based video input and splits
  9961. each frame into its components fields, producing a new half height clip
  9962. with twice the frame rate and twice the frame count.
  9963. This filter use field-dominance information in frame to decide which
  9964. of each pair of fields to place first in the output.
  9965. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9966. @section setdar, setsar
  9967. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9968. output video.
  9969. This is done by changing the specified Sample (aka Pixel) Aspect
  9970. Ratio, according to the following equation:
  9971. @example
  9972. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9973. @end example
  9974. Keep in mind that the @code{setdar} filter does not modify the pixel
  9975. dimensions of the video frame. Also, the display aspect ratio set by
  9976. this filter may be changed by later filters in the filterchain,
  9977. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9978. applied.
  9979. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9980. the filter output video.
  9981. Note that as a consequence of the application of this filter, the
  9982. output display aspect ratio will change according to the equation
  9983. above.
  9984. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9985. filter may be changed by later filters in the filterchain, e.g. if
  9986. another "setsar" or a "setdar" filter is applied.
  9987. It accepts the following parameters:
  9988. @table @option
  9989. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9990. Set the aspect ratio used by the filter.
  9991. The parameter can be a floating point number string, an expression, or
  9992. a string of the form @var{num}:@var{den}, where @var{num} and
  9993. @var{den} are the numerator and denominator of the aspect ratio. If
  9994. the parameter is not specified, it is assumed the value "0".
  9995. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9996. should be escaped.
  9997. @item max
  9998. Set the maximum integer value to use for expressing numerator and
  9999. denominator when reducing the expressed aspect ratio to a rational.
  10000. Default value is @code{100}.
  10001. @end table
  10002. The parameter @var{sar} is an expression containing
  10003. the following constants:
  10004. @table @option
  10005. @item E, PI, PHI
  10006. These are approximated values for the mathematical constants e
  10007. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10008. @item w, h
  10009. The input width and height.
  10010. @item a
  10011. These are the same as @var{w} / @var{h}.
  10012. @item sar
  10013. The input sample aspect ratio.
  10014. @item dar
  10015. The input display aspect ratio. It is the same as
  10016. (@var{w} / @var{h}) * @var{sar}.
  10017. @item hsub, vsub
  10018. Horizontal and vertical chroma subsample values. For example, for the
  10019. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10020. @end table
  10021. @subsection Examples
  10022. @itemize
  10023. @item
  10024. To change the display aspect ratio to 16:9, specify one of the following:
  10025. @example
  10026. setdar=dar=1.77777
  10027. setdar=dar=16/9
  10028. @end example
  10029. @item
  10030. To change the sample aspect ratio to 10:11, specify:
  10031. @example
  10032. setsar=sar=10/11
  10033. @end example
  10034. @item
  10035. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10036. 1000 in the aspect ratio reduction, use the command:
  10037. @example
  10038. setdar=ratio=16/9:max=1000
  10039. @end example
  10040. @end itemize
  10041. @anchor{setfield}
  10042. @section setfield
  10043. Force field for the output video frame.
  10044. The @code{setfield} filter marks the interlace type field for the
  10045. output frames. It does not change the input frame, but only sets the
  10046. corresponding property, which affects how the frame is treated by
  10047. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10048. The filter accepts the following options:
  10049. @table @option
  10050. @item mode
  10051. Available values are:
  10052. @table @samp
  10053. @item auto
  10054. Keep the same field property.
  10055. @item bff
  10056. Mark the frame as bottom-field-first.
  10057. @item tff
  10058. Mark the frame as top-field-first.
  10059. @item prog
  10060. Mark the frame as progressive.
  10061. @end table
  10062. @end table
  10063. @section showinfo
  10064. Show a line containing various information for each input video frame.
  10065. The input video is not modified.
  10066. The shown line contains a sequence of key/value pairs of the form
  10067. @var{key}:@var{value}.
  10068. The following values are shown in the output:
  10069. @table @option
  10070. @item n
  10071. The (sequential) number of the input frame, starting from 0.
  10072. @item pts
  10073. The Presentation TimeStamp of the input frame, expressed as a number of
  10074. time base units. The time base unit depends on the filter input pad.
  10075. @item pts_time
  10076. The Presentation TimeStamp of the input frame, expressed as a number of
  10077. seconds.
  10078. @item pos
  10079. The position of the frame in the input stream, or -1 if this information is
  10080. unavailable and/or meaningless (for example in case of synthetic video).
  10081. @item fmt
  10082. The pixel format name.
  10083. @item sar
  10084. The sample aspect ratio of the input frame, expressed in the form
  10085. @var{num}/@var{den}.
  10086. @item s
  10087. The size of the input frame. For the syntax of this option, check the
  10088. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10089. @item i
  10090. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10091. for bottom field first).
  10092. @item iskey
  10093. This is 1 if the frame is a key frame, 0 otherwise.
  10094. @item type
  10095. The picture type of the input frame ("I" for an I-frame, "P" for a
  10096. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10097. Also refer to the documentation of the @code{AVPictureType} enum and of
  10098. the @code{av_get_picture_type_char} function defined in
  10099. @file{libavutil/avutil.h}.
  10100. @item checksum
  10101. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10102. @item plane_checksum
  10103. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10104. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10105. @end table
  10106. @section showpalette
  10107. Displays the 256 colors palette of each frame. This filter is only relevant for
  10108. @var{pal8} pixel format frames.
  10109. It accepts the following option:
  10110. @table @option
  10111. @item s
  10112. Set the size of the box used to represent one palette color entry. Default is
  10113. @code{30} (for a @code{30x30} pixel box).
  10114. @end table
  10115. @section shuffleframes
  10116. Reorder and/or duplicate and/or drop video frames.
  10117. It accepts the following parameters:
  10118. @table @option
  10119. @item mapping
  10120. Set the destination indexes of input frames.
  10121. This is space or '|' separated list of indexes that maps input frames to output
  10122. frames. Number of indexes also sets maximal value that each index may have.
  10123. '-1' index have special meaning and that is to drop frame.
  10124. @end table
  10125. The first frame has the index 0. The default is to keep the input unchanged.
  10126. @subsection Examples
  10127. @itemize
  10128. @item
  10129. Swap second and third frame of every three frames of the input:
  10130. @example
  10131. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10132. @end example
  10133. @item
  10134. Swap 10th and 1st frame of every ten frames of the input:
  10135. @example
  10136. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10137. @end example
  10138. @end itemize
  10139. @section shuffleplanes
  10140. Reorder and/or duplicate video planes.
  10141. It accepts the following parameters:
  10142. @table @option
  10143. @item map0
  10144. The index of the input plane to be used as the first output plane.
  10145. @item map1
  10146. The index of the input plane to be used as the second output plane.
  10147. @item map2
  10148. The index of the input plane to be used as the third output plane.
  10149. @item map3
  10150. The index of the input plane to be used as the fourth output plane.
  10151. @end table
  10152. The first plane has the index 0. The default is to keep the input unchanged.
  10153. @subsection Examples
  10154. @itemize
  10155. @item
  10156. Swap the second and third planes of the input:
  10157. @example
  10158. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10159. @end example
  10160. @end itemize
  10161. @anchor{signalstats}
  10162. @section signalstats
  10163. Evaluate various visual metrics that assist in determining issues associated
  10164. with the digitization of analog video media.
  10165. By default the filter will log these metadata values:
  10166. @table @option
  10167. @item YMIN
  10168. Display the minimal Y value contained within the input frame. Expressed in
  10169. range of [0-255].
  10170. @item YLOW
  10171. Display the Y value at the 10% percentile within the input frame. Expressed in
  10172. range of [0-255].
  10173. @item YAVG
  10174. Display the average Y value within the input frame. Expressed in range of
  10175. [0-255].
  10176. @item YHIGH
  10177. Display the Y value at the 90% percentile within the input frame. Expressed in
  10178. range of [0-255].
  10179. @item YMAX
  10180. Display the maximum Y value contained within the input frame. Expressed in
  10181. range of [0-255].
  10182. @item UMIN
  10183. Display the minimal U value contained within the input frame. Expressed in
  10184. range of [0-255].
  10185. @item ULOW
  10186. Display the U value at the 10% percentile within the input frame. Expressed in
  10187. range of [0-255].
  10188. @item UAVG
  10189. Display the average U value within the input frame. Expressed in range of
  10190. [0-255].
  10191. @item UHIGH
  10192. Display the U value at the 90% percentile within the input frame. Expressed in
  10193. range of [0-255].
  10194. @item UMAX
  10195. Display the maximum U value contained within the input frame. Expressed in
  10196. range of [0-255].
  10197. @item VMIN
  10198. Display the minimal V value contained within the input frame. Expressed in
  10199. range of [0-255].
  10200. @item VLOW
  10201. Display the V value at the 10% percentile within the input frame. Expressed in
  10202. range of [0-255].
  10203. @item VAVG
  10204. Display the average V value within the input frame. Expressed in range of
  10205. [0-255].
  10206. @item VHIGH
  10207. Display the V value at the 90% percentile within the input frame. Expressed in
  10208. range of [0-255].
  10209. @item VMAX
  10210. Display the maximum V value contained within the input frame. Expressed in
  10211. range of [0-255].
  10212. @item SATMIN
  10213. Display the minimal saturation value contained within the input frame.
  10214. Expressed in range of [0-~181.02].
  10215. @item SATLOW
  10216. Display the saturation value at the 10% percentile within the input frame.
  10217. Expressed in range of [0-~181.02].
  10218. @item SATAVG
  10219. Display the average saturation value within the input frame. Expressed in range
  10220. of [0-~181.02].
  10221. @item SATHIGH
  10222. Display the saturation value at the 90% percentile within the input frame.
  10223. Expressed in range of [0-~181.02].
  10224. @item SATMAX
  10225. Display the maximum saturation value contained within the input frame.
  10226. Expressed in range of [0-~181.02].
  10227. @item HUEMED
  10228. Display the median value for hue within the input frame. Expressed in range of
  10229. [0-360].
  10230. @item HUEAVG
  10231. Display the average value for hue within the input frame. Expressed in range of
  10232. [0-360].
  10233. @item YDIF
  10234. Display the average of sample value difference between all values of the Y
  10235. plane in the current frame and corresponding values of the previous input frame.
  10236. Expressed in range of [0-255].
  10237. @item UDIF
  10238. Display the average of sample value difference between all values of the U
  10239. plane in the current frame and corresponding values of the previous input frame.
  10240. Expressed in range of [0-255].
  10241. @item VDIF
  10242. Display the average of sample value difference between all values of the V
  10243. plane in the current frame and corresponding values of the previous input frame.
  10244. Expressed in range of [0-255].
  10245. @item YBITDEPTH
  10246. Display bit depth of Y plane in current frame.
  10247. Expressed in range of [0-16].
  10248. @item UBITDEPTH
  10249. Display bit depth of U plane in current frame.
  10250. Expressed in range of [0-16].
  10251. @item VBITDEPTH
  10252. Display bit depth of V plane in current frame.
  10253. Expressed in range of [0-16].
  10254. @end table
  10255. The filter accepts the following options:
  10256. @table @option
  10257. @item stat
  10258. @item out
  10259. @option{stat} specify an additional form of image analysis.
  10260. @option{out} output video with the specified type of pixel highlighted.
  10261. Both options accept the following values:
  10262. @table @samp
  10263. @item tout
  10264. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10265. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10266. include the results of video dropouts, head clogs, or tape tracking issues.
  10267. @item vrep
  10268. Identify @var{vertical line repetition}. Vertical line repetition includes
  10269. similar rows of pixels within a frame. In born-digital video vertical line
  10270. repetition is common, but this pattern is uncommon in video digitized from an
  10271. analog source. When it occurs in video that results from the digitization of an
  10272. analog source it can indicate concealment from a dropout compensator.
  10273. @item brng
  10274. Identify pixels that fall outside of legal broadcast range.
  10275. @end table
  10276. @item color, c
  10277. Set the highlight color for the @option{out} option. The default color is
  10278. yellow.
  10279. @end table
  10280. @subsection Examples
  10281. @itemize
  10282. @item
  10283. Output data of various video metrics:
  10284. @example
  10285. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10286. @end example
  10287. @item
  10288. Output specific data about the minimum and maximum values of the Y plane per frame:
  10289. @example
  10290. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10291. @end example
  10292. @item
  10293. Playback video while highlighting pixels that are outside of broadcast range in red.
  10294. @example
  10295. ffplay example.mov -vf signalstats="out=brng:color=red"
  10296. @end example
  10297. @item
  10298. Playback video with signalstats metadata drawn over the frame.
  10299. @example
  10300. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10301. @end example
  10302. The contents of signalstat_drawtext.txt used in the command are:
  10303. @example
  10304. time %@{pts:hms@}
  10305. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10306. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10307. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10308. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10309. @end example
  10310. @end itemize
  10311. @anchor{signature}
  10312. @section signature
  10313. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10314. input. In this case the matching between the inputs can be calculated additionally.
  10315. The filter always passes through the first input. The signature of each stream can
  10316. be written into a file.
  10317. It accepts the following options:
  10318. @table @option
  10319. @item detectmode
  10320. Enable or disable the matching process.
  10321. Available values are:
  10322. @table @samp
  10323. @item off
  10324. Disable the calculation of a matching (default).
  10325. @item full
  10326. Calculate the matching for the whole video and output whether the whole video
  10327. matches or only parts.
  10328. @item fast
  10329. Calculate only until a matching is found or the video ends. Should be faster in
  10330. some cases.
  10331. @end table
  10332. @item nb_inputs
  10333. Set the number of inputs. The option value must be a non negative integer.
  10334. Default value is 1.
  10335. @item filename
  10336. Set the path to which the output is written. If there is more than one input,
  10337. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10338. integer), that will be replaced with the input number. If no filename is
  10339. specified, no output will be written. This is the default.
  10340. @item format
  10341. Choose the output format.
  10342. Available values are:
  10343. @table @samp
  10344. @item binary
  10345. Use the specified binary representation (default).
  10346. @item xml
  10347. Use the specified xml representation.
  10348. @end table
  10349. @item th_d
  10350. Set threshold to detect one word as similar. The option value must be an integer
  10351. greater than zero. The default value is 9000.
  10352. @item th_dc
  10353. Set threshold to detect all words as similar. The option value must be an integer
  10354. greater than zero. The default value is 60000.
  10355. @item th_xh
  10356. Set threshold to detect frames as similar. The option value must be an integer
  10357. greater than zero. The default value is 116.
  10358. @item th_di
  10359. Set the minimum length of a sequence in frames to recognize it as matching
  10360. sequence. The option value must be a non negative integer value.
  10361. The default value is 0.
  10362. @item th_it
  10363. Set the minimum relation, that matching frames to all frames must have.
  10364. The option value must be a double value between 0 and 1. The default value is 0.5.
  10365. @end table
  10366. @subsection Examples
  10367. @itemize
  10368. @item
  10369. To calculate the signature of an input video and store it in signature.bin:
  10370. @example
  10371. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10372. @end example
  10373. @item
  10374. To detect whether two videos match and store the signatures in XML format in
  10375. signature0.xml and signature1.xml:
  10376. @example
  10377. 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 -
  10378. @end example
  10379. @end itemize
  10380. @anchor{smartblur}
  10381. @section smartblur
  10382. Blur the input video without impacting the outlines.
  10383. It accepts the following options:
  10384. @table @option
  10385. @item luma_radius, lr
  10386. Set the luma radius. The option value must be a float number in
  10387. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10388. used to blur the image (slower if larger). Default value is 1.0.
  10389. @item luma_strength, ls
  10390. Set the luma strength. The option value must be a float number
  10391. in the range [-1.0,1.0] that configures the blurring. A value included
  10392. in [0.0,1.0] will blur the image whereas a value included in
  10393. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10394. @item luma_threshold, lt
  10395. Set the luma threshold used as a coefficient to determine
  10396. whether a pixel should be blurred or not. The option value must be an
  10397. integer in the range [-30,30]. A value of 0 will filter all the image,
  10398. a value included in [0,30] will filter flat areas and a value included
  10399. in [-30,0] will filter edges. Default value is 0.
  10400. @item chroma_radius, cr
  10401. Set the chroma radius. The option value must be a float number in
  10402. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10403. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10404. @item chroma_strength, cs
  10405. Set the chroma strength. The option value must be a float number
  10406. in the range [-1.0,1.0] that configures the blurring. A value included
  10407. in [0.0,1.0] will blur the image whereas a value included in
  10408. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10409. @item chroma_threshold, ct
  10410. Set the chroma threshold used as a coefficient to determine
  10411. whether a pixel should be blurred or not. The option value must be an
  10412. integer in the range [-30,30]. A value of 0 will filter all the image,
  10413. a value included in [0,30] will filter flat areas and a value included
  10414. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10415. @end table
  10416. If a chroma option is not explicitly set, the corresponding luma value
  10417. is set.
  10418. @section ssim
  10419. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10420. This filter takes in input two input videos, the first input is
  10421. considered the "main" source and is passed unchanged to the
  10422. output. The second input is used as a "reference" video for computing
  10423. the SSIM.
  10424. Both video inputs must have the same resolution and pixel format for
  10425. this filter to work correctly. Also it assumes that both inputs
  10426. have the same number of frames, which are compared one by one.
  10427. The filter stores the calculated SSIM of each frame.
  10428. The description of the accepted parameters follows.
  10429. @table @option
  10430. @item stats_file, f
  10431. If specified the filter will use the named file to save the SSIM of
  10432. each individual frame. When filename equals "-" the data is sent to
  10433. standard output.
  10434. @end table
  10435. The file printed if @var{stats_file} is selected, contains a sequence of
  10436. key/value pairs of the form @var{key}:@var{value} for each compared
  10437. couple of frames.
  10438. A description of each shown parameter follows:
  10439. @table @option
  10440. @item n
  10441. sequential number of the input frame, starting from 1
  10442. @item Y, U, V, R, G, B
  10443. SSIM of the compared frames for the component specified by the suffix.
  10444. @item All
  10445. SSIM of the compared frames for the whole frame.
  10446. @item dB
  10447. Same as above but in dB representation.
  10448. @end table
  10449. This filter also supports the @ref{framesync} options.
  10450. For example:
  10451. @example
  10452. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10453. [main][ref] ssim="stats_file=stats.log" [out]
  10454. @end example
  10455. On this example the input file being processed is compared with the
  10456. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10457. is stored in @file{stats.log}.
  10458. Another example with both psnr and ssim at same time:
  10459. @example
  10460. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10461. @end example
  10462. @section stereo3d
  10463. Convert between different stereoscopic image formats.
  10464. The filters accept the following options:
  10465. @table @option
  10466. @item in
  10467. Set stereoscopic image format of input.
  10468. Available values for input image formats are:
  10469. @table @samp
  10470. @item sbsl
  10471. side by side parallel (left eye left, right eye right)
  10472. @item sbsr
  10473. side by side crosseye (right eye left, left eye right)
  10474. @item sbs2l
  10475. side by side parallel with half width resolution
  10476. (left eye left, right eye right)
  10477. @item sbs2r
  10478. side by side crosseye with half width resolution
  10479. (right eye left, left eye right)
  10480. @item abl
  10481. above-below (left eye above, right eye below)
  10482. @item abr
  10483. above-below (right eye above, left eye below)
  10484. @item ab2l
  10485. above-below with half height resolution
  10486. (left eye above, right eye below)
  10487. @item ab2r
  10488. above-below with half height resolution
  10489. (right eye above, left eye below)
  10490. @item al
  10491. alternating frames (left eye first, right eye second)
  10492. @item ar
  10493. alternating frames (right eye first, left eye second)
  10494. @item irl
  10495. interleaved rows (left eye has top row, right eye starts on next row)
  10496. @item irr
  10497. interleaved rows (right eye has top row, left eye starts on next row)
  10498. @item icl
  10499. interleaved columns, left eye first
  10500. @item icr
  10501. interleaved columns, right eye first
  10502. Default value is @samp{sbsl}.
  10503. @end table
  10504. @item out
  10505. Set stereoscopic image format of output.
  10506. @table @samp
  10507. @item sbsl
  10508. side by side parallel (left eye left, right eye right)
  10509. @item sbsr
  10510. side by side crosseye (right eye left, left eye right)
  10511. @item sbs2l
  10512. side by side parallel with half width resolution
  10513. (left eye left, right eye right)
  10514. @item sbs2r
  10515. side by side crosseye with half width resolution
  10516. (right eye left, left eye right)
  10517. @item abl
  10518. above-below (left eye above, right eye below)
  10519. @item abr
  10520. above-below (right eye above, left eye below)
  10521. @item ab2l
  10522. above-below with half height resolution
  10523. (left eye above, right eye below)
  10524. @item ab2r
  10525. above-below with half height resolution
  10526. (right eye above, left eye below)
  10527. @item al
  10528. alternating frames (left eye first, right eye second)
  10529. @item ar
  10530. alternating frames (right eye first, left eye second)
  10531. @item irl
  10532. interleaved rows (left eye has top row, right eye starts on next row)
  10533. @item irr
  10534. interleaved rows (right eye has top row, left eye starts on next row)
  10535. @item arbg
  10536. anaglyph red/blue gray
  10537. (red filter on left eye, blue filter on right eye)
  10538. @item argg
  10539. anaglyph red/green gray
  10540. (red filter on left eye, green filter on right eye)
  10541. @item arcg
  10542. anaglyph red/cyan gray
  10543. (red filter on left eye, cyan filter on right eye)
  10544. @item arch
  10545. anaglyph red/cyan half colored
  10546. (red filter on left eye, cyan filter on right eye)
  10547. @item arcc
  10548. anaglyph red/cyan color
  10549. (red filter on left eye, cyan filter on right eye)
  10550. @item arcd
  10551. anaglyph red/cyan color optimized with the least squares projection of dubois
  10552. (red filter on left eye, cyan filter on right eye)
  10553. @item agmg
  10554. anaglyph green/magenta gray
  10555. (green filter on left eye, magenta filter on right eye)
  10556. @item agmh
  10557. anaglyph green/magenta half colored
  10558. (green filter on left eye, magenta filter on right eye)
  10559. @item agmc
  10560. anaglyph green/magenta colored
  10561. (green filter on left eye, magenta filter on right eye)
  10562. @item agmd
  10563. anaglyph green/magenta color optimized with the least squares projection of dubois
  10564. (green filter on left eye, magenta filter on right eye)
  10565. @item aybg
  10566. anaglyph yellow/blue gray
  10567. (yellow filter on left eye, blue filter on right eye)
  10568. @item aybh
  10569. anaglyph yellow/blue half colored
  10570. (yellow filter on left eye, blue filter on right eye)
  10571. @item aybc
  10572. anaglyph yellow/blue colored
  10573. (yellow filter on left eye, blue filter on right eye)
  10574. @item aybd
  10575. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10576. (yellow filter on left eye, blue filter on right eye)
  10577. @item ml
  10578. mono output (left eye only)
  10579. @item mr
  10580. mono output (right eye only)
  10581. @item chl
  10582. checkerboard, left eye first
  10583. @item chr
  10584. checkerboard, right eye first
  10585. @item icl
  10586. interleaved columns, left eye first
  10587. @item icr
  10588. interleaved columns, right eye first
  10589. @item hdmi
  10590. HDMI frame pack
  10591. @end table
  10592. Default value is @samp{arcd}.
  10593. @end table
  10594. @subsection Examples
  10595. @itemize
  10596. @item
  10597. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10598. @example
  10599. stereo3d=sbsl:aybd
  10600. @end example
  10601. @item
  10602. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10603. @example
  10604. stereo3d=abl:sbsr
  10605. @end example
  10606. @end itemize
  10607. @section streamselect, astreamselect
  10608. Select video or audio streams.
  10609. The filter accepts the following options:
  10610. @table @option
  10611. @item inputs
  10612. Set number of inputs. Default is 2.
  10613. @item map
  10614. Set input indexes to remap to outputs.
  10615. @end table
  10616. @subsection Commands
  10617. The @code{streamselect} and @code{astreamselect} filter supports the following
  10618. commands:
  10619. @table @option
  10620. @item map
  10621. Set input indexes to remap to outputs.
  10622. @end table
  10623. @subsection Examples
  10624. @itemize
  10625. @item
  10626. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10627. @example
  10628. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10629. @end example
  10630. @item
  10631. Same as above, but for audio:
  10632. @example
  10633. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10634. @end example
  10635. @end itemize
  10636. @section sobel
  10637. Apply sobel operator to input video stream.
  10638. The filter accepts the following option:
  10639. @table @option
  10640. @item planes
  10641. Set which planes will be processed, unprocessed planes will be copied.
  10642. By default value 0xf, all planes will be processed.
  10643. @item scale
  10644. Set value which will be multiplied with filtered result.
  10645. @item delta
  10646. Set value which will be added to filtered result.
  10647. @end table
  10648. @anchor{spp}
  10649. @section spp
  10650. Apply a simple postprocessing filter that compresses and decompresses the image
  10651. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10652. and average the results.
  10653. The filter accepts the following options:
  10654. @table @option
  10655. @item quality
  10656. Set quality. This option defines the number of levels for averaging. It accepts
  10657. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10658. effect. A value of @code{6} means the higher quality. For each increment of
  10659. that value the speed drops by a factor of approximately 2. Default value is
  10660. @code{3}.
  10661. @item qp
  10662. Force a constant quantization parameter. If not set, the filter will use the QP
  10663. from the video stream (if available).
  10664. @item mode
  10665. Set thresholding mode. Available modes are:
  10666. @table @samp
  10667. @item hard
  10668. Set hard thresholding (default).
  10669. @item soft
  10670. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10671. @end table
  10672. @item use_bframe_qp
  10673. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10674. option may cause flicker since the B-Frames have often larger QP. Default is
  10675. @code{0} (not enabled).
  10676. @end table
  10677. @anchor{subtitles}
  10678. @section subtitles
  10679. Draw subtitles on top of input video using the libass library.
  10680. To enable compilation of this filter you need to configure FFmpeg with
  10681. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10682. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10683. Alpha) subtitles format.
  10684. The filter accepts the following options:
  10685. @table @option
  10686. @item filename, f
  10687. Set the filename of the subtitle file to read. It must be specified.
  10688. @item original_size
  10689. Specify the size of the original video, the video for which the ASS file
  10690. was composed. For the syntax of this option, check the
  10691. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10692. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10693. correctly scale the fonts if the aspect ratio has been changed.
  10694. @item fontsdir
  10695. Set a directory path containing fonts that can be used by the filter.
  10696. These fonts will be used in addition to whatever the font provider uses.
  10697. @item charenc
  10698. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10699. useful if not UTF-8.
  10700. @item stream_index, si
  10701. Set subtitles stream index. @code{subtitles} filter only.
  10702. @item force_style
  10703. Override default style or script info parameters of the subtitles. It accepts a
  10704. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10705. @end table
  10706. If the first key is not specified, it is assumed that the first value
  10707. specifies the @option{filename}.
  10708. For example, to render the file @file{sub.srt} on top of the input
  10709. video, use the command:
  10710. @example
  10711. subtitles=sub.srt
  10712. @end example
  10713. which is equivalent to:
  10714. @example
  10715. subtitles=filename=sub.srt
  10716. @end example
  10717. To render the default subtitles stream from file @file{video.mkv}, use:
  10718. @example
  10719. subtitles=video.mkv
  10720. @end example
  10721. To render the second subtitles stream from that file, use:
  10722. @example
  10723. subtitles=video.mkv:si=1
  10724. @end example
  10725. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10726. @code{DejaVu Serif}, use:
  10727. @example
  10728. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10729. @end example
  10730. @section super2xsai
  10731. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10732. Interpolate) pixel art scaling algorithm.
  10733. Useful for enlarging pixel art images without reducing sharpness.
  10734. @section swaprect
  10735. Swap two rectangular objects in video.
  10736. This filter accepts the following options:
  10737. @table @option
  10738. @item w
  10739. Set object width.
  10740. @item h
  10741. Set object height.
  10742. @item x1
  10743. Set 1st rect x coordinate.
  10744. @item y1
  10745. Set 1st rect y coordinate.
  10746. @item x2
  10747. Set 2nd rect x coordinate.
  10748. @item y2
  10749. Set 2nd rect y coordinate.
  10750. All expressions are evaluated once for each frame.
  10751. @end table
  10752. The all options are expressions containing the following constants:
  10753. @table @option
  10754. @item w
  10755. @item h
  10756. The input width and height.
  10757. @item a
  10758. same as @var{w} / @var{h}
  10759. @item sar
  10760. input sample aspect ratio
  10761. @item dar
  10762. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10763. @item n
  10764. The number of the input frame, starting from 0.
  10765. @item t
  10766. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10767. @item pos
  10768. the position in the file of the input frame, NAN if unknown
  10769. @end table
  10770. @section swapuv
  10771. Swap U & V plane.
  10772. @section telecine
  10773. Apply telecine process to the video.
  10774. This filter accepts the following options:
  10775. @table @option
  10776. @item first_field
  10777. @table @samp
  10778. @item top, t
  10779. top field first
  10780. @item bottom, b
  10781. bottom field first
  10782. The default value is @code{top}.
  10783. @end table
  10784. @item pattern
  10785. A string of numbers representing the pulldown pattern you wish to apply.
  10786. The default value is @code{23}.
  10787. @end table
  10788. @example
  10789. Some typical patterns:
  10790. NTSC output (30i):
  10791. 27.5p: 32222
  10792. 24p: 23 (classic)
  10793. 24p: 2332 (preferred)
  10794. 20p: 33
  10795. 18p: 334
  10796. 16p: 3444
  10797. PAL output (25i):
  10798. 27.5p: 12222
  10799. 24p: 222222222223 ("Euro pulldown")
  10800. 16.67p: 33
  10801. 16p: 33333334
  10802. @end example
  10803. @section threshold
  10804. Apply threshold effect to video stream.
  10805. This filter needs four video streams to perform thresholding.
  10806. First stream is stream we are filtering.
  10807. Second stream is holding threshold values, third stream is holding min values,
  10808. and last, fourth stream is holding max values.
  10809. The filter accepts the following option:
  10810. @table @option
  10811. @item planes
  10812. Set which planes will be processed, unprocessed planes will be copied.
  10813. By default value 0xf, all planes will be processed.
  10814. @end table
  10815. For example if first stream pixel's component value is less then threshold value
  10816. of pixel component from 2nd threshold stream, third stream value will picked,
  10817. otherwise fourth stream pixel component value will be picked.
  10818. Using color source filter one can perform various types of thresholding:
  10819. @subsection Examples
  10820. @itemize
  10821. @item
  10822. Binary threshold, using gray color as threshold:
  10823. @example
  10824. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10825. @end example
  10826. @item
  10827. Inverted binary threshold, using gray color as threshold:
  10828. @example
  10829. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10830. @end example
  10831. @item
  10832. Truncate binary threshold, using gray color as threshold:
  10833. @example
  10834. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10835. @end example
  10836. @item
  10837. Threshold to zero, using gray color as threshold:
  10838. @example
  10839. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10840. @end example
  10841. @item
  10842. Inverted threshold to zero, using gray color as threshold:
  10843. @example
  10844. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10845. @end example
  10846. @end itemize
  10847. @section thumbnail
  10848. Select the most representative frame in a given sequence of consecutive frames.
  10849. The filter accepts the following options:
  10850. @table @option
  10851. @item n
  10852. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10853. will pick one of them, and then handle the next batch of @var{n} frames until
  10854. the end. Default is @code{100}.
  10855. @end table
  10856. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10857. value will result in a higher memory usage, so a high value is not recommended.
  10858. @subsection Examples
  10859. @itemize
  10860. @item
  10861. Extract one picture each 50 frames:
  10862. @example
  10863. thumbnail=50
  10864. @end example
  10865. @item
  10866. Complete example of a thumbnail creation with @command{ffmpeg}:
  10867. @example
  10868. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10869. @end example
  10870. @end itemize
  10871. @section tile
  10872. Tile several successive frames together.
  10873. The filter accepts the following options:
  10874. @table @option
  10875. @item layout
  10876. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10877. this option, check the
  10878. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10879. @item nb_frames
  10880. Set the maximum number of frames to render in the given area. It must be less
  10881. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10882. the area will be used.
  10883. @item margin
  10884. Set the outer border margin in pixels.
  10885. @item padding
  10886. Set the inner border thickness (i.e. the number of pixels between frames). For
  10887. more advanced padding options (such as having different values for the edges),
  10888. refer to the pad video filter.
  10889. @item color
  10890. Specify the color of the unused area. For the syntax of this option, check the
  10891. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10892. is "black".
  10893. @end table
  10894. @subsection Examples
  10895. @itemize
  10896. @item
  10897. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10898. @example
  10899. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10900. @end example
  10901. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10902. duplicating each output frame to accommodate the originally detected frame
  10903. rate.
  10904. @item
  10905. Display @code{5} pictures in an area of @code{3x2} frames,
  10906. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10907. mixed flat and named options:
  10908. @example
  10909. tile=3x2:nb_frames=5:padding=7:margin=2
  10910. @end example
  10911. @end itemize
  10912. @section tinterlace
  10913. Perform various types of temporal field interlacing.
  10914. Frames are counted starting from 1, so the first input frame is
  10915. considered odd.
  10916. The filter accepts the following options:
  10917. @table @option
  10918. @item mode
  10919. Specify the mode of the interlacing. This option can also be specified
  10920. as a value alone. See below for a list of values for this option.
  10921. Available values are:
  10922. @table @samp
  10923. @item merge, 0
  10924. Move odd frames into the upper field, even into the lower field,
  10925. generating a double height frame at half frame rate.
  10926. @example
  10927. ------> time
  10928. Input:
  10929. Frame 1 Frame 2 Frame 3 Frame 4
  10930. 11111 22222 33333 44444
  10931. 11111 22222 33333 44444
  10932. 11111 22222 33333 44444
  10933. 11111 22222 33333 44444
  10934. Output:
  10935. 11111 33333
  10936. 22222 44444
  10937. 11111 33333
  10938. 22222 44444
  10939. 11111 33333
  10940. 22222 44444
  10941. 11111 33333
  10942. 22222 44444
  10943. @end example
  10944. @item drop_even, 1
  10945. Only output odd frames, even frames are dropped, generating a frame with
  10946. unchanged height at half frame rate.
  10947. @example
  10948. ------> time
  10949. Input:
  10950. Frame 1 Frame 2 Frame 3 Frame 4
  10951. 11111 22222 33333 44444
  10952. 11111 22222 33333 44444
  10953. 11111 22222 33333 44444
  10954. 11111 22222 33333 44444
  10955. Output:
  10956. 11111 33333
  10957. 11111 33333
  10958. 11111 33333
  10959. 11111 33333
  10960. @end example
  10961. @item drop_odd, 2
  10962. Only output even frames, odd frames are dropped, generating a frame with
  10963. unchanged height at half frame rate.
  10964. @example
  10965. ------> time
  10966. Input:
  10967. Frame 1 Frame 2 Frame 3 Frame 4
  10968. 11111 22222 33333 44444
  10969. 11111 22222 33333 44444
  10970. 11111 22222 33333 44444
  10971. 11111 22222 33333 44444
  10972. Output:
  10973. 22222 44444
  10974. 22222 44444
  10975. 22222 44444
  10976. 22222 44444
  10977. @end example
  10978. @item pad, 3
  10979. Expand each frame to full height, but pad alternate lines with black,
  10980. generating a frame with double height at the same input frame rate.
  10981. @example
  10982. ------> time
  10983. Input:
  10984. Frame 1 Frame 2 Frame 3 Frame 4
  10985. 11111 22222 33333 44444
  10986. 11111 22222 33333 44444
  10987. 11111 22222 33333 44444
  10988. 11111 22222 33333 44444
  10989. Output:
  10990. 11111 ..... 33333 .....
  10991. ..... 22222 ..... 44444
  10992. 11111 ..... 33333 .....
  10993. ..... 22222 ..... 44444
  10994. 11111 ..... 33333 .....
  10995. ..... 22222 ..... 44444
  10996. 11111 ..... 33333 .....
  10997. ..... 22222 ..... 44444
  10998. @end example
  10999. @item interleave_top, 4
  11000. Interleave the upper field from odd frames with the lower field from
  11001. even frames, generating a frame with unchanged height at half frame rate.
  11002. @example
  11003. ------> time
  11004. Input:
  11005. Frame 1 Frame 2 Frame 3 Frame 4
  11006. 11111<- 22222 33333<- 44444
  11007. 11111 22222<- 33333 44444<-
  11008. 11111<- 22222 33333<- 44444
  11009. 11111 22222<- 33333 44444<-
  11010. Output:
  11011. 11111 33333
  11012. 22222 44444
  11013. 11111 33333
  11014. 22222 44444
  11015. @end example
  11016. @item interleave_bottom, 5
  11017. Interleave the lower field from odd frames with the upper field from
  11018. even frames, generating a frame with unchanged height at half frame rate.
  11019. @example
  11020. ------> time
  11021. Input:
  11022. Frame 1 Frame 2 Frame 3 Frame 4
  11023. 11111 22222<- 33333 44444<-
  11024. 11111<- 22222 33333<- 44444
  11025. 11111 22222<- 33333 44444<-
  11026. 11111<- 22222 33333<- 44444
  11027. Output:
  11028. 22222 44444
  11029. 11111 33333
  11030. 22222 44444
  11031. 11111 33333
  11032. @end example
  11033. @item interlacex2, 6
  11034. Double frame rate with unchanged height. Frames are inserted each
  11035. containing the second temporal field from the previous input frame and
  11036. the first temporal field from the next input frame. This mode relies on
  11037. the top_field_first flag. Useful for interlaced video displays with no
  11038. field synchronisation.
  11039. @example
  11040. ------> time
  11041. Input:
  11042. Frame 1 Frame 2 Frame 3 Frame 4
  11043. 11111 22222 33333 44444
  11044. 11111 22222 33333 44444
  11045. 11111 22222 33333 44444
  11046. 11111 22222 33333 44444
  11047. Output:
  11048. 11111 22222 22222 33333 33333 44444 44444
  11049. 11111 11111 22222 22222 33333 33333 44444
  11050. 11111 22222 22222 33333 33333 44444 44444
  11051. 11111 11111 22222 22222 33333 33333 44444
  11052. @end example
  11053. @item mergex2, 7
  11054. Move odd frames into the upper field, even into the lower field,
  11055. generating a double height frame at same frame rate.
  11056. @example
  11057. ------> time
  11058. Input:
  11059. Frame 1 Frame 2 Frame 3 Frame 4
  11060. 11111 22222 33333 44444
  11061. 11111 22222 33333 44444
  11062. 11111 22222 33333 44444
  11063. 11111 22222 33333 44444
  11064. Output:
  11065. 11111 33333 33333 55555
  11066. 22222 22222 44444 44444
  11067. 11111 33333 33333 55555
  11068. 22222 22222 44444 44444
  11069. 11111 33333 33333 55555
  11070. 22222 22222 44444 44444
  11071. 11111 33333 33333 55555
  11072. 22222 22222 44444 44444
  11073. @end example
  11074. @end table
  11075. Numeric values are deprecated but are accepted for backward
  11076. compatibility reasons.
  11077. Default mode is @code{merge}.
  11078. @item flags
  11079. Specify flags influencing the filter process.
  11080. Available value for @var{flags} is:
  11081. @table @option
  11082. @item low_pass_filter, vlfp
  11083. Enable linear vertical low-pass filtering in the filter.
  11084. Vertical low-pass filtering is required when creating an interlaced
  11085. destination from a progressive source which contains high-frequency
  11086. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11087. patterning.
  11088. @item complex_filter, cvlfp
  11089. Enable complex vertical low-pass filtering.
  11090. This will slightly less reduce interlace 'twitter' and Moire
  11091. patterning but better retain detail and subjective sharpness impression.
  11092. @end table
  11093. Vertical low-pass filtering can only be enabled for @option{mode}
  11094. @var{interleave_top} and @var{interleave_bottom}.
  11095. @end table
  11096. @section tonemap
  11097. Tone map colors from different dynamic ranges.
  11098. This filter expects data in single precision floating point, as it needs to
  11099. operate on (and can output) out-of-range values. Another filter, such as
  11100. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11101. The tonemapping algorithms implemented only work on linear light, so input
  11102. data should be linearized beforehand (and possibly correctly tagged).
  11103. @example
  11104. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11105. @end example
  11106. @subsection Options
  11107. The filter accepts the following options.
  11108. @table @option
  11109. @item tonemap
  11110. Set the tone map algorithm to use.
  11111. Possible values are:
  11112. @table @var
  11113. @item none
  11114. Do not apply any tone map, only desaturate overbright pixels.
  11115. @item clip
  11116. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11117. in-range values, while distorting out-of-range values.
  11118. @item linear
  11119. Stretch the entire reference gamut to a linear multiple of the display.
  11120. @item gamma
  11121. Fit a logarithmic transfer between the tone curves.
  11122. @item reinhard
  11123. Preserve overall image brightness with a simple curve, using nonlinear
  11124. contrast, which results in flattening details and degrading color accuracy.
  11125. @item hable
  11126. Peserve both dark and bright details better than @var{reinhard}, at the cost
  11127. of slightly darkening everything. Use it when detail preservation is more
  11128. important than color and brightness accuracy.
  11129. @item mobius
  11130. Smoothly map out-of-range values, while retaining contrast and colors for
  11131. in-range material as much as possible. Use it when color accuracy is more
  11132. important than detail preservation.
  11133. @end table
  11134. Default is none.
  11135. @item param
  11136. Tune the tone mapping algorithm.
  11137. This affects the following algorithms:
  11138. @table @var
  11139. @item none
  11140. Ignored.
  11141. @item linear
  11142. Specifies the scale factor to use while stretching.
  11143. Default to 1.0.
  11144. @item gamma
  11145. Specifies the exponent of the function.
  11146. Default to 1.8.
  11147. @item clip
  11148. Specify an extra linear coefficient to multiply into the signal before clipping.
  11149. Default to 1.0.
  11150. @item reinhard
  11151. Specify the local contrast coefficient at the display peak.
  11152. Default to 0.5, which means that in-gamut values will be about half as bright
  11153. as when clipping.
  11154. @item hable
  11155. Ignored.
  11156. @item mobius
  11157. Specify the transition point from linear to mobius transform. Every value
  11158. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11159. more accurate the result will be, at the cost of losing bright details.
  11160. Default to 0.3, which due to the steep initial slope still preserves in-range
  11161. colors fairly accurately.
  11162. @end table
  11163. @item desat
  11164. Apply desaturation for highlights that exceed this level of brightness. The
  11165. higher the parameter, the more color information will be preserved. This
  11166. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11167. (smoothly) turning into white instead. This makes images feel more natural,
  11168. at the cost of reducing information about out-of-range colors.
  11169. The default of 2.0 is somewhat conservative and will mostly just apply to
  11170. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11171. This option works only if the input frame has a supported color tag.
  11172. @item peak
  11173. Override signal/nominal/reference peak with this value. Useful when the
  11174. embedded peak information in display metadata is not reliable or when tone
  11175. mapping from a lower range to a higher range.
  11176. @end table
  11177. @section transpose
  11178. Transpose rows with columns in the input video and optionally flip it.
  11179. It accepts the following parameters:
  11180. @table @option
  11181. @item dir
  11182. Specify the transposition direction.
  11183. Can assume the following values:
  11184. @table @samp
  11185. @item 0, 4, cclock_flip
  11186. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11187. @example
  11188. L.R L.l
  11189. . . -> . .
  11190. l.r R.r
  11191. @end example
  11192. @item 1, 5, clock
  11193. Rotate by 90 degrees clockwise, that is:
  11194. @example
  11195. L.R l.L
  11196. . . -> . .
  11197. l.r r.R
  11198. @end example
  11199. @item 2, 6, cclock
  11200. Rotate by 90 degrees counterclockwise, that is:
  11201. @example
  11202. L.R R.r
  11203. . . -> . .
  11204. l.r L.l
  11205. @end example
  11206. @item 3, 7, clock_flip
  11207. Rotate by 90 degrees clockwise and vertically flip, that is:
  11208. @example
  11209. L.R r.R
  11210. . . -> . .
  11211. l.r l.L
  11212. @end example
  11213. @end table
  11214. For values between 4-7, the transposition is only done if the input
  11215. video geometry is portrait and not landscape. These values are
  11216. deprecated, the @code{passthrough} option should be used instead.
  11217. Numerical values are deprecated, and should be dropped in favor of
  11218. symbolic constants.
  11219. @item passthrough
  11220. Do not apply the transposition if the input geometry matches the one
  11221. specified by the specified value. It accepts the following values:
  11222. @table @samp
  11223. @item none
  11224. Always apply transposition.
  11225. @item portrait
  11226. Preserve portrait geometry (when @var{height} >= @var{width}).
  11227. @item landscape
  11228. Preserve landscape geometry (when @var{width} >= @var{height}).
  11229. @end table
  11230. Default value is @code{none}.
  11231. @end table
  11232. For example to rotate by 90 degrees clockwise and preserve portrait
  11233. layout:
  11234. @example
  11235. transpose=dir=1:passthrough=portrait
  11236. @end example
  11237. The command above can also be specified as:
  11238. @example
  11239. transpose=1:portrait
  11240. @end example
  11241. @section trim
  11242. Trim the input so that the output contains one continuous subpart of the input.
  11243. It accepts the following parameters:
  11244. @table @option
  11245. @item start
  11246. Specify the time of the start of the kept section, i.e. the frame with the
  11247. timestamp @var{start} will be the first frame in the output.
  11248. @item end
  11249. Specify the time of the first frame that will be dropped, i.e. the frame
  11250. immediately preceding the one with the timestamp @var{end} will be the last
  11251. frame in the output.
  11252. @item start_pts
  11253. This is the same as @var{start}, except this option sets the start timestamp
  11254. in timebase units instead of seconds.
  11255. @item end_pts
  11256. This is the same as @var{end}, except this option sets the end timestamp
  11257. in timebase units instead of seconds.
  11258. @item duration
  11259. The maximum duration of the output in seconds.
  11260. @item start_frame
  11261. The number of the first frame that should be passed to the output.
  11262. @item end_frame
  11263. The number of the first frame that should be dropped.
  11264. @end table
  11265. @option{start}, @option{end}, and @option{duration} are expressed as time
  11266. duration specifications; see
  11267. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11268. for the accepted syntax.
  11269. Note that the first two sets of the start/end options and the @option{duration}
  11270. option look at the frame timestamp, while the _frame variants simply count the
  11271. frames that pass through the filter. Also note that this filter does not modify
  11272. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11273. setpts filter after the trim filter.
  11274. If multiple start or end options are set, this filter tries to be greedy and
  11275. keep all the frames that match at least one of the specified constraints. To keep
  11276. only the part that matches all the constraints at once, chain multiple trim
  11277. filters.
  11278. The defaults are such that all the input is kept. So it is possible to set e.g.
  11279. just the end values to keep everything before the specified time.
  11280. Examples:
  11281. @itemize
  11282. @item
  11283. Drop everything except the second minute of input:
  11284. @example
  11285. ffmpeg -i INPUT -vf trim=60:120
  11286. @end example
  11287. @item
  11288. Keep only the first second:
  11289. @example
  11290. ffmpeg -i INPUT -vf trim=duration=1
  11291. @end example
  11292. @end itemize
  11293. @section unpremultiply
  11294. Apply alpha unpremultiply effect to input video stream using first plane
  11295. of second stream as alpha.
  11296. Both streams must have same dimensions and same pixel format.
  11297. The filter accepts the following option:
  11298. @table @option
  11299. @item planes
  11300. Set which planes will be processed, unprocessed planes will be copied.
  11301. By default value 0xf, all planes will be processed.
  11302. If the format has 1 or 2 components, then luma is bit 0.
  11303. If the format has 3 or 4 components:
  11304. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11305. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11306. If present, the alpha channel is always the last bit.
  11307. @item inplace
  11308. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11309. @end table
  11310. @anchor{unsharp}
  11311. @section unsharp
  11312. Sharpen or blur the input video.
  11313. It accepts the following parameters:
  11314. @table @option
  11315. @item luma_msize_x, lx
  11316. Set the luma matrix horizontal size. It must be an odd integer between
  11317. 3 and 23. The default value is 5.
  11318. @item luma_msize_y, ly
  11319. Set the luma matrix vertical size. It must be an odd integer between 3
  11320. and 23. The default value is 5.
  11321. @item luma_amount, la
  11322. Set the luma effect strength. It must be a floating point number, reasonable
  11323. values lay between -1.5 and 1.5.
  11324. Negative values will blur the input video, while positive values will
  11325. sharpen it, a value of zero will disable the effect.
  11326. Default value is 1.0.
  11327. @item chroma_msize_x, cx
  11328. Set the chroma matrix horizontal size. It must be an odd integer
  11329. between 3 and 23. The default value is 5.
  11330. @item chroma_msize_y, cy
  11331. Set the chroma matrix vertical size. It must be an odd integer
  11332. between 3 and 23. The default value is 5.
  11333. @item chroma_amount, ca
  11334. Set the chroma effect strength. It must be a floating point number, reasonable
  11335. values lay between -1.5 and 1.5.
  11336. Negative values will blur the input video, while positive values will
  11337. sharpen it, a value of zero will disable the effect.
  11338. Default value is 0.0.
  11339. @item opencl
  11340. If set to 1, specify using OpenCL capabilities, only available if
  11341. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11342. @end table
  11343. All parameters are optional and default to the equivalent of the
  11344. string '5:5:1.0:5:5:0.0'.
  11345. @subsection Examples
  11346. @itemize
  11347. @item
  11348. Apply strong luma sharpen effect:
  11349. @example
  11350. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11351. @end example
  11352. @item
  11353. Apply a strong blur of both luma and chroma parameters:
  11354. @example
  11355. unsharp=7:7:-2:7:7:-2
  11356. @end example
  11357. @end itemize
  11358. @section uspp
  11359. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11360. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11361. shifts and average the results.
  11362. The way this differs from the behavior of spp is that uspp actually encodes &
  11363. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11364. DCT similar to MJPEG.
  11365. The filter accepts the following options:
  11366. @table @option
  11367. @item quality
  11368. Set quality. This option defines the number of levels for averaging. It accepts
  11369. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11370. effect. A value of @code{8} means the higher quality. For each increment of
  11371. that value the speed drops by a factor of approximately 2. Default value is
  11372. @code{3}.
  11373. @item qp
  11374. Force a constant quantization parameter. If not set, the filter will use the QP
  11375. from the video stream (if available).
  11376. @end table
  11377. @section vaguedenoiser
  11378. Apply a wavelet based denoiser.
  11379. It transforms each frame from the video input into the wavelet domain,
  11380. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11381. the obtained coefficients. It does an inverse wavelet transform after.
  11382. Due to wavelet properties, it should give a nice smoothed result, and
  11383. reduced noise, without blurring picture features.
  11384. This filter accepts the following options:
  11385. @table @option
  11386. @item threshold
  11387. The filtering strength. The higher, the more filtered the video will be.
  11388. Hard thresholding can use a higher threshold than soft thresholding
  11389. before the video looks overfiltered.
  11390. @item method
  11391. The filtering method the filter will use.
  11392. It accepts the following values:
  11393. @table @samp
  11394. @item hard
  11395. All values under the threshold will be zeroed.
  11396. @item soft
  11397. All values under the threshold will be zeroed. All values above will be
  11398. reduced by the threshold.
  11399. @item garrote
  11400. Scales or nullifies coefficients - intermediary between (more) soft and
  11401. (less) hard thresholding.
  11402. @end table
  11403. @item nsteps
  11404. Number of times, the wavelet will decompose the picture. Picture can't
  11405. be decomposed beyond a particular point (typically, 8 for a 640x480
  11406. frame - as 2^9 = 512 > 480)
  11407. @item percent
  11408. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11409. @item planes
  11410. A list of the planes to process. By default all planes are processed.
  11411. @end table
  11412. @section vectorscope
  11413. Display 2 color component values in the two dimensional graph (which is called
  11414. a vectorscope).
  11415. This filter accepts the following options:
  11416. @table @option
  11417. @item mode, m
  11418. Set vectorscope mode.
  11419. It accepts the following values:
  11420. @table @samp
  11421. @item gray
  11422. Gray values are displayed on graph, higher brightness means more pixels have
  11423. same component color value on location in graph. This is the default mode.
  11424. @item color
  11425. Gray values are displayed on graph. Surrounding pixels values which are not
  11426. present in video frame are drawn in gradient of 2 color components which are
  11427. set by option @code{x} and @code{y}. The 3rd color component is static.
  11428. @item color2
  11429. Actual color components values present in video frame are displayed on graph.
  11430. @item color3
  11431. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11432. on graph increases value of another color component, which is luminance by
  11433. default values of @code{x} and @code{y}.
  11434. @item color4
  11435. Actual colors present in video frame are displayed on graph. If two different
  11436. colors map to same position on graph then color with higher value of component
  11437. not present in graph is picked.
  11438. @item color5
  11439. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11440. component picked from radial gradient.
  11441. @end table
  11442. @item x
  11443. Set which color component will be represented on X-axis. Default is @code{1}.
  11444. @item y
  11445. Set which color component will be represented on Y-axis. Default is @code{2}.
  11446. @item intensity, i
  11447. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11448. of color component which represents frequency of (X, Y) location in graph.
  11449. @item envelope, e
  11450. @table @samp
  11451. @item none
  11452. No envelope, this is default.
  11453. @item instant
  11454. Instant envelope, even darkest single pixel will be clearly highlighted.
  11455. @item peak
  11456. Hold maximum and minimum values presented in graph over time. This way you
  11457. can still spot out of range values without constantly looking at vectorscope.
  11458. @item peak+instant
  11459. Peak and instant envelope combined together.
  11460. @end table
  11461. @item graticule, g
  11462. Set what kind of graticule to draw.
  11463. @table @samp
  11464. @item none
  11465. @item green
  11466. @item color
  11467. @end table
  11468. @item opacity, o
  11469. Set graticule opacity.
  11470. @item flags, f
  11471. Set graticule flags.
  11472. @table @samp
  11473. @item white
  11474. Draw graticule for white point.
  11475. @item black
  11476. Draw graticule for black point.
  11477. @item name
  11478. Draw color points short names.
  11479. @end table
  11480. @item bgopacity, b
  11481. Set background opacity.
  11482. @item lthreshold, l
  11483. Set low threshold for color component not represented on X or Y axis.
  11484. Values lower than this value will be ignored. Default is 0.
  11485. Note this value is multiplied with actual max possible value one pixel component
  11486. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11487. is 0.1 * 255 = 25.
  11488. @item hthreshold, h
  11489. Set high threshold for color component not represented on X or Y axis.
  11490. Values higher than this value will be ignored. Default is 1.
  11491. Note this value is multiplied with actual max possible value one pixel component
  11492. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11493. is 0.9 * 255 = 230.
  11494. @item colorspace, c
  11495. Set what kind of colorspace to use when drawing graticule.
  11496. @table @samp
  11497. @item auto
  11498. @item 601
  11499. @item 709
  11500. @end table
  11501. Default is auto.
  11502. @end table
  11503. @anchor{vidstabdetect}
  11504. @section vidstabdetect
  11505. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11506. @ref{vidstabtransform} for pass 2.
  11507. This filter generates a file with relative translation and rotation
  11508. transform information about subsequent frames, which is then used by
  11509. the @ref{vidstabtransform} filter.
  11510. To enable compilation of this filter you need to configure FFmpeg with
  11511. @code{--enable-libvidstab}.
  11512. This filter accepts the following options:
  11513. @table @option
  11514. @item result
  11515. Set the path to the file used to write the transforms information.
  11516. Default value is @file{transforms.trf}.
  11517. @item shakiness
  11518. Set how shaky the video is and how quick the camera is. It accepts an
  11519. integer in the range 1-10, a value of 1 means little shakiness, a
  11520. value of 10 means strong shakiness. Default value is 5.
  11521. @item accuracy
  11522. Set the accuracy of the detection process. It must be a value in the
  11523. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11524. accuracy. Default value is 15.
  11525. @item stepsize
  11526. Set stepsize of the search process. The region around minimum is
  11527. scanned with 1 pixel resolution. Default value is 6.
  11528. @item mincontrast
  11529. Set minimum contrast. Below this value a local measurement field is
  11530. discarded. Must be a floating point value in the range 0-1. Default
  11531. value is 0.3.
  11532. @item tripod
  11533. Set reference frame number for tripod mode.
  11534. If enabled, the motion of the frames is compared to a reference frame
  11535. in the filtered stream, identified by the specified number. The idea
  11536. is to compensate all movements in a more-or-less static scene and keep
  11537. the camera view absolutely still.
  11538. If set to 0, it is disabled. The frames are counted starting from 1.
  11539. @item show
  11540. Show fields and transforms in the resulting frames. It accepts an
  11541. integer in the range 0-2. Default value is 0, which disables any
  11542. visualization.
  11543. @end table
  11544. @subsection Examples
  11545. @itemize
  11546. @item
  11547. Use default values:
  11548. @example
  11549. vidstabdetect
  11550. @end example
  11551. @item
  11552. Analyze strongly shaky movie and put the results in file
  11553. @file{mytransforms.trf}:
  11554. @example
  11555. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11556. @end example
  11557. @item
  11558. Visualize the result of internal transformations in the resulting
  11559. video:
  11560. @example
  11561. vidstabdetect=show=1
  11562. @end example
  11563. @item
  11564. Analyze a video with medium shakiness using @command{ffmpeg}:
  11565. @example
  11566. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11567. @end example
  11568. @end itemize
  11569. @anchor{vidstabtransform}
  11570. @section vidstabtransform
  11571. Video stabilization/deshaking: pass 2 of 2,
  11572. see @ref{vidstabdetect} for pass 1.
  11573. Read a file with transform information for each frame and
  11574. apply/compensate them. Together with the @ref{vidstabdetect}
  11575. filter this can be used to deshake videos. See also
  11576. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11577. the @ref{unsharp} filter, see below.
  11578. To enable compilation of this filter you need to configure FFmpeg with
  11579. @code{--enable-libvidstab}.
  11580. @subsection Options
  11581. @table @option
  11582. @item input
  11583. Set path to the file used to read the transforms. Default value is
  11584. @file{transforms.trf}.
  11585. @item smoothing
  11586. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11587. camera movements. Default value is 10.
  11588. For example a number of 10 means that 21 frames are used (10 in the
  11589. past and 10 in the future) to smoothen the motion in the video. A
  11590. larger value leads to a smoother video, but limits the acceleration of
  11591. the camera (pan/tilt movements). 0 is a special case where a static
  11592. camera is simulated.
  11593. @item optalgo
  11594. Set the camera path optimization algorithm.
  11595. Accepted values are:
  11596. @table @samp
  11597. @item gauss
  11598. gaussian kernel low-pass filter on camera motion (default)
  11599. @item avg
  11600. averaging on transformations
  11601. @end table
  11602. @item maxshift
  11603. Set maximal number of pixels to translate frames. Default value is -1,
  11604. meaning no limit.
  11605. @item maxangle
  11606. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11607. value is -1, meaning no limit.
  11608. @item crop
  11609. Specify how to deal with borders that may be visible due to movement
  11610. compensation.
  11611. Available values are:
  11612. @table @samp
  11613. @item keep
  11614. keep image information from previous frame (default)
  11615. @item black
  11616. fill the border black
  11617. @end table
  11618. @item invert
  11619. Invert transforms if set to 1. Default value is 0.
  11620. @item relative
  11621. Consider transforms as relative to previous frame if set to 1,
  11622. absolute if set to 0. Default value is 0.
  11623. @item zoom
  11624. Set percentage to zoom. A positive value will result in a zoom-in
  11625. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11626. zoom).
  11627. @item optzoom
  11628. Set optimal zooming to avoid borders.
  11629. Accepted values are:
  11630. @table @samp
  11631. @item 0
  11632. disabled
  11633. @item 1
  11634. optimal static zoom value is determined (only very strong movements
  11635. will lead to visible borders) (default)
  11636. @item 2
  11637. optimal adaptive zoom value is determined (no borders will be
  11638. visible), see @option{zoomspeed}
  11639. @end table
  11640. Note that the value given at zoom is added to the one calculated here.
  11641. @item zoomspeed
  11642. Set percent to zoom maximally each frame (enabled when
  11643. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11644. 0.25.
  11645. @item interpol
  11646. Specify type of interpolation.
  11647. Available values are:
  11648. @table @samp
  11649. @item no
  11650. no interpolation
  11651. @item linear
  11652. linear only horizontal
  11653. @item bilinear
  11654. linear in both directions (default)
  11655. @item bicubic
  11656. cubic in both directions (slow)
  11657. @end table
  11658. @item tripod
  11659. Enable virtual tripod mode if set to 1, which is equivalent to
  11660. @code{relative=0:smoothing=0}. Default value is 0.
  11661. Use also @code{tripod} option of @ref{vidstabdetect}.
  11662. @item debug
  11663. Increase log verbosity if set to 1. Also the detected global motions
  11664. are written to the temporary file @file{global_motions.trf}. Default
  11665. value is 0.
  11666. @end table
  11667. @subsection Examples
  11668. @itemize
  11669. @item
  11670. Use @command{ffmpeg} for a typical stabilization with default values:
  11671. @example
  11672. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11673. @end example
  11674. Note the use of the @ref{unsharp} filter which is always recommended.
  11675. @item
  11676. Zoom in a bit more and load transform data from a given file:
  11677. @example
  11678. vidstabtransform=zoom=5:input="mytransforms.trf"
  11679. @end example
  11680. @item
  11681. Smoothen the video even more:
  11682. @example
  11683. vidstabtransform=smoothing=30
  11684. @end example
  11685. @end itemize
  11686. @section vflip
  11687. Flip the input video vertically.
  11688. For example, to vertically flip a video with @command{ffmpeg}:
  11689. @example
  11690. ffmpeg -i in.avi -vf "vflip" out.avi
  11691. @end example
  11692. @anchor{vignette}
  11693. @section vignette
  11694. Make or reverse a natural vignetting effect.
  11695. The filter accepts the following options:
  11696. @table @option
  11697. @item angle, a
  11698. Set lens angle expression as a number of radians.
  11699. The value is clipped in the @code{[0,PI/2]} range.
  11700. Default value: @code{"PI/5"}
  11701. @item x0
  11702. @item y0
  11703. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11704. by default.
  11705. @item mode
  11706. Set forward/backward mode.
  11707. Available modes are:
  11708. @table @samp
  11709. @item forward
  11710. The larger the distance from the central point, the darker the image becomes.
  11711. @item backward
  11712. The larger the distance from the central point, the brighter the image becomes.
  11713. This can be used to reverse a vignette effect, though there is no automatic
  11714. detection to extract the lens @option{angle} and other settings (yet). It can
  11715. also be used to create a burning effect.
  11716. @end table
  11717. Default value is @samp{forward}.
  11718. @item eval
  11719. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11720. It accepts the following values:
  11721. @table @samp
  11722. @item init
  11723. Evaluate expressions only once during the filter initialization.
  11724. @item frame
  11725. Evaluate expressions for each incoming frame. This is way slower than the
  11726. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11727. allows advanced dynamic expressions.
  11728. @end table
  11729. Default value is @samp{init}.
  11730. @item dither
  11731. Set dithering to reduce the circular banding effects. Default is @code{1}
  11732. (enabled).
  11733. @item aspect
  11734. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11735. Setting this value to the SAR of the input will make a rectangular vignetting
  11736. following the dimensions of the video.
  11737. Default is @code{1/1}.
  11738. @end table
  11739. @subsection Expressions
  11740. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11741. following parameters.
  11742. @table @option
  11743. @item w
  11744. @item h
  11745. input width and height
  11746. @item n
  11747. the number of input frame, starting from 0
  11748. @item pts
  11749. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11750. @var{TB} units, NAN if undefined
  11751. @item r
  11752. frame rate of the input video, NAN if the input frame rate is unknown
  11753. @item t
  11754. the PTS (Presentation TimeStamp) of the filtered video frame,
  11755. expressed in seconds, NAN if undefined
  11756. @item tb
  11757. time base of the input video
  11758. @end table
  11759. @subsection Examples
  11760. @itemize
  11761. @item
  11762. Apply simple strong vignetting effect:
  11763. @example
  11764. vignette=PI/4
  11765. @end example
  11766. @item
  11767. Make a flickering vignetting:
  11768. @example
  11769. vignette='PI/4+random(1)*PI/50':eval=frame
  11770. @end example
  11771. @end itemize
  11772. @section vstack
  11773. Stack input videos vertically.
  11774. All streams must be of same pixel format and of same width.
  11775. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11776. to create same output.
  11777. The filter accept the following option:
  11778. @table @option
  11779. @item inputs
  11780. Set number of input streams. Default is 2.
  11781. @item shortest
  11782. If set to 1, force the output to terminate when the shortest input
  11783. terminates. Default value is 0.
  11784. @end table
  11785. @section w3fdif
  11786. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11787. Deinterlacing Filter").
  11788. Based on the process described by Martin Weston for BBC R&D, and
  11789. implemented based on the de-interlace algorithm written by Jim
  11790. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11791. uses filter coefficients calculated by BBC R&D.
  11792. There are two sets of filter coefficients, so called "simple":
  11793. and "complex". Which set of filter coefficients is used can
  11794. be set by passing an optional parameter:
  11795. @table @option
  11796. @item filter
  11797. Set the interlacing filter coefficients. Accepts one of the following values:
  11798. @table @samp
  11799. @item simple
  11800. Simple filter coefficient set.
  11801. @item complex
  11802. More-complex filter coefficient set.
  11803. @end table
  11804. Default value is @samp{complex}.
  11805. @item deint
  11806. Specify which frames to deinterlace. Accept one of the following values:
  11807. @table @samp
  11808. @item all
  11809. Deinterlace all frames,
  11810. @item interlaced
  11811. Only deinterlace frames marked as interlaced.
  11812. @end table
  11813. Default value is @samp{all}.
  11814. @end table
  11815. @section waveform
  11816. Video waveform monitor.
  11817. The waveform monitor plots color component intensity. By default luminance
  11818. only. Each column of the waveform corresponds to a column of pixels in the
  11819. source video.
  11820. It accepts the following options:
  11821. @table @option
  11822. @item mode, m
  11823. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11824. In row mode, the graph on the left side represents color component value 0 and
  11825. the right side represents value = 255. In column mode, the top side represents
  11826. color component value = 0 and bottom side represents value = 255.
  11827. @item intensity, i
  11828. Set intensity. Smaller values are useful to find out how many values of the same
  11829. luminance are distributed across input rows/columns.
  11830. Default value is @code{0.04}. Allowed range is [0, 1].
  11831. @item mirror, r
  11832. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11833. In mirrored mode, higher values will be represented on the left
  11834. side for @code{row} mode and at the top for @code{column} mode. Default is
  11835. @code{1} (mirrored).
  11836. @item display, d
  11837. Set display mode.
  11838. It accepts the following values:
  11839. @table @samp
  11840. @item overlay
  11841. Presents information identical to that in the @code{parade}, except
  11842. that the graphs representing color components are superimposed directly
  11843. over one another.
  11844. This display mode makes it easier to spot relative differences or similarities
  11845. in overlapping areas of the color components that are supposed to be identical,
  11846. such as neutral whites, grays, or blacks.
  11847. @item stack
  11848. Display separate graph for the color components side by side in
  11849. @code{row} mode or one below the other in @code{column} mode.
  11850. @item parade
  11851. Display separate graph for the color components side by side in
  11852. @code{column} mode or one below the other in @code{row} mode.
  11853. Using this display mode makes it easy to spot color casts in the highlights
  11854. and shadows of an image, by comparing the contours of the top and the bottom
  11855. graphs of each waveform. Since whites, grays, and blacks are characterized
  11856. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11857. should display three waveforms of roughly equal width/height. If not, the
  11858. correction is easy to perform by making level adjustments the three waveforms.
  11859. @end table
  11860. Default is @code{stack}.
  11861. @item components, c
  11862. Set which color components to display. Default is 1, which means only luminance
  11863. or red color component if input is in RGB colorspace. If is set for example to
  11864. 7 it will display all 3 (if) available color components.
  11865. @item envelope, e
  11866. @table @samp
  11867. @item none
  11868. No envelope, this is default.
  11869. @item instant
  11870. Instant envelope, minimum and maximum values presented in graph will be easily
  11871. visible even with small @code{step} value.
  11872. @item peak
  11873. Hold minimum and maximum values presented in graph across time. This way you
  11874. can still spot out of range values without constantly looking at waveforms.
  11875. @item peak+instant
  11876. Peak and instant envelope combined together.
  11877. @end table
  11878. @item filter, f
  11879. @table @samp
  11880. @item lowpass
  11881. No filtering, this is default.
  11882. @item flat
  11883. Luma and chroma combined together.
  11884. @item aflat
  11885. Similar as above, but shows difference between blue and red chroma.
  11886. @item chroma
  11887. Displays only chroma.
  11888. @item color
  11889. Displays actual color value on waveform.
  11890. @item acolor
  11891. Similar as above, but with luma showing frequency of chroma values.
  11892. @end table
  11893. @item graticule, g
  11894. Set which graticule to display.
  11895. @table @samp
  11896. @item none
  11897. Do not display graticule.
  11898. @item green
  11899. Display green graticule showing legal broadcast ranges.
  11900. @end table
  11901. @item opacity, o
  11902. Set graticule opacity.
  11903. @item flags, fl
  11904. Set graticule flags.
  11905. @table @samp
  11906. @item numbers
  11907. Draw numbers above lines. By default enabled.
  11908. @item dots
  11909. Draw dots instead of lines.
  11910. @end table
  11911. @item scale, s
  11912. Set scale used for displaying graticule.
  11913. @table @samp
  11914. @item digital
  11915. @item millivolts
  11916. @item ire
  11917. @end table
  11918. Default is digital.
  11919. @item bgopacity, b
  11920. Set background opacity.
  11921. @end table
  11922. @section weave, doubleweave
  11923. The @code{weave} takes a field-based video input and join
  11924. each two sequential fields into single frame, producing a new double
  11925. height clip with half the frame rate and half the frame count.
  11926. The @code{doubleweave} works same as @code{weave} but without
  11927. halving frame rate and frame count.
  11928. It accepts the following option:
  11929. @table @option
  11930. @item first_field
  11931. Set first field. Available values are:
  11932. @table @samp
  11933. @item top, t
  11934. Set the frame as top-field-first.
  11935. @item bottom, b
  11936. Set the frame as bottom-field-first.
  11937. @end table
  11938. @end table
  11939. @subsection Examples
  11940. @itemize
  11941. @item
  11942. Interlace video using @ref{select} and @ref{separatefields} filter:
  11943. @example
  11944. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11945. @end example
  11946. @end itemize
  11947. @section xbr
  11948. Apply the xBR high-quality magnification filter which is designed for pixel
  11949. art. It follows a set of edge-detection rules, see
  11950. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11951. It accepts the following option:
  11952. @table @option
  11953. @item n
  11954. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11955. @code{3xBR} and @code{4} for @code{4xBR}.
  11956. Default is @code{3}.
  11957. @end table
  11958. @anchor{yadif}
  11959. @section yadif
  11960. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11961. filter").
  11962. It accepts the following parameters:
  11963. @table @option
  11964. @item mode
  11965. The interlacing mode to adopt. It accepts one of the following values:
  11966. @table @option
  11967. @item 0, send_frame
  11968. Output one frame for each frame.
  11969. @item 1, send_field
  11970. Output one frame for each field.
  11971. @item 2, send_frame_nospatial
  11972. Like @code{send_frame}, but it skips the spatial interlacing check.
  11973. @item 3, send_field_nospatial
  11974. Like @code{send_field}, but it skips the spatial interlacing check.
  11975. @end table
  11976. The default value is @code{send_frame}.
  11977. @item parity
  11978. The picture field parity assumed for the input interlaced video. It accepts one
  11979. of the following values:
  11980. @table @option
  11981. @item 0, tff
  11982. Assume the top field is first.
  11983. @item 1, bff
  11984. Assume the bottom field is first.
  11985. @item -1, auto
  11986. Enable automatic detection of field parity.
  11987. @end table
  11988. The default value is @code{auto}.
  11989. If the interlacing is unknown or the decoder does not export this information,
  11990. top field first will be assumed.
  11991. @item deint
  11992. Specify which frames to deinterlace. Accept one of the following
  11993. values:
  11994. @table @option
  11995. @item 0, all
  11996. Deinterlace all frames.
  11997. @item 1, interlaced
  11998. Only deinterlace frames marked as interlaced.
  11999. @end table
  12000. The default value is @code{all}.
  12001. @end table
  12002. @section zoompan
  12003. Apply Zoom & Pan effect.
  12004. This filter accepts the following options:
  12005. @table @option
  12006. @item zoom, z
  12007. Set the zoom expression. Default is 1.
  12008. @item x
  12009. @item y
  12010. Set the x and y expression. Default is 0.
  12011. @item d
  12012. Set the duration expression in number of frames.
  12013. This sets for how many number of frames effect will last for
  12014. single input image.
  12015. @item s
  12016. Set the output image size, default is 'hd720'.
  12017. @item fps
  12018. Set the output frame rate, default is '25'.
  12019. @end table
  12020. Each expression can contain the following constants:
  12021. @table @option
  12022. @item in_w, iw
  12023. Input width.
  12024. @item in_h, ih
  12025. Input height.
  12026. @item out_w, ow
  12027. Output width.
  12028. @item out_h, oh
  12029. Output height.
  12030. @item in
  12031. Input frame count.
  12032. @item on
  12033. Output frame count.
  12034. @item x
  12035. @item y
  12036. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12037. for current input frame.
  12038. @item px
  12039. @item py
  12040. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12041. not yet such frame (first input frame).
  12042. @item zoom
  12043. Last calculated zoom from 'z' expression for current input frame.
  12044. @item pzoom
  12045. Last calculated zoom of last output frame of previous input frame.
  12046. @item duration
  12047. Number of output frames for current input frame. Calculated from 'd' expression
  12048. for each input frame.
  12049. @item pduration
  12050. number of output frames created for previous input frame
  12051. @item a
  12052. Rational number: input width / input height
  12053. @item sar
  12054. sample aspect ratio
  12055. @item dar
  12056. display aspect ratio
  12057. @end table
  12058. @subsection Examples
  12059. @itemize
  12060. @item
  12061. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12062. @example
  12063. 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
  12064. @end example
  12065. @item
  12066. Zoom-in up to 1.5 and pan always at center of picture:
  12067. @example
  12068. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12069. @end example
  12070. @item
  12071. Same as above but without pausing:
  12072. @example
  12073. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12074. @end example
  12075. @end itemize
  12076. @anchor{zscale}
  12077. @section zscale
  12078. Scale (resize) the input video, using the z.lib library:
  12079. https://github.com/sekrit-twc/zimg.
  12080. The zscale filter forces the output display aspect ratio to be the same
  12081. as the input, by changing the output sample aspect ratio.
  12082. If the input image format is different from the format requested by
  12083. the next filter, the zscale filter will convert the input to the
  12084. requested format.
  12085. @subsection Options
  12086. The filter accepts the following options.
  12087. @table @option
  12088. @item width, w
  12089. @item height, h
  12090. Set the output video dimension expression. Default value is the input
  12091. dimension.
  12092. If the @var{width} or @var{w} value is 0, the input width is used for
  12093. the output. If the @var{height} or @var{h} value is 0, the input height
  12094. is used for the output.
  12095. If one and only one of the values is -n with n >= 1, the zscale filter
  12096. will use a value that maintains the aspect ratio of the input image,
  12097. calculated from the other specified dimension. After that it will,
  12098. however, make sure that the calculated dimension is divisible by n and
  12099. adjust the value if necessary.
  12100. If both values are -n with n >= 1, the behavior will be identical to
  12101. both values being set to 0 as previously detailed.
  12102. See below for the list of accepted constants for use in the dimension
  12103. expression.
  12104. @item size, s
  12105. Set the video size. For the syntax of this option, check the
  12106. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12107. @item dither, d
  12108. Set the dither type.
  12109. Possible values are:
  12110. @table @var
  12111. @item none
  12112. @item ordered
  12113. @item random
  12114. @item error_diffusion
  12115. @end table
  12116. Default is none.
  12117. @item filter, f
  12118. Set the resize filter type.
  12119. Possible values are:
  12120. @table @var
  12121. @item point
  12122. @item bilinear
  12123. @item bicubic
  12124. @item spline16
  12125. @item spline36
  12126. @item lanczos
  12127. @end table
  12128. Default is bilinear.
  12129. @item range, r
  12130. Set the color range.
  12131. Possible values are:
  12132. @table @var
  12133. @item input
  12134. @item limited
  12135. @item full
  12136. @end table
  12137. Default is same as input.
  12138. @item primaries, p
  12139. Set the color primaries.
  12140. Possible values are:
  12141. @table @var
  12142. @item input
  12143. @item 709
  12144. @item unspecified
  12145. @item 170m
  12146. @item 240m
  12147. @item 2020
  12148. @end table
  12149. Default is same as input.
  12150. @item transfer, t
  12151. Set the transfer characteristics.
  12152. Possible values are:
  12153. @table @var
  12154. @item input
  12155. @item 709
  12156. @item unspecified
  12157. @item 601
  12158. @item linear
  12159. @item 2020_10
  12160. @item 2020_12
  12161. @item smpte2084
  12162. @item iec61966-2-1
  12163. @item arib-std-b67
  12164. @end table
  12165. Default is same as input.
  12166. @item matrix, m
  12167. Set the colorspace matrix.
  12168. Possible value are:
  12169. @table @var
  12170. @item input
  12171. @item 709
  12172. @item unspecified
  12173. @item 470bg
  12174. @item 170m
  12175. @item 2020_ncl
  12176. @item 2020_cl
  12177. @end table
  12178. Default is same as input.
  12179. @item rangein, rin
  12180. Set the input color range.
  12181. Possible values are:
  12182. @table @var
  12183. @item input
  12184. @item limited
  12185. @item full
  12186. @end table
  12187. Default is same as input.
  12188. @item primariesin, pin
  12189. Set the input color primaries.
  12190. Possible values are:
  12191. @table @var
  12192. @item input
  12193. @item 709
  12194. @item unspecified
  12195. @item 170m
  12196. @item 240m
  12197. @item 2020
  12198. @end table
  12199. Default is same as input.
  12200. @item transferin, tin
  12201. Set the input transfer characteristics.
  12202. Possible values are:
  12203. @table @var
  12204. @item input
  12205. @item 709
  12206. @item unspecified
  12207. @item 601
  12208. @item linear
  12209. @item 2020_10
  12210. @item 2020_12
  12211. @end table
  12212. Default is same as input.
  12213. @item matrixin, min
  12214. Set the input colorspace matrix.
  12215. Possible value are:
  12216. @table @var
  12217. @item input
  12218. @item 709
  12219. @item unspecified
  12220. @item 470bg
  12221. @item 170m
  12222. @item 2020_ncl
  12223. @item 2020_cl
  12224. @end table
  12225. @item chromal, c
  12226. Set the output chroma location.
  12227. Possible values are:
  12228. @table @var
  12229. @item input
  12230. @item left
  12231. @item center
  12232. @item topleft
  12233. @item top
  12234. @item bottomleft
  12235. @item bottom
  12236. @end table
  12237. @item chromalin, cin
  12238. Set the input chroma location.
  12239. Possible values are:
  12240. @table @var
  12241. @item input
  12242. @item left
  12243. @item center
  12244. @item topleft
  12245. @item top
  12246. @item bottomleft
  12247. @item bottom
  12248. @end table
  12249. @item npl
  12250. Set the nominal peak luminance.
  12251. @end table
  12252. The values of the @option{w} and @option{h} options are expressions
  12253. containing the following constants:
  12254. @table @var
  12255. @item in_w
  12256. @item in_h
  12257. The input width and height
  12258. @item iw
  12259. @item ih
  12260. These are the same as @var{in_w} and @var{in_h}.
  12261. @item out_w
  12262. @item out_h
  12263. The output (scaled) width and height
  12264. @item ow
  12265. @item oh
  12266. These are the same as @var{out_w} and @var{out_h}
  12267. @item a
  12268. The same as @var{iw} / @var{ih}
  12269. @item sar
  12270. input sample aspect ratio
  12271. @item dar
  12272. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12273. @item hsub
  12274. @item vsub
  12275. horizontal and vertical input chroma subsample values. For example for the
  12276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12277. @item ohsub
  12278. @item ovsub
  12279. horizontal and vertical output chroma subsample values. For example for the
  12280. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12281. @end table
  12282. @table @option
  12283. @end table
  12284. @c man end VIDEO FILTERS
  12285. @chapter Video Sources
  12286. @c man begin VIDEO SOURCES
  12287. Below is a description of the currently available video sources.
  12288. @section buffer
  12289. Buffer video frames, and make them available to the filter chain.
  12290. This source is mainly intended for a programmatic use, in particular
  12291. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12292. It accepts the following parameters:
  12293. @table @option
  12294. @item video_size
  12295. Specify the size (width and height) of the buffered video frames. For the
  12296. syntax of this option, check the
  12297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12298. @item width
  12299. The input video width.
  12300. @item height
  12301. The input video height.
  12302. @item pix_fmt
  12303. A string representing the pixel format of the buffered video frames.
  12304. It may be a number corresponding to a pixel format, or a pixel format
  12305. name.
  12306. @item time_base
  12307. Specify the timebase assumed by the timestamps of the buffered frames.
  12308. @item frame_rate
  12309. Specify the frame rate expected for the video stream.
  12310. @item pixel_aspect, sar
  12311. The sample (pixel) aspect ratio of the input video.
  12312. @item sws_param
  12313. Specify the optional parameters to be used for the scale filter which
  12314. is automatically inserted when an input change is detected in the
  12315. input size or format.
  12316. @item hw_frames_ctx
  12317. When using a hardware pixel format, this should be a reference to an
  12318. AVHWFramesContext describing input frames.
  12319. @end table
  12320. For example:
  12321. @example
  12322. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12323. @end example
  12324. will instruct the source to accept video frames with size 320x240 and
  12325. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12326. square pixels (1:1 sample aspect ratio).
  12327. Since the pixel format with name "yuv410p" corresponds to the number 6
  12328. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12329. this example corresponds to:
  12330. @example
  12331. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12332. @end example
  12333. Alternatively, the options can be specified as a flat string, but this
  12334. syntax is deprecated:
  12335. @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}]
  12336. @section cellauto
  12337. Create a pattern generated by an elementary cellular automaton.
  12338. The initial state of the cellular automaton can be defined through the
  12339. @option{filename} and @option{pattern} options. If such options are
  12340. not specified an initial state is created randomly.
  12341. At each new frame a new row in the video is filled with the result of
  12342. the cellular automaton next generation. The behavior when the whole
  12343. frame is filled is defined by the @option{scroll} option.
  12344. This source accepts the following options:
  12345. @table @option
  12346. @item filename, f
  12347. Read the initial cellular automaton state, i.e. the starting row, from
  12348. the specified file.
  12349. In the file, each non-whitespace character is considered an alive
  12350. cell, a newline will terminate the row, and further characters in the
  12351. file will be ignored.
  12352. @item pattern, p
  12353. Read the initial cellular automaton state, i.e. the starting row, from
  12354. the specified string.
  12355. Each non-whitespace character in the string is considered an alive
  12356. cell, a newline will terminate the row, and further characters in the
  12357. string will be ignored.
  12358. @item rate, r
  12359. Set the video rate, that is the number of frames generated per second.
  12360. Default is 25.
  12361. @item random_fill_ratio, ratio
  12362. Set the random fill ratio for the initial cellular automaton row. It
  12363. is a floating point number value ranging from 0 to 1, defaults to
  12364. 1/PHI.
  12365. This option is ignored when a file or a pattern is specified.
  12366. @item random_seed, seed
  12367. Set the seed for filling randomly the initial row, must be an integer
  12368. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12369. set to -1, the filter will try to use a good random seed on a best
  12370. effort basis.
  12371. @item rule
  12372. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12373. Default value is 110.
  12374. @item size, s
  12375. Set the size of the output video. For the syntax of this option, check the
  12376. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12377. If @option{filename} or @option{pattern} is specified, the size is set
  12378. by default to the width of the specified initial state row, and the
  12379. height is set to @var{width} * PHI.
  12380. If @option{size} is set, it must contain the width of the specified
  12381. pattern string, and the specified pattern will be centered in the
  12382. larger row.
  12383. If a filename or a pattern string is not specified, the size value
  12384. defaults to "320x518" (used for a randomly generated initial state).
  12385. @item scroll
  12386. If set to 1, scroll the output upward when all the rows in the output
  12387. have been already filled. If set to 0, the new generated row will be
  12388. written over the top row just after the bottom row is filled.
  12389. Defaults to 1.
  12390. @item start_full, full
  12391. If set to 1, completely fill the output with generated rows before
  12392. outputting the first frame.
  12393. This is the default behavior, for disabling set the value to 0.
  12394. @item stitch
  12395. If set to 1, stitch the left and right row edges together.
  12396. This is the default behavior, for disabling set the value to 0.
  12397. @end table
  12398. @subsection Examples
  12399. @itemize
  12400. @item
  12401. Read the initial state from @file{pattern}, and specify an output of
  12402. size 200x400.
  12403. @example
  12404. cellauto=f=pattern:s=200x400
  12405. @end example
  12406. @item
  12407. Generate a random initial row with a width of 200 cells, with a fill
  12408. ratio of 2/3:
  12409. @example
  12410. cellauto=ratio=2/3:s=200x200
  12411. @end example
  12412. @item
  12413. Create a pattern generated by rule 18 starting by a single alive cell
  12414. centered on an initial row with width 100:
  12415. @example
  12416. cellauto=p=@@:s=100x400:full=0:rule=18
  12417. @end example
  12418. @item
  12419. Specify a more elaborated initial pattern:
  12420. @example
  12421. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12422. @end example
  12423. @end itemize
  12424. @anchor{coreimagesrc}
  12425. @section coreimagesrc
  12426. Video source generated on GPU using Apple's CoreImage API on OSX.
  12427. This video source is a specialized version of the @ref{coreimage} video filter.
  12428. Use a core image generator at the beginning of the applied filterchain to
  12429. generate the content.
  12430. The coreimagesrc video source accepts the following options:
  12431. @table @option
  12432. @item list_generators
  12433. List all available generators along with all their respective options as well as
  12434. possible minimum and maximum values along with the default values.
  12435. @example
  12436. list_generators=true
  12437. @end example
  12438. @item size, s
  12439. Specify the size of the sourced video. For the syntax of this option, check the
  12440. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12441. The default value is @code{320x240}.
  12442. @item rate, r
  12443. Specify the frame rate of the sourced video, as the number of frames
  12444. generated per second. It has to be a string in the format
  12445. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12446. number or a valid video frame rate abbreviation. The default value is
  12447. "25".
  12448. @item sar
  12449. Set the sample aspect ratio of the sourced video.
  12450. @item duration, d
  12451. Set the duration of the sourced video. See
  12452. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12453. for the accepted syntax.
  12454. If not specified, or the expressed duration is negative, the video is
  12455. supposed to be generated forever.
  12456. @end table
  12457. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12458. A complete filterchain can be used for further processing of the
  12459. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12460. and examples for details.
  12461. @subsection Examples
  12462. @itemize
  12463. @item
  12464. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12465. given as complete and escaped command-line for Apple's standard bash shell:
  12466. @example
  12467. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12468. @end example
  12469. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12470. need for a nullsrc video source.
  12471. @end itemize
  12472. @section mandelbrot
  12473. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12474. point specified with @var{start_x} and @var{start_y}.
  12475. This source accepts the following options:
  12476. @table @option
  12477. @item end_pts
  12478. Set the terminal pts value. Default value is 400.
  12479. @item end_scale
  12480. Set the terminal scale value.
  12481. Must be a floating point value. Default value is 0.3.
  12482. @item inner
  12483. Set the inner coloring mode, that is the algorithm used to draw the
  12484. Mandelbrot fractal internal region.
  12485. It shall assume one of the following values:
  12486. @table @option
  12487. @item black
  12488. Set black mode.
  12489. @item convergence
  12490. Show time until convergence.
  12491. @item mincol
  12492. Set color based on point closest to the origin of the iterations.
  12493. @item period
  12494. Set period mode.
  12495. @end table
  12496. Default value is @var{mincol}.
  12497. @item bailout
  12498. Set the bailout value. Default value is 10.0.
  12499. @item maxiter
  12500. Set the maximum of iterations performed by the rendering
  12501. algorithm. Default value is 7189.
  12502. @item outer
  12503. Set outer coloring mode.
  12504. It shall assume one of following values:
  12505. @table @option
  12506. @item iteration_count
  12507. Set iteration cound mode.
  12508. @item normalized_iteration_count
  12509. set normalized iteration count mode.
  12510. @end table
  12511. Default value is @var{normalized_iteration_count}.
  12512. @item rate, r
  12513. Set frame rate, expressed as number of frames per second. Default
  12514. value is "25".
  12515. @item size, s
  12516. Set frame size. For the syntax of this option, check the "Video
  12517. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12518. @item start_scale
  12519. Set the initial scale value. Default value is 3.0.
  12520. @item start_x
  12521. Set the initial x position. Must be a floating point value between
  12522. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12523. @item start_y
  12524. Set the initial y position. Must be a floating point value between
  12525. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12526. @end table
  12527. @section mptestsrc
  12528. Generate various test patterns, as generated by the MPlayer test filter.
  12529. The size of the generated video is fixed, and is 256x256.
  12530. This source is useful in particular for testing encoding features.
  12531. This source accepts the following options:
  12532. @table @option
  12533. @item rate, r
  12534. Specify the frame rate of the sourced video, as the number of frames
  12535. generated per second. It has to be a string in the format
  12536. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12537. number or a valid video frame rate abbreviation. The default value is
  12538. "25".
  12539. @item duration, d
  12540. Set the duration of the sourced video. See
  12541. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12542. for the accepted syntax.
  12543. If not specified, or the expressed duration is negative, the video is
  12544. supposed to be generated forever.
  12545. @item test, t
  12546. Set the number or the name of the test to perform. Supported tests are:
  12547. @table @option
  12548. @item dc_luma
  12549. @item dc_chroma
  12550. @item freq_luma
  12551. @item freq_chroma
  12552. @item amp_luma
  12553. @item amp_chroma
  12554. @item cbp
  12555. @item mv
  12556. @item ring1
  12557. @item ring2
  12558. @item all
  12559. @end table
  12560. Default value is "all", which will cycle through the list of all tests.
  12561. @end table
  12562. Some examples:
  12563. @example
  12564. mptestsrc=t=dc_luma
  12565. @end example
  12566. will generate a "dc_luma" test pattern.
  12567. @section frei0r_src
  12568. Provide a frei0r source.
  12569. To enable compilation of this filter you need to install the frei0r
  12570. header and configure FFmpeg with @code{--enable-frei0r}.
  12571. This source accepts the following parameters:
  12572. @table @option
  12573. @item size
  12574. The size of the video to generate. For the syntax of this option, check the
  12575. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12576. @item framerate
  12577. The framerate of the generated video. It may be a string of the form
  12578. @var{num}/@var{den} or a frame rate abbreviation.
  12579. @item filter_name
  12580. The name to the frei0r source to load. For more information regarding frei0r and
  12581. how to set the parameters, read the @ref{frei0r} section in the video filters
  12582. documentation.
  12583. @item filter_params
  12584. A '|'-separated list of parameters to pass to the frei0r source.
  12585. @end table
  12586. For example, to generate a frei0r partik0l source with size 200x200
  12587. and frame rate 10 which is overlaid on the overlay filter main input:
  12588. @example
  12589. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12590. @end example
  12591. @section life
  12592. Generate a life pattern.
  12593. This source is based on a generalization of John Conway's life game.
  12594. The sourced input represents a life grid, each pixel represents a cell
  12595. which can be in one of two possible states, alive or dead. Every cell
  12596. interacts with its eight neighbours, which are the cells that are
  12597. horizontally, vertically, or diagonally adjacent.
  12598. At each interaction the grid evolves according to the adopted rule,
  12599. which specifies the number of neighbor alive cells which will make a
  12600. cell stay alive or born. The @option{rule} option allows one to specify
  12601. the rule to adopt.
  12602. This source accepts the following options:
  12603. @table @option
  12604. @item filename, f
  12605. Set the file from which to read the initial grid state. In the file,
  12606. each non-whitespace character is considered an alive cell, and newline
  12607. is used to delimit the end of each row.
  12608. If this option is not specified, the initial grid is generated
  12609. randomly.
  12610. @item rate, r
  12611. Set the video rate, that is the number of frames generated per second.
  12612. Default is 25.
  12613. @item random_fill_ratio, ratio
  12614. Set the random fill ratio for the initial random grid. It is a
  12615. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12616. It is ignored when a file is specified.
  12617. @item random_seed, seed
  12618. Set the seed for filling the initial random grid, must be an integer
  12619. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12620. set to -1, the filter will try to use a good random seed on a best
  12621. effort basis.
  12622. @item rule
  12623. Set the life rule.
  12624. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12625. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12626. @var{NS} specifies the number of alive neighbor cells which make a
  12627. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12628. which make a dead cell to become alive (i.e. to "born").
  12629. "s" and "b" can be used in place of "S" and "B", respectively.
  12630. Alternatively a rule can be specified by an 18-bits integer. The 9
  12631. high order bits are used to encode the next cell state if it is alive
  12632. for each number of neighbor alive cells, the low order bits specify
  12633. the rule for "borning" new cells. Higher order bits encode for an
  12634. higher number of neighbor cells.
  12635. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12636. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12637. Default value is "S23/B3", which is the original Conway's game of life
  12638. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12639. cells, and will born a new cell if there are three alive cells around
  12640. a dead cell.
  12641. @item size, s
  12642. Set the size of the output video. For the syntax of this option, check the
  12643. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12644. If @option{filename} is specified, the size is set by default to the
  12645. same size of the input file. If @option{size} is set, it must contain
  12646. the size specified in the input file, and the initial grid defined in
  12647. that file is centered in the larger resulting area.
  12648. If a filename is not specified, the size value defaults to "320x240"
  12649. (used for a randomly generated initial grid).
  12650. @item stitch
  12651. If set to 1, stitch the left and right grid edges together, and the
  12652. top and bottom edges also. Defaults to 1.
  12653. @item mold
  12654. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12655. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12656. value from 0 to 255.
  12657. @item life_color
  12658. Set the color of living (or new born) cells.
  12659. @item death_color
  12660. Set the color of dead cells. If @option{mold} is set, this is the first color
  12661. used to represent a dead cell.
  12662. @item mold_color
  12663. Set mold color, for definitely dead and moldy cells.
  12664. For the syntax of these 3 color options, check the "Color" section in the
  12665. ffmpeg-utils manual.
  12666. @end table
  12667. @subsection Examples
  12668. @itemize
  12669. @item
  12670. Read a grid from @file{pattern}, and center it on a grid of size
  12671. 300x300 pixels:
  12672. @example
  12673. life=f=pattern:s=300x300
  12674. @end example
  12675. @item
  12676. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12677. @example
  12678. life=ratio=2/3:s=200x200
  12679. @end example
  12680. @item
  12681. Specify a custom rule for evolving a randomly generated grid:
  12682. @example
  12683. life=rule=S14/B34
  12684. @end example
  12685. @item
  12686. Full example with slow death effect (mold) using @command{ffplay}:
  12687. @example
  12688. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12689. @end example
  12690. @end itemize
  12691. @anchor{allrgb}
  12692. @anchor{allyuv}
  12693. @anchor{color}
  12694. @anchor{haldclutsrc}
  12695. @anchor{nullsrc}
  12696. @anchor{rgbtestsrc}
  12697. @anchor{smptebars}
  12698. @anchor{smptehdbars}
  12699. @anchor{testsrc}
  12700. @anchor{testsrc2}
  12701. @anchor{yuvtestsrc}
  12702. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12703. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12704. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12705. The @code{color} source provides an uniformly colored input.
  12706. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12707. @ref{haldclut} filter.
  12708. The @code{nullsrc} source returns unprocessed video frames. It is
  12709. mainly useful to be employed in analysis / debugging tools, or as the
  12710. source for filters which ignore the input data.
  12711. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12712. detecting RGB vs BGR issues. You should see a red, green and blue
  12713. stripe from top to bottom.
  12714. The @code{smptebars} source generates a color bars pattern, based on
  12715. the SMPTE Engineering Guideline EG 1-1990.
  12716. The @code{smptehdbars} source generates a color bars pattern, based on
  12717. the SMPTE RP 219-2002.
  12718. The @code{testsrc} source generates a test video pattern, showing a
  12719. color pattern, a scrolling gradient and a timestamp. This is mainly
  12720. intended for testing purposes.
  12721. The @code{testsrc2} source is similar to testsrc, but supports more
  12722. pixel formats instead of just @code{rgb24}. This allows using it as an
  12723. input for other tests without requiring a format conversion.
  12724. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12725. see a y, cb and cr stripe from top to bottom.
  12726. The sources accept the following parameters:
  12727. @table @option
  12728. @item alpha
  12729. Specify the alpha (opacity) of the background, only available in the
  12730. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12731. 255 (fully opaque, the default).
  12732. @item color, c
  12733. Specify the color of the source, only available in the @code{color}
  12734. source. For the syntax of this option, check the "Color" section in the
  12735. ffmpeg-utils manual.
  12736. @item level
  12737. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12738. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12739. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12740. coded on a @code{1/(N*N)} scale.
  12741. @item size, s
  12742. Specify the size of the sourced video. For the syntax of this option, check the
  12743. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12744. The default value is @code{320x240}.
  12745. This option is not available with the @code{haldclutsrc} filter.
  12746. @item rate, r
  12747. Specify the frame rate of the sourced video, as the number of frames
  12748. generated per second. It has to be a string in the format
  12749. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12750. number or a valid video frame rate abbreviation. The default value is
  12751. "25".
  12752. @item sar
  12753. Set the sample aspect ratio of the sourced video.
  12754. @item duration, d
  12755. Set the duration of the sourced video. See
  12756. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12757. for the accepted syntax.
  12758. If not specified, or the expressed duration is negative, the video is
  12759. supposed to be generated forever.
  12760. @item decimals, n
  12761. Set the number of decimals to show in the timestamp, only available in the
  12762. @code{testsrc} source.
  12763. The displayed timestamp value will correspond to the original
  12764. timestamp value multiplied by the power of 10 of the specified
  12765. value. Default value is 0.
  12766. @end table
  12767. For example the following:
  12768. @example
  12769. testsrc=duration=5.3:size=qcif:rate=10
  12770. @end example
  12771. will generate a video with a duration of 5.3 seconds, with size
  12772. 176x144 and a frame rate of 10 frames per second.
  12773. The following graph description will generate a red source
  12774. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12775. frames per second.
  12776. @example
  12777. color=c=red@@0.2:s=qcif:r=10
  12778. @end example
  12779. If the input content is to be ignored, @code{nullsrc} can be used. The
  12780. following command generates noise in the luminance plane by employing
  12781. the @code{geq} filter:
  12782. @example
  12783. nullsrc=s=256x256, geq=random(1)*255:128:128
  12784. @end example
  12785. @subsection Commands
  12786. The @code{color} source supports the following commands:
  12787. @table @option
  12788. @item c, color
  12789. Set the color of the created image. Accepts the same syntax of the
  12790. corresponding @option{color} option.
  12791. @end table
  12792. @c man end VIDEO SOURCES
  12793. @chapter Video Sinks
  12794. @c man begin VIDEO SINKS
  12795. Below is a description of the currently available video sinks.
  12796. @section buffersink
  12797. Buffer video frames, and make them available to the end of the filter
  12798. graph.
  12799. This sink is mainly intended for programmatic use, in particular
  12800. through the interface defined in @file{libavfilter/buffersink.h}
  12801. or the options system.
  12802. It accepts a pointer to an AVBufferSinkContext structure, which
  12803. defines the incoming buffers' formats, to be passed as the opaque
  12804. parameter to @code{avfilter_init_filter} for initialization.
  12805. @section nullsink
  12806. Null video sink: do absolutely nothing with the input video. It is
  12807. mainly useful as a template and for use in analysis / debugging
  12808. tools.
  12809. @c man end VIDEO SINKS
  12810. @chapter Multimedia Filters
  12811. @c man begin MULTIMEDIA FILTERS
  12812. Below is a description of the currently available multimedia filters.
  12813. @section abitscope
  12814. Convert input audio to a video output, displaying the audio bit scope.
  12815. The filter accepts the following options:
  12816. @table @option
  12817. @item rate, r
  12818. Set frame rate, expressed as number of frames per second. Default
  12819. value is "25".
  12820. @item size, s
  12821. Specify the video size for the output. For the syntax of this option, check the
  12822. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12823. Default value is @code{1024x256}.
  12824. @item colors
  12825. Specify list of colors separated by space or by '|' which will be used to
  12826. draw channels. Unrecognized or missing colors will be replaced
  12827. by white color.
  12828. @end table
  12829. @section ahistogram
  12830. Convert input audio to a video output, displaying the volume histogram.
  12831. The filter accepts the following options:
  12832. @table @option
  12833. @item dmode
  12834. Specify how histogram is calculated.
  12835. It accepts the following values:
  12836. @table @samp
  12837. @item single
  12838. Use single histogram for all channels.
  12839. @item separate
  12840. Use separate histogram for each channel.
  12841. @end table
  12842. Default is @code{single}.
  12843. @item rate, r
  12844. Set frame rate, expressed as number of frames per second. Default
  12845. value is "25".
  12846. @item size, s
  12847. Specify the video size for the output. For the syntax of this option, check the
  12848. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12849. Default value is @code{hd720}.
  12850. @item scale
  12851. Set display scale.
  12852. It accepts the following values:
  12853. @table @samp
  12854. @item log
  12855. logarithmic
  12856. @item sqrt
  12857. square root
  12858. @item cbrt
  12859. cubic root
  12860. @item lin
  12861. linear
  12862. @item rlog
  12863. reverse logarithmic
  12864. @end table
  12865. Default is @code{log}.
  12866. @item ascale
  12867. Set amplitude scale.
  12868. It accepts the following values:
  12869. @table @samp
  12870. @item log
  12871. logarithmic
  12872. @item lin
  12873. linear
  12874. @end table
  12875. Default is @code{log}.
  12876. @item acount
  12877. Set how much frames to accumulate in histogram.
  12878. Defauls is 1. Setting this to -1 accumulates all frames.
  12879. @item rheight
  12880. Set histogram ratio of window height.
  12881. @item slide
  12882. Set sonogram sliding.
  12883. It accepts the following values:
  12884. @table @samp
  12885. @item replace
  12886. replace old rows with new ones.
  12887. @item scroll
  12888. scroll from top to bottom.
  12889. @end table
  12890. Default is @code{replace}.
  12891. @end table
  12892. @section aphasemeter
  12893. Convert input audio to a video output, displaying the audio phase.
  12894. The filter accepts the following options:
  12895. @table @option
  12896. @item rate, r
  12897. Set the output frame rate. Default value is @code{25}.
  12898. @item size, s
  12899. Set the video size for the output. For the syntax of this option, check the
  12900. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12901. Default value is @code{800x400}.
  12902. @item rc
  12903. @item gc
  12904. @item bc
  12905. Specify the red, green, blue contrast. Default values are @code{2},
  12906. @code{7} and @code{1}.
  12907. Allowed range is @code{[0, 255]}.
  12908. @item mpc
  12909. Set color which will be used for drawing median phase. If color is
  12910. @code{none} which is default, no median phase value will be drawn.
  12911. @item video
  12912. Enable video output. Default is enabled.
  12913. @end table
  12914. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12915. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12916. The @code{-1} means left and right channels are completely out of phase and
  12917. @code{1} means channels are in phase.
  12918. @section avectorscope
  12919. Convert input audio to a video output, representing the audio vector
  12920. scope.
  12921. The filter is used to measure the difference between channels of stereo
  12922. audio stream. A monoaural signal, consisting of identical left and right
  12923. signal, results in straight vertical line. Any stereo separation is visible
  12924. as a deviation from this line, creating a Lissajous figure.
  12925. If the straight (or deviation from it) but horizontal line appears this
  12926. indicates that the left and right channels are out of phase.
  12927. The filter accepts the following options:
  12928. @table @option
  12929. @item mode, m
  12930. Set the vectorscope mode.
  12931. Available values are:
  12932. @table @samp
  12933. @item lissajous
  12934. Lissajous rotated by 45 degrees.
  12935. @item lissajous_xy
  12936. Same as above but not rotated.
  12937. @item polar
  12938. Shape resembling half of circle.
  12939. @end table
  12940. Default value is @samp{lissajous}.
  12941. @item size, s
  12942. Set the video size for the output. For the syntax of this option, check the
  12943. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12944. Default value is @code{400x400}.
  12945. @item rate, r
  12946. Set the output frame rate. Default value is @code{25}.
  12947. @item rc
  12948. @item gc
  12949. @item bc
  12950. @item ac
  12951. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12952. @code{160}, @code{80} and @code{255}.
  12953. Allowed range is @code{[0, 255]}.
  12954. @item rf
  12955. @item gf
  12956. @item bf
  12957. @item af
  12958. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12959. @code{10}, @code{5} and @code{5}.
  12960. Allowed range is @code{[0, 255]}.
  12961. @item zoom
  12962. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12963. @item draw
  12964. Set the vectorscope drawing mode.
  12965. Available values are:
  12966. @table @samp
  12967. @item dot
  12968. Draw dot for each sample.
  12969. @item line
  12970. Draw line between previous and current sample.
  12971. @end table
  12972. Default value is @samp{dot}.
  12973. @item scale
  12974. Specify amplitude scale of audio samples.
  12975. Available values are:
  12976. @table @samp
  12977. @item lin
  12978. Linear.
  12979. @item sqrt
  12980. Square root.
  12981. @item cbrt
  12982. Cubic root.
  12983. @item log
  12984. Logarithmic.
  12985. @end table
  12986. @end table
  12987. @subsection Examples
  12988. @itemize
  12989. @item
  12990. Complete example using @command{ffplay}:
  12991. @example
  12992. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12993. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12994. @end example
  12995. @end itemize
  12996. @section bench, abench
  12997. Benchmark part of a filtergraph.
  12998. The filter accepts the following options:
  12999. @table @option
  13000. @item action
  13001. Start or stop a timer.
  13002. Available values are:
  13003. @table @samp
  13004. @item start
  13005. Get the current time, set it as frame metadata (using the key
  13006. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13007. @item stop
  13008. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13009. the input frame metadata to get the time difference. Time difference, average,
  13010. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13011. @code{min}) are then printed. The timestamps are expressed in seconds.
  13012. @end table
  13013. @end table
  13014. @subsection Examples
  13015. @itemize
  13016. @item
  13017. Benchmark @ref{selectivecolor} filter:
  13018. @example
  13019. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13020. @end example
  13021. @end itemize
  13022. @section concat
  13023. Concatenate audio and video streams, joining them together one after the
  13024. other.
  13025. The filter works on segments of synchronized video and audio streams. All
  13026. segments must have the same number of streams of each type, and that will
  13027. also be the number of streams at output.
  13028. The filter accepts the following options:
  13029. @table @option
  13030. @item n
  13031. Set the number of segments. Default is 2.
  13032. @item v
  13033. Set the number of output video streams, that is also the number of video
  13034. streams in each segment. Default is 1.
  13035. @item a
  13036. Set the number of output audio streams, that is also the number of audio
  13037. streams in each segment. Default is 0.
  13038. @item unsafe
  13039. Activate unsafe mode: do not fail if segments have a different format.
  13040. @end table
  13041. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13042. @var{a} audio outputs.
  13043. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13044. segment, in the same order as the outputs, then the inputs for the second
  13045. segment, etc.
  13046. Related streams do not always have exactly the same duration, for various
  13047. reasons including codec frame size or sloppy authoring. For that reason,
  13048. related synchronized streams (e.g. a video and its audio track) should be
  13049. concatenated at once. The concat filter will use the duration of the longest
  13050. stream in each segment (except the last one), and if necessary pad shorter
  13051. audio streams with silence.
  13052. For this filter to work correctly, all segments must start at timestamp 0.
  13053. All corresponding streams must have the same parameters in all segments; the
  13054. filtering system will automatically select a common pixel format for video
  13055. streams, and a common sample format, sample rate and channel layout for
  13056. audio streams, but other settings, such as resolution, must be converted
  13057. explicitly by the user.
  13058. Different frame rates are acceptable but will result in variable frame rate
  13059. at output; be sure to configure the output file to handle it.
  13060. @subsection Examples
  13061. @itemize
  13062. @item
  13063. Concatenate an opening, an episode and an ending, all in bilingual version
  13064. (video in stream 0, audio in streams 1 and 2):
  13065. @example
  13066. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13067. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13068. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13069. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13070. @end example
  13071. @item
  13072. Concatenate two parts, handling audio and video separately, using the
  13073. (a)movie sources, and adjusting the resolution:
  13074. @example
  13075. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13076. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13077. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13078. @end example
  13079. Note that a desync will happen at the stitch if the audio and video streams
  13080. do not have exactly the same duration in the first file.
  13081. @end itemize
  13082. @section drawgraph, adrawgraph
  13083. Draw a graph using input video or audio metadata.
  13084. It accepts the following parameters:
  13085. @table @option
  13086. @item m1
  13087. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13088. @item fg1
  13089. Set 1st foreground color expression.
  13090. @item m2
  13091. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13092. @item fg2
  13093. Set 2nd foreground color expression.
  13094. @item m3
  13095. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13096. @item fg3
  13097. Set 3rd foreground color expression.
  13098. @item m4
  13099. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13100. @item fg4
  13101. Set 4th foreground color expression.
  13102. @item min
  13103. Set minimal value of metadata value.
  13104. @item max
  13105. Set maximal value of metadata value.
  13106. @item bg
  13107. Set graph background color. Default is white.
  13108. @item mode
  13109. Set graph mode.
  13110. Available values for mode is:
  13111. @table @samp
  13112. @item bar
  13113. @item dot
  13114. @item line
  13115. @end table
  13116. Default is @code{line}.
  13117. @item slide
  13118. Set slide mode.
  13119. Available values for slide is:
  13120. @table @samp
  13121. @item frame
  13122. Draw new frame when right border is reached.
  13123. @item replace
  13124. Replace old columns with new ones.
  13125. @item scroll
  13126. Scroll from right to left.
  13127. @item rscroll
  13128. Scroll from left to right.
  13129. @item picture
  13130. Draw single picture.
  13131. @end table
  13132. Default is @code{frame}.
  13133. @item size
  13134. Set size of graph video. For the syntax of this option, check the
  13135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13136. The default value is @code{900x256}.
  13137. The foreground color expressions can use the following variables:
  13138. @table @option
  13139. @item MIN
  13140. Minimal value of metadata value.
  13141. @item MAX
  13142. Maximal value of metadata value.
  13143. @item VAL
  13144. Current metadata key value.
  13145. @end table
  13146. The color is defined as 0xAABBGGRR.
  13147. @end table
  13148. Example using metadata from @ref{signalstats} filter:
  13149. @example
  13150. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13151. @end example
  13152. Example using metadata from @ref{ebur128} filter:
  13153. @example
  13154. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13155. @end example
  13156. @anchor{ebur128}
  13157. @section ebur128
  13158. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13159. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13160. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13161. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13162. The filter also has a video output (see the @var{video} option) with a real
  13163. time graph to observe the loudness evolution. The graphic contains the logged
  13164. message mentioned above, so it is not printed anymore when this option is set,
  13165. unless the verbose logging is set. The main graphing area contains the
  13166. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13167. the momentary loudness (400 milliseconds).
  13168. More information about the Loudness Recommendation EBU R128 on
  13169. @url{http://tech.ebu.ch/loudness}.
  13170. The filter accepts the following options:
  13171. @table @option
  13172. @item video
  13173. Activate the video output. The audio stream is passed unchanged whether this
  13174. option is set or no. The video stream will be the first output stream if
  13175. activated. Default is @code{0}.
  13176. @item size
  13177. Set the video size. This option is for video only. For the syntax of this
  13178. option, check the
  13179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13180. Default and minimum resolution is @code{640x480}.
  13181. @item meter
  13182. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13183. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13184. other integer value between this range is allowed.
  13185. @item metadata
  13186. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13187. into 100ms output frames, each of them containing various loudness information
  13188. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13189. Default is @code{0}.
  13190. @item framelog
  13191. Force the frame logging level.
  13192. Available values are:
  13193. @table @samp
  13194. @item info
  13195. information logging level
  13196. @item verbose
  13197. verbose logging level
  13198. @end table
  13199. By default, the logging level is set to @var{info}. If the @option{video} or
  13200. the @option{metadata} options are set, it switches to @var{verbose}.
  13201. @item peak
  13202. Set peak mode(s).
  13203. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13204. values are:
  13205. @table @samp
  13206. @item none
  13207. Disable any peak mode (default).
  13208. @item sample
  13209. Enable sample-peak mode.
  13210. Simple peak mode looking for the higher sample value. It logs a message
  13211. for sample-peak (identified by @code{SPK}).
  13212. @item true
  13213. Enable true-peak mode.
  13214. If enabled, the peak lookup is done on an over-sampled version of the input
  13215. stream for better peak accuracy. It logs a message for true-peak.
  13216. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13217. This mode requires a build with @code{libswresample}.
  13218. @end table
  13219. @item dualmono
  13220. Treat mono input files as "dual mono". If a mono file is intended for playback
  13221. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13222. If set to @code{true}, this option will compensate for this effect.
  13223. Multi-channel input files are not affected by this option.
  13224. @item panlaw
  13225. Set a specific pan law to be used for the measurement of dual mono files.
  13226. This parameter is optional, and has a default value of -3.01dB.
  13227. @end table
  13228. @subsection Examples
  13229. @itemize
  13230. @item
  13231. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13232. @example
  13233. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13234. @end example
  13235. @item
  13236. Run an analysis with @command{ffmpeg}:
  13237. @example
  13238. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13239. @end example
  13240. @end itemize
  13241. @section interleave, ainterleave
  13242. Temporally interleave frames from several inputs.
  13243. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13244. These filters read frames from several inputs and send the oldest
  13245. queued frame to the output.
  13246. Input streams must have well defined, monotonically increasing frame
  13247. timestamp values.
  13248. In order to submit one frame to output, these filters need to enqueue
  13249. at least one frame for each input, so they cannot work in case one
  13250. input is not yet terminated and will not receive incoming frames.
  13251. For example consider the case when one input is a @code{select} filter
  13252. which always drops input frames. The @code{interleave} filter will keep
  13253. reading from that input, but it will never be able to send new frames
  13254. to output until the input sends an end-of-stream signal.
  13255. Also, depending on inputs synchronization, the filters will drop
  13256. frames in case one input receives more frames than the other ones, and
  13257. the queue is already filled.
  13258. These filters accept the following options:
  13259. @table @option
  13260. @item nb_inputs, n
  13261. Set the number of different inputs, it is 2 by default.
  13262. @end table
  13263. @subsection Examples
  13264. @itemize
  13265. @item
  13266. Interleave frames belonging to different streams using @command{ffmpeg}:
  13267. @example
  13268. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13269. @end example
  13270. @item
  13271. Add flickering blur effect:
  13272. @example
  13273. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13274. @end example
  13275. @end itemize
  13276. @section metadata, ametadata
  13277. Manipulate frame metadata.
  13278. This filter accepts the following options:
  13279. @table @option
  13280. @item mode
  13281. Set mode of operation of the filter.
  13282. Can be one of the following:
  13283. @table @samp
  13284. @item select
  13285. If both @code{value} and @code{key} is set, select frames
  13286. which have such metadata. If only @code{key} is set, select
  13287. every frame that has such key in metadata.
  13288. @item add
  13289. Add new metadata @code{key} and @code{value}. If key is already available
  13290. do nothing.
  13291. @item modify
  13292. Modify value of already present key.
  13293. @item delete
  13294. If @code{value} is set, delete only keys that have such value.
  13295. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13296. the frame.
  13297. @item print
  13298. Print key and its value if metadata was found. If @code{key} is not set print all
  13299. metadata values available in frame.
  13300. @end table
  13301. @item key
  13302. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13303. @item value
  13304. Set metadata value which will be used. This option is mandatory for
  13305. @code{modify} and @code{add} mode.
  13306. @item function
  13307. Which function to use when comparing metadata value and @code{value}.
  13308. Can be one of following:
  13309. @table @samp
  13310. @item same_str
  13311. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13312. @item starts_with
  13313. Values are interpreted as strings, returns true if metadata value starts with
  13314. the @code{value} option string.
  13315. @item less
  13316. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13317. @item equal
  13318. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13319. @item greater
  13320. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13321. @item expr
  13322. Values are interpreted as floats, returns true if expression from option @code{expr}
  13323. evaluates to true.
  13324. @end table
  13325. @item expr
  13326. Set expression which is used when @code{function} is set to @code{expr}.
  13327. The expression is evaluated through the eval API and can contain the following
  13328. constants:
  13329. @table @option
  13330. @item VALUE1
  13331. Float representation of @code{value} from metadata key.
  13332. @item VALUE2
  13333. Float representation of @code{value} as supplied by user in @code{value} option.
  13334. @end table
  13335. @item file
  13336. If specified in @code{print} mode, output is written to the named file. Instead of
  13337. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13338. for standard output. If @code{file} option is not set, output is written to the log
  13339. with AV_LOG_INFO loglevel.
  13340. @end table
  13341. @subsection Examples
  13342. @itemize
  13343. @item
  13344. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13345. between 0 and 1.
  13346. @example
  13347. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13348. @end example
  13349. @item
  13350. Print silencedetect output to file @file{metadata.txt}.
  13351. @example
  13352. silencedetect,ametadata=mode=print:file=metadata.txt
  13353. @end example
  13354. @item
  13355. Direct all metadata to a pipe with file descriptor 4.
  13356. @example
  13357. metadata=mode=print:file='pipe\:4'
  13358. @end example
  13359. @end itemize
  13360. @section perms, aperms
  13361. Set read/write permissions for the output frames.
  13362. These filters are mainly aimed at developers to test direct path in the
  13363. following filter in the filtergraph.
  13364. The filters accept the following options:
  13365. @table @option
  13366. @item mode
  13367. Select the permissions mode.
  13368. It accepts the following values:
  13369. @table @samp
  13370. @item none
  13371. Do nothing. This is the default.
  13372. @item ro
  13373. Set all the output frames read-only.
  13374. @item rw
  13375. Set all the output frames directly writable.
  13376. @item toggle
  13377. Make the frame read-only if writable, and writable if read-only.
  13378. @item random
  13379. Set each output frame read-only or writable randomly.
  13380. @end table
  13381. @item seed
  13382. Set the seed for the @var{random} mode, must be an integer included between
  13383. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13384. @code{-1}, the filter will try to use a good random seed on a best effort
  13385. basis.
  13386. @end table
  13387. Note: in case of auto-inserted filter between the permission filter and the
  13388. following one, the permission might not be received as expected in that
  13389. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13390. perms/aperms filter can avoid this problem.
  13391. @section realtime, arealtime
  13392. Slow down filtering to match real time approximatively.
  13393. These filters will pause the filtering for a variable amount of time to
  13394. match the output rate with the input timestamps.
  13395. They are similar to the @option{re} option to @code{ffmpeg}.
  13396. They accept the following options:
  13397. @table @option
  13398. @item limit
  13399. Time limit for the pauses. Any pause longer than that will be considered
  13400. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13401. @end table
  13402. @anchor{select}
  13403. @section select, aselect
  13404. Select frames to pass in output.
  13405. This filter accepts the following options:
  13406. @table @option
  13407. @item expr, e
  13408. Set expression, which is evaluated for each input frame.
  13409. If the expression is evaluated to zero, the frame is discarded.
  13410. If the evaluation result is negative or NaN, the frame is sent to the
  13411. first output; otherwise it is sent to the output with index
  13412. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13413. For example a value of @code{1.2} corresponds to the output with index
  13414. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13415. @item outputs, n
  13416. Set the number of outputs. The output to which to send the selected
  13417. frame is based on the result of the evaluation. Default value is 1.
  13418. @end table
  13419. The expression can contain the following constants:
  13420. @table @option
  13421. @item n
  13422. The (sequential) number of the filtered frame, starting from 0.
  13423. @item selected_n
  13424. The (sequential) number of the selected frame, starting from 0.
  13425. @item prev_selected_n
  13426. The sequential number of the last selected frame. It's NAN if undefined.
  13427. @item TB
  13428. The timebase of the input timestamps.
  13429. @item pts
  13430. The PTS (Presentation TimeStamp) of the filtered video frame,
  13431. expressed in @var{TB} units. It's NAN if undefined.
  13432. @item t
  13433. The PTS of the filtered video frame,
  13434. expressed in seconds. It's NAN if undefined.
  13435. @item prev_pts
  13436. The PTS of the previously filtered video frame. It's NAN if undefined.
  13437. @item prev_selected_pts
  13438. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13439. @item prev_selected_t
  13440. The PTS of the last previously selected video frame. It's NAN if undefined.
  13441. @item start_pts
  13442. The PTS of the first video frame in the video. It's NAN if undefined.
  13443. @item start_t
  13444. The time of the first video frame in the video. It's NAN if undefined.
  13445. @item pict_type @emph{(video only)}
  13446. The type of the filtered frame. It can assume one of the following
  13447. values:
  13448. @table @option
  13449. @item I
  13450. @item P
  13451. @item B
  13452. @item S
  13453. @item SI
  13454. @item SP
  13455. @item BI
  13456. @end table
  13457. @item interlace_type @emph{(video only)}
  13458. The frame interlace type. It can assume one of the following values:
  13459. @table @option
  13460. @item PROGRESSIVE
  13461. The frame is progressive (not interlaced).
  13462. @item TOPFIRST
  13463. The frame is top-field-first.
  13464. @item BOTTOMFIRST
  13465. The frame is bottom-field-first.
  13466. @end table
  13467. @item consumed_sample_n @emph{(audio only)}
  13468. the number of selected samples before the current frame
  13469. @item samples_n @emph{(audio only)}
  13470. the number of samples in the current frame
  13471. @item sample_rate @emph{(audio only)}
  13472. the input sample rate
  13473. @item key
  13474. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13475. @item pos
  13476. the position in the file of the filtered frame, -1 if the information
  13477. is not available (e.g. for synthetic video)
  13478. @item scene @emph{(video only)}
  13479. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13480. probability for the current frame to introduce a new scene, while a higher
  13481. value means the current frame is more likely to be one (see the example below)
  13482. @item concatdec_select
  13483. The concat demuxer can select only part of a concat input file by setting an
  13484. inpoint and an outpoint, but the output packets may not be entirely contained
  13485. in the selected interval. By using this variable, it is possible to skip frames
  13486. generated by the concat demuxer which are not exactly contained in the selected
  13487. interval.
  13488. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13489. and the @var{lavf.concat.duration} packet metadata values which are also
  13490. present in the decoded frames.
  13491. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13492. start_time and either the duration metadata is missing or the frame pts is less
  13493. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13494. missing.
  13495. That basically means that an input frame is selected if its pts is within the
  13496. interval set by the concat demuxer.
  13497. @end table
  13498. The default value of the select expression is "1".
  13499. @subsection Examples
  13500. @itemize
  13501. @item
  13502. Select all frames in input:
  13503. @example
  13504. select
  13505. @end example
  13506. The example above is the same as:
  13507. @example
  13508. select=1
  13509. @end example
  13510. @item
  13511. Skip all frames:
  13512. @example
  13513. select=0
  13514. @end example
  13515. @item
  13516. Select only I-frames:
  13517. @example
  13518. select='eq(pict_type\,I)'
  13519. @end example
  13520. @item
  13521. Select one frame every 100:
  13522. @example
  13523. select='not(mod(n\,100))'
  13524. @end example
  13525. @item
  13526. Select only frames contained in the 10-20 time interval:
  13527. @example
  13528. select=between(t\,10\,20)
  13529. @end example
  13530. @item
  13531. Select only I-frames contained in the 10-20 time interval:
  13532. @example
  13533. select=between(t\,10\,20)*eq(pict_type\,I)
  13534. @end example
  13535. @item
  13536. Select frames with a minimum distance of 10 seconds:
  13537. @example
  13538. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13539. @end example
  13540. @item
  13541. Use aselect to select only audio frames with samples number > 100:
  13542. @example
  13543. aselect='gt(samples_n\,100)'
  13544. @end example
  13545. @item
  13546. Create a mosaic of the first scenes:
  13547. @example
  13548. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13549. @end example
  13550. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13551. choice.
  13552. @item
  13553. Send even and odd frames to separate outputs, and compose them:
  13554. @example
  13555. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13556. @end example
  13557. @item
  13558. Select useful frames from an ffconcat file which is using inpoints and
  13559. outpoints but where the source files are not intra frame only.
  13560. @example
  13561. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13562. @end example
  13563. @end itemize
  13564. @section sendcmd, asendcmd
  13565. Send commands to filters in the filtergraph.
  13566. These filters read commands to be sent to other filters in the
  13567. filtergraph.
  13568. @code{sendcmd} must be inserted between two video filters,
  13569. @code{asendcmd} must be inserted between two audio filters, but apart
  13570. from that they act the same way.
  13571. The specification of commands can be provided in the filter arguments
  13572. with the @var{commands} option, or in a file specified by the
  13573. @var{filename} option.
  13574. These filters accept the following options:
  13575. @table @option
  13576. @item commands, c
  13577. Set the commands to be read and sent to the other filters.
  13578. @item filename, f
  13579. Set the filename of the commands to be read and sent to the other
  13580. filters.
  13581. @end table
  13582. @subsection Commands syntax
  13583. A commands description consists of a sequence of interval
  13584. specifications, comprising a list of commands to be executed when a
  13585. particular event related to that interval occurs. The occurring event
  13586. is typically the current frame time entering or leaving a given time
  13587. interval.
  13588. An interval is specified by the following syntax:
  13589. @example
  13590. @var{START}[-@var{END}] @var{COMMANDS};
  13591. @end example
  13592. The time interval is specified by the @var{START} and @var{END} times.
  13593. @var{END} is optional and defaults to the maximum time.
  13594. The current frame time is considered within the specified interval if
  13595. it is included in the interval [@var{START}, @var{END}), that is when
  13596. the time is greater or equal to @var{START} and is lesser than
  13597. @var{END}.
  13598. @var{COMMANDS} consists of a sequence of one or more command
  13599. specifications, separated by ",", relating to that interval. The
  13600. syntax of a command specification is given by:
  13601. @example
  13602. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13603. @end example
  13604. @var{FLAGS} is optional and specifies the type of events relating to
  13605. the time interval which enable sending the specified command, and must
  13606. be a non-null sequence of identifier flags separated by "+" or "|" and
  13607. enclosed between "[" and "]".
  13608. The following flags are recognized:
  13609. @table @option
  13610. @item enter
  13611. The command is sent when the current frame timestamp enters the
  13612. specified interval. In other words, the command is sent when the
  13613. previous frame timestamp was not in the given interval, and the
  13614. current is.
  13615. @item leave
  13616. The command is sent when the current frame timestamp leaves the
  13617. specified interval. In other words, the command is sent when the
  13618. previous frame timestamp was in the given interval, and the
  13619. current is not.
  13620. @end table
  13621. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13622. assumed.
  13623. @var{TARGET} specifies the target of the command, usually the name of
  13624. the filter class or a specific filter instance name.
  13625. @var{COMMAND} specifies the name of the command for the target filter.
  13626. @var{ARG} is optional and specifies the optional list of argument for
  13627. the given @var{COMMAND}.
  13628. Between one interval specification and another, whitespaces, or
  13629. sequences of characters starting with @code{#} until the end of line,
  13630. are ignored and can be used to annotate comments.
  13631. A simplified BNF description of the commands specification syntax
  13632. follows:
  13633. @example
  13634. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13635. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13636. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13637. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13638. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13639. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13640. @end example
  13641. @subsection Examples
  13642. @itemize
  13643. @item
  13644. Specify audio tempo change at second 4:
  13645. @example
  13646. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13647. @end example
  13648. @item
  13649. Target a specific filter instance:
  13650. @example
  13651. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13652. @end example
  13653. @item
  13654. Specify a list of drawtext and hue commands in a file.
  13655. @example
  13656. # show text in the interval 5-10
  13657. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13658. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13659. # desaturate the image in the interval 15-20
  13660. 15.0-20.0 [enter] hue s 0,
  13661. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13662. [leave] hue s 1,
  13663. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13664. # apply an exponential saturation fade-out effect, starting from time 25
  13665. 25 [enter] hue s exp(25-t)
  13666. @end example
  13667. A filtergraph allowing to read and process the above command list
  13668. stored in a file @file{test.cmd}, can be specified with:
  13669. @example
  13670. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13671. @end example
  13672. @end itemize
  13673. @anchor{setpts}
  13674. @section setpts, asetpts
  13675. Change the PTS (presentation timestamp) of the input frames.
  13676. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13677. This filter accepts the following options:
  13678. @table @option
  13679. @item expr
  13680. The expression which is evaluated for each frame to construct its timestamp.
  13681. @end table
  13682. The expression is evaluated through the eval API and can contain the following
  13683. constants:
  13684. @table @option
  13685. @item FRAME_RATE
  13686. frame rate, only defined for constant frame-rate video
  13687. @item PTS
  13688. The presentation timestamp in input
  13689. @item N
  13690. The count of the input frame for video or the number of consumed samples,
  13691. not including the current frame for audio, starting from 0.
  13692. @item NB_CONSUMED_SAMPLES
  13693. The number of consumed samples, not including the current frame (only
  13694. audio)
  13695. @item NB_SAMPLES, S
  13696. The number of samples in the current frame (only audio)
  13697. @item SAMPLE_RATE, SR
  13698. The audio sample rate.
  13699. @item STARTPTS
  13700. The PTS of the first frame.
  13701. @item STARTT
  13702. the time in seconds of the first frame
  13703. @item INTERLACED
  13704. State whether the current frame is interlaced.
  13705. @item T
  13706. the time in seconds of the current frame
  13707. @item POS
  13708. original position in the file of the frame, or undefined if undefined
  13709. for the current frame
  13710. @item PREV_INPTS
  13711. The previous input PTS.
  13712. @item PREV_INT
  13713. previous input time in seconds
  13714. @item PREV_OUTPTS
  13715. The previous output PTS.
  13716. @item PREV_OUTT
  13717. previous output time in seconds
  13718. @item RTCTIME
  13719. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13720. instead.
  13721. @item RTCSTART
  13722. The wallclock (RTC) time at the start of the movie in microseconds.
  13723. @item TB
  13724. The timebase of the input timestamps.
  13725. @end table
  13726. @subsection Examples
  13727. @itemize
  13728. @item
  13729. Start counting PTS from zero
  13730. @example
  13731. setpts=PTS-STARTPTS
  13732. @end example
  13733. @item
  13734. Apply fast motion effect:
  13735. @example
  13736. setpts=0.5*PTS
  13737. @end example
  13738. @item
  13739. Apply slow motion effect:
  13740. @example
  13741. setpts=2.0*PTS
  13742. @end example
  13743. @item
  13744. Set fixed rate of 25 frames per second:
  13745. @example
  13746. setpts=N/(25*TB)
  13747. @end example
  13748. @item
  13749. Set fixed rate 25 fps with some jitter:
  13750. @example
  13751. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13752. @end example
  13753. @item
  13754. Apply an offset of 10 seconds to the input PTS:
  13755. @example
  13756. setpts=PTS+10/TB
  13757. @end example
  13758. @item
  13759. Generate timestamps from a "live source" and rebase onto the current timebase:
  13760. @example
  13761. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13762. @end example
  13763. @item
  13764. Generate timestamps by counting samples:
  13765. @example
  13766. asetpts=N/SR/TB
  13767. @end example
  13768. @end itemize
  13769. @section settb, asettb
  13770. Set the timebase to use for the output frames timestamps.
  13771. It is mainly useful for testing timebase configuration.
  13772. It accepts the following parameters:
  13773. @table @option
  13774. @item expr, tb
  13775. The expression which is evaluated into the output timebase.
  13776. @end table
  13777. The value for @option{tb} is an arithmetic expression representing a
  13778. rational. The expression can contain the constants "AVTB" (the default
  13779. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13780. audio only). Default value is "intb".
  13781. @subsection Examples
  13782. @itemize
  13783. @item
  13784. Set the timebase to 1/25:
  13785. @example
  13786. settb=expr=1/25
  13787. @end example
  13788. @item
  13789. Set the timebase to 1/10:
  13790. @example
  13791. settb=expr=0.1
  13792. @end example
  13793. @item
  13794. Set the timebase to 1001/1000:
  13795. @example
  13796. settb=1+0.001
  13797. @end example
  13798. @item
  13799. Set the timebase to 2*intb:
  13800. @example
  13801. settb=2*intb
  13802. @end example
  13803. @item
  13804. Set the default timebase value:
  13805. @example
  13806. settb=AVTB
  13807. @end example
  13808. @end itemize
  13809. @section showcqt
  13810. Convert input audio to a video output representing frequency spectrum
  13811. logarithmically using Brown-Puckette constant Q transform algorithm with
  13812. direct frequency domain coefficient calculation (but the transform itself
  13813. is not really constant Q, instead the Q factor is actually variable/clamped),
  13814. with musical tone scale, from E0 to D#10.
  13815. The filter accepts the following options:
  13816. @table @option
  13817. @item size, s
  13818. Specify the video size for the output. It must be even. For the syntax of this option,
  13819. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13820. Default value is @code{1920x1080}.
  13821. @item fps, rate, r
  13822. Set the output frame rate. Default value is @code{25}.
  13823. @item bar_h
  13824. Set the bargraph height. It must be even. Default value is @code{-1} which
  13825. computes the bargraph height automatically.
  13826. @item axis_h
  13827. Set the axis height. It must be even. Default value is @code{-1} which computes
  13828. the axis height automatically.
  13829. @item sono_h
  13830. Set the sonogram height. It must be even. Default value is @code{-1} which
  13831. computes the sonogram height automatically.
  13832. @item fullhd
  13833. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13834. instead. Default value is @code{1}.
  13835. @item sono_v, volume
  13836. Specify the sonogram volume expression. It can contain variables:
  13837. @table @option
  13838. @item bar_v
  13839. the @var{bar_v} evaluated expression
  13840. @item frequency, freq, f
  13841. the frequency where it is evaluated
  13842. @item timeclamp, tc
  13843. the value of @var{timeclamp} option
  13844. @end table
  13845. and functions:
  13846. @table @option
  13847. @item a_weighting(f)
  13848. A-weighting of equal loudness
  13849. @item b_weighting(f)
  13850. B-weighting of equal loudness
  13851. @item c_weighting(f)
  13852. C-weighting of equal loudness.
  13853. @end table
  13854. Default value is @code{16}.
  13855. @item bar_v, volume2
  13856. Specify the bargraph volume expression. It can contain variables:
  13857. @table @option
  13858. @item sono_v
  13859. the @var{sono_v} evaluated expression
  13860. @item frequency, freq, f
  13861. the frequency where it is evaluated
  13862. @item timeclamp, tc
  13863. the value of @var{timeclamp} option
  13864. @end table
  13865. and functions:
  13866. @table @option
  13867. @item a_weighting(f)
  13868. A-weighting of equal loudness
  13869. @item b_weighting(f)
  13870. B-weighting of equal loudness
  13871. @item c_weighting(f)
  13872. C-weighting of equal loudness.
  13873. @end table
  13874. Default value is @code{sono_v}.
  13875. @item sono_g, gamma
  13876. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13877. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13878. Acceptable range is @code{[1, 7]}.
  13879. @item bar_g, gamma2
  13880. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13881. @code{[1, 7]}.
  13882. @item bar_t
  13883. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13884. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13885. @item timeclamp, tc
  13886. Specify the transform timeclamp. At low frequency, there is trade-off between
  13887. accuracy in time domain and frequency domain. If timeclamp is lower,
  13888. event in time domain is represented more accurately (such as fast bass drum),
  13889. otherwise event in frequency domain is represented more accurately
  13890. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13891. @item attack
  13892. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13893. limits future samples by applying asymmetric windowing in time domain, useful
  13894. when low latency is required. Accepted range is @code{[0, 1]}.
  13895. @item basefreq
  13896. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13897. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13898. @item endfreq
  13899. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13900. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13901. @item coeffclamp
  13902. This option is deprecated and ignored.
  13903. @item tlength
  13904. Specify the transform length in time domain. Use this option to control accuracy
  13905. trade-off between time domain and frequency domain at every frequency sample.
  13906. It can contain variables:
  13907. @table @option
  13908. @item frequency, freq, f
  13909. the frequency where it is evaluated
  13910. @item timeclamp, tc
  13911. the value of @var{timeclamp} option.
  13912. @end table
  13913. Default value is @code{384*tc/(384+tc*f)}.
  13914. @item count
  13915. Specify the transform count for every video frame. Default value is @code{6}.
  13916. Acceptable range is @code{[1, 30]}.
  13917. @item fcount
  13918. Specify the transform count for every single pixel. Default value is @code{0},
  13919. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13920. @item fontfile
  13921. Specify font file for use with freetype to draw the axis. If not specified,
  13922. use embedded font. Note that drawing with font file or embedded font is not
  13923. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13924. option instead.
  13925. @item font
  13926. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13927. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13928. @item fontcolor
  13929. Specify font color expression. This is arithmetic expression that should return
  13930. integer value 0xRRGGBB. It can contain variables:
  13931. @table @option
  13932. @item frequency, freq, f
  13933. the frequency where it is evaluated
  13934. @item timeclamp, tc
  13935. the value of @var{timeclamp} option
  13936. @end table
  13937. and functions:
  13938. @table @option
  13939. @item midi(f)
  13940. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13941. @item r(x), g(x), b(x)
  13942. red, green, and blue value of intensity x.
  13943. @end table
  13944. Default value is @code{st(0, (midi(f)-59.5)/12);
  13945. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13946. r(1-ld(1)) + b(ld(1))}.
  13947. @item axisfile
  13948. Specify image file to draw the axis. This option override @var{fontfile} and
  13949. @var{fontcolor} option.
  13950. @item axis, text
  13951. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13952. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13953. Default value is @code{1}.
  13954. @item csp
  13955. Set colorspace. The accepted values are:
  13956. @table @samp
  13957. @item unspecified
  13958. Unspecified (default)
  13959. @item bt709
  13960. BT.709
  13961. @item fcc
  13962. FCC
  13963. @item bt470bg
  13964. BT.470BG or BT.601-6 625
  13965. @item smpte170m
  13966. SMPTE-170M or BT.601-6 525
  13967. @item smpte240m
  13968. SMPTE-240M
  13969. @item bt2020ncl
  13970. BT.2020 with non-constant luminance
  13971. @end table
  13972. @item cscheme
  13973. Set spectrogram color scheme. This is list of floating point values with format
  13974. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13975. The default is @code{1|0.5|0|0|0.5|1}.
  13976. @end table
  13977. @subsection Examples
  13978. @itemize
  13979. @item
  13980. Playing audio while showing the spectrum:
  13981. @example
  13982. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13983. @end example
  13984. @item
  13985. Same as above, but with frame rate 30 fps:
  13986. @example
  13987. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13988. @end example
  13989. @item
  13990. Playing at 1280x720:
  13991. @example
  13992. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13993. @end example
  13994. @item
  13995. Disable sonogram display:
  13996. @example
  13997. sono_h=0
  13998. @end example
  13999. @item
  14000. A1 and its harmonics: A1, A2, (near)E3, A3:
  14001. @example
  14002. 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),
  14003. asplit[a][out1]; [a] showcqt [out0]'
  14004. @end example
  14005. @item
  14006. Same as above, but with more accuracy in frequency domain:
  14007. @example
  14008. 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),
  14009. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14010. @end example
  14011. @item
  14012. Custom volume:
  14013. @example
  14014. bar_v=10:sono_v=bar_v*a_weighting(f)
  14015. @end example
  14016. @item
  14017. Custom gamma, now spectrum is linear to the amplitude.
  14018. @example
  14019. bar_g=2:sono_g=2
  14020. @end example
  14021. @item
  14022. Custom tlength equation:
  14023. @example
  14024. 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)))'
  14025. @end example
  14026. @item
  14027. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14028. @example
  14029. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14030. @end example
  14031. @item
  14032. Custom font using fontconfig:
  14033. @example
  14034. font='Courier New,Monospace,mono|bold'
  14035. @end example
  14036. @item
  14037. Custom frequency range with custom axis using image file:
  14038. @example
  14039. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14040. @end example
  14041. @end itemize
  14042. @section showfreqs
  14043. Convert input audio to video output representing the audio power spectrum.
  14044. Audio amplitude is on Y-axis while frequency is on X-axis.
  14045. The filter accepts the following options:
  14046. @table @option
  14047. @item size, s
  14048. Specify size of video. For the syntax of this option, check the
  14049. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14050. Default is @code{1024x512}.
  14051. @item mode
  14052. Set display mode.
  14053. This set how each frequency bin will be represented.
  14054. It accepts the following values:
  14055. @table @samp
  14056. @item line
  14057. @item bar
  14058. @item dot
  14059. @end table
  14060. Default is @code{bar}.
  14061. @item ascale
  14062. Set amplitude scale.
  14063. It accepts the following values:
  14064. @table @samp
  14065. @item lin
  14066. Linear scale.
  14067. @item sqrt
  14068. Square root scale.
  14069. @item cbrt
  14070. Cubic root scale.
  14071. @item log
  14072. Logarithmic scale.
  14073. @end table
  14074. Default is @code{log}.
  14075. @item fscale
  14076. Set frequency scale.
  14077. It accepts the following values:
  14078. @table @samp
  14079. @item lin
  14080. Linear scale.
  14081. @item log
  14082. Logarithmic scale.
  14083. @item rlog
  14084. Reverse logarithmic scale.
  14085. @end table
  14086. Default is @code{lin}.
  14087. @item win_size
  14088. Set window size.
  14089. It accepts the following values:
  14090. @table @samp
  14091. @item w16
  14092. @item w32
  14093. @item w64
  14094. @item w128
  14095. @item w256
  14096. @item w512
  14097. @item w1024
  14098. @item w2048
  14099. @item w4096
  14100. @item w8192
  14101. @item w16384
  14102. @item w32768
  14103. @item w65536
  14104. @end table
  14105. Default is @code{w2048}
  14106. @item win_func
  14107. Set windowing function.
  14108. It accepts the following values:
  14109. @table @samp
  14110. @item rect
  14111. @item bartlett
  14112. @item hanning
  14113. @item hamming
  14114. @item blackman
  14115. @item welch
  14116. @item flattop
  14117. @item bharris
  14118. @item bnuttall
  14119. @item bhann
  14120. @item sine
  14121. @item nuttall
  14122. @item lanczos
  14123. @item gauss
  14124. @item tukey
  14125. @item dolph
  14126. @item cauchy
  14127. @item parzen
  14128. @item poisson
  14129. @end table
  14130. Default is @code{hanning}.
  14131. @item overlap
  14132. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14133. which means optimal overlap for selected window function will be picked.
  14134. @item averaging
  14135. Set time averaging. Setting this to 0 will display current maximal peaks.
  14136. Default is @code{1}, which means time averaging is disabled.
  14137. @item colors
  14138. Specify list of colors separated by space or by '|' which will be used to
  14139. draw channel frequencies. Unrecognized or missing colors will be replaced
  14140. by white color.
  14141. @item cmode
  14142. Set channel display mode.
  14143. It accepts the following values:
  14144. @table @samp
  14145. @item combined
  14146. @item separate
  14147. @end table
  14148. Default is @code{combined}.
  14149. @item minamp
  14150. Set minimum amplitude used in @code{log} amplitude scaler.
  14151. @end table
  14152. @anchor{showspectrum}
  14153. @section showspectrum
  14154. Convert input audio to a video output, representing the audio frequency
  14155. spectrum.
  14156. The filter accepts the following options:
  14157. @table @option
  14158. @item size, s
  14159. Specify the video size for the output. For the syntax of this option, check the
  14160. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14161. Default value is @code{640x512}.
  14162. @item slide
  14163. Specify how the spectrum should slide along the window.
  14164. It accepts the following values:
  14165. @table @samp
  14166. @item replace
  14167. the samples start again on the left when they reach the right
  14168. @item scroll
  14169. the samples scroll from right to left
  14170. @item fullframe
  14171. frames are only produced when the samples reach the right
  14172. @item rscroll
  14173. the samples scroll from left to right
  14174. @end table
  14175. Default value is @code{replace}.
  14176. @item mode
  14177. Specify display mode.
  14178. It accepts the following values:
  14179. @table @samp
  14180. @item combined
  14181. all channels are displayed in the same row
  14182. @item separate
  14183. all channels are displayed in separate rows
  14184. @end table
  14185. Default value is @samp{combined}.
  14186. @item color
  14187. Specify display color mode.
  14188. It accepts the following values:
  14189. @table @samp
  14190. @item channel
  14191. each channel is displayed in a separate color
  14192. @item intensity
  14193. each channel is displayed using the same color scheme
  14194. @item rainbow
  14195. each channel is displayed using the rainbow color scheme
  14196. @item moreland
  14197. each channel is displayed using the moreland color scheme
  14198. @item nebulae
  14199. each channel is displayed using the nebulae color scheme
  14200. @item fire
  14201. each channel is displayed using the fire color scheme
  14202. @item fiery
  14203. each channel is displayed using the fiery color scheme
  14204. @item fruit
  14205. each channel is displayed using the fruit color scheme
  14206. @item cool
  14207. each channel is displayed using the cool color scheme
  14208. @end table
  14209. Default value is @samp{channel}.
  14210. @item scale
  14211. Specify scale used for calculating intensity color values.
  14212. It accepts the following values:
  14213. @table @samp
  14214. @item lin
  14215. linear
  14216. @item sqrt
  14217. square root, default
  14218. @item cbrt
  14219. cubic root
  14220. @item log
  14221. logarithmic
  14222. @item 4thrt
  14223. 4th root
  14224. @item 5thrt
  14225. 5th root
  14226. @end table
  14227. Default value is @samp{sqrt}.
  14228. @item saturation
  14229. Set saturation modifier for displayed colors. Negative values provide
  14230. alternative color scheme. @code{0} is no saturation at all.
  14231. Saturation must be in [-10.0, 10.0] range.
  14232. Default value is @code{1}.
  14233. @item win_func
  14234. Set window function.
  14235. It accepts the following values:
  14236. @table @samp
  14237. @item rect
  14238. @item bartlett
  14239. @item hann
  14240. @item hanning
  14241. @item hamming
  14242. @item blackman
  14243. @item welch
  14244. @item flattop
  14245. @item bharris
  14246. @item bnuttall
  14247. @item bhann
  14248. @item sine
  14249. @item nuttall
  14250. @item lanczos
  14251. @item gauss
  14252. @item tukey
  14253. @item dolph
  14254. @item cauchy
  14255. @item parzen
  14256. @item poisson
  14257. @end table
  14258. Default value is @code{hann}.
  14259. @item orientation
  14260. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14261. @code{horizontal}. Default is @code{vertical}.
  14262. @item overlap
  14263. Set ratio of overlap window. Default value is @code{0}.
  14264. When value is @code{1} overlap is set to recommended size for specific
  14265. window function currently used.
  14266. @item gain
  14267. Set scale gain for calculating intensity color values.
  14268. Default value is @code{1}.
  14269. @item data
  14270. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14271. @item rotation
  14272. Set color rotation, must be in [-1.0, 1.0] range.
  14273. Default value is @code{0}.
  14274. @end table
  14275. The usage is very similar to the showwaves filter; see the examples in that
  14276. section.
  14277. @subsection Examples
  14278. @itemize
  14279. @item
  14280. Large window with logarithmic color scaling:
  14281. @example
  14282. showspectrum=s=1280x480:scale=log
  14283. @end example
  14284. @item
  14285. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14286. @example
  14287. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14288. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14289. @end example
  14290. @end itemize
  14291. @section showspectrumpic
  14292. Convert input audio to a single video frame, representing the audio frequency
  14293. spectrum.
  14294. The filter accepts the following options:
  14295. @table @option
  14296. @item size, s
  14297. Specify the video size for the output. For the syntax of this option, check the
  14298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14299. Default value is @code{4096x2048}.
  14300. @item mode
  14301. Specify display mode.
  14302. It accepts the following values:
  14303. @table @samp
  14304. @item combined
  14305. all channels are displayed in the same row
  14306. @item separate
  14307. all channels are displayed in separate rows
  14308. @end table
  14309. Default value is @samp{combined}.
  14310. @item color
  14311. Specify display color mode.
  14312. It accepts the following values:
  14313. @table @samp
  14314. @item channel
  14315. each channel is displayed in a separate color
  14316. @item intensity
  14317. each channel is displayed using the same color scheme
  14318. @item rainbow
  14319. each channel is displayed using the rainbow color scheme
  14320. @item moreland
  14321. each channel is displayed using the moreland color scheme
  14322. @item nebulae
  14323. each channel is displayed using the nebulae color scheme
  14324. @item fire
  14325. each channel is displayed using the fire color scheme
  14326. @item fiery
  14327. each channel is displayed using the fiery color scheme
  14328. @item fruit
  14329. each channel is displayed using the fruit color scheme
  14330. @item cool
  14331. each channel is displayed using the cool color scheme
  14332. @end table
  14333. Default value is @samp{intensity}.
  14334. @item scale
  14335. Specify scale used for calculating intensity color values.
  14336. It accepts the following values:
  14337. @table @samp
  14338. @item lin
  14339. linear
  14340. @item sqrt
  14341. square root, default
  14342. @item cbrt
  14343. cubic root
  14344. @item log
  14345. logarithmic
  14346. @item 4thrt
  14347. 4th root
  14348. @item 5thrt
  14349. 5th root
  14350. @end table
  14351. Default value is @samp{log}.
  14352. @item saturation
  14353. Set saturation modifier for displayed colors. Negative values provide
  14354. alternative color scheme. @code{0} is no saturation at all.
  14355. Saturation must be in [-10.0, 10.0] range.
  14356. Default value is @code{1}.
  14357. @item win_func
  14358. Set window function.
  14359. It accepts the following values:
  14360. @table @samp
  14361. @item rect
  14362. @item bartlett
  14363. @item hann
  14364. @item hanning
  14365. @item hamming
  14366. @item blackman
  14367. @item welch
  14368. @item flattop
  14369. @item bharris
  14370. @item bnuttall
  14371. @item bhann
  14372. @item sine
  14373. @item nuttall
  14374. @item lanczos
  14375. @item gauss
  14376. @item tukey
  14377. @item dolph
  14378. @item cauchy
  14379. @item parzen
  14380. @item poisson
  14381. @end table
  14382. Default value is @code{hann}.
  14383. @item orientation
  14384. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14385. @code{horizontal}. Default is @code{vertical}.
  14386. @item gain
  14387. Set scale gain for calculating intensity color values.
  14388. Default value is @code{1}.
  14389. @item legend
  14390. Draw time and frequency axes and legends. Default is enabled.
  14391. @item rotation
  14392. Set color rotation, must be in [-1.0, 1.0] range.
  14393. Default value is @code{0}.
  14394. @end table
  14395. @subsection Examples
  14396. @itemize
  14397. @item
  14398. Extract an audio spectrogram of a whole audio track
  14399. in a 1024x1024 picture using @command{ffmpeg}:
  14400. @example
  14401. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14402. @end example
  14403. @end itemize
  14404. @section showvolume
  14405. Convert input audio volume to a video output.
  14406. The filter accepts the following options:
  14407. @table @option
  14408. @item rate, r
  14409. Set video rate.
  14410. @item b
  14411. Set border width, allowed range is [0, 5]. Default is 1.
  14412. @item w
  14413. Set channel width, allowed range is [80, 8192]. Default is 400.
  14414. @item h
  14415. Set channel height, allowed range is [1, 900]. Default is 20.
  14416. @item f
  14417. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14418. @item c
  14419. Set volume color expression.
  14420. The expression can use the following variables:
  14421. @table @option
  14422. @item VOLUME
  14423. Current max volume of channel in dB.
  14424. @item PEAK
  14425. Current peak.
  14426. @item CHANNEL
  14427. Current channel number, starting from 0.
  14428. @end table
  14429. @item t
  14430. If set, displays channel names. Default is enabled.
  14431. @item v
  14432. If set, displays volume values. Default is enabled.
  14433. @item o
  14434. Set orientation, can be @code{horizontal} or @code{vertical},
  14435. default is @code{horizontal}.
  14436. @item s
  14437. Set step size, allowed range s [0, 5]. Default is 0, which means
  14438. step is disabled.
  14439. @end table
  14440. @section showwaves
  14441. Convert input audio to a video output, representing the samples waves.
  14442. The filter accepts the following options:
  14443. @table @option
  14444. @item size, s
  14445. Specify the video size for the output. For the syntax of this option, check the
  14446. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14447. Default value is @code{600x240}.
  14448. @item mode
  14449. Set display mode.
  14450. Available values are:
  14451. @table @samp
  14452. @item point
  14453. Draw a point for each sample.
  14454. @item line
  14455. Draw a vertical line for each sample.
  14456. @item p2p
  14457. Draw a point for each sample and a line between them.
  14458. @item cline
  14459. Draw a centered vertical line for each sample.
  14460. @end table
  14461. Default value is @code{point}.
  14462. @item n
  14463. Set the number of samples which are printed on the same column. A
  14464. larger value will decrease the frame rate. Must be a positive
  14465. integer. This option can be set only if the value for @var{rate}
  14466. is not explicitly specified.
  14467. @item rate, r
  14468. Set the (approximate) output frame rate. This is done by setting the
  14469. option @var{n}. Default value is "25".
  14470. @item split_channels
  14471. Set if channels should be drawn separately or overlap. Default value is 0.
  14472. @item colors
  14473. Set colors separated by '|' which are going to be used for drawing of each channel.
  14474. @item scale
  14475. Set amplitude scale.
  14476. Available values are:
  14477. @table @samp
  14478. @item lin
  14479. Linear.
  14480. @item log
  14481. Logarithmic.
  14482. @item sqrt
  14483. Square root.
  14484. @item cbrt
  14485. Cubic root.
  14486. @end table
  14487. Default is linear.
  14488. @end table
  14489. @subsection Examples
  14490. @itemize
  14491. @item
  14492. Output the input file audio and the corresponding video representation
  14493. at the same time:
  14494. @example
  14495. amovie=a.mp3,asplit[out0],showwaves[out1]
  14496. @end example
  14497. @item
  14498. Create a synthetic signal and show it with showwaves, forcing a
  14499. frame rate of 30 frames per second:
  14500. @example
  14501. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14502. @end example
  14503. @end itemize
  14504. @section showwavespic
  14505. Convert input audio to a single video frame, representing the samples waves.
  14506. The filter accepts the following options:
  14507. @table @option
  14508. @item size, s
  14509. Specify the video size for the output. For the syntax of this option, check the
  14510. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14511. Default value is @code{600x240}.
  14512. @item split_channels
  14513. Set if channels should be drawn separately or overlap. Default value is 0.
  14514. @item colors
  14515. Set colors separated by '|' which are going to be used for drawing of each channel.
  14516. @item scale
  14517. Set amplitude scale.
  14518. Available values are:
  14519. @table @samp
  14520. @item lin
  14521. Linear.
  14522. @item log
  14523. Logarithmic.
  14524. @item sqrt
  14525. Square root.
  14526. @item cbrt
  14527. Cubic root.
  14528. @end table
  14529. Default is linear.
  14530. @end table
  14531. @subsection Examples
  14532. @itemize
  14533. @item
  14534. Extract a channel split representation of the wave form of a whole audio track
  14535. in a 1024x800 picture using @command{ffmpeg}:
  14536. @example
  14537. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14538. @end example
  14539. @end itemize
  14540. @section sidedata, asidedata
  14541. Delete frame side data, or select frames based on it.
  14542. This filter accepts the following options:
  14543. @table @option
  14544. @item mode
  14545. Set mode of operation of the filter.
  14546. Can be one of the following:
  14547. @table @samp
  14548. @item select
  14549. Select every frame with side data of @code{type}.
  14550. @item delete
  14551. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14552. data in the frame.
  14553. @end table
  14554. @item type
  14555. Set side data type used with all modes. Must be set for @code{select} mode. For
  14556. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14557. in @file{libavutil/frame.h}. For example, to choose
  14558. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14559. @end table
  14560. @section spectrumsynth
  14561. Sythesize audio from 2 input video spectrums, first input stream represents
  14562. magnitude across time and second represents phase across time.
  14563. The filter will transform from frequency domain as displayed in videos back
  14564. to time domain as presented in audio output.
  14565. This filter is primarily created for reversing processed @ref{showspectrum}
  14566. filter outputs, but can synthesize sound from other spectrograms too.
  14567. But in such case results are going to be poor if the phase data is not
  14568. available, because in such cases phase data need to be recreated, usually
  14569. its just recreated from random noise.
  14570. For best results use gray only output (@code{channel} color mode in
  14571. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14572. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14573. @code{data} option. Inputs videos should generally use @code{fullframe}
  14574. slide mode as that saves resources needed for decoding video.
  14575. The filter accepts the following options:
  14576. @table @option
  14577. @item sample_rate
  14578. Specify sample rate of output audio, the sample rate of audio from which
  14579. spectrum was generated may differ.
  14580. @item channels
  14581. Set number of channels represented in input video spectrums.
  14582. @item scale
  14583. Set scale which was used when generating magnitude input spectrum.
  14584. Can be @code{lin} or @code{log}. Default is @code{log}.
  14585. @item slide
  14586. Set slide which was used when generating inputs spectrums.
  14587. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14588. Default is @code{fullframe}.
  14589. @item win_func
  14590. Set window function used for resynthesis.
  14591. @item overlap
  14592. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14593. which means optimal overlap for selected window function will be picked.
  14594. @item orientation
  14595. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14596. Default is @code{vertical}.
  14597. @end table
  14598. @subsection Examples
  14599. @itemize
  14600. @item
  14601. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14602. then resynthesize videos back to audio with spectrumsynth:
  14603. @example
  14604. 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
  14605. 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
  14606. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14607. @end example
  14608. @end itemize
  14609. @section split, asplit
  14610. Split input into several identical outputs.
  14611. @code{asplit} works with audio input, @code{split} with video.
  14612. The filter accepts a single parameter which specifies the number of outputs. If
  14613. unspecified, it defaults to 2.
  14614. @subsection Examples
  14615. @itemize
  14616. @item
  14617. Create two separate outputs from the same input:
  14618. @example
  14619. [in] split [out0][out1]
  14620. @end example
  14621. @item
  14622. To create 3 or more outputs, you need to specify the number of
  14623. outputs, like in:
  14624. @example
  14625. [in] asplit=3 [out0][out1][out2]
  14626. @end example
  14627. @item
  14628. Create two separate outputs from the same input, one cropped and
  14629. one padded:
  14630. @example
  14631. [in] split [splitout1][splitout2];
  14632. [splitout1] crop=100:100:0:0 [cropout];
  14633. [splitout2] pad=200:200:100:100 [padout];
  14634. @end example
  14635. @item
  14636. Create 5 copies of the input audio with @command{ffmpeg}:
  14637. @example
  14638. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14639. @end example
  14640. @end itemize
  14641. @section zmq, azmq
  14642. Receive commands sent through a libzmq client, and forward them to
  14643. filters in the filtergraph.
  14644. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14645. must be inserted between two video filters, @code{azmq} between two
  14646. audio filters.
  14647. To enable these filters you need to install the libzmq library and
  14648. headers and configure FFmpeg with @code{--enable-libzmq}.
  14649. For more information about libzmq see:
  14650. @url{http://www.zeromq.org/}
  14651. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14652. receives messages sent through a network interface defined by the
  14653. @option{bind_address} option.
  14654. The received message must be in the form:
  14655. @example
  14656. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14657. @end example
  14658. @var{TARGET} specifies the target of the command, usually the name of
  14659. the filter class or a specific filter instance name.
  14660. @var{COMMAND} specifies the name of the command for the target filter.
  14661. @var{ARG} is optional and specifies the optional argument list for the
  14662. given @var{COMMAND}.
  14663. Upon reception, the message is processed and the corresponding command
  14664. is injected into the filtergraph. Depending on the result, the filter
  14665. will send a reply to the client, adopting the format:
  14666. @example
  14667. @var{ERROR_CODE} @var{ERROR_REASON}
  14668. @var{MESSAGE}
  14669. @end example
  14670. @var{MESSAGE} is optional.
  14671. @subsection Examples
  14672. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14673. be used to send commands processed by these filters.
  14674. Consider the following filtergraph generated by @command{ffplay}
  14675. @example
  14676. ffplay -dumpgraph 1 -f lavfi "
  14677. color=s=100x100:c=red [l];
  14678. color=s=100x100:c=blue [r];
  14679. nullsrc=s=200x100, zmq [bg];
  14680. [bg][l] overlay [bg+l];
  14681. [bg+l][r] overlay=x=100 "
  14682. @end example
  14683. To change the color of the left side of the video, the following
  14684. command can be used:
  14685. @example
  14686. echo Parsed_color_0 c yellow | tools/zmqsend
  14687. @end example
  14688. To change the right side:
  14689. @example
  14690. echo Parsed_color_1 c pink | tools/zmqsend
  14691. @end example
  14692. @c man end MULTIMEDIA FILTERS
  14693. @chapter Multimedia Sources
  14694. @c man begin MULTIMEDIA SOURCES
  14695. Below is a description of the currently available multimedia sources.
  14696. @section amovie
  14697. This is the same as @ref{movie} source, except it selects an audio
  14698. stream by default.
  14699. @anchor{movie}
  14700. @section movie
  14701. Read audio and/or video stream(s) from a movie container.
  14702. It accepts the following parameters:
  14703. @table @option
  14704. @item filename
  14705. The name of the resource to read (not necessarily a file; it can also be a
  14706. device or a stream accessed through some protocol).
  14707. @item format_name, f
  14708. Specifies the format assumed for the movie to read, and can be either
  14709. the name of a container or an input device. If not specified, the
  14710. format is guessed from @var{movie_name} or by probing.
  14711. @item seek_point, sp
  14712. Specifies the seek point in seconds. The frames will be output
  14713. starting from this seek point. The parameter is evaluated with
  14714. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14715. postfix. The default value is "0".
  14716. @item streams, s
  14717. Specifies the streams to read. Several streams can be specified,
  14718. separated by "+". The source will then have as many outputs, in the
  14719. same order. The syntax is explained in the ``Stream specifiers''
  14720. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14721. respectively the default (best suited) video and audio stream. Default
  14722. is "dv", or "da" if the filter is called as "amovie".
  14723. @item stream_index, si
  14724. Specifies the index of the video stream to read. If the value is -1,
  14725. the most suitable video stream will be automatically selected. The default
  14726. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14727. audio instead of video.
  14728. @item loop
  14729. Specifies how many times to read the stream in sequence.
  14730. If the value is 0, the stream will be looped infinitely.
  14731. Default value is "1".
  14732. Note that when the movie is looped the source timestamps are not
  14733. changed, so it will generate non monotonically increasing timestamps.
  14734. @item discontinuity
  14735. Specifies the time difference between frames above which the point is
  14736. considered a timestamp discontinuity which is removed by adjusting the later
  14737. timestamps.
  14738. @end table
  14739. It allows overlaying a second video on top of the main input of
  14740. a filtergraph, as shown in this graph:
  14741. @example
  14742. input -----------> deltapts0 --> overlay --> output
  14743. ^
  14744. |
  14745. movie --> scale--> deltapts1 -------+
  14746. @end example
  14747. @subsection Examples
  14748. @itemize
  14749. @item
  14750. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14751. on top of the input labelled "in":
  14752. @example
  14753. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14754. [in] setpts=PTS-STARTPTS [main];
  14755. [main][over] overlay=16:16 [out]
  14756. @end example
  14757. @item
  14758. Read from a video4linux2 device, and overlay it on top of the input
  14759. labelled "in":
  14760. @example
  14761. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14762. [in] setpts=PTS-STARTPTS [main];
  14763. [main][over] overlay=16:16 [out]
  14764. @end example
  14765. @item
  14766. Read the first video stream and the audio stream with id 0x81 from
  14767. dvd.vob; the video is connected to the pad named "video" and the audio is
  14768. connected to the pad named "audio":
  14769. @example
  14770. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14771. @end example
  14772. @end itemize
  14773. @subsection Commands
  14774. Both movie and amovie support the following commands:
  14775. @table @option
  14776. @item seek
  14777. Perform seek using "av_seek_frame".
  14778. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14779. @itemize
  14780. @item
  14781. @var{stream_index}: If stream_index is -1, a default
  14782. stream is selected, and @var{timestamp} is automatically converted
  14783. from AV_TIME_BASE units to the stream specific time_base.
  14784. @item
  14785. @var{timestamp}: Timestamp in AVStream.time_base units
  14786. or, if no stream is specified, in AV_TIME_BASE units.
  14787. @item
  14788. @var{flags}: Flags which select direction and seeking mode.
  14789. @end itemize
  14790. @item get_duration
  14791. Get movie duration in AV_TIME_BASE units.
  14792. @end table
  14793. @c man end MULTIMEDIA SOURCES