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.

14743 lines
403KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @anchor{aformat}
  588. @section aformat
  589. Set output format constraints for the input audio. The framework will
  590. negotiate the most appropriate format to minimize conversions.
  591. It accepts the following parameters:
  592. @table @option
  593. @item sample_fmts
  594. A '|'-separated list of requested sample formats.
  595. @item sample_rates
  596. A '|'-separated list of requested sample rates.
  597. @item channel_layouts
  598. A '|'-separated list of requested channel layouts.
  599. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  600. for the required syntax.
  601. @end table
  602. If a parameter is omitted, all values are allowed.
  603. Force the output to either unsigned 8-bit or signed 16-bit stereo
  604. @example
  605. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  606. @end example
  607. @section agate
  608. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  609. processing reduces disturbing noise between useful signals.
  610. Gating is done by detecting the volume below a chosen level @var{threshold}
  611. and divide it by the factor set with @var{ratio}. The bottom of the noise
  612. floor is set via @var{range}. Because an exact manipulation of the signal
  613. would cause distortion of the waveform the reduction can be levelled over
  614. time. This is done by setting @var{attack} and @var{release}.
  615. @var{attack} determines how long the signal has to fall below the threshold
  616. before any reduction will occur and @var{release} sets the time the signal
  617. has to raise above the threshold to reduce the reduction again.
  618. Shorter signals than the chosen attack time will be left untouched.
  619. @table @option
  620. @item level_in
  621. Set input level before filtering.
  622. Default is 1. Allowed range is from 0.015625 to 64.
  623. @item range
  624. Set the level of gain reduction when the signal is below the threshold.
  625. Default is 0.06125. Allowed range is from 0 to 1.
  626. @item threshold
  627. If a signal rises above this level the gain reduction is released.
  628. Default is 0.125. Allowed range is from 0 to 1.
  629. @item ratio
  630. Set a ratio about which the signal is reduced.
  631. Default is 2. Allowed range is from 1 to 9000.
  632. @item attack
  633. Amount of milliseconds the signal has to rise above the threshold before gain
  634. reduction stops.
  635. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  636. @item release
  637. Amount of milliseconds the signal has to fall below the threshold before the
  638. reduction is increased again. Default is 250 milliseconds.
  639. Allowed range is from 0.01 to 9000.
  640. @item makeup
  641. Set amount of amplification of signal after processing.
  642. Default is 1. Allowed range is from 1 to 64.
  643. @item knee
  644. Curve the sharp knee around the threshold to enter gain reduction more softly.
  645. Default is 2.828427125. Allowed range is from 1 to 8.
  646. @item detection
  647. Choose if exact signal should be taken for detection or an RMS like one.
  648. Default is rms. Can be peak or rms.
  649. @item link
  650. Choose if the average level between all channels or the louder channel affects
  651. the reduction.
  652. Default is average. Can be average or maximum.
  653. @end table
  654. @section alimiter
  655. The limiter prevents input signal from raising over a desired threshold.
  656. This limiter uses lookahead technology to prevent your signal from distorting.
  657. It means that there is a small delay after signal is processed. Keep in mind
  658. that the delay it produces is the attack time you set.
  659. The filter accepts the following options:
  660. @table @option
  661. @item limit
  662. Don't let signals above this level pass the limiter. The removed amplitude is
  663. added automatically. Default is 1.
  664. @item attack
  665. The limiter will reach its attenuation level in this amount of time in
  666. milliseconds. Default is 5 milliseconds.
  667. @item release
  668. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  669. Default is 50 milliseconds.
  670. @item asc
  671. When gain reduction is always needed ASC takes care of releasing to an
  672. average reduction level rather than reaching a reduction of 0 in the release
  673. time.
  674. @item asc_level
  675. Select how much the release time is affected by ASC, 0 means nearly no changes
  676. in release time while 1 produces higher release times.
  677. @end table
  678. Depending on picked setting it is recommended to upsample input 2x or 4x times
  679. with @ref{aresample} before applying this filter.
  680. @section allpass
  681. Apply a two-pole all-pass filter with central frequency (in Hz)
  682. @var{frequency}, and filter-width @var{width}.
  683. An all-pass filter changes the audio's frequency to phase relationship
  684. without changing its frequency to amplitude relationship.
  685. The filter accepts the following options:
  686. @table @option
  687. @item frequency, f
  688. Set frequency in Hz.
  689. @item width_type
  690. Set method to specify band-width of filter.
  691. @table @option
  692. @item h
  693. Hz
  694. @item q
  695. Q-Factor
  696. @item o
  697. octave
  698. @item s
  699. slope
  700. @end table
  701. @item width, w
  702. Specify the band-width of a filter in width_type units.
  703. @end table
  704. @anchor{amerge}
  705. @section amerge
  706. Merge two or more audio streams into a single multi-channel stream.
  707. The filter accepts the following options:
  708. @table @option
  709. @item inputs
  710. Set the number of inputs. Default is 2.
  711. @end table
  712. If the channel layouts of the inputs are disjoint, and therefore compatible,
  713. the channel layout of the output will be set accordingly and the channels
  714. will be reordered as necessary. If the channel layouts of the inputs are not
  715. disjoint, the output will have all the channels of the first input then all
  716. the channels of the second input, in that order, and the channel layout of
  717. the output will be the default value corresponding to the total number of
  718. channels.
  719. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  720. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  721. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  722. first input, b1 is the first channel of the second input).
  723. On the other hand, if both input are in stereo, the output channels will be
  724. in the default order: a1, a2, b1, b2, and the channel layout will be
  725. arbitrarily set to 4.0, which may or may not be the expected value.
  726. All inputs must have the same sample rate, and format.
  727. If inputs do not have the same duration, the output will stop with the
  728. shortest.
  729. @subsection Examples
  730. @itemize
  731. @item
  732. Merge two mono files into a stereo stream:
  733. @example
  734. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  735. @end example
  736. @item
  737. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  738. @example
  739. 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
  740. @end example
  741. @end itemize
  742. @section amix
  743. Mixes multiple audio inputs into a single output.
  744. Note that this filter only supports float samples (the @var{amerge}
  745. and @var{pan} audio filters support many formats). If the @var{amix}
  746. input has integer samples then @ref{aresample} will be automatically
  747. inserted to perform the conversion to float samples.
  748. For example
  749. @example
  750. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  751. @end example
  752. will mix 3 input audio streams to a single output with the same duration as the
  753. first input and a dropout transition time of 3 seconds.
  754. It accepts the following parameters:
  755. @table @option
  756. @item inputs
  757. The number of inputs. If unspecified, it defaults to 2.
  758. @item duration
  759. How to determine the end-of-stream.
  760. @table @option
  761. @item longest
  762. The duration of the longest input. (default)
  763. @item shortest
  764. The duration of the shortest input.
  765. @item first
  766. The duration of the first input.
  767. @end table
  768. @item dropout_transition
  769. The transition time, in seconds, for volume renormalization when an input
  770. stream ends. The default value is 2 seconds.
  771. @end table
  772. @section anull
  773. Pass the audio source unchanged to the output.
  774. @section apad
  775. Pad the end of an audio stream with silence.
  776. This can be used together with @command{ffmpeg} @option{-shortest} to
  777. extend audio streams to the same length as the video stream.
  778. A description of the accepted options follows.
  779. @table @option
  780. @item packet_size
  781. Set silence packet size. Default value is 4096.
  782. @item pad_len
  783. Set the number of samples of silence to add to the end. After the
  784. value is reached, the stream is terminated. This option is mutually
  785. exclusive with @option{whole_len}.
  786. @item whole_len
  787. Set the minimum total number of samples in the output audio stream. If
  788. the value is longer than the input audio length, silence is added to
  789. the end, until the value is reached. This option is mutually exclusive
  790. with @option{pad_len}.
  791. @end table
  792. If neither the @option{pad_len} nor the @option{whole_len} option is
  793. set, the filter will add silence to the end of the input stream
  794. indefinitely.
  795. @subsection Examples
  796. @itemize
  797. @item
  798. Add 1024 samples of silence to the end of the input:
  799. @example
  800. apad=pad_len=1024
  801. @end example
  802. @item
  803. Make sure the audio output will contain at least 10000 samples, pad
  804. the input with silence if required:
  805. @example
  806. apad=whole_len=10000
  807. @end example
  808. @item
  809. Use @command{ffmpeg} to pad the audio input with silence, so that the
  810. video stream will always result the shortest and will be converted
  811. until the end in the output file when using the @option{shortest}
  812. option:
  813. @example
  814. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  815. @end example
  816. @end itemize
  817. @section aphaser
  818. Add a phasing effect to the input audio.
  819. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  820. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  821. A description of the accepted parameters follows.
  822. @table @option
  823. @item in_gain
  824. Set input gain. Default is 0.4.
  825. @item out_gain
  826. Set output gain. Default is 0.74
  827. @item delay
  828. Set delay in milliseconds. Default is 3.0.
  829. @item decay
  830. Set decay. Default is 0.4.
  831. @item speed
  832. Set modulation speed in Hz. Default is 0.5.
  833. @item type
  834. Set modulation type. Default is triangular.
  835. It accepts the following values:
  836. @table @samp
  837. @item triangular, t
  838. @item sinusoidal, s
  839. @end table
  840. @end table
  841. @section apulsator
  842. Audio pulsator is something between an autopanner and a tremolo.
  843. But it can produce funny stereo effects as well. Pulsator changes the volume
  844. of the left and right channel based on a LFO (low frequency oscillator) with
  845. different waveforms and shifted phases.
  846. This filter have the ability to define an offset between left and right
  847. channel. An offset of 0 means that both LFO shapes match each other.
  848. The left and right channel are altered equally - a conventional tremolo.
  849. An offset of 50% means that the shape of the right channel is exactly shifted
  850. in phase (or moved backwards about half of the frequency) - pulsator acts as
  851. an autopanner. At 1 both curves match again. Every setting in between moves the
  852. phase shift gapless between all stages and produces some "bypassing" sounds with
  853. sine and triangle waveforms. The more you set the offset near 1 (starting from
  854. the 0.5) the faster the signal passes from the left to the right speaker.
  855. The filter accepts the following options:
  856. @table @option
  857. @item level_in
  858. Set input gain. By default it is 1. Range is [0.015625 - 64].
  859. @item level_out
  860. Set output gain. By default it is 1. Range is [0.015625 - 64].
  861. @item mode
  862. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  863. sawup or sawdown. Default is sine.
  864. @item amount
  865. Set modulation. Define how much of original signal is affected by the LFO.
  866. @item offset_l
  867. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  868. @item offset_r
  869. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  870. @item width
  871. Set pulse width. Default is 1. Allowed range is [0 - 2].
  872. @item timing
  873. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  874. @item bpm
  875. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  876. is set to bpm.
  877. @item ms
  878. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  879. is set to ms.
  880. @item hz
  881. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  882. if timing is set to hz.
  883. @end table
  884. @anchor{aresample}
  885. @section aresample
  886. Resample the input audio to the specified parameters, using the
  887. libswresample library. If none are specified then the filter will
  888. automatically convert between its input and output.
  889. This filter is also able to stretch/squeeze the audio data to make it match
  890. the timestamps or to inject silence / cut out audio to make it match the
  891. timestamps, do a combination of both or do neither.
  892. The filter accepts the syntax
  893. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  894. expresses a sample rate and @var{resampler_options} is a list of
  895. @var{key}=@var{value} pairs, separated by ":". See the
  896. ffmpeg-resampler manual for the complete list of supported options.
  897. @subsection Examples
  898. @itemize
  899. @item
  900. Resample the input audio to 44100Hz:
  901. @example
  902. aresample=44100
  903. @end example
  904. @item
  905. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  906. samples per second compensation:
  907. @example
  908. aresample=async=1000
  909. @end example
  910. @end itemize
  911. @section asetnsamples
  912. Set the number of samples per each output audio frame.
  913. The last output packet may contain a different number of samples, as
  914. the filter will flush all the remaining samples when the input audio
  915. signal its end.
  916. The filter accepts the following options:
  917. @table @option
  918. @item nb_out_samples, n
  919. Set the number of frames per each output audio frame. The number is
  920. intended as the number of samples @emph{per each channel}.
  921. Default value is 1024.
  922. @item pad, p
  923. If set to 1, the filter will pad the last audio frame with zeroes, so
  924. that the last frame will contain the same number of samples as the
  925. previous ones. Default value is 1.
  926. @end table
  927. For example, to set the number of per-frame samples to 1234 and
  928. disable padding for the last frame, use:
  929. @example
  930. asetnsamples=n=1234:p=0
  931. @end example
  932. @section asetrate
  933. Set the sample rate without altering the PCM data.
  934. This will result in a change of speed and pitch.
  935. The filter accepts the following options:
  936. @table @option
  937. @item sample_rate, r
  938. Set the output sample rate. Default is 44100 Hz.
  939. @end table
  940. @section ashowinfo
  941. Show a line containing various information for each input audio frame.
  942. The input audio is not modified.
  943. The shown line contains a sequence of key/value pairs of the form
  944. @var{key}:@var{value}.
  945. The following values are shown in the output:
  946. @table @option
  947. @item n
  948. The (sequential) number of the input frame, starting from 0.
  949. @item pts
  950. The presentation timestamp of the input frame, in time base units; the time base
  951. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  952. @item pts_time
  953. The presentation timestamp of the input frame in seconds.
  954. @item pos
  955. position of the frame in the input stream, -1 if this information in
  956. unavailable and/or meaningless (for example in case of synthetic audio)
  957. @item fmt
  958. The sample format.
  959. @item chlayout
  960. The channel layout.
  961. @item rate
  962. The sample rate for the audio frame.
  963. @item nb_samples
  964. The number of samples (per channel) in the frame.
  965. @item checksum
  966. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  967. audio, the data is treated as if all the planes were concatenated.
  968. @item plane_checksums
  969. A list of Adler-32 checksums for each data plane.
  970. @end table
  971. @anchor{astats}
  972. @section astats
  973. Display time domain statistical information about the audio channels.
  974. Statistics are calculated and displayed for each audio channel and,
  975. where applicable, an overall figure is also given.
  976. It accepts the following option:
  977. @table @option
  978. @item length
  979. Short window length in seconds, used for peak and trough RMS measurement.
  980. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  981. @item metadata
  982. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  983. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  984. disabled.
  985. Available keys for each channel are:
  986. DC_offset
  987. Min_level
  988. Max_level
  989. Min_difference
  990. Max_difference
  991. Mean_difference
  992. Peak_level
  993. RMS_peak
  994. RMS_trough
  995. Crest_factor
  996. Flat_factor
  997. Peak_count
  998. Bit_depth
  999. and for Overall:
  1000. DC_offset
  1001. Min_level
  1002. Max_level
  1003. Min_difference
  1004. Max_difference
  1005. Mean_difference
  1006. Peak_level
  1007. RMS_level
  1008. RMS_peak
  1009. RMS_trough
  1010. Flat_factor
  1011. Peak_count
  1012. Bit_depth
  1013. Number_of_samples
  1014. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1015. this @code{lavfi.astats.Overall.Peak_count}.
  1016. For description what each key means read below.
  1017. @item reset
  1018. Set number of frame after which stats are going to be recalculated.
  1019. Default is disabled.
  1020. @end table
  1021. A description of each shown parameter follows:
  1022. @table @option
  1023. @item DC offset
  1024. Mean amplitude displacement from zero.
  1025. @item Min level
  1026. Minimal sample level.
  1027. @item Max level
  1028. Maximal sample level.
  1029. @item Min difference
  1030. Minimal difference between two consecutive samples.
  1031. @item Max difference
  1032. Maximal difference between two consecutive samples.
  1033. @item Mean difference
  1034. Mean difference between two consecutive samples.
  1035. The average of each difference between two consecutive samples.
  1036. @item Peak level dB
  1037. @item RMS level dB
  1038. Standard peak and RMS level measured in dBFS.
  1039. @item RMS peak dB
  1040. @item RMS trough dB
  1041. Peak and trough values for RMS level measured over a short window.
  1042. @item Crest factor
  1043. Standard ratio of peak to RMS level (note: not in dB).
  1044. @item Flat factor
  1045. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1046. (i.e. either @var{Min level} or @var{Max level}).
  1047. @item Peak count
  1048. Number of occasions (not the number of samples) that the signal attained either
  1049. @var{Min level} or @var{Max level}.
  1050. @item Bit depth
  1051. Overall bit depth of audio. Number of bits used for each sample.
  1052. @end table
  1053. @section asyncts
  1054. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1055. dropping samples/adding silence when needed.
  1056. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1057. It accepts the following parameters:
  1058. @table @option
  1059. @item compensate
  1060. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1061. by default. When disabled, time gaps are covered with silence.
  1062. @item min_delta
  1063. The minimum difference between timestamps and audio data (in seconds) to trigger
  1064. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1065. sync with this filter, try setting this parameter to 0.
  1066. @item max_comp
  1067. The maximum compensation in samples per second. Only relevant with compensate=1.
  1068. The default value is 500.
  1069. @item first_pts
  1070. Assume that the first PTS should be this value. The time base is 1 / sample
  1071. rate. This allows for padding/trimming at the start of the stream. By default,
  1072. no assumption is made about the first frame's expected PTS, so no padding or
  1073. trimming is done. For example, this could be set to 0 to pad the beginning with
  1074. silence if an audio stream starts after the video stream or to trim any samples
  1075. with a negative PTS due to encoder delay.
  1076. @end table
  1077. @section atempo
  1078. Adjust audio tempo.
  1079. The filter accepts exactly one parameter, the audio tempo. If not
  1080. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1081. be in the [0.5, 2.0] range.
  1082. @subsection Examples
  1083. @itemize
  1084. @item
  1085. Slow down audio to 80% tempo:
  1086. @example
  1087. atempo=0.8
  1088. @end example
  1089. @item
  1090. To speed up audio to 125% tempo:
  1091. @example
  1092. atempo=1.25
  1093. @end example
  1094. @end itemize
  1095. @section atrim
  1096. Trim the input so that the output contains one continuous subpart of the input.
  1097. It accepts the following parameters:
  1098. @table @option
  1099. @item start
  1100. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1101. sample with the timestamp @var{start} will be the first sample in the output.
  1102. @item end
  1103. Specify time of the first audio sample that will be dropped, i.e. the
  1104. audio sample immediately preceding the one with the timestamp @var{end} will be
  1105. the last sample in the output.
  1106. @item start_pts
  1107. Same as @var{start}, except this option sets the start timestamp in samples
  1108. instead of seconds.
  1109. @item end_pts
  1110. Same as @var{end}, except this option sets the end timestamp in samples instead
  1111. of seconds.
  1112. @item duration
  1113. The maximum duration of the output in seconds.
  1114. @item start_sample
  1115. The number of the first sample that should be output.
  1116. @item end_sample
  1117. The number of the first sample that should be dropped.
  1118. @end table
  1119. @option{start}, @option{end}, and @option{duration} are expressed as time
  1120. duration specifications; see
  1121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1122. Note that the first two sets of the start/end options and the @option{duration}
  1123. option look at the frame timestamp, while the _sample options simply count the
  1124. samples that pass through the filter. So start/end_pts and start/end_sample will
  1125. give different results when the timestamps are wrong, inexact or do not start at
  1126. zero. Also note that this filter does not modify the timestamps. If you wish
  1127. to have the output timestamps start at zero, insert the asetpts filter after the
  1128. atrim filter.
  1129. If multiple start or end options are set, this filter tries to be greedy and
  1130. keep all samples that match at least one of the specified constraints. To keep
  1131. only the part that matches all the constraints at once, chain multiple atrim
  1132. filters.
  1133. The defaults are such that all the input is kept. So it is possible to set e.g.
  1134. just the end values to keep everything before the specified time.
  1135. Examples:
  1136. @itemize
  1137. @item
  1138. Drop everything except the second minute of input:
  1139. @example
  1140. ffmpeg -i INPUT -af atrim=60:120
  1141. @end example
  1142. @item
  1143. Keep only the first 1000 samples:
  1144. @example
  1145. ffmpeg -i INPUT -af atrim=end_sample=1000
  1146. @end example
  1147. @end itemize
  1148. @section bandpass
  1149. Apply a two-pole Butterworth band-pass filter with central
  1150. frequency @var{frequency}, and (3dB-point) band-width width.
  1151. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1152. instead of the default: constant 0dB peak gain.
  1153. The filter roll off at 6dB per octave (20dB per decade).
  1154. The filter accepts the following options:
  1155. @table @option
  1156. @item frequency, f
  1157. Set the filter's central frequency. Default is @code{3000}.
  1158. @item csg
  1159. Constant skirt gain if set to 1. Defaults to 0.
  1160. @item width_type
  1161. Set method to specify band-width of filter.
  1162. @table @option
  1163. @item h
  1164. Hz
  1165. @item q
  1166. Q-Factor
  1167. @item o
  1168. octave
  1169. @item s
  1170. slope
  1171. @end table
  1172. @item width, w
  1173. Specify the band-width of a filter in width_type units.
  1174. @end table
  1175. @section bandreject
  1176. Apply a two-pole Butterworth band-reject filter with central
  1177. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1178. The filter roll off at 6dB per octave (20dB per decade).
  1179. The filter accepts the following options:
  1180. @table @option
  1181. @item frequency, f
  1182. Set the filter's central frequency. Default is @code{3000}.
  1183. @item width_type
  1184. Set method to specify band-width of filter.
  1185. @table @option
  1186. @item h
  1187. Hz
  1188. @item q
  1189. Q-Factor
  1190. @item o
  1191. octave
  1192. @item s
  1193. slope
  1194. @end table
  1195. @item width, w
  1196. Specify the band-width of a filter in width_type units.
  1197. @end table
  1198. @section bass
  1199. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1200. shelving filter with a response similar to that of a standard
  1201. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1202. The filter accepts the following options:
  1203. @table @option
  1204. @item gain, g
  1205. Give the gain at 0 Hz. Its useful range is about -20
  1206. (for a large cut) to +20 (for a large boost).
  1207. Beware of clipping when using a positive gain.
  1208. @item frequency, f
  1209. Set the filter's central frequency and so can be used
  1210. to extend or reduce the frequency range to be boosted or cut.
  1211. The default value is @code{100} Hz.
  1212. @item width_type
  1213. Set method to specify band-width of filter.
  1214. @table @option
  1215. @item h
  1216. Hz
  1217. @item q
  1218. Q-Factor
  1219. @item o
  1220. octave
  1221. @item s
  1222. slope
  1223. @end table
  1224. @item width, w
  1225. Determine how steep is the filter's shelf transition.
  1226. @end table
  1227. @section biquad
  1228. Apply a biquad IIR filter with the given coefficients.
  1229. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1230. are the numerator and denominator coefficients respectively.
  1231. @section bs2b
  1232. Bauer stereo to binaural transformation, which improves headphone listening of
  1233. stereo audio records.
  1234. It accepts the following parameters:
  1235. @table @option
  1236. @item profile
  1237. Pre-defined crossfeed level.
  1238. @table @option
  1239. @item default
  1240. Default level (fcut=700, feed=50).
  1241. @item cmoy
  1242. Chu Moy circuit (fcut=700, feed=60).
  1243. @item jmeier
  1244. Jan Meier circuit (fcut=650, feed=95).
  1245. @end table
  1246. @item fcut
  1247. Cut frequency (in Hz).
  1248. @item feed
  1249. Feed level (in Hz).
  1250. @end table
  1251. @section channelmap
  1252. Remap input channels to new locations.
  1253. It accepts the following parameters:
  1254. @table @option
  1255. @item channel_layout
  1256. The channel layout of the output stream.
  1257. @item map
  1258. Map channels from input to output. The argument is a '|'-separated list of
  1259. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1260. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1261. channel (e.g. FL for front left) or its index in the input channel layout.
  1262. @var{out_channel} is the name of the output channel or its index in the output
  1263. channel layout. If @var{out_channel} is not given then it is implicitly an
  1264. index, starting with zero and increasing by one for each mapping.
  1265. @end table
  1266. If no mapping is present, the filter will implicitly map input channels to
  1267. output channels, preserving indices.
  1268. For example, assuming a 5.1+downmix input MOV file,
  1269. @example
  1270. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1271. @end example
  1272. will create an output WAV file tagged as stereo from the downmix channels of
  1273. the input.
  1274. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1275. @example
  1276. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1277. @end example
  1278. @section channelsplit
  1279. Split each channel from an input audio stream into a separate output stream.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item channel_layout
  1283. The channel layout of the input stream. The default is "stereo".
  1284. @end table
  1285. For example, assuming a stereo input MP3 file,
  1286. @example
  1287. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1288. @end example
  1289. will create an output Matroska file with two audio streams, one containing only
  1290. the left channel and the other the right channel.
  1291. Split a 5.1 WAV file into per-channel files:
  1292. @example
  1293. ffmpeg -i in.wav -filter_complex
  1294. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1295. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1296. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1297. side_right.wav
  1298. @end example
  1299. @section chorus
  1300. Add a chorus effect to the audio.
  1301. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1302. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1303. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1304. The modulation depth defines the range the modulated delay is played before or after
  1305. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1306. sound tuned around the original one, like in a chorus where some vocals are slightly
  1307. off key.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item in_gain
  1311. Set input gain. Default is 0.4.
  1312. @item out_gain
  1313. Set output gain. Default is 0.4.
  1314. @item delays
  1315. Set delays. A typical delay is around 40ms to 60ms.
  1316. @item decays
  1317. Set decays.
  1318. @item speeds
  1319. Set speeds.
  1320. @item depths
  1321. Set depths.
  1322. @end table
  1323. @subsection Examples
  1324. @itemize
  1325. @item
  1326. A single delay:
  1327. @example
  1328. chorus=0.7:0.9:55:0.4:0.25:2
  1329. @end example
  1330. @item
  1331. Two delays:
  1332. @example
  1333. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1334. @end example
  1335. @item
  1336. Fuller sounding chorus with three delays:
  1337. @example
  1338. 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
  1339. @end example
  1340. @end itemize
  1341. @section compand
  1342. Compress or expand the audio's dynamic range.
  1343. It accepts the following parameters:
  1344. @table @option
  1345. @item attacks
  1346. @item decays
  1347. A list of times in seconds for each channel over which the instantaneous level
  1348. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1349. increase of volume and @var{decays} refers to decrease of volume. For most
  1350. situations, the attack time (response to the audio getting louder) should be
  1351. shorter than the decay time, because the human ear is more sensitive to sudden
  1352. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1353. a typical value for decay is 0.8 seconds.
  1354. If specified number of attacks & decays is lower than number of channels, the last
  1355. set attack/decay will be used for all remaining channels.
  1356. @item points
  1357. A list of points for the transfer function, specified in dB relative to the
  1358. maximum possible signal amplitude. Each key points list must be defined using
  1359. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1360. @code{x0/y0 x1/y1 x2/y2 ....}
  1361. The input values must be in strictly increasing order but the transfer function
  1362. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1363. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1364. function are @code{-70/-70|-60/-20}.
  1365. @item soft-knee
  1366. Set the curve radius in dB for all joints. It defaults to 0.01.
  1367. @item gain
  1368. Set the additional gain in dB to be applied at all points on the transfer
  1369. function. This allows for easy adjustment of the overall gain.
  1370. It defaults to 0.
  1371. @item volume
  1372. Set an initial volume, in dB, to be assumed for each channel when filtering
  1373. starts. This permits the user to supply a nominal level initially, so that, for
  1374. example, a very large gain is not applied to initial signal levels before the
  1375. companding has begun to operate. A typical value for audio which is initially
  1376. quiet is -90 dB. It defaults to 0.
  1377. @item delay
  1378. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1379. delayed before being fed to the volume adjuster. Specifying a delay
  1380. approximately equal to the attack/decay times allows the filter to effectively
  1381. operate in predictive rather than reactive mode. It defaults to 0.
  1382. @end table
  1383. @subsection Examples
  1384. @itemize
  1385. @item
  1386. Make music with both quiet and loud passages suitable for listening to in a
  1387. noisy environment:
  1388. @example
  1389. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1390. @end example
  1391. Another example for audio with whisper and explosion parts:
  1392. @example
  1393. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1394. @end example
  1395. @item
  1396. A noise gate for when the noise is at a lower level than the signal:
  1397. @example
  1398. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1399. @end example
  1400. @item
  1401. Here is another noise gate, this time for when the noise is at a higher level
  1402. than the signal (making it, in some ways, similar to squelch):
  1403. @example
  1404. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1405. @end example
  1406. @end itemize
  1407. @section compensationdelay
  1408. Compensation Delay Line is a metric based delay to compensate differing
  1409. positions of microphones or speakers.
  1410. For example, you have recorded guitar with two microphones placed in
  1411. different location. Because the front of sound wave has fixed speed in
  1412. normal conditions, the phasing of microphones can vary and depends on
  1413. their location and interposition. The best sound mix can be achieved when
  1414. these microphones are in phase (synchronized). Note that distance of
  1415. ~30 cm between microphones makes one microphone to capture signal in
  1416. antiphase to another microphone. That makes the final mix sounding moody.
  1417. This filter helps to solve phasing problems by adding different delays
  1418. to each microphone track and make them synchronized.
  1419. The best result can be reached when you take one track as base and
  1420. synchronize other tracks one by one with it.
  1421. Remember that synchronization/delay tolerance depends on sample rate, too.
  1422. Higher sample rates will give more tolerance.
  1423. It accepts the following parameters:
  1424. @table @option
  1425. @item mm
  1426. Set millimeters distance. This is compensation distance for fine tuning.
  1427. Default is 0.
  1428. @item cm
  1429. Set cm distance. This is compensation distance for tightening distance setup.
  1430. Default is 0.
  1431. @item m
  1432. Set meters distance. This is compensation distance for hard distance setup.
  1433. Default is 0.
  1434. @item dry
  1435. Set dry amount. Amount of unprocessed (dry) signal.
  1436. Default is 0.
  1437. @item wet
  1438. Set wet amount. Amount of processed (wet) signal.
  1439. Default is 1.
  1440. @item temp
  1441. Set temperature degree in Celsius. This is the temperature of the environment.
  1442. Default is 20.
  1443. @end table
  1444. @section dcshift
  1445. Apply a DC shift to the audio.
  1446. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1447. in the recording chain) from the audio. The effect of a DC offset is reduced
  1448. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1449. a signal has a DC offset.
  1450. @table @option
  1451. @item shift
  1452. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1453. the audio.
  1454. @item limitergain
  1455. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1456. used to prevent clipping.
  1457. @end table
  1458. @section dynaudnorm
  1459. Dynamic Audio Normalizer.
  1460. This filter applies a certain amount of gain to the input audio in order
  1461. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1462. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1463. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1464. This allows for applying extra gain to the "quiet" sections of the audio
  1465. while avoiding distortions or clipping the "loud" sections. In other words:
  1466. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1467. sections, in the sense that the volume of each section is brought to the
  1468. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1469. this goal *without* applying "dynamic range compressing". It will retain 100%
  1470. of the dynamic range *within* each section of the audio file.
  1471. @table @option
  1472. @item f
  1473. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1474. Default is 500 milliseconds.
  1475. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1476. referred to as frames. This is required, because a peak magnitude has no
  1477. meaning for just a single sample value. Instead, we need to determine the
  1478. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1479. normalizer would simply use the peak magnitude of the complete file, the
  1480. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1481. frame. The length of a frame is specified in milliseconds. By default, the
  1482. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1483. been found to give good results with most files.
  1484. Note that the exact frame length, in number of samples, will be determined
  1485. automatically, based on the sampling rate of the individual input audio file.
  1486. @item g
  1487. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1488. number. Default is 31.
  1489. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1490. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1491. is specified in frames, centered around the current frame. For the sake of
  1492. simplicity, this must be an odd number. Consequently, the default value of 31
  1493. takes into account the current frame, as well as the 15 preceding frames and
  1494. the 15 subsequent frames. Using a larger window results in a stronger
  1495. smoothing effect and thus in less gain variation, i.e. slower gain
  1496. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1497. effect and thus in more gain variation, i.e. faster gain adaptation.
  1498. In other words, the more you increase this value, the more the Dynamic Audio
  1499. Normalizer will behave like a "traditional" normalization filter. On the
  1500. contrary, the more you decrease this value, the more the Dynamic Audio
  1501. Normalizer will behave like a dynamic range compressor.
  1502. @item p
  1503. Set the target peak value. This specifies the highest permissible magnitude
  1504. level for the normalized audio input. This filter will try to approach the
  1505. target peak magnitude as closely as possible, but at the same time it also
  1506. makes sure that the normalized signal will never exceed the peak magnitude.
  1507. A frame's maximum local gain factor is imposed directly by the target peak
  1508. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1509. It is not recommended to go above this value.
  1510. @item m
  1511. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1512. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1513. factor for each input frame, i.e. the maximum gain factor that does not
  1514. result in clipping or distortion. The maximum gain factor is determined by
  1515. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1516. additionally bounds the frame's maximum gain factor by a predetermined
  1517. (global) maximum gain factor. This is done in order to avoid excessive gain
  1518. factors in "silent" or almost silent frames. By default, the maximum gain
  1519. factor is 10.0, For most inputs the default value should be sufficient and
  1520. it usually is not recommended to increase this value. Though, for input
  1521. with an extremely low overall volume level, it may be necessary to allow even
  1522. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1523. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1524. Instead, a "sigmoid" threshold function will be applied. This way, the
  1525. gain factors will smoothly approach the threshold value, but never exceed that
  1526. value.
  1527. @item r
  1528. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1529. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1530. This means that the maximum local gain factor for each frame is defined
  1531. (only) by the frame's highest magnitude sample. This way, the samples can
  1532. be amplified as much as possible without exceeding the maximum signal
  1533. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1534. Normalizer can also take into account the frame's root mean square,
  1535. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1536. determine the power of a time-varying signal. It is therefore considered
  1537. that the RMS is a better approximation of the "perceived loudness" than
  1538. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1539. frames to a constant RMS value, a uniform "perceived loudness" can be
  1540. established. If a target RMS value has been specified, a frame's local gain
  1541. factor is defined as the factor that would result in exactly that RMS value.
  1542. Note, however, that the maximum local gain factor is still restricted by the
  1543. frame's highest magnitude sample, in order to prevent clipping.
  1544. @item n
  1545. Enable channels coupling. By default is enabled.
  1546. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1547. amount. This means the same gain factor will be applied to all channels, i.e.
  1548. the maximum possible gain factor is determined by the "loudest" channel.
  1549. However, in some recordings, it may happen that the volume of the different
  1550. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1551. In this case, this option can be used to disable the channel coupling. This way,
  1552. the gain factor will be determined independently for each channel, depending
  1553. only on the individual channel's highest magnitude sample. This allows for
  1554. harmonizing the volume of the different channels.
  1555. @item c
  1556. Enable DC bias correction. By default is disabled.
  1557. An audio signal (in the time domain) is a sequence of sample values.
  1558. In the Dynamic Audio Normalizer these sample values are represented in the
  1559. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1560. audio signal, or "waveform", should be centered around the zero point.
  1561. That means if we calculate the mean value of all samples in a file, or in a
  1562. single frame, then the result should be 0.0 or at least very close to that
  1563. value. If, however, there is a significant deviation of the mean value from
  1564. 0.0, in either positive or negative direction, this is referred to as a
  1565. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1566. Audio Normalizer provides optional DC bias correction.
  1567. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1568. the mean value, or "DC correction" offset, of each input frame and subtract
  1569. that value from all of the frame's sample values which ensures those samples
  1570. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1571. boundaries, the DC correction offset values will be interpolated smoothly
  1572. between neighbouring frames.
  1573. @item b
  1574. Enable alternative boundary mode. By default is disabled.
  1575. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1576. around each frame. This includes the preceding frames as well as the
  1577. subsequent frames. However, for the "boundary" frames, located at the very
  1578. beginning and at the very end of the audio file, not all neighbouring
  1579. frames are available. In particular, for the first few frames in the audio
  1580. file, the preceding frames are not known. And, similarly, for the last few
  1581. frames in the audio file, the subsequent frames are not known. Thus, the
  1582. question arises which gain factors should be assumed for the missing frames
  1583. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1584. to deal with this situation. The default boundary mode assumes a gain factor
  1585. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1586. "fade out" at the beginning and at the end of the input, respectively.
  1587. @item s
  1588. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1589. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1590. compression. This means that signal peaks will not be pruned and thus the
  1591. full dynamic range will be retained within each local neighbourhood. However,
  1592. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1593. normalization algorithm with a more "traditional" compression.
  1594. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1595. (thresholding) function. If (and only if) the compression feature is enabled,
  1596. all input frames will be processed by a soft knee thresholding function prior
  1597. to the actual normalization process. Put simply, the thresholding function is
  1598. going to prune all samples whose magnitude exceeds a certain threshold value.
  1599. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1600. value. Instead, the threshold value will be adjusted for each individual
  1601. frame.
  1602. In general, smaller parameters result in stronger compression, and vice versa.
  1603. Values below 3.0 are not recommended, because audible distortion may appear.
  1604. @end table
  1605. @section earwax
  1606. Make audio easier to listen to on headphones.
  1607. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1608. so that when listened to on headphones the stereo image is moved from
  1609. inside your head (standard for headphones) to outside and in front of
  1610. the listener (standard for speakers).
  1611. Ported from SoX.
  1612. @section equalizer
  1613. Apply a two-pole peaking equalisation (EQ) filter. With this
  1614. filter, the signal-level at and around a selected frequency can
  1615. be increased or decreased, whilst (unlike bandpass and bandreject
  1616. filters) that at all other frequencies is unchanged.
  1617. In order to produce complex equalisation curves, this filter can
  1618. be given several times, each with a different central frequency.
  1619. The filter accepts the following options:
  1620. @table @option
  1621. @item frequency, f
  1622. Set the filter's central frequency in Hz.
  1623. @item width_type
  1624. Set method to specify band-width of filter.
  1625. @table @option
  1626. @item h
  1627. Hz
  1628. @item q
  1629. Q-Factor
  1630. @item o
  1631. octave
  1632. @item s
  1633. slope
  1634. @end table
  1635. @item width, w
  1636. Specify the band-width of a filter in width_type units.
  1637. @item gain, g
  1638. Set the required gain or attenuation in dB.
  1639. Beware of clipping when using a positive gain.
  1640. @end table
  1641. @subsection Examples
  1642. @itemize
  1643. @item
  1644. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1645. @example
  1646. equalizer=f=1000:width_type=h:width=200:g=-10
  1647. @end example
  1648. @item
  1649. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1650. @example
  1651. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1652. @end example
  1653. @end itemize
  1654. @section extrastereo
  1655. Linearly increases the difference between left and right channels which
  1656. adds some sort of "live" effect to playback.
  1657. The filter accepts the following option:
  1658. @table @option
  1659. @item m
  1660. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1661. (average of both channels), with 1.0 sound will be unchanged, with
  1662. -1.0 left and right channels will be swapped.
  1663. @item c
  1664. Enable clipping. By default is enabled.
  1665. @end table
  1666. @section flanger
  1667. Apply a flanging effect to the audio.
  1668. The filter accepts the following options:
  1669. @table @option
  1670. @item delay
  1671. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1672. @item depth
  1673. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1674. @item regen
  1675. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1676. Default value is 0.
  1677. @item width
  1678. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1679. Default value is 71.
  1680. @item speed
  1681. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1682. @item shape
  1683. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1684. Default value is @var{sinusoidal}.
  1685. @item phase
  1686. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1687. Default value is 25.
  1688. @item interp
  1689. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1690. Default is @var{linear}.
  1691. @end table
  1692. @section highpass
  1693. Apply a high-pass filter with 3dB point frequency.
  1694. The filter can be either single-pole, or double-pole (the default).
  1695. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1696. The filter accepts the following options:
  1697. @table @option
  1698. @item frequency, f
  1699. Set frequency in Hz. Default is 3000.
  1700. @item poles, p
  1701. Set number of poles. Default is 2.
  1702. @item width_type
  1703. Set method to specify band-width of filter.
  1704. @table @option
  1705. @item h
  1706. Hz
  1707. @item q
  1708. Q-Factor
  1709. @item o
  1710. octave
  1711. @item s
  1712. slope
  1713. @end table
  1714. @item width, w
  1715. Specify the band-width of a filter in width_type units.
  1716. Applies only to double-pole filter.
  1717. The default is 0.707q and gives a Butterworth response.
  1718. @end table
  1719. @section join
  1720. Join multiple input streams into one multi-channel stream.
  1721. It accepts the following parameters:
  1722. @table @option
  1723. @item inputs
  1724. The number of input streams. It defaults to 2.
  1725. @item channel_layout
  1726. The desired output channel layout. It defaults to stereo.
  1727. @item map
  1728. Map channels from inputs to output. The argument is a '|'-separated list of
  1729. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1730. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1731. can be either the name of the input channel (e.g. FL for front left) or its
  1732. index in the specified input stream. @var{out_channel} is the name of the output
  1733. channel.
  1734. @end table
  1735. The filter will attempt to guess the mappings when they are not specified
  1736. explicitly. It does so by first trying to find an unused matching input channel
  1737. and if that fails it picks the first unused input channel.
  1738. Join 3 inputs (with properly set channel layouts):
  1739. @example
  1740. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1741. @end example
  1742. Build a 5.1 output from 6 single-channel streams:
  1743. @example
  1744. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1745. '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'
  1746. out
  1747. @end example
  1748. @section ladspa
  1749. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1750. To enable compilation of this filter you need to configure FFmpeg with
  1751. @code{--enable-ladspa}.
  1752. @table @option
  1753. @item file, f
  1754. Specifies the name of LADSPA plugin library to load. If the environment
  1755. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1756. each one of the directories specified by the colon separated list in
  1757. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1758. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1759. @file{/usr/lib/ladspa/}.
  1760. @item plugin, p
  1761. Specifies the plugin within the library. Some libraries contain only
  1762. one plugin, but others contain many of them. If this is not set filter
  1763. will list all available plugins within the specified library.
  1764. @item controls, c
  1765. Set the '|' separated list of controls which are zero or more floating point
  1766. values that determine the behavior of the loaded plugin (for example delay,
  1767. threshold or gain).
  1768. Controls need to be defined using the following syntax:
  1769. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1770. @var{valuei} is the value set on the @var{i}-th control.
  1771. Alternatively they can be also defined using the following syntax:
  1772. @var{value0}|@var{value1}|@var{value2}|..., where
  1773. @var{valuei} is the value set on the @var{i}-th control.
  1774. If @option{controls} is set to @code{help}, all available controls and
  1775. their valid ranges are printed.
  1776. @item sample_rate, s
  1777. Specify the sample rate, default to 44100. Only used if plugin have
  1778. zero inputs.
  1779. @item nb_samples, n
  1780. Set the number of samples per channel per each output frame, default
  1781. is 1024. Only used if plugin have zero inputs.
  1782. @item duration, d
  1783. Set the minimum duration of the sourced audio. See
  1784. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1785. for the accepted syntax.
  1786. Note that the resulting duration may be greater than the specified duration,
  1787. as the generated audio is always cut at the end of a complete frame.
  1788. If not specified, or the expressed duration is negative, the audio is
  1789. supposed to be generated forever.
  1790. Only used if plugin have zero inputs.
  1791. @end table
  1792. @subsection Examples
  1793. @itemize
  1794. @item
  1795. List all available plugins within amp (LADSPA example plugin) library:
  1796. @example
  1797. ladspa=file=amp
  1798. @end example
  1799. @item
  1800. List all available controls and their valid ranges for @code{vcf_notch}
  1801. plugin from @code{VCF} library:
  1802. @example
  1803. ladspa=f=vcf:p=vcf_notch:c=help
  1804. @end example
  1805. @item
  1806. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1807. plugin library:
  1808. @example
  1809. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1810. @end example
  1811. @item
  1812. Add reverberation to the audio using TAP-plugins
  1813. (Tom's Audio Processing plugins):
  1814. @example
  1815. ladspa=file=tap_reverb:tap_reverb
  1816. @end example
  1817. @item
  1818. Generate white noise, with 0.2 amplitude:
  1819. @example
  1820. ladspa=file=cmt:noise_source_white:c=c0=.2
  1821. @end example
  1822. @item
  1823. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1824. @code{C* Audio Plugin Suite} (CAPS) library:
  1825. @example
  1826. ladspa=file=caps:Click:c=c1=20'
  1827. @end example
  1828. @item
  1829. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1830. @example
  1831. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1832. @end example
  1833. @item
  1834. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1835. @code{SWH Plugins} collection:
  1836. @example
  1837. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1838. @end example
  1839. @item
  1840. Attenuate low frequencies using Multiband EQ from Steve Harris
  1841. @code{SWH Plugins} collection:
  1842. @example
  1843. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1844. @end example
  1845. @end itemize
  1846. @subsection Commands
  1847. This filter supports the following commands:
  1848. @table @option
  1849. @item cN
  1850. Modify the @var{N}-th control value.
  1851. If the specified value is not valid, it is ignored and prior one is kept.
  1852. @end table
  1853. @section lowpass
  1854. Apply a low-pass filter with 3dB point frequency.
  1855. The filter can be either single-pole or double-pole (the default).
  1856. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1857. The filter accepts the following options:
  1858. @table @option
  1859. @item frequency, f
  1860. Set frequency in Hz. Default is 500.
  1861. @item poles, p
  1862. Set number of poles. Default is 2.
  1863. @item width_type
  1864. Set method to specify band-width of filter.
  1865. @table @option
  1866. @item h
  1867. Hz
  1868. @item q
  1869. Q-Factor
  1870. @item o
  1871. octave
  1872. @item s
  1873. slope
  1874. @end table
  1875. @item width, w
  1876. Specify the band-width of a filter in width_type units.
  1877. Applies only to double-pole filter.
  1878. The default is 0.707q and gives a Butterworth response.
  1879. @end table
  1880. @anchor{pan}
  1881. @section pan
  1882. Mix channels with specific gain levels. The filter accepts the output
  1883. channel layout followed by a set of channels definitions.
  1884. This filter is also designed to efficiently remap the channels of an audio
  1885. stream.
  1886. The filter accepts parameters of the form:
  1887. "@var{l}|@var{outdef}|@var{outdef}|..."
  1888. @table @option
  1889. @item l
  1890. output channel layout or number of channels
  1891. @item outdef
  1892. output channel specification, of the form:
  1893. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1894. @item out_name
  1895. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1896. number (c0, c1, etc.)
  1897. @item gain
  1898. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1899. @item in_name
  1900. input channel to use, see out_name for details; it is not possible to mix
  1901. named and numbered input channels
  1902. @end table
  1903. If the `=' in a channel specification is replaced by `<', then the gains for
  1904. that specification will be renormalized so that the total is 1, thus
  1905. avoiding clipping noise.
  1906. @subsection Mixing examples
  1907. For example, if you want to down-mix from stereo to mono, but with a bigger
  1908. factor for the left channel:
  1909. @example
  1910. pan=1c|c0=0.9*c0+0.1*c1
  1911. @end example
  1912. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1913. 7-channels surround:
  1914. @example
  1915. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1916. @end example
  1917. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1918. that should be preferred (see "-ac" option) unless you have very specific
  1919. needs.
  1920. @subsection Remapping examples
  1921. The channel remapping will be effective if, and only if:
  1922. @itemize
  1923. @item gain coefficients are zeroes or ones,
  1924. @item only one input per channel output,
  1925. @end itemize
  1926. If all these conditions are satisfied, the filter will notify the user ("Pure
  1927. channel mapping detected"), and use an optimized and lossless method to do the
  1928. remapping.
  1929. For example, if you have a 5.1 source and want a stereo audio stream by
  1930. dropping the extra channels:
  1931. @example
  1932. pan="stereo| c0=FL | c1=FR"
  1933. @end example
  1934. Given the same source, you can also switch front left and front right channels
  1935. and keep the input channel layout:
  1936. @example
  1937. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1938. @end example
  1939. If the input is a stereo audio stream, you can mute the front left channel (and
  1940. still keep the stereo channel layout) with:
  1941. @example
  1942. pan="stereo|c1=c1"
  1943. @end example
  1944. Still with a stereo audio stream input, you can copy the right channel in both
  1945. front left and right:
  1946. @example
  1947. pan="stereo| c0=FR | c1=FR"
  1948. @end example
  1949. @section replaygain
  1950. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1951. outputs it unchanged.
  1952. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1953. @section resample
  1954. Convert the audio sample format, sample rate and channel layout. It is
  1955. not meant to be used directly.
  1956. @section rubberband
  1957. Apply time-stretching and pitch-shifting with librubberband.
  1958. The filter accepts the following options:
  1959. @table @option
  1960. @item tempo
  1961. Set tempo scale factor.
  1962. @item pitch
  1963. Set pitch scale factor.
  1964. @item transients
  1965. Set transients detector.
  1966. Possible values are:
  1967. @table @var
  1968. @item crisp
  1969. @item mixed
  1970. @item smooth
  1971. @end table
  1972. @item detector
  1973. Set detector.
  1974. Possible values are:
  1975. @table @var
  1976. @item compound
  1977. @item percussive
  1978. @item soft
  1979. @end table
  1980. @item phase
  1981. Set phase.
  1982. Possible values are:
  1983. @table @var
  1984. @item laminar
  1985. @item independent
  1986. @end table
  1987. @item window
  1988. Set processing window size.
  1989. Possible values are:
  1990. @table @var
  1991. @item standard
  1992. @item short
  1993. @item long
  1994. @end table
  1995. @item smoothing
  1996. Set smoothing.
  1997. Possible values are:
  1998. @table @var
  1999. @item off
  2000. @item on
  2001. @end table
  2002. @item formant
  2003. Enable formant preservation when shift pitching.
  2004. Possible values are:
  2005. @table @var
  2006. @item shifted
  2007. @item preserved
  2008. @end table
  2009. @item pitchq
  2010. Set pitch quality.
  2011. Possible values are:
  2012. @table @var
  2013. @item quality
  2014. @item speed
  2015. @item consistency
  2016. @end table
  2017. @item channels
  2018. Set channels.
  2019. Possible values are:
  2020. @table @var
  2021. @item apart
  2022. @item together
  2023. @end table
  2024. @end table
  2025. @section sidechaincompress
  2026. This filter acts like normal compressor but has the ability to compress
  2027. detected signal using second input signal.
  2028. It needs two input streams and returns one output stream.
  2029. First input stream will be processed depending on second stream signal.
  2030. The filtered signal then can be filtered with other filters in later stages of
  2031. processing. See @ref{pan} and @ref{amerge} filter.
  2032. The filter accepts the following options:
  2033. @table @option
  2034. @item level_in
  2035. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2036. @item threshold
  2037. If a signal of second stream raises above this level it will affect the gain
  2038. reduction of first stream.
  2039. By default is 0.125. Range is between 0.00097563 and 1.
  2040. @item ratio
  2041. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2042. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2043. Default is 2. Range is between 1 and 20.
  2044. @item attack
  2045. Amount of milliseconds the signal has to rise above the threshold before gain
  2046. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2047. @item release
  2048. Amount of milliseconds the signal has to fall below the threshold before
  2049. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2050. @item makeup
  2051. Set the amount by how much signal will be amplified after processing.
  2052. Default is 2. Range is from 1 and 64.
  2053. @item knee
  2054. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2055. Default is 2.82843. Range is between 1 and 8.
  2056. @item link
  2057. Choose if the @code{average} level between all channels of side-chain stream
  2058. or the louder(@code{maximum}) channel of side-chain stream affects the
  2059. reduction. Default is @code{average}.
  2060. @item detection
  2061. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2062. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2063. @item level_sc
  2064. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2065. @item mix
  2066. How much to use compressed signal in output. Default is 1.
  2067. Range is between 0 and 1.
  2068. @end table
  2069. @subsection Examples
  2070. @itemize
  2071. @item
  2072. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2073. depending on the signal of 2nd input and later compressed signal to be
  2074. merged with 2nd input:
  2075. @example
  2076. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2077. @end example
  2078. @end itemize
  2079. @section sidechaingate
  2080. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2081. filter the detected signal before sending it to the gain reduction stage.
  2082. Normally a gate uses the full range signal to detect a level above the
  2083. threshold.
  2084. For example: If you cut all lower frequencies from your sidechain signal
  2085. the gate will decrease the volume of your track only if not enough highs
  2086. appear. With this technique you are able to reduce the resonation of a
  2087. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2088. guitar.
  2089. It needs two input streams and returns one output stream.
  2090. First input stream will be processed depending on second stream signal.
  2091. The filter accepts the following options:
  2092. @table @option
  2093. @item level_in
  2094. Set input level before filtering.
  2095. Default is 1. Allowed range is from 0.015625 to 64.
  2096. @item range
  2097. Set the level of gain reduction when the signal is below the threshold.
  2098. Default is 0.06125. Allowed range is from 0 to 1.
  2099. @item threshold
  2100. If a signal rises above this level the gain reduction is released.
  2101. Default is 0.125. Allowed range is from 0 to 1.
  2102. @item ratio
  2103. Set a ratio about which the signal is reduced.
  2104. Default is 2. Allowed range is from 1 to 9000.
  2105. @item attack
  2106. Amount of milliseconds the signal has to rise above the threshold before gain
  2107. reduction stops.
  2108. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2109. @item release
  2110. Amount of milliseconds the signal has to fall below the threshold before the
  2111. reduction is increased again. Default is 250 milliseconds.
  2112. Allowed range is from 0.01 to 9000.
  2113. @item makeup
  2114. Set amount of amplification of signal after processing.
  2115. Default is 1. Allowed range is from 1 to 64.
  2116. @item knee
  2117. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2118. Default is 2.828427125. Allowed range is from 1 to 8.
  2119. @item detection
  2120. Choose if exact signal should be taken for detection or an RMS like one.
  2121. Default is rms. Can be peak or rms.
  2122. @item link
  2123. Choose if the average level between all channels or the louder channel affects
  2124. the reduction.
  2125. Default is average. Can be average or maximum.
  2126. @item level_sc
  2127. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2128. @end table
  2129. @section silencedetect
  2130. Detect silence in an audio stream.
  2131. This filter logs a message when it detects that the input audio volume is less
  2132. or equal to a noise tolerance value for a duration greater or equal to the
  2133. minimum detected noise duration.
  2134. The printed times and duration are expressed in seconds.
  2135. The filter accepts the following options:
  2136. @table @option
  2137. @item duration, d
  2138. Set silence duration until notification (default is 2 seconds).
  2139. @item noise, n
  2140. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2141. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2142. @end table
  2143. @subsection Examples
  2144. @itemize
  2145. @item
  2146. Detect 5 seconds of silence with -50dB noise tolerance:
  2147. @example
  2148. silencedetect=n=-50dB:d=5
  2149. @end example
  2150. @item
  2151. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2152. tolerance in @file{silence.mp3}:
  2153. @example
  2154. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2155. @end example
  2156. @end itemize
  2157. @section silenceremove
  2158. Remove silence from the beginning, middle or end of the audio.
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item start_periods
  2162. This value is used to indicate if audio should be trimmed at beginning of
  2163. the audio. A value of zero indicates no silence should be trimmed from the
  2164. beginning. When specifying a non-zero value, it trims audio up until it
  2165. finds non-silence. Normally, when trimming silence from beginning of audio
  2166. the @var{start_periods} will be @code{1} but it can be increased to higher
  2167. values to trim all audio up to specific count of non-silence periods.
  2168. Default value is @code{0}.
  2169. @item start_duration
  2170. Specify the amount of time that non-silence must be detected before it stops
  2171. trimming audio. By increasing the duration, bursts of noises can be treated
  2172. as silence and trimmed off. Default value is @code{0}.
  2173. @item start_threshold
  2174. This indicates what sample value should be treated as silence. For digital
  2175. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2176. you may wish to increase the value to account for background noise.
  2177. Can be specified in dB (in case "dB" is appended to the specified value)
  2178. or amplitude ratio. Default value is @code{0}.
  2179. @item stop_periods
  2180. Set the count for trimming silence from the end of audio.
  2181. To remove silence from the middle of a file, specify a @var{stop_periods}
  2182. that is negative. This value is then treated as a positive value and is
  2183. used to indicate the effect should restart processing as specified by
  2184. @var{start_periods}, making it suitable for removing periods of silence
  2185. in the middle of the audio.
  2186. Default value is @code{0}.
  2187. @item stop_duration
  2188. Specify a duration of silence that must exist before audio is not copied any
  2189. more. By specifying a higher duration, silence that is wanted can be left in
  2190. the audio.
  2191. Default value is @code{0}.
  2192. @item stop_threshold
  2193. This is the same as @option{start_threshold} but for trimming silence from
  2194. the end of audio.
  2195. Can be specified in dB (in case "dB" is appended to the specified value)
  2196. or amplitude ratio. Default value is @code{0}.
  2197. @item leave_silence
  2198. This indicate that @var{stop_duration} length of audio should be left intact
  2199. at the beginning of each period of silence.
  2200. For example, if you want to remove long pauses between words but do not want
  2201. to remove the pauses completely. Default value is @code{0}.
  2202. @end table
  2203. @subsection Examples
  2204. @itemize
  2205. @item
  2206. The following example shows how this filter can be used to start a recording
  2207. that does not contain the delay at the start which usually occurs between
  2208. pressing the record button and the start of the performance:
  2209. @example
  2210. silenceremove=1:5:0.02
  2211. @end example
  2212. @end itemize
  2213. @section stereotools
  2214. This filter has some handy utilities to manage stereo signals, for converting
  2215. M/S stereo recordings to L/R signal while having control over the parameters
  2216. or spreading the stereo image of master track.
  2217. The filter accepts the following options:
  2218. @table @option
  2219. @item level_in
  2220. Set input level before filtering for both channels. Defaults is 1.
  2221. Allowed range is from 0.015625 to 64.
  2222. @item level_out
  2223. Set output level after filtering for both channels. Defaults is 1.
  2224. Allowed range is from 0.015625 to 64.
  2225. @item balance_in
  2226. Set input balance between both channels. Default is 0.
  2227. Allowed range is from -1 to 1.
  2228. @item balance_out
  2229. Set output balance between both channels. Default is 0.
  2230. Allowed range is from -1 to 1.
  2231. @item softclip
  2232. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2233. clipping. Disabled by default.
  2234. @item mutel
  2235. Mute the left channel. Disabled by default.
  2236. @item muter
  2237. Mute the right channel. Disabled by default.
  2238. @item phasel
  2239. Change the phase of the left channel. Disabled by default.
  2240. @item phaser
  2241. Change the phase of the right channel. Disabled by default.
  2242. @item mode
  2243. Set stereo mode. Available values are:
  2244. @table @samp
  2245. @item lr>lr
  2246. Left/Right to Left/Right, this is default.
  2247. @item lr>ms
  2248. Left/Right to Mid/Side.
  2249. @item ms>lr
  2250. Mid/Side to Left/Right.
  2251. @item lr>ll
  2252. Left/Right to Left/Left.
  2253. @item lr>rr
  2254. Left/Right to Right/Right.
  2255. @item lr>l+r
  2256. Left/Right to Left + Right.
  2257. @item lr>rl
  2258. Left/Right to Right/Left.
  2259. @end table
  2260. @item slev
  2261. Set level of side signal. Default is 1.
  2262. Allowed range is from 0.015625 to 64.
  2263. @item sbal
  2264. Set balance of side signal. Default is 0.
  2265. Allowed range is from -1 to 1.
  2266. @item mlev
  2267. Set level of the middle signal. Default is 1.
  2268. Allowed range is from 0.015625 to 64.
  2269. @item mpan
  2270. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2271. @item base
  2272. Set stereo base between mono and inversed channels. Default is 0.
  2273. Allowed range is from -1 to 1.
  2274. @item delay
  2275. Set delay in milliseconds how much to delay left from right channel and
  2276. vice versa. Default is 0. Allowed range is from -20 to 20.
  2277. @item sclevel
  2278. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2279. @item phase
  2280. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2281. @end table
  2282. @section stereowiden
  2283. This filter enhance the stereo effect by suppressing signal common to both
  2284. channels and by delaying the signal of left into right and vice versa,
  2285. thereby widening the stereo effect.
  2286. The filter accepts the following options:
  2287. @table @option
  2288. @item delay
  2289. Time in milliseconds of the delay of left signal into right and vice versa.
  2290. Default is 20 milliseconds.
  2291. @item feedback
  2292. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2293. effect of left signal in right output and vice versa which gives widening
  2294. effect. Default is 0.3.
  2295. @item crossfeed
  2296. Cross feed of left into right with inverted phase. This helps in suppressing
  2297. the mono. If the value is 1 it will cancel all the signal common to both
  2298. channels. Default is 0.3.
  2299. @item drymix
  2300. Set level of input signal of original channel. Default is 0.8.
  2301. @end table
  2302. @section treble
  2303. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2304. shelving filter with a response similar to that of a standard
  2305. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2306. The filter accepts the following options:
  2307. @table @option
  2308. @item gain, g
  2309. Give the gain at whichever is the lower of ~22 kHz and the
  2310. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2311. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2312. @item frequency, f
  2313. Set the filter's central frequency and so can be used
  2314. to extend or reduce the frequency range to be boosted or cut.
  2315. The default value is @code{3000} Hz.
  2316. @item width_type
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @end table
  2328. @item width, w
  2329. Determine how steep is the filter's shelf transition.
  2330. @end table
  2331. @section tremolo
  2332. Sinusoidal amplitude modulation.
  2333. The filter accepts the following options:
  2334. @table @option
  2335. @item f
  2336. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2337. (20 Hz or lower) will result in a tremolo effect.
  2338. This filter may also be used as a ring modulator by specifying
  2339. a modulation frequency higher than 20 Hz.
  2340. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2341. @item d
  2342. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2343. Default value is 0.5.
  2344. @end table
  2345. @section vibrato
  2346. Sinusoidal phase modulation.
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item f
  2350. Modulation frequency in Hertz.
  2351. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2352. @item d
  2353. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2354. Default value is 0.5.
  2355. @end table
  2356. @section volume
  2357. Adjust the input audio volume.
  2358. It accepts the following parameters:
  2359. @table @option
  2360. @item volume
  2361. Set audio volume expression.
  2362. Output values are clipped to the maximum value.
  2363. The output audio volume is given by the relation:
  2364. @example
  2365. @var{output_volume} = @var{volume} * @var{input_volume}
  2366. @end example
  2367. The default value for @var{volume} is "1.0".
  2368. @item precision
  2369. This parameter represents the mathematical precision.
  2370. It determines which input sample formats will be allowed, which affects the
  2371. precision of the volume scaling.
  2372. @table @option
  2373. @item fixed
  2374. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2375. @item float
  2376. 32-bit floating-point; this limits input sample format to FLT. (default)
  2377. @item double
  2378. 64-bit floating-point; this limits input sample format to DBL.
  2379. @end table
  2380. @item replaygain
  2381. Choose the behaviour on encountering ReplayGain side data in input frames.
  2382. @table @option
  2383. @item drop
  2384. Remove ReplayGain side data, ignoring its contents (the default).
  2385. @item ignore
  2386. Ignore ReplayGain side data, but leave it in the frame.
  2387. @item track
  2388. Prefer the track gain, if present.
  2389. @item album
  2390. Prefer the album gain, if present.
  2391. @end table
  2392. @item replaygain_preamp
  2393. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2394. Default value for @var{replaygain_preamp} is 0.0.
  2395. @item eval
  2396. Set when the volume expression is evaluated.
  2397. It accepts the following values:
  2398. @table @samp
  2399. @item once
  2400. only evaluate expression once during the filter initialization, or
  2401. when the @samp{volume} command is sent
  2402. @item frame
  2403. evaluate expression for each incoming frame
  2404. @end table
  2405. Default value is @samp{once}.
  2406. @end table
  2407. The volume expression can contain the following parameters.
  2408. @table @option
  2409. @item n
  2410. frame number (starting at zero)
  2411. @item nb_channels
  2412. number of channels
  2413. @item nb_consumed_samples
  2414. number of samples consumed by the filter
  2415. @item nb_samples
  2416. number of samples in the current frame
  2417. @item pos
  2418. original frame position in the file
  2419. @item pts
  2420. frame PTS
  2421. @item sample_rate
  2422. sample rate
  2423. @item startpts
  2424. PTS at start of stream
  2425. @item startt
  2426. time at start of stream
  2427. @item t
  2428. frame time
  2429. @item tb
  2430. timestamp timebase
  2431. @item volume
  2432. last set volume value
  2433. @end table
  2434. Note that when @option{eval} is set to @samp{once} only the
  2435. @var{sample_rate} and @var{tb} variables are available, all other
  2436. variables will evaluate to NAN.
  2437. @subsection Commands
  2438. This filter supports the following commands:
  2439. @table @option
  2440. @item volume
  2441. Modify the volume expression.
  2442. The command accepts the same syntax of the corresponding option.
  2443. If the specified expression is not valid, it is kept at its current
  2444. value.
  2445. @item replaygain_noclip
  2446. Prevent clipping by limiting the gain applied.
  2447. Default value for @var{replaygain_noclip} is 1.
  2448. @end table
  2449. @subsection Examples
  2450. @itemize
  2451. @item
  2452. Halve the input audio volume:
  2453. @example
  2454. volume=volume=0.5
  2455. volume=volume=1/2
  2456. volume=volume=-6.0206dB
  2457. @end example
  2458. In all the above example the named key for @option{volume} can be
  2459. omitted, for example like in:
  2460. @example
  2461. volume=0.5
  2462. @end example
  2463. @item
  2464. Increase input audio power by 6 decibels using fixed-point precision:
  2465. @example
  2466. volume=volume=6dB:precision=fixed
  2467. @end example
  2468. @item
  2469. Fade volume after time 10 with an annihilation period of 5 seconds:
  2470. @example
  2471. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2472. @end example
  2473. @end itemize
  2474. @section volumedetect
  2475. Detect the volume of the input video.
  2476. The filter has no parameters. The input is not modified. Statistics about
  2477. the volume will be printed in the log when the input stream end is reached.
  2478. In particular it will show the mean volume (root mean square), maximum
  2479. volume (on a per-sample basis), and the beginning of a histogram of the
  2480. registered volume values (from the maximum value to a cumulated 1/1000 of
  2481. the samples).
  2482. All volumes are in decibels relative to the maximum PCM value.
  2483. @subsection Examples
  2484. Here is an excerpt of the output:
  2485. @example
  2486. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2487. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2488. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2489. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2490. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2491. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2492. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2493. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2494. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2495. @end example
  2496. It means that:
  2497. @itemize
  2498. @item
  2499. The mean square energy is approximately -27 dB, or 10^-2.7.
  2500. @item
  2501. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2502. @item
  2503. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2504. @end itemize
  2505. In other words, raising the volume by +4 dB does not cause any clipping,
  2506. raising it by +5 dB causes clipping for 6 samples, etc.
  2507. @c man end AUDIO FILTERS
  2508. @chapter Audio Sources
  2509. @c man begin AUDIO SOURCES
  2510. Below is a description of the currently available audio sources.
  2511. @section abuffer
  2512. Buffer audio frames, and make them available to the filter chain.
  2513. This source is mainly intended for a programmatic use, in particular
  2514. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2515. It accepts the following parameters:
  2516. @table @option
  2517. @item time_base
  2518. The timebase which will be used for timestamps of submitted frames. It must be
  2519. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2520. @item sample_rate
  2521. The sample rate of the incoming audio buffers.
  2522. @item sample_fmt
  2523. The sample format of the incoming audio buffers.
  2524. Either a sample format name or its corresponding integer representation from
  2525. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2526. @item channel_layout
  2527. The channel layout of the incoming audio buffers.
  2528. Either a channel layout name from channel_layout_map in
  2529. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2530. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2531. @item channels
  2532. The number of channels of the incoming audio buffers.
  2533. If both @var{channels} and @var{channel_layout} are specified, then they
  2534. must be consistent.
  2535. @end table
  2536. @subsection Examples
  2537. @example
  2538. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2539. @end example
  2540. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2541. Since the sample format with name "s16p" corresponds to the number
  2542. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2543. equivalent to:
  2544. @example
  2545. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2546. @end example
  2547. @section aevalsrc
  2548. Generate an audio signal specified by an expression.
  2549. This source accepts in input one or more expressions (one for each
  2550. channel), which are evaluated and used to generate a corresponding
  2551. audio signal.
  2552. This source accepts the following options:
  2553. @table @option
  2554. @item exprs
  2555. Set the '|'-separated expressions list for each separate channel. In case the
  2556. @option{channel_layout} option is not specified, the selected channel layout
  2557. depends on the number of provided expressions. Otherwise the last
  2558. specified expression is applied to the remaining output channels.
  2559. @item channel_layout, c
  2560. Set the channel layout. The number of channels in the specified layout
  2561. must be equal to the number of specified expressions.
  2562. @item duration, d
  2563. Set the minimum duration of the sourced audio. See
  2564. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2565. for the accepted syntax.
  2566. Note that the resulting duration may be greater than the specified
  2567. duration, as the generated audio is always cut at the end of a
  2568. complete frame.
  2569. If not specified, or the expressed duration is negative, the audio is
  2570. supposed to be generated forever.
  2571. @item nb_samples, n
  2572. Set the number of samples per channel per each output frame,
  2573. default to 1024.
  2574. @item sample_rate, s
  2575. Specify the sample rate, default to 44100.
  2576. @end table
  2577. Each expression in @var{exprs} can contain the following constants:
  2578. @table @option
  2579. @item n
  2580. number of the evaluated sample, starting from 0
  2581. @item t
  2582. time of the evaluated sample expressed in seconds, starting from 0
  2583. @item s
  2584. sample rate
  2585. @end table
  2586. @subsection Examples
  2587. @itemize
  2588. @item
  2589. Generate silence:
  2590. @example
  2591. aevalsrc=0
  2592. @end example
  2593. @item
  2594. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2595. 8000 Hz:
  2596. @example
  2597. aevalsrc="sin(440*2*PI*t):s=8000"
  2598. @end example
  2599. @item
  2600. Generate a two channels signal, specify the channel layout (Front
  2601. Center + Back Center) explicitly:
  2602. @example
  2603. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2604. @end example
  2605. @item
  2606. Generate white noise:
  2607. @example
  2608. aevalsrc="-2+random(0)"
  2609. @end example
  2610. @item
  2611. Generate an amplitude modulated signal:
  2612. @example
  2613. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2614. @end example
  2615. @item
  2616. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2617. @example
  2618. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2619. @end example
  2620. @end itemize
  2621. @section anullsrc
  2622. The null audio source, return unprocessed audio frames. It is mainly useful
  2623. as a template and to be employed in analysis / debugging tools, or as
  2624. the source for filters which ignore the input data (for example the sox
  2625. synth filter).
  2626. This source accepts the following options:
  2627. @table @option
  2628. @item channel_layout, cl
  2629. Specifies the channel layout, and can be either an integer or a string
  2630. representing a channel layout. The default value of @var{channel_layout}
  2631. is "stereo".
  2632. Check the channel_layout_map definition in
  2633. @file{libavutil/channel_layout.c} for the mapping between strings and
  2634. channel layout values.
  2635. @item sample_rate, r
  2636. Specifies the sample rate, and defaults to 44100.
  2637. @item nb_samples, n
  2638. Set the number of samples per requested frames.
  2639. @end table
  2640. @subsection Examples
  2641. @itemize
  2642. @item
  2643. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2644. @example
  2645. anullsrc=r=48000:cl=4
  2646. @end example
  2647. @item
  2648. Do the same operation with a more obvious syntax:
  2649. @example
  2650. anullsrc=r=48000:cl=mono
  2651. @end example
  2652. @end itemize
  2653. All the parameters need to be explicitly defined.
  2654. @section flite
  2655. Synthesize a voice utterance using the libflite library.
  2656. To enable compilation of this filter you need to configure FFmpeg with
  2657. @code{--enable-libflite}.
  2658. Note that the flite library is not thread-safe.
  2659. The filter accepts the following options:
  2660. @table @option
  2661. @item list_voices
  2662. If set to 1, list the names of the available voices and exit
  2663. immediately. Default value is 0.
  2664. @item nb_samples, n
  2665. Set the maximum number of samples per frame. Default value is 512.
  2666. @item textfile
  2667. Set the filename containing the text to speak.
  2668. @item text
  2669. Set the text to speak.
  2670. @item voice, v
  2671. Set the voice to use for the speech synthesis. Default value is
  2672. @code{kal}. See also the @var{list_voices} option.
  2673. @end table
  2674. @subsection Examples
  2675. @itemize
  2676. @item
  2677. Read from file @file{speech.txt}, and synthesize the text using the
  2678. standard flite voice:
  2679. @example
  2680. flite=textfile=speech.txt
  2681. @end example
  2682. @item
  2683. Read the specified text selecting the @code{slt} voice:
  2684. @example
  2685. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2686. @end example
  2687. @item
  2688. Input text to ffmpeg:
  2689. @example
  2690. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2691. @end example
  2692. @item
  2693. Make @file{ffplay} speak the specified text, using @code{flite} and
  2694. the @code{lavfi} device:
  2695. @example
  2696. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2697. @end example
  2698. @end itemize
  2699. For more information about libflite, check:
  2700. @url{http://www.speech.cs.cmu.edu/flite/}
  2701. @section anoisesrc
  2702. Generate a noise audio signal.
  2703. The filter accepts the following options:
  2704. @table @option
  2705. @item sample_rate, r
  2706. Specify the sample rate. Default value is 48000 Hz.
  2707. @item amplitude, a
  2708. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2709. is 1.0.
  2710. @item duration, d
  2711. Specify the duration of the generated audio stream. Not specifying this option
  2712. results in noise with an infinite length.
  2713. @item color, colour, c
  2714. Specify the color of noise. Available noise colors are white, pink, and brown.
  2715. Default color is white.
  2716. @item seed, s
  2717. Specify a value used to seed the PRNG.
  2718. @item nb_samples, n
  2719. Set the number of samples per each output frame, default is 1024.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2725. @example
  2726. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2727. @end example
  2728. @end itemize
  2729. @section sine
  2730. Generate an audio signal made of a sine wave with amplitude 1/8.
  2731. The audio signal is bit-exact.
  2732. The filter accepts the following options:
  2733. @table @option
  2734. @item frequency, f
  2735. Set the carrier frequency. Default is 440 Hz.
  2736. @item beep_factor, b
  2737. Enable a periodic beep every second with frequency @var{beep_factor} times
  2738. the carrier frequency. Default is 0, meaning the beep is disabled.
  2739. @item sample_rate, r
  2740. Specify the sample rate, default is 44100.
  2741. @item duration, d
  2742. Specify the duration of the generated audio stream.
  2743. @item samples_per_frame
  2744. Set the number of samples per output frame.
  2745. The expression can contain the following constants:
  2746. @table @option
  2747. @item n
  2748. The (sequential) number of the output audio frame, starting from 0.
  2749. @item pts
  2750. The PTS (Presentation TimeStamp) of the output audio frame,
  2751. expressed in @var{TB} units.
  2752. @item t
  2753. The PTS of the output audio frame, expressed in seconds.
  2754. @item TB
  2755. The timebase of the output audio frames.
  2756. @end table
  2757. Default is @code{1024}.
  2758. @end table
  2759. @subsection Examples
  2760. @itemize
  2761. @item
  2762. Generate a simple 440 Hz sine wave:
  2763. @example
  2764. sine
  2765. @end example
  2766. @item
  2767. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2768. @example
  2769. sine=220:4:d=5
  2770. sine=f=220:b=4:d=5
  2771. sine=frequency=220:beep_factor=4:duration=5
  2772. @end example
  2773. @item
  2774. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2775. pattern:
  2776. @example
  2777. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2778. @end example
  2779. @end itemize
  2780. @c man end AUDIO SOURCES
  2781. @chapter Audio Sinks
  2782. @c man begin AUDIO SINKS
  2783. Below is a description of the currently available audio sinks.
  2784. @section abuffersink
  2785. Buffer audio frames, and make them available to the end of filter chain.
  2786. This sink is mainly intended for programmatic use, in particular
  2787. through the interface defined in @file{libavfilter/buffersink.h}
  2788. or the options system.
  2789. It accepts a pointer to an AVABufferSinkContext structure, which
  2790. defines the incoming buffers' formats, to be passed as the opaque
  2791. parameter to @code{avfilter_init_filter} for initialization.
  2792. @section anullsink
  2793. Null audio sink; do absolutely nothing with the input audio. It is
  2794. mainly useful as a template and for use in analysis / debugging
  2795. tools.
  2796. @c man end AUDIO SINKS
  2797. @chapter Video Filters
  2798. @c man begin VIDEO FILTERS
  2799. When you configure your FFmpeg build, you can disable any of the
  2800. existing filters using @code{--disable-filters}.
  2801. The configure output will show the video filters included in your
  2802. build.
  2803. Below is a description of the currently available video filters.
  2804. @section alphaextract
  2805. Extract the alpha component from the input as a grayscale video. This
  2806. is especially useful with the @var{alphamerge} filter.
  2807. @section alphamerge
  2808. Add or replace the alpha component of the primary input with the
  2809. grayscale value of a second input. This is intended for use with
  2810. @var{alphaextract} to allow the transmission or storage of frame
  2811. sequences that have alpha in a format that doesn't support an alpha
  2812. channel.
  2813. For example, to reconstruct full frames from a normal YUV-encoded video
  2814. and a separate video created with @var{alphaextract}, you might use:
  2815. @example
  2816. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2817. @end example
  2818. Since this filter is designed for reconstruction, it operates on frame
  2819. sequences without considering timestamps, and terminates when either
  2820. input reaches end of stream. This will cause problems if your encoding
  2821. pipeline drops frames. If you're trying to apply an image as an
  2822. overlay to a video stream, consider the @var{overlay} filter instead.
  2823. @section ass
  2824. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2825. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2826. Substation Alpha) subtitles files.
  2827. This filter accepts the following option in addition to the common options from
  2828. the @ref{subtitles} filter:
  2829. @table @option
  2830. @item shaping
  2831. Set the shaping engine
  2832. Available values are:
  2833. @table @samp
  2834. @item auto
  2835. The default libass shaping engine, which is the best available.
  2836. @item simple
  2837. Fast, font-agnostic shaper that can do only substitutions
  2838. @item complex
  2839. Slower shaper using OpenType for substitutions and positioning
  2840. @end table
  2841. The default is @code{auto}.
  2842. @end table
  2843. @section atadenoise
  2844. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2845. The filter accepts the following options:
  2846. @table @option
  2847. @item 0a
  2848. Set threshold A for 1st plane. Default is 0.02.
  2849. Valid range is 0 to 0.3.
  2850. @item 0b
  2851. Set threshold B for 1st plane. Default is 0.04.
  2852. Valid range is 0 to 5.
  2853. @item 1a
  2854. Set threshold A for 2nd plane. Default is 0.02.
  2855. Valid range is 0 to 0.3.
  2856. @item 1b
  2857. Set threshold B for 2nd plane. Default is 0.04.
  2858. Valid range is 0 to 5.
  2859. @item 2a
  2860. Set threshold A for 3rd plane. Default is 0.02.
  2861. Valid range is 0 to 0.3.
  2862. @item 2b
  2863. Set threshold B for 3rd plane. Default is 0.04.
  2864. Valid range is 0 to 5.
  2865. Threshold A is designed to react on abrupt changes in the input signal and
  2866. threshold B is designed to react on continuous changes in the input signal.
  2867. @item s
  2868. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2869. number in range [5, 129].
  2870. @end table
  2871. @section bbox
  2872. Compute the bounding box for the non-black pixels in the input frame
  2873. luminance plane.
  2874. This filter computes the bounding box containing all the pixels with a
  2875. luminance value greater than the minimum allowed value.
  2876. The parameters describing the bounding box are printed on the filter
  2877. log.
  2878. The filter accepts the following option:
  2879. @table @option
  2880. @item min_val
  2881. Set the minimal luminance value. Default is @code{16}.
  2882. @end table
  2883. @section blackdetect
  2884. Detect video intervals that are (almost) completely black. Can be
  2885. useful to detect chapter transitions, commercials, or invalid
  2886. recordings. Output lines contains the time for the start, end and
  2887. duration of the detected black interval expressed in seconds.
  2888. In order to display the output lines, you need to set the loglevel at
  2889. least to the AV_LOG_INFO value.
  2890. The filter accepts the following options:
  2891. @table @option
  2892. @item black_min_duration, d
  2893. Set the minimum detected black duration expressed in seconds. It must
  2894. be a non-negative floating point number.
  2895. Default value is 2.0.
  2896. @item picture_black_ratio_th, pic_th
  2897. Set the threshold for considering a picture "black".
  2898. Express the minimum value for the ratio:
  2899. @example
  2900. @var{nb_black_pixels} / @var{nb_pixels}
  2901. @end example
  2902. for which a picture is considered black.
  2903. Default value is 0.98.
  2904. @item pixel_black_th, pix_th
  2905. Set the threshold for considering a pixel "black".
  2906. The threshold expresses the maximum pixel luminance value for which a
  2907. pixel is considered "black". The provided value is scaled according to
  2908. the following equation:
  2909. @example
  2910. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2911. @end example
  2912. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2913. the input video format, the range is [0-255] for YUV full-range
  2914. formats and [16-235] for YUV non full-range formats.
  2915. Default value is 0.10.
  2916. @end table
  2917. The following example sets the maximum pixel threshold to the minimum
  2918. value, and detects only black intervals of 2 or more seconds:
  2919. @example
  2920. blackdetect=d=2:pix_th=0.00
  2921. @end example
  2922. @section blackframe
  2923. Detect frames that are (almost) completely black. Can be useful to
  2924. detect chapter transitions or commercials. Output lines consist of
  2925. the frame number of the detected frame, the percentage of blackness,
  2926. the position in the file if known or -1 and the timestamp in seconds.
  2927. In order to display the output lines, you need to set the loglevel at
  2928. least to the AV_LOG_INFO value.
  2929. It accepts the following parameters:
  2930. @table @option
  2931. @item amount
  2932. The percentage of the pixels that have to be below the threshold; it defaults to
  2933. @code{98}.
  2934. @item threshold, thresh
  2935. The threshold below which a pixel value is considered black; it defaults to
  2936. @code{32}.
  2937. @end table
  2938. @section blend, tblend
  2939. Blend two video frames into each other.
  2940. The @code{blend} filter takes two input streams and outputs one
  2941. stream, the first input is the "top" layer and second input is
  2942. "bottom" layer. Output terminates when shortest input terminates.
  2943. The @code{tblend} (time blend) filter takes two consecutive frames
  2944. from one single stream, and outputs the result obtained by blending
  2945. the new frame on top of the old frame.
  2946. A description of the accepted options follows.
  2947. @table @option
  2948. @item c0_mode
  2949. @item c1_mode
  2950. @item c2_mode
  2951. @item c3_mode
  2952. @item all_mode
  2953. Set blend mode for specific pixel component or all pixel components in case
  2954. of @var{all_mode}. Default value is @code{normal}.
  2955. Available values for component modes are:
  2956. @table @samp
  2957. @item addition
  2958. @item addition128
  2959. @item and
  2960. @item average
  2961. @item burn
  2962. @item darken
  2963. @item difference
  2964. @item difference128
  2965. @item divide
  2966. @item dodge
  2967. @item exclusion
  2968. @item glow
  2969. @item hardlight
  2970. @item hardmix
  2971. @item lighten
  2972. @item linearlight
  2973. @item multiply
  2974. @item negation
  2975. @item normal
  2976. @item or
  2977. @item overlay
  2978. @item phoenix
  2979. @item pinlight
  2980. @item reflect
  2981. @item screen
  2982. @item softlight
  2983. @item subtract
  2984. @item vividlight
  2985. @item xor
  2986. @end table
  2987. @item c0_opacity
  2988. @item c1_opacity
  2989. @item c2_opacity
  2990. @item c3_opacity
  2991. @item all_opacity
  2992. Set blend opacity for specific pixel component or all pixel components in case
  2993. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2994. @item c0_expr
  2995. @item c1_expr
  2996. @item c2_expr
  2997. @item c3_expr
  2998. @item all_expr
  2999. Set blend expression for specific pixel component or all pixel components in case
  3000. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3001. The expressions can use the following variables:
  3002. @table @option
  3003. @item N
  3004. The sequential number of the filtered frame, starting from @code{0}.
  3005. @item X
  3006. @item Y
  3007. the coordinates of the current sample
  3008. @item W
  3009. @item H
  3010. the width and height of currently filtered plane
  3011. @item SW
  3012. @item SH
  3013. Width and height scale depending on the currently filtered plane. It is the
  3014. ratio between the corresponding luma plane number of pixels and the current
  3015. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3016. @code{0.5,0.5} for chroma planes.
  3017. @item T
  3018. Time of the current frame, expressed in seconds.
  3019. @item TOP, A
  3020. Value of pixel component at current location for first video frame (top layer).
  3021. @item BOTTOM, B
  3022. Value of pixel component at current location for second video frame (bottom layer).
  3023. @end table
  3024. @item shortest
  3025. Force termination when the shortest input terminates. Default is
  3026. @code{0}. This option is only defined for the @code{blend} filter.
  3027. @item repeatlast
  3028. Continue applying the last bottom frame after the end of the stream. A value of
  3029. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3030. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3031. @end table
  3032. @subsection Examples
  3033. @itemize
  3034. @item
  3035. Apply transition from bottom layer to top layer in first 10 seconds:
  3036. @example
  3037. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3038. @end example
  3039. @item
  3040. Apply 1x1 checkerboard effect:
  3041. @example
  3042. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3043. @end example
  3044. @item
  3045. Apply uncover left effect:
  3046. @example
  3047. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3048. @end example
  3049. @item
  3050. Apply uncover down effect:
  3051. @example
  3052. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3053. @end example
  3054. @item
  3055. Apply uncover up-left effect:
  3056. @example
  3057. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3058. @end example
  3059. @item
  3060. Display differences between the current and the previous frame:
  3061. @example
  3062. tblend=all_mode=difference128
  3063. @end example
  3064. @end itemize
  3065. @section boxblur
  3066. Apply a boxblur algorithm to the input video.
  3067. It accepts the following parameters:
  3068. @table @option
  3069. @item luma_radius, lr
  3070. @item luma_power, lp
  3071. @item chroma_radius, cr
  3072. @item chroma_power, cp
  3073. @item alpha_radius, ar
  3074. @item alpha_power, ap
  3075. @end table
  3076. A description of the accepted options follows.
  3077. @table @option
  3078. @item luma_radius, lr
  3079. @item chroma_radius, cr
  3080. @item alpha_radius, ar
  3081. Set an expression for the box radius in pixels used for blurring the
  3082. corresponding input plane.
  3083. The radius value must be a non-negative number, and must not be
  3084. greater than the value of the expression @code{min(w,h)/2} for the
  3085. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3086. planes.
  3087. Default value for @option{luma_radius} is "2". If not specified,
  3088. @option{chroma_radius} and @option{alpha_radius} default to the
  3089. corresponding value set for @option{luma_radius}.
  3090. The expressions can contain the following constants:
  3091. @table @option
  3092. @item w
  3093. @item h
  3094. The input width and height in pixels.
  3095. @item cw
  3096. @item ch
  3097. The input chroma image width and height in pixels.
  3098. @item hsub
  3099. @item vsub
  3100. The horizontal and vertical chroma subsample values. For example, for the
  3101. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3102. @end table
  3103. @item luma_power, lp
  3104. @item chroma_power, cp
  3105. @item alpha_power, ap
  3106. Specify how many times the boxblur filter is applied to the
  3107. corresponding plane.
  3108. Default value for @option{luma_power} is 2. If not specified,
  3109. @option{chroma_power} and @option{alpha_power} default to the
  3110. corresponding value set for @option{luma_power}.
  3111. A value of 0 will disable the effect.
  3112. @end table
  3113. @subsection Examples
  3114. @itemize
  3115. @item
  3116. Apply a boxblur filter with the luma, chroma, and alpha radii
  3117. set to 2:
  3118. @example
  3119. boxblur=luma_radius=2:luma_power=1
  3120. boxblur=2:1
  3121. @end example
  3122. @item
  3123. Set the luma radius to 2, and alpha and chroma radius to 0:
  3124. @example
  3125. boxblur=2:1:cr=0:ar=0
  3126. @end example
  3127. @item
  3128. Set the luma and chroma radii to a fraction of the video dimension:
  3129. @example
  3130. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3131. @end example
  3132. @end itemize
  3133. @section chromakey
  3134. YUV colorspace color/chroma keying.
  3135. The filter accepts the following options:
  3136. @table @option
  3137. @item color
  3138. The color which will be replaced with transparency.
  3139. @item similarity
  3140. Similarity percentage with the key color.
  3141. 0.01 matches only the exact key color, while 1.0 matches everything.
  3142. @item blend
  3143. Blend percentage.
  3144. 0.0 makes pixels either fully transparent, or not transparent at all.
  3145. Higher values result in semi-transparent pixels, with a higher transparency
  3146. the more similar the pixels color is to the key color.
  3147. @item yuv
  3148. Signals that the color passed is already in YUV instead of RGB.
  3149. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3150. This can be used to pass exact YUV values as hexadecimal numbers.
  3151. @end table
  3152. @subsection Examples
  3153. @itemize
  3154. @item
  3155. Make every green pixel in the input image transparent:
  3156. @example
  3157. ffmpeg -i input.png -vf chromakey=green out.png
  3158. @end example
  3159. @item
  3160. Overlay a greenscreen-video on top of a static black background.
  3161. @example
  3162. 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
  3163. @end example
  3164. @end itemize
  3165. @section codecview
  3166. Visualize information exported by some codecs.
  3167. Some codecs can export information through frames using side-data or other
  3168. means. For example, some MPEG based codecs export motion vectors through the
  3169. @var{export_mvs} flag in the codec @option{flags2} option.
  3170. The filter accepts the following option:
  3171. @table @option
  3172. @item mv
  3173. Set motion vectors to visualize.
  3174. Available flags for @var{mv} are:
  3175. @table @samp
  3176. @item pf
  3177. forward predicted MVs of P-frames
  3178. @item bf
  3179. forward predicted MVs of B-frames
  3180. @item bb
  3181. backward predicted MVs of B-frames
  3182. @end table
  3183. @item qp
  3184. Display quantization parameters using the chroma planes
  3185. @end table
  3186. @subsection Examples
  3187. @itemize
  3188. @item
  3189. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3190. @example
  3191. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3192. @end example
  3193. @end itemize
  3194. @section colorbalance
  3195. Modify intensity of primary colors (red, green and blue) of input frames.
  3196. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3197. regions for the red-cyan, green-magenta or blue-yellow balance.
  3198. A positive adjustment value shifts the balance towards the primary color, a negative
  3199. value towards the complementary color.
  3200. The filter accepts the following options:
  3201. @table @option
  3202. @item rs
  3203. @item gs
  3204. @item bs
  3205. Adjust red, green and blue shadows (darkest pixels).
  3206. @item rm
  3207. @item gm
  3208. @item bm
  3209. Adjust red, green and blue midtones (medium pixels).
  3210. @item rh
  3211. @item gh
  3212. @item bh
  3213. Adjust red, green and blue highlights (brightest pixels).
  3214. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3215. @end table
  3216. @subsection Examples
  3217. @itemize
  3218. @item
  3219. Add red color cast to shadows:
  3220. @example
  3221. colorbalance=rs=.3
  3222. @end example
  3223. @end itemize
  3224. @section colorkey
  3225. RGB colorspace color keying.
  3226. The filter accepts the following options:
  3227. @table @option
  3228. @item color
  3229. The color which will be replaced with transparency.
  3230. @item similarity
  3231. Similarity percentage with the key color.
  3232. 0.01 matches only the exact key color, while 1.0 matches everything.
  3233. @item blend
  3234. Blend percentage.
  3235. 0.0 makes pixels either fully transparent, or not transparent at all.
  3236. Higher values result in semi-transparent pixels, with a higher transparency
  3237. the more similar the pixels color is to the key color.
  3238. @end table
  3239. @subsection Examples
  3240. @itemize
  3241. @item
  3242. Make every green pixel in the input image transparent:
  3243. @example
  3244. ffmpeg -i input.png -vf colorkey=green out.png
  3245. @end example
  3246. @item
  3247. Overlay a greenscreen-video on top of a static background image.
  3248. @example
  3249. 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
  3250. @end example
  3251. @end itemize
  3252. @section colorlevels
  3253. Adjust video input frames using levels.
  3254. The filter accepts the following options:
  3255. @table @option
  3256. @item rimin
  3257. @item gimin
  3258. @item bimin
  3259. @item aimin
  3260. Adjust red, green, blue and alpha input black point.
  3261. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3262. @item rimax
  3263. @item gimax
  3264. @item bimax
  3265. @item aimax
  3266. Adjust red, green, blue and alpha input white point.
  3267. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3268. Input levels are used to lighten highlights (bright tones), darken shadows
  3269. (dark tones), change the balance of bright and dark tones.
  3270. @item romin
  3271. @item gomin
  3272. @item bomin
  3273. @item aomin
  3274. Adjust red, green, blue and alpha output black point.
  3275. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3276. @item romax
  3277. @item gomax
  3278. @item bomax
  3279. @item aomax
  3280. Adjust red, green, blue and alpha output white point.
  3281. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3282. Output levels allows manual selection of a constrained output level range.
  3283. @end table
  3284. @subsection Examples
  3285. @itemize
  3286. @item
  3287. Make video output darker:
  3288. @example
  3289. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3290. @end example
  3291. @item
  3292. Increase contrast:
  3293. @example
  3294. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3295. @end example
  3296. @item
  3297. Make video output lighter:
  3298. @example
  3299. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3300. @end example
  3301. @item
  3302. Increase brightness:
  3303. @example
  3304. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3305. @end example
  3306. @end itemize
  3307. @section colorchannelmixer
  3308. Adjust video input frames by re-mixing color channels.
  3309. This filter modifies a color channel by adding the values associated to
  3310. the other channels of the same pixels. For example if the value to
  3311. modify is red, the output value will be:
  3312. @example
  3313. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3314. @end example
  3315. The filter accepts the following options:
  3316. @table @option
  3317. @item rr
  3318. @item rg
  3319. @item rb
  3320. @item ra
  3321. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3322. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3323. @item gr
  3324. @item gg
  3325. @item gb
  3326. @item ga
  3327. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3328. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3329. @item br
  3330. @item bg
  3331. @item bb
  3332. @item ba
  3333. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3334. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3335. @item ar
  3336. @item ag
  3337. @item ab
  3338. @item aa
  3339. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3340. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3341. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3342. @end table
  3343. @subsection Examples
  3344. @itemize
  3345. @item
  3346. Convert source to grayscale:
  3347. @example
  3348. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3349. @end example
  3350. @item
  3351. Simulate sepia tones:
  3352. @example
  3353. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3354. @end example
  3355. @end itemize
  3356. @section colormatrix
  3357. Convert color matrix.
  3358. The filter accepts the following options:
  3359. @table @option
  3360. @item src
  3361. @item dst
  3362. Specify the source and destination color matrix. Both values must be
  3363. specified.
  3364. The accepted values are:
  3365. @table @samp
  3366. @item bt709
  3367. BT.709
  3368. @item bt601
  3369. BT.601
  3370. @item smpte240m
  3371. SMPTE-240M
  3372. @item fcc
  3373. FCC
  3374. @end table
  3375. @end table
  3376. For example to convert from BT.601 to SMPTE-240M, use the command:
  3377. @example
  3378. colormatrix=bt601:smpte240m
  3379. @end example
  3380. @section copy
  3381. Copy the input source unchanged to the output. This is mainly useful for
  3382. testing purposes.
  3383. @section crop
  3384. Crop the input video to given dimensions.
  3385. It accepts the following parameters:
  3386. @table @option
  3387. @item w, out_w
  3388. The width of the output video. It defaults to @code{iw}.
  3389. This expression is evaluated only once during the filter
  3390. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3391. @item h, out_h
  3392. The height of the output video. It defaults to @code{ih}.
  3393. This expression is evaluated only once during the filter
  3394. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3395. @item x
  3396. The horizontal position, in the input video, of the left edge of the output
  3397. video. It defaults to @code{(in_w-out_w)/2}.
  3398. This expression is evaluated per-frame.
  3399. @item y
  3400. The vertical position, in the input video, of the top edge of the output video.
  3401. It defaults to @code{(in_h-out_h)/2}.
  3402. This expression is evaluated per-frame.
  3403. @item keep_aspect
  3404. If set to 1 will force the output display aspect ratio
  3405. to be the same of the input, by changing the output sample aspect
  3406. ratio. It defaults to 0.
  3407. @end table
  3408. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3409. expressions containing the following constants:
  3410. @table @option
  3411. @item x
  3412. @item y
  3413. The computed values for @var{x} and @var{y}. They are evaluated for
  3414. each new frame.
  3415. @item in_w
  3416. @item in_h
  3417. The input width and height.
  3418. @item iw
  3419. @item ih
  3420. These are the same as @var{in_w} and @var{in_h}.
  3421. @item out_w
  3422. @item out_h
  3423. The output (cropped) width and height.
  3424. @item ow
  3425. @item oh
  3426. These are the same as @var{out_w} and @var{out_h}.
  3427. @item a
  3428. same as @var{iw} / @var{ih}
  3429. @item sar
  3430. input sample aspect ratio
  3431. @item dar
  3432. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3433. @item hsub
  3434. @item vsub
  3435. horizontal and vertical chroma subsample values. For example for the
  3436. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3437. @item n
  3438. The number of the input frame, starting from 0.
  3439. @item pos
  3440. the position in the file of the input frame, NAN if unknown
  3441. @item t
  3442. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3443. @end table
  3444. The expression for @var{out_w} may depend on the value of @var{out_h},
  3445. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3446. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3447. evaluated after @var{out_w} and @var{out_h}.
  3448. The @var{x} and @var{y} parameters specify the expressions for the
  3449. position of the top-left corner of the output (non-cropped) area. They
  3450. are evaluated for each frame. If the evaluated value is not valid, it
  3451. is approximated to the nearest valid value.
  3452. The expression for @var{x} may depend on @var{y}, and the expression
  3453. for @var{y} may depend on @var{x}.
  3454. @subsection Examples
  3455. @itemize
  3456. @item
  3457. Crop area with size 100x100 at position (12,34).
  3458. @example
  3459. crop=100:100:12:34
  3460. @end example
  3461. Using named options, the example above becomes:
  3462. @example
  3463. crop=w=100:h=100:x=12:y=34
  3464. @end example
  3465. @item
  3466. Crop the central input area with size 100x100:
  3467. @example
  3468. crop=100:100
  3469. @end example
  3470. @item
  3471. Crop the central input area with size 2/3 of the input video:
  3472. @example
  3473. crop=2/3*in_w:2/3*in_h
  3474. @end example
  3475. @item
  3476. Crop the input video central square:
  3477. @example
  3478. crop=out_w=in_h
  3479. crop=in_h
  3480. @end example
  3481. @item
  3482. Delimit the rectangle with the top-left corner placed at position
  3483. 100:100 and the right-bottom corner corresponding to the right-bottom
  3484. corner of the input image.
  3485. @example
  3486. crop=in_w-100:in_h-100:100:100
  3487. @end example
  3488. @item
  3489. Crop 10 pixels from the left and right borders, and 20 pixels from
  3490. the top and bottom borders
  3491. @example
  3492. crop=in_w-2*10:in_h-2*20
  3493. @end example
  3494. @item
  3495. Keep only the bottom right quarter of the input image:
  3496. @example
  3497. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3498. @end example
  3499. @item
  3500. Crop height for getting Greek harmony:
  3501. @example
  3502. crop=in_w:1/PHI*in_w
  3503. @end example
  3504. @item
  3505. Apply trembling effect:
  3506. @example
  3507. 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)
  3508. @end example
  3509. @item
  3510. Apply erratic camera effect depending on timestamp:
  3511. @example
  3512. 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)"
  3513. @end example
  3514. @item
  3515. Set x depending on the value of y:
  3516. @example
  3517. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3518. @end example
  3519. @end itemize
  3520. @subsection Commands
  3521. This filter supports the following commands:
  3522. @table @option
  3523. @item w, out_w
  3524. @item h, out_h
  3525. @item x
  3526. @item y
  3527. Set width/height of the output video and the horizontal/vertical position
  3528. in the input video.
  3529. The command accepts the same syntax of the corresponding option.
  3530. If the specified expression is not valid, it is kept at its current
  3531. value.
  3532. @end table
  3533. @section cropdetect
  3534. Auto-detect the crop size.
  3535. It calculates the necessary cropping parameters and prints the
  3536. recommended parameters via the logging system. The detected dimensions
  3537. correspond to the non-black area of the input video.
  3538. It accepts the following parameters:
  3539. @table @option
  3540. @item limit
  3541. Set higher black value threshold, which can be optionally specified
  3542. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3543. value greater to the set value is considered non-black. It defaults to 24.
  3544. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3545. on the bitdepth of the pixel format.
  3546. @item round
  3547. The value which the width/height should be divisible by. It defaults to
  3548. 16. The offset is automatically adjusted to center the video. Use 2 to
  3549. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3550. encoding to most video codecs.
  3551. @item reset_count, reset
  3552. Set the counter that determines after how many frames cropdetect will
  3553. reset the previously detected largest video area and start over to
  3554. detect the current optimal crop area. Default value is 0.
  3555. This can be useful when channel logos distort the video area. 0
  3556. indicates 'never reset', and returns the largest area encountered during
  3557. playback.
  3558. @end table
  3559. @anchor{curves}
  3560. @section curves
  3561. Apply color adjustments using curves.
  3562. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3563. component (red, green and blue) has its values defined by @var{N} key points
  3564. tied from each other using a smooth curve. The x-axis represents the pixel
  3565. values from the input frame, and the y-axis the new pixel values to be set for
  3566. the output frame.
  3567. By default, a component curve is defined by the two points @var{(0;0)} and
  3568. @var{(1;1)}. This creates a straight line where each original pixel value is
  3569. "adjusted" to its own value, which means no change to the image.
  3570. The filter allows you to redefine these two points and add some more. A new
  3571. curve (using a natural cubic spline interpolation) will be define to pass
  3572. smoothly through all these new coordinates. The new defined points needs to be
  3573. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3574. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3575. the vector spaces, the values will be clipped accordingly.
  3576. If there is no key point defined in @code{x=0}, the filter will automatically
  3577. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3578. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3579. The filter accepts the following options:
  3580. @table @option
  3581. @item preset
  3582. Select one of the available color presets. This option can be used in addition
  3583. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3584. options takes priority on the preset values.
  3585. Available presets are:
  3586. @table @samp
  3587. @item none
  3588. @item color_negative
  3589. @item cross_process
  3590. @item darker
  3591. @item increase_contrast
  3592. @item lighter
  3593. @item linear_contrast
  3594. @item medium_contrast
  3595. @item negative
  3596. @item strong_contrast
  3597. @item vintage
  3598. @end table
  3599. Default is @code{none}.
  3600. @item master, m
  3601. Set the master key points. These points will define a second pass mapping. It
  3602. is sometimes called a "luminance" or "value" mapping. It can be used with
  3603. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3604. post-processing LUT.
  3605. @item red, r
  3606. Set the key points for the red component.
  3607. @item green, g
  3608. Set the key points for the green component.
  3609. @item blue, b
  3610. Set the key points for the blue component.
  3611. @item all
  3612. Set the key points for all components (not including master).
  3613. Can be used in addition to the other key points component
  3614. options. In this case, the unset component(s) will fallback on this
  3615. @option{all} setting.
  3616. @item psfile
  3617. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3618. @end table
  3619. To avoid some filtergraph syntax conflicts, each key points list need to be
  3620. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3621. @subsection Examples
  3622. @itemize
  3623. @item
  3624. Increase slightly the middle level of blue:
  3625. @example
  3626. curves=blue='0.5/0.58'
  3627. @end example
  3628. @item
  3629. Vintage effect:
  3630. @example
  3631. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3632. @end example
  3633. Here we obtain the following coordinates for each components:
  3634. @table @var
  3635. @item red
  3636. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3637. @item green
  3638. @code{(0;0) (0.50;0.48) (1;1)}
  3639. @item blue
  3640. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3641. @end table
  3642. @item
  3643. The previous example can also be achieved with the associated built-in preset:
  3644. @example
  3645. curves=preset=vintage
  3646. @end example
  3647. @item
  3648. Or simply:
  3649. @example
  3650. curves=vintage
  3651. @end example
  3652. @item
  3653. Use a Photoshop preset and redefine the points of the green component:
  3654. @example
  3655. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3656. @end example
  3657. @end itemize
  3658. @section dctdnoiz
  3659. Denoise frames using 2D DCT (frequency domain filtering).
  3660. This filter is not designed for real time.
  3661. The filter accepts the following options:
  3662. @table @option
  3663. @item sigma, s
  3664. Set the noise sigma constant.
  3665. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3666. coefficient (absolute value) below this threshold with be dropped.
  3667. If you need a more advanced filtering, see @option{expr}.
  3668. Default is @code{0}.
  3669. @item overlap
  3670. Set number overlapping pixels for each block. Since the filter can be slow, you
  3671. may want to reduce this value, at the cost of a less effective filter and the
  3672. risk of various artefacts.
  3673. If the overlapping value doesn't permit processing the whole input width or
  3674. height, a warning will be displayed and according borders won't be denoised.
  3675. Default value is @var{blocksize}-1, which is the best possible setting.
  3676. @item expr, e
  3677. Set the coefficient factor expression.
  3678. For each coefficient of a DCT block, this expression will be evaluated as a
  3679. multiplier value for the coefficient.
  3680. If this is option is set, the @option{sigma} option will be ignored.
  3681. The absolute value of the coefficient can be accessed through the @var{c}
  3682. variable.
  3683. @item n
  3684. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3685. @var{blocksize}, which is the width and height of the processed blocks.
  3686. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3687. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3688. on the speed processing. Also, a larger block size does not necessarily means a
  3689. better de-noising.
  3690. @end table
  3691. @subsection Examples
  3692. Apply a denoise with a @option{sigma} of @code{4.5}:
  3693. @example
  3694. dctdnoiz=4.5
  3695. @end example
  3696. The same operation can be achieved using the expression system:
  3697. @example
  3698. dctdnoiz=e='gte(c, 4.5*3)'
  3699. @end example
  3700. Violent denoise using a block size of @code{16x16}:
  3701. @example
  3702. dctdnoiz=15:n=4
  3703. @end example
  3704. @section deband
  3705. Remove banding artifacts from input video.
  3706. It works by replacing banded pixels with average value of referenced pixels.
  3707. The filter accepts the following options:
  3708. @table @option
  3709. @item 1thr
  3710. @item 2thr
  3711. @item 3thr
  3712. @item 4thr
  3713. Set banding detection threshold for each plane. Default is 0.02.
  3714. Valid range is 0.00003 to 0.5.
  3715. If difference between current pixel and reference pixel is less than threshold,
  3716. it will be considered as banded.
  3717. @item range, r
  3718. Banding detection range in pixels. Default is 16. If positive, random number
  3719. in range 0 to set value will be used. If negative, exact absolute value
  3720. will be used.
  3721. The range defines square of four pixels around current pixel.
  3722. @item direction, d
  3723. Set direction in radians from which four pixel will be compared. If positive,
  3724. random direction from 0 to set direction will be picked. If negative, exact of
  3725. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3726. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3727. column.
  3728. @item blur
  3729. If enabled, current pixel is compared with average value of all four
  3730. surrounding pixels. The default is enabled. If disabled current pixel is
  3731. compared with all four surrounding pixels. The pixel is considered banded
  3732. if only all four differences with surrounding pixels are less than threshold.
  3733. @end table
  3734. @anchor{decimate}
  3735. @section decimate
  3736. Drop duplicated frames at regular intervals.
  3737. The filter accepts the following options:
  3738. @table @option
  3739. @item cycle
  3740. Set the number of frames from which one will be dropped. Setting this to
  3741. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3742. Default is @code{5}.
  3743. @item dupthresh
  3744. Set the threshold for duplicate detection. If the difference metric for a frame
  3745. is less than or equal to this value, then it is declared as duplicate. Default
  3746. is @code{1.1}
  3747. @item scthresh
  3748. Set scene change threshold. Default is @code{15}.
  3749. @item blockx
  3750. @item blocky
  3751. Set the size of the x and y-axis blocks used during metric calculations.
  3752. Larger blocks give better noise suppression, but also give worse detection of
  3753. small movements. Must be a power of two. Default is @code{32}.
  3754. @item ppsrc
  3755. Mark main input as a pre-processed input and activate clean source input
  3756. stream. This allows the input to be pre-processed with various filters to help
  3757. the metrics calculation while keeping the frame selection lossless. When set to
  3758. @code{1}, the first stream is for the pre-processed input, and the second
  3759. stream is the clean source from where the kept frames are chosen. Default is
  3760. @code{0}.
  3761. @item chroma
  3762. Set whether or not chroma is considered in the metric calculations. Default is
  3763. @code{1}.
  3764. @end table
  3765. @section deflate
  3766. Apply deflate effect to the video.
  3767. This filter replaces the pixel by the local(3x3) average by taking into account
  3768. only values lower than the pixel.
  3769. It accepts the following options:
  3770. @table @option
  3771. @item threshold0
  3772. @item threshold1
  3773. @item threshold2
  3774. @item threshold3
  3775. Limit the maximum change for each plane, default is 65535.
  3776. If 0, plane will remain unchanged.
  3777. @end table
  3778. @section dejudder
  3779. Remove judder produced by partially interlaced telecined content.
  3780. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3781. source was partially telecined content then the output of @code{pullup,dejudder}
  3782. will have a variable frame rate. May change the recorded frame rate of the
  3783. container. Aside from that change, this filter will not affect constant frame
  3784. rate video.
  3785. The option available in this filter is:
  3786. @table @option
  3787. @item cycle
  3788. Specify the length of the window over which the judder repeats.
  3789. Accepts any integer greater than 1. Useful values are:
  3790. @table @samp
  3791. @item 4
  3792. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3793. @item 5
  3794. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3795. @item 20
  3796. If a mixture of the two.
  3797. @end table
  3798. The default is @samp{4}.
  3799. @end table
  3800. @section delogo
  3801. Suppress a TV station logo by a simple interpolation of the surrounding
  3802. pixels. Just set a rectangle covering the logo and watch it disappear
  3803. (and sometimes something even uglier appear - your mileage may vary).
  3804. It accepts the following parameters:
  3805. @table @option
  3806. @item x
  3807. @item y
  3808. Specify the top left corner coordinates of the logo. They must be
  3809. specified.
  3810. @item w
  3811. @item h
  3812. Specify the width and height of the logo to clear. They must be
  3813. specified.
  3814. @item band, t
  3815. Specify the thickness of the fuzzy edge of the rectangle (added to
  3816. @var{w} and @var{h}). The default value is 1. This option is
  3817. deprecated, setting higher values should no longer be necessary and
  3818. is not recommended.
  3819. @item show
  3820. When set to 1, a green rectangle is drawn on the screen to simplify
  3821. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3822. The default value is 0.
  3823. The rectangle is drawn on the outermost pixels which will be (partly)
  3824. replaced with interpolated values. The values of the next pixels
  3825. immediately outside this rectangle in each direction will be used to
  3826. compute the interpolated pixel values inside the rectangle.
  3827. @end table
  3828. @subsection Examples
  3829. @itemize
  3830. @item
  3831. Set a rectangle covering the area with top left corner coordinates 0,0
  3832. and size 100x77, and a band of size 10:
  3833. @example
  3834. delogo=x=0:y=0:w=100:h=77:band=10
  3835. @end example
  3836. @end itemize
  3837. @section deshake
  3838. Attempt to fix small changes in horizontal and/or vertical shift. This
  3839. filter helps remove camera shake from hand-holding a camera, bumping a
  3840. tripod, moving on a vehicle, etc.
  3841. The filter accepts the following options:
  3842. @table @option
  3843. @item x
  3844. @item y
  3845. @item w
  3846. @item h
  3847. Specify a rectangular area where to limit the search for motion
  3848. vectors.
  3849. If desired the search for motion vectors can be limited to a
  3850. rectangular area of the frame defined by its top left corner, width
  3851. and height. These parameters have the same meaning as the drawbox
  3852. filter which can be used to visualise the position of the bounding
  3853. box.
  3854. This is useful when simultaneous movement of subjects within the frame
  3855. might be confused for camera motion by the motion vector search.
  3856. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3857. then the full frame is used. This allows later options to be set
  3858. without specifying the bounding box for the motion vector search.
  3859. Default - search the whole frame.
  3860. @item rx
  3861. @item ry
  3862. Specify the maximum extent of movement in x and y directions in the
  3863. range 0-64 pixels. Default 16.
  3864. @item edge
  3865. Specify how to generate pixels to fill blanks at the edge of the
  3866. frame. Available values are:
  3867. @table @samp
  3868. @item blank, 0
  3869. Fill zeroes at blank locations
  3870. @item original, 1
  3871. Original image at blank locations
  3872. @item clamp, 2
  3873. Extruded edge value at blank locations
  3874. @item mirror, 3
  3875. Mirrored edge at blank locations
  3876. @end table
  3877. Default value is @samp{mirror}.
  3878. @item blocksize
  3879. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3880. default 8.
  3881. @item contrast
  3882. Specify the contrast threshold for blocks. Only blocks with more than
  3883. the specified contrast (difference between darkest and lightest
  3884. pixels) will be considered. Range 1-255, default 125.
  3885. @item search
  3886. Specify the search strategy. Available values are:
  3887. @table @samp
  3888. @item exhaustive, 0
  3889. Set exhaustive search
  3890. @item less, 1
  3891. Set less exhaustive search.
  3892. @end table
  3893. Default value is @samp{exhaustive}.
  3894. @item filename
  3895. If set then a detailed log of the motion search is written to the
  3896. specified file.
  3897. @item opencl
  3898. If set to 1, specify using OpenCL capabilities, only available if
  3899. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3900. @end table
  3901. @section detelecine
  3902. Apply an exact inverse of the telecine operation. It requires a predefined
  3903. pattern specified using the pattern option which must be the same as that passed
  3904. to the telecine filter.
  3905. This filter accepts the following options:
  3906. @table @option
  3907. @item first_field
  3908. @table @samp
  3909. @item top, t
  3910. top field first
  3911. @item bottom, b
  3912. bottom field first
  3913. The default value is @code{top}.
  3914. @end table
  3915. @item pattern
  3916. A string of numbers representing the pulldown pattern you wish to apply.
  3917. The default value is @code{23}.
  3918. @item start_frame
  3919. A number representing position of the first frame with respect to the telecine
  3920. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3921. @end table
  3922. @section dilation
  3923. Apply dilation effect to the video.
  3924. This filter replaces the pixel by the local(3x3) maximum.
  3925. It accepts the following options:
  3926. @table @option
  3927. @item threshold0
  3928. @item threshold1
  3929. @item threshold2
  3930. @item threshold3
  3931. Limit the maximum change for each plane, default is 65535.
  3932. If 0, plane will remain unchanged.
  3933. @item coordinates
  3934. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3935. pixels are used.
  3936. Flags to local 3x3 coordinates maps like this:
  3937. 1 2 3
  3938. 4 5
  3939. 6 7 8
  3940. @end table
  3941. @section displace
  3942. Displace pixels as indicated by second and third input stream.
  3943. It takes three input streams and outputs one stream, the first input is the
  3944. source, and second and third input are displacement maps.
  3945. The second input specifies how much to displace pixels along the
  3946. x-axis, while the third input specifies how much to displace pixels
  3947. along the y-axis.
  3948. If one of displacement map streams terminates, last frame from that
  3949. displacement map will be used.
  3950. Note that once generated, displacements maps can be reused over and over again.
  3951. A description of the accepted options follows.
  3952. @table @option
  3953. @item edge
  3954. Set displace behavior for pixels that are out of range.
  3955. Available values are:
  3956. @table @samp
  3957. @item blank
  3958. Missing pixels are replaced by black pixels.
  3959. @item smear
  3960. Adjacent pixels will spread out to replace missing pixels.
  3961. @item wrap
  3962. Out of range pixels are wrapped so they point to pixels of other side.
  3963. @end table
  3964. Default is @samp{smear}.
  3965. @end table
  3966. @subsection Examples
  3967. @itemize
  3968. @item
  3969. Add ripple effect to rgb input of video size hd720:
  3970. @example
  3971. 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
  3972. @end example
  3973. @item
  3974. Add wave effect to rgb input of video size hd720:
  3975. @example
  3976. 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
  3977. @end example
  3978. @end itemize
  3979. @section drawbox
  3980. Draw a colored box on the input image.
  3981. It accepts the following parameters:
  3982. @table @option
  3983. @item x
  3984. @item y
  3985. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3986. @item width, w
  3987. @item height, h
  3988. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3989. the input width and height. It defaults to 0.
  3990. @item color, c
  3991. Specify the color of the box to write. For the general syntax of this option,
  3992. check the "Color" section in the ffmpeg-utils manual. If the special
  3993. value @code{invert} is used, the box edge color is the same as the
  3994. video with inverted luma.
  3995. @item thickness, t
  3996. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3997. See below for the list of accepted constants.
  3998. @end table
  3999. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4000. following constants:
  4001. @table @option
  4002. @item dar
  4003. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4004. @item hsub
  4005. @item vsub
  4006. horizontal and vertical chroma subsample values. For example for the
  4007. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4008. @item in_h, ih
  4009. @item in_w, iw
  4010. The input width and height.
  4011. @item sar
  4012. The input sample aspect ratio.
  4013. @item x
  4014. @item y
  4015. The x and y offset coordinates where the box is drawn.
  4016. @item w
  4017. @item h
  4018. The width and height of the drawn box.
  4019. @item t
  4020. The thickness of the drawn box.
  4021. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4022. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4023. @end table
  4024. @subsection Examples
  4025. @itemize
  4026. @item
  4027. Draw a black box around the edge of the input image:
  4028. @example
  4029. drawbox
  4030. @end example
  4031. @item
  4032. Draw a box with color red and an opacity of 50%:
  4033. @example
  4034. drawbox=10:20:200:60:red@@0.5
  4035. @end example
  4036. The previous example can be specified as:
  4037. @example
  4038. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4039. @end example
  4040. @item
  4041. Fill the box with pink color:
  4042. @example
  4043. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4044. @end example
  4045. @item
  4046. Draw a 2-pixel red 2.40:1 mask:
  4047. @example
  4048. 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
  4049. @end example
  4050. @end itemize
  4051. @section drawgraph, adrawgraph
  4052. Draw a graph using input video or audio metadata.
  4053. It accepts the following parameters:
  4054. @table @option
  4055. @item m1
  4056. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4057. @item fg1
  4058. Set 1st foreground color expression.
  4059. @item m2
  4060. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4061. @item fg2
  4062. Set 2nd foreground color expression.
  4063. @item m3
  4064. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4065. @item fg3
  4066. Set 3rd foreground color expression.
  4067. @item m4
  4068. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4069. @item fg4
  4070. Set 4th foreground color expression.
  4071. @item min
  4072. Set minimal value of metadata value.
  4073. @item max
  4074. Set maximal value of metadata value.
  4075. @item bg
  4076. Set graph background color. Default is white.
  4077. @item mode
  4078. Set graph mode.
  4079. Available values for mode is:
  4080. @table @samp
  4081. @item bar
  4082. @item dot
  4083. @item line
  4084. @end table
  4085. Default is @code{line}.
  4086. @item slide
  4087. Set slide mode.
  4088. Available values for slide is:
  4089. @table @samp
  4090. @item frame
  4091. Draw new frame when right border is reached.
  4092. @item replace
  4093. Replace old columns with new ones.
  4094. @item scroll
  4095. Scroll from right to left.
  4096. @item rscroll
  4097. Scroll from left to right.
  4098. @end table
  4099. Default is @code{frame}.
  4100. @item size
  4101. Set size of graph video. For the syntax of this option, check the
  4102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4103. The default value is @code{900x256}.
  4104. The foreground color expressions can use the following variables:
  4105. @table @option
  4106. @item MIN
  4107. Minimal value of metadata value.
  4108. @item MAX
  4109. Maximal value of metadata value.
  4110. @item VAL
  4111. Current metadata key value.
  4112. @end table
  4113. The color is defined as 0xAABBGGRR.
  4114. @end table
  4115. Example using metadata from @ref{signalstats} filter:
  4116. @example
  4117. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4118. @end example
  4119. Example using metadata from @ref{ebur128} filter:
  4120. @example
  4121. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4122. @end example
  4123. @section drawgrid
  4124. Draw a grid on the input image.
  4125. It accepts the following parameters:
  4126. @table @option
  4127. @item x
  4128. @item y
  4129. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4130. @item width, w
  4131. @item height, h
  4132. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4133. input width and height, respectively, minus @code{thickness}, so image gets
  4134. framed. Default to 0.
  4135. @item color, c
  4136. Specify the color of the grid. For the general syntax of this option,
  4137. check the "Color" section in the ffmpeg-utils manual. If the special
  4138. value @code{invert} is used, the grid color is the same as the
  4139. video with inverted luma.
  4140. @item thickness, t
  4141. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4142. See below for the list of accepted constants.
  4143. @end table
  4144. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4145. following constants:
  4146. @table @option
  4147. @item dar
  4148. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4149. @item hsub
  4150. @item vsub
  4151. horizontal and vertical chroma subsample values. For example for the
  4152. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4153. @item in_h, ih
  4154. @item in_w, iw
  4155. The input grid cell width and height.
  4156. @item sar
  4157. The input sample aspect ratio.
  4158. @item x
  4159. @item y
  4160. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4161. @item w
  4162. @item h
  4163. The width and height of the drawn cell.
  4164. @item t
  4165. The thickness of the drawn cell.
  4166. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4167. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4168. @end table
  4169. @subsection Examples
  4170. @itemize
  4171. @item
  4172. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4173. @example
  4174. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4175. @end example
  4176. @item
  4177. Draw a white 3x3 grid with an opacity of 50%:
  4178. @example
  4179. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4180. @end example
  4181. @end itemize
  4182. @anchor{drawtext}
  4183. @section drawtext
  4184. Draw a text string or text from a specified file on top of a video, using the
  4185. libfreetype library.
  4186. To enable compilation of this filter, you need to configure FFmpeg with
  4187. @code{--enable-libfreetype}.
  4188. To enable default font fallback and the @var{font} option you need to
  4189. configure FFmpeg with @code{--enable-libfontconfig}.
  4190. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4191. @code{--enable-libfribidi}.
  4192. @subsection Syntax
  4193. It accepts the following parameters:
  4194. @table @option
  4195. @item box
  4196. Used to draw a box around text using the background color.
  4197. The value must be either 1 (enable) or 0 (disable).
  4198. The default value of @var{box} is 0.
  4199. @item boxborderw
  4200. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4201. The default value of @var{boxborderw} is 0.
  4202. @item boxcolor
  4203. The color to be used for drawing box around text. For the syntax of this
  4204. option, check the "Color" section in the ffmpeg-utils manual.
  4205. The default value of @var{boxcolor} is "white".
  4206. @item borderw
  4207. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4208. The default value of @var{borderw} is 0.
  4209. @item bordercolor
  4210. Set the color to be used for drawing border around text. For the syntax of this
  4211. option, check the "Color" section in the ffmpeg-utils manual.
  4212. The default value of @var{bordercolor} is "black".
  4213. @item expansion
  4214. Select how the @var{text} is expanded. Can be either @code{none},
  4215. @code{strftime} (deprecated) or
  4216. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4217. below for details.
  4218. @item fix_bounds
  4219. If true, check and fix text coords to avoid clipping.
  4220. @item fontcolor
  4221. The color to be used for drawing fonts. For the syntax of this option, check
  4222. the "Color" section in the ffmpeg-utils manual.
  4223. The default value of @var{fontcolor} is "black".
  4224. @item fontcolor_expr
  4225. String which is expanded the same way as @var{text} to obtain dynamic
  4226. @var{fontcolor} value. By default this option has empty value and is not
  4227. processed. When this option is set, it overrides @var{fontcolor} option.
  4228. @item font
  4229. The font family to be used for drawing text. By default Sans.
  4230. @item fontfile
  4231. The font file to be used for drawing text. The path must be included.
  4232. This parameter is mandatory if the fontconfig support is disabled.
  4233. @item draw
  4234. This option does not exist, please see the timeline system
  4235. @item alpha
  4236. Draw the text applying alpha blending. The value can
  4237. be either a number between 0.0 and 1.0
  4238. The expression accepts the same variables @var{x, y} do.
  4239. The default value is 1.
  4240. Please see fontcolor_expr
  4241. @item fontsize
  4242. The font size to be used for drawing text.
  4243. The default value of @var{fontsize} is 16.
  4244. @item text_shaping
  4245. If set to 1, attempt to shape the text (for example, reverse the order of
  4246. right-to-left text and join Arabic characters) before drawing it.
  4247. Otherwise, just draw the text exactly as given.
  4248. By default 1 (if supported).
  4249. @item ft_load_flags
  4250. The flags to be used for loading the fonts.
  4251. The flags map the corresponding flags supported by libfreetype, and are
  4252. a combination of the following values:
  4253. @table @var
  4254. @item default
  4255. @item no_scale
  4256. @item no_hinting
  4257. @item render
  4258. @item no_bitmap
  4259. @item vertical_layout
  4260. @item force_autohint
  4261. @item crop_bitmap
  4262. @item pedantic
  4263. @item ignore_global_advance_width
  4264. @item no_recurse
  4265. @item ignore_transform
  4266. @item monochrome
  4267. @item linear_design
  4268. @item no_autohint
  4269. @end table
  4270. Default value is "default".
  4271. For more information consult the documentation for the FT_LOAD_*
  4272. libfreetype flags.
  4273. @item shadowcolor
  4274. The color to be used for drawing a shadow behind the drawn text. For the
  4275. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4276. The default value of @var{shadowcolor} is "black".
  4277. @item shadowx
  4278. @item shadowy
  4279. The x and y offsets for the text shadow position with respect to the
  4280. position of the text. They can be either positive or negative
  4281. values. The default value for both is "0".
  4282. @item start_number
  4283. The starting frame number for the n/frame_num variable. The default value
  4284. is "0".
  4285. @item tabsize
  4286. The size in number of spaces to use for rendering the tab.
  4287. Default value is 4.
  4288. @item timecode
  4289. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4290. format. It can be used with or without text parameter. @var{timecode_rate}
  4291. option must be specified.
  4292. @item timecode_rate, rate, r
  4293. Set the timecode frame rate (timecode only).
  4294. @item text
  4295. The text string to be drawn. The text must be a sequence of UTF-8
  4296. encoded characters.
  4297. This parameter is mandatory if no file is specified with the parameter
  4298. @var{textfile}.
  4299. @item textfile
  4300. A text file containing text to be drawn. The text must be a sequence
  4301. of UTF-8 encoded characters.
  4302. This parameter is mandatory if no text string is specified with the
  4303. parameter @var{text}.
  4304. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4305. @item reload
  4306. If set to 1, the @var{textfile} will be reloaded before each frame.
  4307. Be sure to update it atomically, or it may be read partially, or even fail.
  4308. @item x
  4309. @item y
  4310. The expressions which specify the offsets where text will be drawn
  4311. within the video frame. They are relative to the top/left border of the
  4312. output image.
  4313. The default value of @var{x} and @var{y} is "0".
  4314. See below for the list of accepted constants and functions.
  4315. @end table
  4316. The parameters for @var{x} and @var{y} are expressions containing the
  4317. following constants and functions:
  4318. @table @option
  4319. @item dar
  4320. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4321. @item hsub
  4322. @item vsub
  4323. horizontal and vertical chroma subsample values. For example for the
  4324. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4325. @item line_h, lh
  4326. the height of each text line
  4327. @item main_h, h, H
  4328. the input height
  4329. @item main_w, w, W
  4330. the input width
  4331. @item max_glyph_a, ascent
  4332. the maximum distance from the baseline to the highest/upper grid
  4333. coordinate used to place a glyph outline point, for all the rendered
  4334. glyphs.
  4335. It is a positive value, due to the grid's orientation with the Y axis
  4336. upwards.
  4337. @item max_glyph_d, descent
  4338. the maximum distance from the baseline to the lowest grid coordinate
  4339. used to place a glyph outline point, for all the rendered glyphs.
  4340. This is a negative value, due to the grid's orientation, with the Y axis
  4341. upwards.
  4342. @item max_glyph_h
  4343. maximum glyph height, that is the maximum height for all the glyphs
  4344. contained in the rendered text, it is equivalent to @var{ascent} -
  4345. @var{descent}.
  4346. @item max_glyph_w
  4347. maximum glyph width, that is the maximum width for all the glyphs
  4348. contained in the rendered text
  4349. @item n
  4350. the number of input frame, starting from 0
  4351. @item rand(min, max)
  4352. return a random number included between @var{min} and @var{max}
  4353. @item sar
  4354. The input sample aspect ratio.
  4355. @item t
  4356. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4357. @item text_h, th
  4358. the height of the rendered text
  4359. @item text_w, tw
  4360. the width of the rendered text
  4361. @item x
  4362. @item y
  4363. the x and y offset coordinates where the text is drawn.
  4364. These parameters allow the @var{x} and @var{y} expressions to refer
  4365. each other, so you can for example specify @code{y=x/dar}.
  4366. @end table
  4367. @anchor{drawtext_expansion}
  4368. @subsection Text expansion
  4369. If @option{expansion} is set to @code{strftime},
  4370. the filter recognizes strftime() sequences in the provided text and
  4371. expands them accordingly. Check the documentation of strftime(). This
  4372. feature is deprecated.
  4373. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4374. If @option{expansion} is set to @code{normal} (which is the default),
  4375. the following expansion mechanism is used.
  4376. The backslash character @samp{\}, followed by any character, always expands to
  4377. the second character.
  4378. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4379. braces is a function name, possibly followed by arguments separated by ':'.
  4380. If the arguments contain special characters or delimiters (':' or '@}'),
  4381. they should be escaped.
  4382. Note that they probably must also be escaped as the value for the
  4383. @option{text} option in the filter argument string and as the filter
  4384. argument in the filtergraph description, and possibly also for the shell,
  4385. that makes up to four levels of escaping; using a text file avoids these
  4386. problems.
  4387. The following functions are available:
  4388. @table @command
  4389. @item expr, e
  4390. The expression evaluation result.
  4391. It must take one argument specifying the expression to be evaluated,
  4392. which accepts the same constants and functions as the @var{x} and
  4393. @var{y} values. Note that not all constants should be used, for
  4394. example the text size is not known when evaluating the expression, so
  4395. the constants @var{text_w} and @var{text_h} will have an undefined
  4396. value.
  4397. @item expr_int_format, eif
  4398. Evaluate the expression's value and output as formatted integer.
  4399. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4400. The second argument specifies the output format. Allowed values are @samp{x},
  4401. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4402. @code{printf} function.
  4403. The third parameter is optional and sets the number of positions taken by the output.
  4404. It can be used to add padding with zeros from the left.
  4405. @item gmtime
  4406. The time at which the filter is running, expressed in UTC.
  4407. It can accept an argument: a strftime() format string.
  4408. @item localtime
  4409. The time at which the filter is running, expressed in the local time zone.
  4410. It can accept an argument: a strftime() format string.
  4411. @item metadata
  4412. Frame metadata. It must take one argument specifying metadata key.
  4413. @item n, frame_num
  4414. The frame number, starting from 0.
  4415. @item pict_type
  4416. A 1 character description of the current picture type.
  4417. @item pts
  4418. The timestamp of the current frame.
  4419. It can take up to three arguments.
  4420. The first argument is the format of the timestamp; it defaults to @code{flt}
  4421. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4422. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4423. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4424. @code{localtime} stands for the timestamp of the frame formatted as
  4425. local time zone time.
  4426. The second argument is an offset added to the timestamp.
  4427. If the format is set to @code{localtime} or @code{gmtime},
  4428. a third argument may be supplied: a strftime() format string.
  4429. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4430. @end table
  4431. @subsection Examples
  4432. @itemize
  4433. @item
  4434. Draw "Test Text" with font FreeSerif, using the default values for the
  4435. optional parameters.
  4436. @example
  4437. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4438. @end example
  4439. @item
  4440. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4441. and y=50 (counting from the top-left corner of the screen), text is
  4442. yellow with a red box around it. Both the text and the box have an
  4443. opacity of 20%.
  4444. @example
  4445. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4446. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4447. @end example
  4448. Note that the double quotes are not necessary if spaces are not used
  4449. within the parameter list.
  4450. @item
  4451. Show the text at the center of the video frame:
  4452. @example
  4453. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4454. @end example
  4455. @item
  4456. Show a text line sliding from right to left in the last row of the video
  4457. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4458. with no newlines.
  4459. @example
  4460. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4461. @end example
  4462. @item
  4463. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4464. @example
  4465. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4466. @end example
  4467. @item
  4468. Draw a single green letter "g", at the center of the input video.
  4469. The glyph baseline is placed at half screen height.
  4470. @example
  4471. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4472. @end example
  4473. @item
  4474. Show text for 1 second every 3 seconds:
  4475. @example
  4476. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4477. @end example
  4478. @item
  4479. Use fontconfig to set the font. Note that the colons need to be escaped.
  4480. @example
  4481. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4482. @end example
  4483. @item
  4484. Print the date of a real-time encoding (see strftime(3)):
  4485. @example
  4486. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4487. @end example
  4488. @item
  4489. Show text fading in and out (appearing/disappearing):
  4490. @example
  4491. #!/bin/sh
  4492. DS=1.0 # display start
  4493. DE=10.0 # display end
  4494. FID=1.5 # fade in duration
  4495. FOD=5 # fade out duration
  4496. 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 @}"
  4497. @end example
  4498. @end itemize
  4499. For more information about libfreetype, check:
  4500. @url{http://www.freetype.org/}.
  4501. For more information about fontconfig, check:
  4502. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4503. For more information about libfribidi, check:
  4504. @url{http://fribidi.org/}.
  4505. @section edgedetect
  4506. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4507. The filter accepts the following options:
  4508. @table @option
  4509. @item low
  4510. @item high
  4511. Set low and high threshold values used by the Canny thresholding
  4512. algorithm.
  4513. The high threshold selects the "strong" edge pixels, which are then
  4514. connected through 8-connectivity with the "weak" edge pixels selected
  4515. by the low threshold.
  4516. @var{low} and @var{high} threshold values must be chosen in the range
  4517. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4518. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4519. is @code{50/255}.
  4520. @item mode
  4521. Define the drawing mode.
  4522. @table @samp
  4523. @item wires
  4524. Draw white/gray wires on black background.
  4525. @item colormix
  4526. Mix the colors to create a paint/cartoon effect.
  4527. @end table
  4528. Default value is @var{wires}.
  4529. @end table
  4530. @subsection Examples
  4531. @itemize
  4532. @item
  4533. Standard edge detection with custom values for the hysteresis thresholding:
  4534. @example
  4535. edgedetect=low=0.1:high=0.4
  4536. @end example
  4537. @item
  4538. Painting effect without thresholding:
  4539. @example
  4540. edgedetect=mode=colormix:high=0
  4541. @end example
  4542. @end itemize
  4543. @section eq
  4544. Set brightness, contrast, saturation and approximate gamma adjustment.
  4545. The filter accepts the following options:
  4546. @table @option
  4547. @item contrast
  4548. Set the contrast expression. The value must be a float value in range
  4549. @code{-2.0} to @code{2.0}. The default value is "1".
  4550. @item brightness
  4551. Set the brightness expression. The value must be a float value in
  4552. range @code{-1.0} to @code{1.0}. The default value is "0".
  4553. @item saturation
  4554. Set the saturation expression. The value must be a float in
  4555. range @code{0.0} to @code{3.0}. The default value is "1".
  4556. @item gamma
  4557. Set the gamma expression. The value must be a float in range
  4558. @code{0.1} to @code{10.0}. The default value is "1".
  4559. @item gamma_r
  4560. Set the gamma expression for red. The value must be a float in
  4561. range @code{0.1} to @code{10.0}. The default value is "1".
  4562. @item gamma_g
  4563. Set the gamma expression for green. The value must be a float in range
  4564. @code{0.1} to @code{10.0}. The default value is "1".
  4565. @item gamma_b
  4566. Set the gamma expression for blue. The value must be a float in range
  4567. @code{0.1} to @code{10.0}. The default value is "1".
  4568. @item gamma_weight
  4569. Set the gamma weight expression. It can be used to reduce the effect
  4570. of a high gamma value on bright image areas, e.g. keep them from
  4571. getting overamplified and just plain white. The value must be a float
  4572. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4573. gamma correction all the way down while @code{1.0} leaves it at its
  4574. full strength. Default is "1".
  4575. @item eval
  4576. Set when the expressions for brightness, contrast, saturation and
  4577. gamma expressions are evaluated.
  4578. It accepts the following values:
  4579. @table @samp
  4580. @item init
  4581. only evaluate expressions once during the filter initialization or
  4582. when a command is processed
  4583. @item frame
  4584. evaluate expressions for each incoming frame
  4585. @end table
  4586. Default value is @samp{init}.
  4587. @end table
  4588. The expressions accept the following parameters:
  4589. @table @option
  4590. @item n
  4591. frame count of the input frame starting from 0
  4592. @item pos
  4593. byte position of the corresponding packet in the input file, NAN if
  4594. unspecified
  4595. @item r
  4596. frame rate of the input video, NAN if the input frame rate is unknown
  4597. @item t
  4598. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4599. @end table
  4600. @subsection Commands
  4601. The filter supports the following commands:
  4602. @table @option
  4603. @item contrast
  4604. Set the contrast expression.
  4605. @item brightness
  4606. Set the brightness expression.
  4607. @item saturation
  4608. Set the saturation expression.
  4609. @item gamma
  4610. Set the gamma expression.
  4611. @item gamma_r
  4612. Set the gamma_r expression.
  4613. @item gamma_g
  4614. Set gamma_g expression.
  4615. @item gamma_b
  4616. Set gamma_b expression.
  4617. @item gamma_weight
  4618. Set gamma_weight expression.
  4619. The command accepts the same syntax of the corresponding option.
  4620. If the specified expression is not valid, it is kept at its current
  4621. value.
  4622. @end table
  4623. @section erosion
  4624. Apply erosion effect to the video.
  4625. This filter replaces the pixel by the local(3x3) minimum.
  4626. It accepts the following options:
  4627. @table @option
  4628. @item threshold0
  4629. @item threshold1
  4630. @item threshold2
  4631. @item threshold3
  4632. Limit the maximum change for each plane, default is 65535.
  4633. If 0, plane will remain unchanged.
  4634. @item coordinates
  4635. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4636. pixels are used.
  4637. Flags to local 3x3 coordinates maps like this:
  4638. 1 2 3
  4639. 4 5
  4640. 6 7 8
  4641. @end table
  4642. @section extractplanes
  4643. Extract color channel components from input video stream into
  4644. separate grayscale video streams.
  4645. The filter accepts the following option:
  4646. @table @option
  4647. @item planes
  4648. Set plane(s) to extract.
  4649. Available values for planes are:
  4650. @table @samp
  4651. @item y
  4652. @item u
  4653. @item v
  4654. @item a
  4655. @item r
  4656. @item g
  4657. @item b
  4658. @end table
  4659. Choosing planes not available in the input will result in an error.
  4660. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4661. with @code{y}, @code{u}, @code{v} planes at same time.
  4662. @end table
  4663. @subsection Examples
  4664. @itemize
  4665. @item
  4666. Extract luma, u and v color channel component from input video frame
  4667. into 3 grayscale outputs:
  4668. @example
  4669. 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
  4670. @end example
  4671. @end itemize
  4672. @section elbg
  4673. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4674. For each input image, the filter will compute the optimal mapping from
  4675. the input to the output given the codebook length, that is the number
  4676. of distinct output colors.
  4677. This filter accepts the following options.
  4678. @table @option
  4679. @item codebook_length, l
  4680. Set codebook length. The value must be a positive integer, and
  4681. represents the number of distinct output colors. Default value is 256.
  4682. @item nb_steps, n
  4683. Set the maximum number of iterations to apply for computing the optimal
  4684. mapping. The higher the value the better the result and the higher the
  4685. computation time. Default value is 1.
  4686. @item seed, s
  4687. Set a random seed, must be an integer included between 0 and
  4688. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4689. will try to use a good random seed on a best effort basis.
  4690. @item pal8
  4691. Set pal8 output pixel format. This option does not work with codebook
  4692. length greater than 256.
  4693. @end table
  4694. @section fade
  4695. Apply a fade-in/out effect to the input video.
  4696. It accepts the following parameters:
  4697. @table @option
  4698. @item type, t
  4699. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4700. effect.
  4701. Default is @code{in}.
  4702. @item start_frame, s
  4703. Specify the number of the frame to start applying the fade
  4704. effect at. Default is 0.
  4705. @item nb_frames, n
  4706. The number of frames that the fade effect lasts. At the end of the
  4707. fade-in effect, the output video will have the same intensity as the input video.
  4708. At the end of the fade-out transition, the output video will be filled with the
  4709. selected @option{color}.
  4710. Default is 25.
  4711. @item alpha
  4712. If set to 1, fade only alpha channel, if one exists on the input.
  4713. Default value is 0.
  4714. @item start_time, st
  4715. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4716. effect. If both start_frame and start_time are specified, the fade will start at
  4717. whichever comes last. Default is 0.
  4718. @item duration, d
  4719. The number of seconds for which the fade effect has to last. At the end of the
  4720. fade-in effect the output video will have the same intensity as the input video,
  4721. at the end of the fade-out transition the output video will be filled with the
  4722. selected @option{color}.
  4723. If both duration and nb_frames are specified, duration is used. Default is 0
  4724. (nb_frames is used by default).
  4725. @item color, c
  4726. Specify the color of the fade. Default is "black".
  4727. @end table
  4728. @subsection Examples
  4729. @itemize
  4730. @item
  4731. Fade in the first 30 frames of video:
  4732. @example
  4733. fade=in:0:30
  4734. @end example
  4735. The command above is equivalent to:
  4736. @example
  4737. fade=t=in:s=0:n=30
  4738. @end example
  4739. @item
  4740. Fade out the last 45 frames of a 200-frame video:
  4741. @example
  4742. fade=out:155:45
  4743. fade=type=out:start_frame=155:nb_frames=45
  4744. @end example
  4745. @item
  4746. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4747. @example
  4748. fade=in:0:25, fade=out:975:25
  4749. @end example
  4750. @item
  4751. Make the first 5 frames yellow, then fade in from frame 5-24:
  4752. @example
  4753. fade=in:5:20:color=yellow
  4754. @end example
  4755. @item
  4756. Fade in alpha over first 25 frames of video:
  4757. @example
  4758. fade=in:0:25:alpha=1
  4759. @end example
  4760. @item
  4761. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4762. @example
  4763. fade=t=in:st=5.5:d=0.5
  4764. @end example
  4765. @end itemize
  4766. @section fftfilt
  4767. Apply arbitrary expressions to samples in frequency domain
  4768. @table @option
  4769. @item dc_Y
  4770. Adjust the dc value (gain) of the luma plane of the image. The filter
  4771. accepts an integer value in range @code{0} to @code{1000}. The default
  4772. value is set to @code{0}.
  4773. @item dc_U
  4774. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4775. filter accepts an integer value in range @code{0} to @code{1000}. The
  4776. default value is set to @code{0}.
  4777. @item dc_V
  4778. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4779. filter accepts an integer value in range @code{0} to @code{1000}. The
  4780. default value is set to @code{0}.
  4781. @item weight_Y
  4782. Set the frequency domain weight expression for the luma plane.
  4783. @item weight_U
  4784. Set the frequency domain weight expression for the 1st chroma plane.
  4785. @item weight_V
  4786. Set the frequency domain weight expression for the 2nd chroma plane.
  4787. The filter accepts the following variables:
  4788. @item X
  4789. @item Y
  4790. The coordinates of the current sample.
  4791. @item W
  4792. @item H
  4793. The width and height of the image.
  4794. @end table
  4795. @subsection Examples
  4796. @itemize
  4797. @item
  4798. High-pass:
  4799. @example
  4800. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4801. @end example
  4802. @item
  4803. Low-pass:
  4804. @example
  4805. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4806. @end example
  4807. @item
  4808. Sharpen:
  4809. @example
  4810. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4811. @end example
  4812. @end itemize
  4813. @section field
  4814. Extract a single field from an interlaced image using stride
  4815. arithmetic to avoid wasting CPU time. The output frames are marked as
  4816. non-interlaced.
  4817. The filter accepts the following options:
  4818. @table @option
  4819. @item type
  4820. Specify whether to extract the top (if the value is @code{0} or
  4821. @code{top}) or the bottom field (if the value is @code{1} or
  4822. @code{bottom}).
  4823. @end table
  4824. @section fieldmatch
  4825. Field matching filter for inverse telecine. It is meant to reconstruct the
  4826. progressive frames from a telecined stream. The filter does not drop duplicated
  4827. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4828. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4829. The separation of the field matching and the decimation is notably motivated by
  4830. the possibility of inserting a de-interlacing filter fallback between the two.
  4831. If the source has mixed telecined and real interlaced content,
  4832. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4833. But these remaining combed frames will be marked as interlaced, and thus can be
  4834. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4835. In addition to the various configuration options, @code{fieldmatch} can take an
  4836. optional second stream, activated through the @option{ppsrc} option. If
  4837. enabled, the frames reconstruction will be based on the fields and frames from
  4838. this second stream. This allows the first input to be pre-processed in order to
  4839. help the various algorithms of the filter, while keeping the output lossless
  4840. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4841. or brightness/contrast adjustments can help.
  4842. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4843. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4844. which @code{fieldmatch} is based on. While the semantic and usage are very
  4845. close, some behaviour and options names can differ.
  4846. The @ref{decimate} filter currently only works for constant frame rate input.
  4847. If your input has mixed telecined (30fps) and progressive content with a lower
  4848. framerate like 24fps use the following filterchain to produce the necessary cfr
  4849. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4850. The filter accepts the following options:
  4851. @table @option
  4852. @item order
  4853. Specify the assumed field order of the input stream. Available values are:
  4854. @table @samp
  4855. @item auto
  4856. Auto detect parity (use FFmpeg's internal parity value).
  4857. @item bff
  4858. Assume bottom field first.
  4859. @item tff
  4860. Assume top field first.
  4861. @end table
  4862. Note that it is sometimes recommended not to trust the parity announced by the
  4863. stream.
  4864. Default value is @var{auto}.
  4865. @item mode
  4866. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4867. sense that it won't risk creating jerkiness due to duplicate frames when
  4868. possible, but if there are bad edits or blended fields it will end up
  4869. outputting combed frames when a good match might actually exist. On the other
  4870. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4871. but will almost always find a good frame if there is one. The other values are
  4872. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4873. jerkiness and creating duplicate frames versus finding good matches in sections
  4874. with bad edits, orphaned fields, blended fields, etc.
  4875. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4876. Available values are:
  4877. @table @samp
  4878. @item pc
  4879. 2-way matching (p/c)
  4880. @item pc_n
  4881. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4882. @item pc_u
  4883. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4884. @item pc_n_ub
  4885. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4886. still combed (p/c + n + u/b)
  4887. @item pcn
  4888. 3-way matching (p/c/n)
  4889. @item pcn_ub
  4890. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4891. detected as combed (p/c/n + u/b)
  4892. @end table
  4893. The parenthesis at the end indicate the matches that would be used for that
  4894. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4895. @var{top}).
  4896. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4897. the slowest.
  4898. Default value is @var{pc_n}.
  4899. @item ppsrc
  4900. Mark the main input stream as a pre-processed input, and enable the secondary
  4901. input stream as the clean source to pick the fields from. See the filter
  4902. introduction for more details. It is similar to the @option{clip2} feature from
  4903. VFM/TFM.
  4904. Default value is @code{0} (disabled).
  4905. @item field
  4906. Set the field to match from. It is recommended to set this to the same value as
  4907. @option{order} unless you experience matching failures with that setting. In
  4908. certain circumstances changing the field that is used to match from can have a
  4909. large impact on matching performance. Available values are:
  4910. @table @samp
  4911. @item auto
  4912. Automatic (same value as @option{order}).
  4913. @item bottom
  4914. Match from the bottom field.
  4915. @item top
  4916. Match from the top field.
  4917. @end table
  4918. Default value is @var{auto}.
  4919. @item mchroma
  4920. Set whether or not chroma is included during the match comparisons. In most
  4921. cases it is recommended to leave this enabled. You should set this to @code{0}
  4922. only if your clip has bad chroma problems such as heavy rainbowing or other
  4923. artifacts. Setting this to @code{0} could also be used to speed things up at
  4924. the cost of some accuracy.
  4925. Default value is @code{1}.
  4926. @item y0
  4927. @item y1
  4928. These define an exclusion band which excludes the lines between @option{y0} and
  4929. @option{y1} from being included in the field matching decision. An exclusion
  4930. band can be used to ignore subtitles, a logo, or other things that may
  4931. interfere with the matching. @option{y0} sets the starting scan line and
  4932. @option{y1} sets the ending line; all lines in between @option{y0} and
  4933. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4934. @option{y0} and @option{y1} to the same value will disable the feature.
  4935. @option{y0} and @option{y1} defaults to @code{0}.
  4936. @item scthresh
  4937. Set the scene change detection threshold as a percentage of maximum change on
  4938. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4939. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4940. @option{scthresh} is @code{[0.0, 100.0]}.
  4941. Default value is @code{12.0}.
  4942. @item combmatch
  4943. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4944. account the combed scores of matches when deciding what match to use as the
  4945. final match. Available values are:
  4946. @table @samp
  4947. @item none
  4948. No final matching based on combed scores.
  4949. @item sc
  4950. Combed scores are only used when a scene change is detected.
  4951. @item full
  4952. Use combed scores all the time.
  4953. @end table
  4954. Default is @var{sc}.
  4955. @item combdbg
  4956. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4957. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4958. Available values are:
  4959. @table @samp
  4960. @item none
  4961. No forced calculation.
  4962. @item pcn
  4963. Force p/c/n calculations.
  4964. @item pcnub
  4965. Force p/c/n/u/b calculations.
  4966. @end table
  4967. Default value is @var{none}.
  4968. @item cthresh
  4969. This is the area combing threshold used for combed frame detection. This
  4970. essentially controls how "strong" or "visible" combing must be to be detected.
  4971. Larger values mean combing must be more visible and smaller values mean combing
  4972. can be less visible or strong and still be detected. Valid settings are from
  4973. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4974. be detected as combed). This is basically a pixel difference value. A good
  4975. range is @code{[8, 12]}.
  4976. Default value is @code{9}.
  4977. @item chroma
  4978. Sets whether or not chroma is considered in the combed frame decision. Only
  4979. disable this if your source has chroma problems (rainbowing, etc.) that are
  4980. causing problems for the combed frame detection with chroma enabled. Actually,
  4981. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4982. where there is chroma only combing in the source.
  4983. Default value is @code{0}.
  4984. @item blockx
  4985. @item blocky
  4986. Respectively set the x-axis and y-axis size of the window used during combed
  4987. frame detection. This has to do with the size of the area in which
  4988. @option{combpel} pixels are required to be detected as combed for a frame to be
  4989. declared combed. See the @option{combpel} parameter description for more info.
  4990. Possible values are any number that is a power of 2 starting at 4 and going up
  4991. to 512.
  4992. Default value is @code{16}.
  4993. @item combpel
  4994. The number of combed pixels inside any of the @option{blocky} by
  4995. @option{blockx} size blocks on the frame for the frame to be detected as
  4996. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4997. setting controls "how much" combing there must be in any localized area (a
  4998. window defined by the @option{blockx} and @option{blocky} settings) on the
  4999. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5000. which point no frames will ever be detected as combed). This setting is known
  5001. as @option{MI} in TFM/VFM vocabulary.
  5002. Default value is @code{80}.
  5003. @end table
  5004. @anchor{p/c/n/u/b meaning}
  5005. @subsection p/c/n/u/b meaning
  5006. @subsubsection p/c/n
  5007. We assume the following telecined stream:
  5008. @example
  5009. Top fields: 1 2 2 3 4
  5010. Bottom fields: 1 2 3 4 4
  5011. @end example
  5012. The numbers correspond to the progressive frame the fields relate to. Here, the
  5013. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5014. When @code{fieldmatch} is configured to run a matching from bottom
  5015. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5016. @example
  5017. Input stream:
  5018. T 1 2 2 3 4
  5019. B 1 2 3 4 4 <-- matching reference
  5020. Matches: c c n n c
  5021. Output stream:
  5022. T 1 2 3 4 4
  5023. B 1 2 3 4 4
  5024. @end example
  5025. As a result of the field matching, we can see that some frames get duplicated.
  5026. To perform a complete inverse telecine, you need to rely on a decimation filter
  5027. after this operation. See for instance the @ref{decimate} filter.
  5028. The same operation now matching from top fields (@option{field}=@var{top})
  5029. looks like this:
  5030. @example
  5031. Input stream:
  5032. T 1 2 2 3 4 <-- matching reference
  5033. B 1 2 3 4 4
  5034. Matches: c c p p c
  5035. Output stream:
  5036. T 1 2 2 3 4
  5037. B 1 2 2 3 4
  5038. @end example
  5039. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5040. basically, they refer to the frame and field of the opposite parity:
  5041. @itemize
  5042. @item @var{p} matches the field of the opposite parity in the previous frame
  5043. @item @var{c} matches the field of the opposite parity in the current frame
  5044. @item @var{n} matches the field of the opposite parity in the next frame
  5045. @end itemize
  5046. @subsubsection u/b
  5047. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5048. from the opposite parity flag. In the following examples, we assume that we are
  5049. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5050. 'x' is placed above and below each matched fields.
  5051. With bottom matching (@option{field}=@var{bottom}):
  5052. @example
  5053. Match: c p n b u
  5054. x x x x x
  5055. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5056. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5057. x x x x x
  5058. Output frames:
  5059. 2 1 2 2 2
  5060. 2 2 2 1 3
  5061. @end example
  5062. With top matching (@option{field}=@var{top}):
  5063. @example
  5064. Match: c p n b u
  5065. x x x x x
  5066. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5067. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5068. x x x x x
  5069. Output frames:
  5070. 2 2 2 1 2
  5071. 2 1 3 2 2
  5072. @end example
  5073. @subsection Examples
  5074. Simple IVTC of a top field first telecined stream:
  5075. @example
  5076. fieldmatch=order=tff:combmatch=none, decimate
  5077. @end example
  5078. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5079. @example
  5080. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5081. @end example
  5082. @section fieldorder
  5083. Transform the field order of the input video.
  5084. It accepts the following parameters:
  5085. @table @option
  5086. @item order
  5087. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5088. for bottom field first.
  5089. @end table
  5090. The default value is @samp{tff}.
  5091. The transformation is done by shifting the picture content up or down
  5092. by one line, and filling the remaining line with appropriate picture content.
  5093. This method is consistent with most broadcast field order converters.
  5094. If the input video is not flagged as being interlaced, or it is already
  5095. flagged as being of the required output field order, then this filter does
  5096. not alter the incoming video.
  5097. It is very useful when converting to or from PAL DV material,
  5098. which is bottom field first.
  5099. For example:
  5100. @example
  5101. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5102. @end example
  5103. @section fifo, afifo
  5104. Buffer input images and send them when they are requested.
  5105. It is mainly useful when auto-inserted by the libavfilter
  5106. framework.
  5107. It does not take parameters.
  5108. @section find_rect
  5109. Find a rectangular object
  5110. It accepts the following options:
  5111. @table @option
  5112. @item object
  5113. Filepath of the object image, needs to be in gray8.
  5114. @item threshold
  5115. Detection threshold, default is 0.5.
  5116. @item mipmaps
  5117. Number of mipmaps, default is 3.
  5118. @item xmin, ymin, xmax, ymax
  5119. Specifies the rectangle in which to search.
  5120. @end table
  5121. @subsection Examples
  5122. @itemize
  5123. @item
  5124. Generate a representative palette of a given video using @command{ffmpeg}:
  5125. @example
  5126. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5127. @end example
  5128. @end itemize
  5129. @section cover_rect
  5130. Cover a rectangular object
  5131. It accepts the following options:
  5132. @table @option
  5133. @item cover
  5134. Filepath of the optional cover image, needs to be in yuv420.
  5135. @item mode
  5136. Set covering mode.
  5137. It accepts the following values:
  5138. @table @samp
  5139. @item cover
  5140. cover it by the supplied image
  5141. @item blur
  5142. cover it by interpolating the surrounding pixels
  5143. @end table
  5144. Default value is @var{blur}.
  5145. @end table
  5146. @subsection Examples
  5147. @itemize
  5148. @item
  5149. Generate a representative palette of a given video using @command{ffmpeg}:
  5150. @example
  5151. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5152. @end example
  5153. @end itemize
  5154. @anchor{format}
  5155. @section format
  5156. Convert the input video to one of the specified pixel formats.
  5157. Libavfilter will try to pick one that is suitable as input to
  5158. the next filter.
  5159. It accepts the following parameters:
  5160. @table @option
  5161. @item pix_fmts
  5162. A '|'-separated list of pixel format names, such as
  5163. "pix_fmts=yuv420p|monow|rgb24".
  5164. @end table
  5165. @subsection Examples
  5166. @itemize
  5167. @item
  5168. Convert the input video to the @var{yuv420p} format
  5169. @example
  5170. format=pix_fmts=yuv420p
  5171. @end example
  5172. Convert the input video to any of the formats in the list
  5173. @example
  5174. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5175. @end example
  5176. @end itemize
  5177. @anchor{fps}
  5178. @section fps
  5179. Convert the video to specified constant frame rate by duplicating or dropping
  5180. frames as necessary.
  5181. It accepts the following parameters:
  5182. @table @option
  5183. @item fps
  5184. The desired output frame rate. The default is @code{25}.
  5185. @item round
  5186. Rounding method.
  5187. Possible values are:
  5188. @table @option
  5189. @item zero
  5190. zero round towards 0
  5191. @item inf
  5192. round away from 0
  5193. @item down
  5194. round towards -infinity
  5195. @item up
  5196. round towards +infinity
  5197. @item near
  5198. round to nearest
  5199. @end table
  5200. The default is @code{near}.
  5201. @item start_time
  5202. Assume the first PTS should be the given value, in seconds. This allows for
  5203. padding/trimming at the start of stream. By default, no assumption is made
  5204. about the first frame's expected PTS, so no padding or trimming is done.
  5205. For example, this could be set to 0 to pad the beginning with duplicates of
  5206. the first frame if a video stream starts after the audio stream or to trim any
  5207. frames with a negative PTS.
  5208. @end table
  5209. Alternatively, the options can be specified as a flat string:
  5210. @var{fps}[:@var{round}].
  5211. See also the @ref{setpts} filter.
  5212. @subsection Examples
  5213. @itemize
  5214. @item
  5215. A typical usage in order to set the fps to 25:
  5216. @example
  5217. fps=fps=25
  5218. @end example
  5219. @item
  5220. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5221. @example
  5222. fps=fps=film:round=near
  5223. @end example
  5224. @end itemize
  5225. @section framepack
  5226. Pack two different video streams into a stereoscopic video, setting proper
  5227. metadata on supported codecs. The two views should have the same size and
  5228. framerate and processing will stop when the shorter video ends. Please note
  5229. that you may conveniently adjust view properties with the @ref{scale} and
  5230. @ref{fps} filters.
  5231. It accepts the following parameters:
  5232. @table @option
  5233. @item format
  5234. The desired packing format. Supported values are:
  5235. @table @option
  5236. @item sbs
  5237. The views are next to each other (default).
  5238. @item tab
  5239. The views are on top of each other.
  5240. @item lines
  5241. The views are packed by line.
  5242. @item columns
  5243. The views are packed by column.
  5244. @item frameseq
  5245. The views are temporally interleaved.
  5246. @end table
  5247. @end table
  5248. Some examples:
  5249. @example
  5250. # Convert left and right views into a frame-sequential video
  5251. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5252. # Convert views into a side-by-side video with the same output resolution as the input
  5253. 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
  5254. @end example
  5255. @section framerate
  5256. Change the frame rate by interpolating new video output frames from the source
  5257. frames.
  5258. This filter is not designed to function correctly with interlaced media. If
  5259. you wish to change the frame rate of interlaced media then you are required
  5260. to deinterlace before this filter and re-interlace after this filter.
  5261. A description of the accepted options follows.
  5262. @table @option
  5263. @item fps
  5264. Specify the output frames per second. This option can also be specified
  5265. as a value alone. The default is @code{50}.
  5266. @item interp_start
  5267. Specify the start of a range where the output frame will be created as a
  5268. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5269. the default is @code{15}.
  5270. @item interp_end
  5271. Specify the end of a range where the output frame will be created as a
  5272. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5273. the default is @code{240}.
  5274. @item scene
  5275. Specify the level at which a scene change is detected as a value between
  5276. 0 and 100 to indicate a new scene; a low value reflects a low
  5277. probability for the current frame to introduce a new scene, while a higher
  5278. value means the current frame is more likely to be one.
  5279. The default is @code{7}.
  5280. @item flags
  5281. Specify flags influencing the filter process.
  5282. Available value for @var{flags} is:
  5283. @table @option
  5284. @item scene_change_detect, scd
  5285. Enable scene change detection using the value of the option @var{scene}.
  5286. This flag is enabled by default.
  5287. @end table
  5288. @end table
  5289. @section framestep
  5290. Select one frame every N-th frame.
  5291. This filter accepts the following option:
  5292. @table @option
  5293. @item step
  5294. Select frame after every @code{step} frames.
  5295. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5296. @end table
  5297. @anchor{frei0r}
  5298. @section frei0r
  5299. Apply a frei0r effect to the input video.
  5300. To enable the compilation of this filter, you need to install the frei0r
  5301. header and configure FFmpeg with @code{--enable-frei0r}.
  5302. It accepts the following parameters:
  5303. @table @option
  5304. @item filter_name
  5305. The name of the frei0r effect to load. If the environment variable
  5306. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5307. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5308. Otherwise, the standard frei0r paths are searched, in this order:
  5309. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5310. @file{/usr/lib/frei0r-1/}.
  5311. @item filter_params
  5312. A '|'-separated list of parameters to pass to the frei0r effect.
  5313. @end table
  5314. A frei0r effect parameter can be a boolean (its value is either
  5315. "y" or "n"), a double, a color (specified as
  5316. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5317. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5318. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5319. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5320. The number and types of parameters depend on the loaded effect. If an
  5321. effect parameter is not specified, the default value is set.
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Apply the distort0r effect, setting the first two double parameters:
  5326. @example
  5327. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5328. @end example
  5329. @item
  5330. Apply the colordistance effect, taking a color as the first parameter:
  5331. @example
  5332. frei0r=colordistance:0.2/0.3/0.4
  5333. frei0r=colordistance:violet
  5334. frei0r=colordistance:0x112233
  5335. @end example
  5336. @item
  5337. Apply the perspective effect, specifying the top left and top right image
  5338. positions:
  5339. @example
  5340. frei0r=perspective:0.2/0.2|0.8/0.2
  5341. @end example
  5342. @end itemize
  5343. For more information, see
  5344. @url{http://frei0r.dyne.org}
  5345. @section fspp
  5346. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5347. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5348. processing filter, one of them is performed once per block, not per pixel.
  5349. This allows for much higher speed.
  5350. The filter accepts the following options:
  5351. @table @option
  5352. @item quality
  5353. Set quality. This option defines the number of levels for averaging. It accepts
  5354. an integer in the range 4-5. Default value is @code{4}.
  5355. @item qp
  5356. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5357. If not set, the filter will use the QP from the video stream (if available).
  5358. @item strength
  5359. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5360. more details but also more artifacts, while higher values make the image smoother
  5361. but also blurrier. Default value is @code{0} − PSNR optimal.
  5362. @item use_bframe_qp
  5363. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5364. option may cause flicker since the B-Frames have often larger QP. Default is
  5365. @code{0} (not enabled).
  5366. @end table
  5367. @section geq
  5368. The filter accepts the following options:
  5369. @table @option
  5370. @item lum_expr, lum
  5371. Set the luminance expression.
  5372. @item cb_expr, cb
  5373. Set the chrominance blue expression.
  5374. @item cr_expr, cr
  5375. Set the chrominance red expression.
  5376. @item alpha_expr, a
  5377. Set the alpha expression.
  5378. @item red_expr, r
  5379. Set the red expression.
  5380. @item green_expr, g
  5381. Set the green expression.
  5382. @item blue_expr, b
  5383. Set the blue expression.
  5384. @end table
  5385. The colorspace is selected according to the specified options. If one
  5386. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5387. options is specified, the filter will automatically select a YCbCr
  5388. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5389. @option{blue_expr} options is specified, it will select an RGB
  5390. colorspace.
  5391. If one of the chrominance expression is not defined, it falls back on the other
  5392. one. If no alpha expression is specified it will evaluate to opaque value.
  5393. If none of chrominance expressions are specified, they will evaluate
  5394. to the luminance expression.
  5395. The expressions can use the following variables and functions:
  5396. @table @option
  5397. @item N
  5398. The sequential number of the filtered frame, starting from @code{0}.
  5399. @item X
  5400. @item Y
  5401. The coordinates of the current sample.
  5402. @item W
  5403. @item H
  5404. The width and height of the image.
  5405. @item SW
  5406. @item SH
  5407. Width and height scale depending on the currently filtered plane. It is the
  5408. ratio between the corresponding luma plane number of pixels and the current
  5409. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5410. @code{0.5,0.5} for chroma planes.
  5411. @item T
  5412. Time of the current frame, expressed in seconds.
  5413. @item p(x, y)
  5414. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5415. plane.
  5416. @item lum(x, y)
  5417. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5418. plane.
  5419. @item cb(x, y)
  5420. Return the value of the pixel at location (@var{x},@var{y}) of the
  5421. blue-difference chroma plane. Return 0 if there is no such plane.
  5422. @item cr(x, y)
  5423. Return the value of the pixel at location (@var{x},@var{y}) of the
  5424. red-difference chroma plane. Return 0 if there is no such plane.
  5425. @item r(x, y)
  5426. @item g(x, y)
  5427. @item b(x, y)
  5428. Return the value of the pixel at location (@var{x},@var{y}) of the
  5429. red/green/blue component. Return 0 if there is no such component.
  5430. @item alpha(x, y)
  5431. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5432. plane. Return 0 if there is no such plane.
  5433. @end table
  5434. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5435. automatically clipped to the closer edge.
  5436. @subsection Examples
  5437. @itemize
  5438. @item
  5439. Flip the image horizontally:
  5440. @example
  5441. geq=p(W-X\,Y)
  5442. @end example
  5443. @item
  5444. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5445. wavelength of 100 pixels:
  5446. @example
  5447. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5448. @end example
  5449. @item
  5450. Generate a fancy enigmatic moving light:
  5451. @example
  5452. 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
  5453. @end example
  5454. @item
  5455. Generate a quick emboss effect:
  5456. @example
  5457. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5458. @end example
  5459. @item
  5460. Modify RGB components depending on pixel position:
  5461. @example
  5462. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5463. @end example
  5464. @item
  5465. Create a radial gradient that is the same size as the input (also see
  5466. the @ref{vignette} filter):
  5467. @example
  5468. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5469. @end example
  5470. @item
  5471. Create a linear gradient to use as a mask for another filter, then
  5472. compose with @ref{overlay}. In this example the video will gradually
  5473. become more blurry from the top to the bottom of the y-axis as defined
  5474. by the linear gradient:
  5475. @example
  5476. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5477. @end example
  5478. @end itemize
  5479. @section gradfun
  5480. Fix the banding artifacts that are sometimes introduced into nearly flat
  5481. regions by truncation to 8bit color depth.
  5482. Interpolate the gradients that should go where the bands are, and
  5483. dither them.
  5484. It is designed for playback only. Do not use it prior to
  5485. lossy compression, because compression tends to lose the dither and
  5486. bring back the bands.
  5487. It accepts the following parameters:
  5488. @table @option
  5489. @item strength
  5490. The maximum amount by which the filter will change any one pixel. This is also
  5491. the threshold for detecting nearly flat regions. Acceptable values range from
  5492. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5493. valid range.
  5494. @item radius
  5495. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5496. gradients, but also prevents the filter from modifying the pixels near detailed
  5497. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5498. values will be clipped to the valid range.
  5499. @end table
  5500. Alternatively, the options can be specified as a flat string:
  5501. @var{strength}[:@var{radius}]
  5502. @subsection Examples
  5503. @itemize
  5504. @item
  5505. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5506. @example
  5507. gradfun=3.5:8
  5508. @end example
  5509. @item
  5510. Specify radius, omitting the strength (which will fall-back to the default
  5511. value):
  5512. @example
  5513. gradfun=radius=8
  5514. @end example
  5515. @end itemize
  5516. @anchor{haldclut}
  5517. @section haldclut
  5518. Apply a Hald CLUT to a video stream.
  5519. First input is the video stream to process, and second one is the Hald CLUT.
  5520. The Hald CLUT input can be a simple picture or a complete video stream.
  5521. The filter accepts the following options:
  5522. @table @option
  5523. @item shortest
  5524. Force termination when the shortest input terminates. Default is @code{0}.
  5525. @item repeatlast
  5526. Continue applying the last CLUT after the end of the stream. A value of
  5527. @code{0} disable the filter after the last frame of the CLUT is reached.
  5528. Default is @code{1}.
  5529. @end table
  5530. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5531. filters share the same internals).
  5532. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5533. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5534. @subsection Workflow examples
  5535. @subsubsection Hald CLUT video stream
  5536. Generate an identity Hald CLUT stream altered with various effects:
  5537. @example
  5538. 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
  5539. @end example
  5540. Note: make sure you use a lossless codec.
  5541. Then use it with @code{haldclut} to apply it on some random stream:
  5542. @example
  5543. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5544. @end example
  5545. The Hald CLUT will be applied to the 10 first seconds (duration of
  5546. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5547. to the remaining frames of the @code{mandelbrot} stream.
  5548. @subsubsection Hald CLUT with preview
  5549. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5550. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5551. biggest possible square starting at the top left of the picture. The remaining
  5552. padding pixels (bottom or right) will be ignored. This area can be used to add
  5553. a preview of the Hald CLUT.
  5554. Typically, the following generated Hald CLUT will be supported by the
  5555. @code{haldclut} filter:
  5556. @example
  5557. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5558. pad=iw+320 [padded_clut];
  5559. smptebars=s=320x256, split [a][b];
  5560. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5561. [main][b] overlay=W-320" -frames:v 1 clut.png
  5562. @end example
  5563. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5564. bars are displayed on the right-top, and below the same color bars processed by
  5565. the color changes.
  5566. Then, the effect of this Hald CLUT can be visualized with:
  5567. @example
  5568. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5569. @end example
  5570. @section hflip
  5571. Flip the input video horizontally.
  5572. For example, to horizontally flip the input video with @command{ffmpeg}:
  5573. @example
  5574. ffmpeg -i in.avi -vf "hflip" out.avi
  5575. @end example
  5576. @section histeq
  5577. This filter applies a global color histogram equalization on a
  5578. per-frame basis.
  5579. It can be used to correct video that has a compressed range of pixel
  5580. intensities. The filter redistributes the pixel intensities to
  5581. equalize their distribution across the intensity range. It may be
  5582. viewed as an "automatically adjusting contrast filter". This filter is
  5583. useful only for correcting degraded or poorly captured source
  5584. video.
  5585. The filter accepts the following options:
  5586. @table @option
  5587. @item strength
  5588. Determine the amount of equalization to be applied. As the strength
  5589. is reduced, the distribution of pixel intensities more-and-more
  5590. approaches that of the input frame. The value must be a float number
  5591. in the range [0,1] and defaults to 0.200.
  5592. @item intensity
  5593. Set the maximum intensity that can generated and scale the output
  5594. values appropriately. The strength should be set as desired and then
  5595. the intensity can be limited if needed to avoid washing-out. The value
  5596. must be a float number in the range [0,1] and defaults to 0.210.
  5597. @item antibanding
  5598. Set the antibanding level. If enabled the filter will randomly vary
  5599. the luminance of output pixels by a small amount to avoid banding of
  5600. the histogram. Possible values are @code{none}, @code{weak} or
  5601. @code{strong}. It defaults to @code{none}.
  5602. @end table
  5603. @section histogram
  5604. Compute and draw a color distribution histogram for the input video.
  5605. The computed histogram is a representation of the color component
  5606. distribution in an image.
  5607. Standard histogram displays the color components distribution in an image.
  5608. Displays color graph for each color component. Shows distribution of
  5609. the Y, U, V, A or R, G, B components, depending on input format, in the
  5610. current frame. Below each graph a color component scale meter is shown.
  5611. The filter accepts the following options:
  5612. @table @option
  5613. @item level_height
  5614. Set height of level. Default value is @code{200}.
  5615. Allowed range is [50, 2048].
  5616. @item scale_height
  5617. Set height of color scale. Default value is @code{12}.
  5618. Allowed range is [0, 40].
  5619. @item display_mode
  5620. Set display mode.
  5621. It accepts the following values:
  5622. @table @samp
  5623. @item parade
  5624. Per color component graphs are placed below each other.
  5625. @item overlay
  5626. Presents information identical to that in the @code{parade}, except
  5627. that the graphs representing color components are superimposed directly
  5628. over one another.
  5629. @end table
  5630. Default is @code{parade}.
  5631. @item levels_mode
  5632. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5633. Default is @code{linear}.
  5634. @item components
  5635. Set what color components to display.
  5636. Default is @code{7}.
  5637. @end table
  5638. @subsection Examples
  5639. @itemize
  5640. @item
  5641. Calculate and draw histogram:
  5642. @example
  5643. ffplay -i input -vf histogram
  5644. @end example
  5645. @end itemize
  5646. @anchor{hqdn3d}
  5647. @section hqdn3d
  5648. This is a high precision/quality 3d denoise filter. It aims to reduce
  5649. image noise, producing smooth images and making still images really
  5650. still. It should enhance compressibility.
  5651. It accepts the following optional parameters:
  5652. @table @option
  5653. @item luma_spatial
  5654. A non-negative floating point number which specifies spatial luma strength.
  5655. It defaults to 4.0.
  5656. @item chroma_spatial
  5657. A non-negative floating point number which specifies spatial chroma strength.
  5658. It defaults to 3.0*@var{luma_spatial}/4.0.
  5659. @item luma_tmp
  5660. A floating point number which specifies luma temporal strength. It defaults to
  5661. 6.0*@var{luma_spatial}/4.0.
  5662. @item chroma_tmp
  5663. A floating point number which specifies chroma temporal strength. It defaults to
  5664. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5665. @end table
  5666. @section hqx
  5667. Apply a high-quality magnification filter designed for pixel art. This filter
  5668. was originally created by Maxim Stepin.
  5669. It accepts the following option:
  5670. @table @option
  5671. @item n
  5672. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5673. @code{hq3x} and @code{4} for @code{hq4x}.
  5674. Default is @code{3}.
  5675. @end table
  5676. @section hstack
  5677. Stack input videos horizontally.
  5678. All streams must be of same pixel format and of same height.
  5679. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5680. to create same output.
  5681. The filter accept the following option:
  5682. @table @option
  5683. @item inputs
  5684. Set number of input streams. Default is 2.
  5685. @item shortest
  5686. If set to 1, force the output to terminate when the shortest input
  5687. terminates. Default value is 0.
  5688. @end table
  5689. @section hue
  5690. Modify the hue and/or the saturation of the input.
  5691. It accepts the following parameters:
  5692. @table @option
  5693. @item h
  5694. Specify the hue angle as a number of degrees. It accepts an expression,
  5695. and defaults to "0".
  5696. @item s
  5697. Specify the saturation in the [-10,10] range. It accepts an expression and
  5698. defaults to "1".
  5699. @item H
  5700. Specify the hue angle as a number of radians. It accepts an
  5701. expression, and defaults to "0".
  5702. @item b
  5703. Specify the brightness in the [-10,10] range. It accepts an expression and
  5704. defaults to "0".
  5705. @end table
  5706. @option{h} and @option{H} are mutually exclusive, and can't be
  5707. specified at the same time.
  5708. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5709. expressions containing the following constants:
  5710. @table @option
  5711. @item n
  5712. frame count of the input frame starting from 0
  5713. @item pts
  5714. presentation timestamp of the input frame expressed in time base units
  5715. @item r
  5716. frame rate of the input video, NAN if the input frame rate is unknown
  5717. @item t
  5718. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5719. @item tb
  5720. time base of the input video
  5721. @end table
  5722. @subsection Examples
  5723. @itemize
  5724. @item
  5725. Set the hue to 90 degrees and the saturation to 1.0:
  5726. @example
  5727. hue=h=90:s=1
  5728. @end example
  5729. @item
  5730. Same command but expressing the hue in radians:
  5731. @example
  5732. hue=H=PI/2:s=1
  5733. @end example
  5734. @item
  5735. Rotate hue and make the saturation swing between 0
  5736. and 2 over a period of 1 second:
  5737. @example
  5738. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5739. @end example
  5740. @item
  5741. Apply a 3 seconds saturation fade-in effect starting at 0:
  5742. @example
  5743. hue="s=min(t/3\,1)"
  5744. @end example
  5745. The general fade-in expression can be written as:
  5746. @example
  5747. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5748. @end example
  5749. @item
  5750. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5751. @example
  5752. hue="s=max(0\, min(1\, (8-t)/3))"
  5753. @end example
  5754. The general fade-out expression can be written as:
  5755. @example
  5756. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5757. @end example
  5758. @end itemize
  5759. @subsection Commands
  5760. This filter supports the following commands:
  5761. @table @option
  5762. @item b
  5763. @item s
  5764. @item h
  5765. @item H
  5766. Modify the hue and/or the saturation and/or brightness of the input video.
  5767. The command accepts the same syntax of the corresponding option.
  5768. If the specified expression is not valid, it is kept at its current
  5769. value.
  5770. @end table
  5771. @section idet
  5772. Detect video interlacing type.
  5773. This filter tries to detect if the input frames as interlaced, progressive,
  5774. top or bottom field first. It will also try and detect fields that are
  5775. repeated between adjacent frames (a sign of telecine).
  5776. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5777. Multiple frame detection incorporates the classification history of previous frames.
  5778. The filter will log these metadata values:
  5779. @table @option
  5780. @item single.current_frame
  5781. Detected type of current frame using single-frame detection. One of:
  5782. ``tff'' (top field first), ``bff'' (bottom field first),
  5783. ``progressive'', or ``undetermined''
  5784. @item single.tff
  5785. Cumulative number of frames detected as top field first using single-frame detection.
  5786. @item multiple.tff
  5787. Cumulative number of frames detected as top field first using multiple-frame detection.
  5788. @item single.bff
  5789. Cumulative number of frames detected as bottom field first using single-frame detection.
  5790. @item multiple.current_frame
  5791. Detected type of current frame using multiple-frame detection. One of:
  5792. ``tff'' (top field first), ``bff'' (bottom field first),
  5793. ``progressive'', or ``undetermined''
  5794. @item multiple.bff
  5795. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5796. @item single.progressive
  5797. Cumulative number of frames detected as progressive using single-frame detection.
  5798. @item multiple.progressive
  5799. Cumulative number of frames detected as progressive using multiple-frame detection.
  5800. @item single.undetermined
  5801. Cumulative number of frames that could not be classified using single-frame detection.
  5802. @item multiple.undetermined
  5803. Cumulative number of frames that could not be classified using multiple-frame detection.
  5804. @item repeated.current_frame
  5805. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5806. @item repeated.neither
  5807. Cumulative number of frames with no repeated field.
  5808. @item repeated.top
  5809. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5810. @item repeated.bottom
  5811. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5812. @end table
  5813. The filter accepts the following options:
  5814. @table @option
  5815. @item intl_thres
  5816. Set interlacing threshold.
  5817. @item prog_thres
  5818. Set progressive threshold.
  5819. @item repeat_thres
  5820. Threshold for repeated field detection.
  5821. @item half_life
  5822. Number of frames after which a given frame's contribution to the
  5823. statistics is halved (i.e., it contributes only 0.5 to it's
  5824. classification). The default of 0 means that all frames seen are given
  5825. full weight of 1.0 forever.
  5826. @item analyze_interlaced_flag
  5827. When this is not 0 then idet will use the specified number of frames to determine
  5828. if the interlaced flag is accurate, it will not count undetermined frames.
  5829. If the flag is found to be accurate it will be used without any further
  5830. computations, if it is found to be inaccurate it will be cleared without any
  5831. further computations. This allows inserting the idet filter as a low computational
  5832. method to clean up the interlaced flag
  5833. @end table
  5834. @section il
  5835. Deinterleave or interleave fields.
  5836. This filter allows one to process interlaced images fields without
  5837. deinterlacing them. Deinterleaving splits the input frame into 2
  5838. fields (so called half pictures). Odd lines are moved to the top
  5839. half of the output image, even lines to the bottom half.
  5840. You can process (filter) them independently and then re-interleave them.
  5841. The filter accepts the following options:
  5842. @table @option
  5843. @item luma_mode, l
  5844. @item chroma_mode, c
  5845. @item alpha_mode, a
  5846. Available values for @var{luma_mode}, @var{chroma_mode} and
  5847. @var{alpha_mode} are:
  5848. @table @samp
  5849. @item none
  5850. Do nothing.
  5851. @item deinterleave, d
  5852. Deinterleave fields, placing one above the other.
  5853. @item interleave, i
  5854. Interleave fields. Reverse the effect of deinterleaving.
  5855. @end table
  5856. Default value is @code{none}.
  5857. @item luma_swap, ls
  5858. @item chroma_swap, cs
  5859. @item alpha_swap, as
  5860. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5861. @end table
  5862. @section inflate
  5863. Apply inflate effect to the video.
  5864. This filter replaces the pixel by the local(3x3) average by taking into account
  5865. only values higher than the pixel.
  5866. It accepts the following options:
  5867. @table @option
  5868. @item threshold0
  5869. @item threshold1
  5870. @item threshold2
  5871. @item threshold3
  5872. Limit the maximum change for each plane, default is 65535.
  5873. If 0, plane will remain unchanged.
  5874. @end table
  5875. @section interlace
  5876. Simple interlacing filter from progressive contents. This interleaves upper (or
  5877. lower) lines from odd frames with lower (or upper) lines from even frames,
  5878. halving the frame rate and preserving image height.
  5879. @example
  5880. Original Original New Frame
  5881. Frame 'j' Frame 'j+1' (tff)
  5882. ========== =========== ==================
  5883. Line 0 --------------------> Frame 'j' Line 0
  5884. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5885. Line 2 ---------------------> Frame 'j' Line 2
  5886. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5887. ... ... ...
  5888. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5889. @end example
  5890. It accepts the following optional parameters:
  5891. @table @option
  5892. @item scan
  5893. This determines whether the interlaced frame is taken from the even
  5894. (tff - default) or odd (bff) lines of the progressive frame.
  5895. @item lowpass
  5896. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5897. interlacing and reduce moire patterns.
  5898. @end table
  5899. @section kerndeint
  5900. Deinterlace input video by applying Donald Graft's adaptive kernel
  5901. deinterling. Work on interlaced parts of a video to produce
  5902. progressive frames.
  5903. The description of the accepted parameters follows.
  5904. @table @option
  5905. @item thresh
  5906. Set the threshold which affects the filter's tolerance when
  5907. determining if a pixel line must be processed. It must be an integer
  5908. in the range [0,255] and defaults to 10. A value of 0 will result in
  5909. applying the process on every pixels.
  5910. @item map
  5911. Paint pixels exceeding the threshold value to white if set to 1.
  5912. Default is 0.
  5913. @item order
  5914. Set the fields order. Swap fields if set to 1, leave fields alone if
  5915. 0. Default is 0.
  5916. @item sharp
  5917. Enable additional sharpening if set to 1. Default is 0.
  5918. @item twoway
  5919. Enable twoway sharpening if set to 1. Default is 0.
  5920. @end table
  5921. @subsection Examples
  5922. @itemize
  5923. @item
  5924. Apply default values:
  5925. @example
  5926. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5927. @end example
  5928. @item
  5929. Enable additional sharpening:
  5930. @example
  5931. kerndeint=sharp=1
  5932. @end example
  5933. @item
  5934. Paint processed pixels in white:
  5935. @example
  5936. kerndeint=map=1
  5937. @end example
  5938. @end itemize
  5939. @section lenscorrection
  5940. Correct radial lens distortion
  5941. This filter can be used to correct for radial distortion as can result from the use
  5942. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5943. one can use tools available for example as part of opencv or simply trial-and-error.
  5944. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5945. and extract the k1 and k2 coefficients from the resulting matrix.
  5946. Note that effectively the same filter is available in the open-source tools Krita and
  5947. Digikam from the KDE project.
  5948. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5949. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5950. brightness distribution, so you may want to use both filters together in certain
  5951. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5952. be applied before or after lens correction.
  5953. @subsection Options
  5954. The filter accepts the following options:
  5955. @table @option
  5956. @item cx
  5957. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5958. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5959. width.
  5960. @item cy
  5961. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5962. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5963. height.
  5964. @item k1
  5965. Coefficient of the quadratic correction term. 0.5 means no correction.
  5966. @item k2
  5967. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5968. @end table
  5969. The formula that generates the correction is:
  5970. @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)
  5971. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5972. distances from the focal point in the source and target images, respectively.
  5973. @anchor{lut3d}
  5974. @section lut3d
  5975. Apply a 3D LUT to an input video.
  5976. The filter accepts the following options:
  5977. @table @option
  5978. @item file
  5979. Set the 3D LUT file name.
  5980. Currently supported formats:
  5981. @table @samp
  5982. @item 3dl
  5983. AfterEffects
  5984. @item cube
  5985. Iridas
  5986. @item dat
  5987. DaVinci
  5988. @item m3d
  5989. Pandora
  5990. @end table
  5991. @item interp
  5992. Select interpolation mode.
  5993. Available values are:
  5994. @table @samp
  5995. @item nearest
  5996. Use values from the nearest defined point.
  5997. @item trilinear
  5998. Interpolate values using the 8 points defining a cube.
  5999. @item tetrahedral
  6000. Interpolate values using a tetrahedron.
  6001. @end table
  6002. @end table
  6003. @section lut, lutrgb, lutyuv
  6004. Compute a look-up table for binding each pixel component input value
  6005. to an output value, and apply it to the input video.
  6006. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6007. to an RGB input video.
  6008. These filters accept the following parameters:
  6009. @table @option
  6010. @item c0
  6011. set first pixel component expression
  6012. @item c1
  6013. set second pixel component expression
  6014. @item c2
  6015. set third pixel component expression
  6016. @item c3
  6017. set fourth pixel component expression, corresponds to the alpha component
  6018. @item r
  6019. set red component expression
  6020. @item g
  6021. set green component expression
  6022. @item b
  6023. set blue component expression
  6024. @item a
  6025. alpha component expression
  6026. @item y
  6027. set Y/luminance component expression
  6028. @item u
  6029. set U/Cb component expression
  6030. @item v
  6031. set V/Cr component expression
  6032. @end table
  6033. Each of them specifies the expression to use for computing the lookup table for
  6034. the corresponding pixel component values.
  6035. The exact component associated to each of the @var{c*} options depends on the
  6036. format in input.
  6037. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6038. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6039. The expressions can contain the following constants and functions:
  6040. @table @option
  6041. @item w
  6042. @item h
  6043. The input width and height.
  6044. @item val
  6045. The input value for the pixel component.
  6046. @item clipval
  6047. The input value, clipped to the @var{minval}-@var{maxval} range.
  6048. @item maxval
  6049. The maximum value for the pixel component.
  6050. @item minval
  6051. The minimum value for the pixel component.
  6052. @item negval
  6053. The negated value for the pixel component value, clipped to the
  6054. @var{minval}-@var{maxval} range; it corresponds to the expression
  6055. "maxval-clipval+minval".
  6056. @item clip(val)
  6057. The computed value in @var{val}, clipped to the
  6058. @var{minval}-@var{maxval} range.
  6059. @item gammaval(gamma)
  6060. The computed gamma correction value of the pixel component value,
  6061. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6062. expression
  6063. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6064. @end table
  6065. All expressions default to "val".
  6066. @subsection Examples
  6067. @itemize
  6068. @item
  6069. Negate input video:
  6070. @example
  6071. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6072. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6073. @end example
  6074. The above is the same as:
  6075. @example
  6076. lutrgb="r=negval:g=negval:b=negval"
  6077. lutyuv="y=negval:u=negval:v=negval"
  6078. @end example
  6079. @item
  6080. Negate luminance:
  6081. @example
  6082. lutyuv=y=negval
  6083. @end example
  6084. @item
  6085. Remove chroma components, turning the video into a graytone image:
  6086. @example
  6087. lutyuv="u=128:v=128"
  6088. @end example
  6089. @item
  6090. Apply a luma burning effect:
  6091. @example
  6092. lutyuv="y=2*val"
  6093. @end example
  6094. @item
  6095. Remove green and blue components:
  6096. @example
  6097. lutrgb="g=0:b=0"
  6098. @end example
  6099. @item
  6100. Set a constant alpha channel value on input:
  6101. @example
  6102. format=rgba,lutrgb=a="maxval-minval/2"
  6103. @end example
  6104. @item
  6105. Correct luminance gamma by a factor of 0.5:
  6106. @example
  6107. lutyuv=y=gammaval(0.5)
  6108. @end example
  6109. @item
  6110. Discard least significant bits of luma:
  6111. @example
  6112. lutyuv=y='bitand(val, 128+64+32)'
  6113. @end example
  6114. @end itemize
  6115. @section maskedmerge
  6116. Merge the first input stream with the second input stream using per pixel
  6117. weights in the third input stream.
  6118. A value of 0 in the third stream pixel component means that pixel component
  6119. from first stream is returned unchanged, while maximum value (eg. 255 for
  6120. 8-bit videos) means that pixel component from second stream is returned
  6121. unchanged. Intermediate values define the amount of merging between both
  6122. input stream's pixel components.
  6123. This filter accepts the following options:
  6124. @table @option
  6125. @item planes
  6126. Set which planes will be processed as bitmap, unprocessed planes will be
  6127. copied from first stream.
  6128. By default value 0xf, all planes will be processed.
  6129. @end table
  6130. @section mcdeint
  6131. Apply motion-compensation deinterlacing.
  6132. It needs one field per frame as input and must thus be used together
  6133. with yadif=1/3 or equivalent.
  6134. This filter accepts the following options:
  6135. @table @option
  6136. @item mode
  6137. Set the deinterlacing mode.
  6138. It accepts one of the following values:
  6139. @table @samp
  6140. @item fast
  6141. @item medium
  6142. @item slow
  6143. use iterative motion estimation
  6144. @item extra_slow
  6145. like @samp{slow}, but use multiple reference frames.
  6146. @end table
  6147. Default value is @samp{fast}.
  6148. @item parity
  6149. Set the picture field parity assumed for the input video. It must be
  6150. one of the following values:
  6151. @table @samp
  6152. @item 0, tff
  6153. assume top field first
  6154. @item 1, bff
  6155. assume bottom field first
  6156. @end table
  6157. Default value is @samp{bff}.
  6158. @item qp
  6159. Set per-block quantization parameter (QP) used by the internal
  6160. encoder.
  6161. Higher values should result in a smoother motion vector field but less
  6162. optimal individual vectors. Default value is 1.
  6163. @end table
  6164. @section mergeplanes
  6165. Merge color channel components from several video streams.
  6166. The filter accepts up to 4 input streams, and merge selected input
  6167. planes to the output video.
  6168. This filter accepts the following options:
  6169. @table @option
  6170. @item mapping
  6171. Set input to output plane mapping. Default is @code{0}.
  6172. The mappings is specified as a bitmap. It should be specified as a
  6173. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6174. mapping for the first plane of the output stream. 'A' sets the number of
  6175. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6176. corresponding input to use (from 0 to 3). The rest of the mappings is
  6177. similar, 'Bb' describes the mapping for the output stream second
  6178. plane, 'Cc' describes the mapping for the output stream third plane and
  6179. 'Dd' describes the mapping for the output stream fourth plane.
  6180. @item format
  6181. Set output pixel format. Default is @code{yuva444p}.
  6182. @end table
  6183. @subsection Examples
  6184. @itemize
  6185. @item
  6186. Merge three gray video streams of same width and height into single video stream:
  6187. @example
  6188. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6189. @end example
  6190. @item
  6191. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6192. @example
  6193. [a0][a1]mergeplanes=0x00010210:yuva444p
  6194. @end example
  6195. @item
  6196. Swap Y and A plane in yuva444p stream:
  6197. @example
  6198. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6199. @end example
  6200. @item
  6201. Swap U and V plane in yuv420p stream:
  6202. @example
  6203. format=yuv420p,mergeplanes=0x000201:yuv420p
  6204. @end example
  6205. @item
  6206. Cast a rgb24 clip to yuv444p:
  6207. @example
  6208. format=rgb24,mergeplanes=0x000102:yuv444p
  6209. @end example
  6210. @end itemize
  6211. @section mpdecimate
  6212. Drop frames that do not differ greatly from the previous frame in
  6213. order to reduce frame rate.
  6214. The main use of this filter is for very-low-bitrate encoding
  6215. (e.g. streaming over dialup modem), but it could in theory be used for
  6216. fixing movies that were inverse-telecined incorrectly.
  6217. A description of the accepted options follows.
  6218. @table @option
  6219. @item max
  6220. Set the maximum number of consecutive frames which can be dropped (if
  6221. positive), or the minimum interval between dropped frames (if
  6222. negative). If the value is 0, the frame is dropped unregarding the
  6223. number of previous sequentially dropped frames.
  6224. Default value is 0.
  6225. @item hi
  6226. @item lo
  6227. @item frac
  6228. Set the dropping threshold values.
  6229. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6230. represent actual pixel value differences, so a threshold of 64
  6231. corresponds to 1 unit of difference for each pixel, or the same spread
  6232. out differently over the block.
  6233. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6234. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6235. meaning the whole image) differ by more than a threshold of @option{lo}.
  6236. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6237. 64*5, and default value for @option{frac} is 0.33.
  6238. @end table
  6239. @section negate
  6240. Negate input video.
  6241. It accepts an integer in input; if non-zero it negates the
  6242. alpha component (if available). The default value in input is 0.
  6243. @section noformat
  6244. Force libavfilter not to use any of the specified pixel formats for the
  6245. input to the next filter.
  6246. It accepts the following parameters:
  6247. @table @option
  6248. @item pix_fmts
  6249. A '|'-separated list of pixel format names, such as
  6250. apix_fmts=yuv420p|monow|rgb24".
  6251. @end table
  6252. @subsection Examples
  6253. @itemize
  6254. @item
  6255. Force libavfilter to use a format different from @var{yuv420p} for the
  6256. input to the vflip filter:
  6257. @example
  6258. noformat=pix_fmts=yuv420p,vflip
  6259. @end example
  6260. @item
  6261. Convert the input video to any of the formats not contained in the list:
  6262. @example
  6263. noformat=yuv420p|yuv444p|yuv410p
  6264. @end example
  6265. @end itemize
  6266. @section noise
  6267. Add noise on video input frame.
  6268. The filter accepts the following options:
  6269. @table @option
  6270. @item all_seed
  6271. @item c0_seed
  6272. @item c1_seed
  6273. @item c2_seed
  6274. @item c3_seed
  6275. Set noise seed for specific pixel component or all pixel components in case
  6276. of @var{all_seed}. Default value is @code{123457}.
  6277. @item all_strength, alls
  6278. @item c0_strength, c0s
  6279. @item c1_strength, c1s
  6280. @item c2_strength, c2s
  6281. @item c3_strength, c3s
  6282. Set noise strength for specific pixel component or all pixel components in case
  6283. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6284. @item all_flags, allf
  6285. @item c0_flags, c0f
  6286. @item c1_flags, c1f
  6287. @item c2_flags, c2f
  6288. @item c3_flags, c3f
  6289. Set pixel component flags or set flags for all components if @var{all_flags}.
  6290. Available values for component flags are:
  6291. @table @samp
  6292. @item a
  6293. averaged temporal noise (smoother)
  6294. @item p
  6295. mix random noise with a (semi)regular pattern
  6296. @item t
  6297. temporal noise (noise pattern changes between frames)
  6298. @item u
  6299. uniform noise (gaussian otherwise)
  6300. @end table
  6301. @end table
  6302. @subsection Examples
  6303. Add temporal and uniform noise to input video:
  6304. @example
  6305. noise=alls=20:allf=t+u
  6306. @end example
  6307. @section null
  6308. Pass the video source unchanged to the output.
  6309. @section ocr
  6310. Optical Character Recognition
  6311. This filter uses Tesseract for optical character recognition.
  6312. It accepts the following options:
  6313. @table @option
  6314. @item datapath
  6315. Set datapath to tesseract data. Default is to use whatever was
  6316. set at installation.
  6317. @item language
  6318. Set language, default is "eng".
  6319. @item whitelist
  6320. Set character whitelist.
  6321. @item blacklist
  6322. Set character blacklist.
  6323. @end table
  6324. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6325. @section ocv
  6326. Apply a video transform using libopencv.
  6327. To enable this filter, install the libopencv library and headers and
  6328. configure FFmpeg with @code{--enable-libopencv}.
  6329. It accepts the following parameters:
  6330. @table @option
  6331. @item filter_name
  6332. The name of the libopencv filter to apply.
  6333. @item filter_params
  6334. The parameters to pass to the libopencv filter. If not specified, the default
  6335. values are assumed.
  6336. @end table
  6337. Refer to the official libopencv documentation for more precise
  6338. information:
  6339. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6340. Several libopencv filters are supported; see the following subsections.
  6341. @anchor{dilate}
  6342. @subsection dilate
  6343. Dilate an image by using a specific structuring element.
  6344. It corresponds to the libopencv function @code{cvDilate}.
  6345. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6346. @var{struct_el} represents a structuring element, and has the syntax:
  6347. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6348. @var{cols} and @var{rows} represent the number of columns and rows of
  6349. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6350. point, and @var{shape} the shape for the structuring element. @var{shape}
  6351. must be "rect", "cross", "ellipse", or "custom".
  6352. If the value for @var{shape} is "custom", it must be followed by a
  6353. string of the form "=@var{filename}". The file with name
  6354. @var{filename} is assumed to represent a binary image, with each
  6355. printable character corresponding to a bright pixel. When a custom
  6356. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6357. or columns and rows of the read file are assumed instead.
  6358. The default value for @var{struct_el} is "3x3+0x0/rect".
  6359. @var{nb_iterations} specifies the number of times the transform is
  6360. applied to the image, and defaults to 1.
  6361. Some examples:
  6362. @example
  6363. # Use the default values
  6364. ocv=dilate
  6365. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6366. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6367. # Read the shape from the file diamond.shape, iterating two times.
  6368. # The file diamond.shape may contain a pattern of characters like this
  6369. # *
  6370. # ***
  6371. # *****
  6372. # ***
  6373. # *
  6374. # The specified columns and rows are ignored
  6375. # but the anchor point coordinates are not
  6376. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6377. @end example
  6378. @subsection erode
  6379. Erode an image by using a specific structuring element.
  6380. It corresponds to the libopencv function @code{cvErode}.
  6381. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6382. with the same syntax and semantics as the @ref{dilate} filter.
  6383. @subsection smooth
  6384. Smooth the input video.
  6385. The filter takes the following parameters:
  6386. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6387. @var{type} is the type of smooth filter to apply, and must be one of
  6388. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6389. or "bilateral". The default value is "gaussian".
  6390. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6391. depend on the smooth type. @var{param1} and
  6392. @var{param2} accept integer positive values or 0. @var{param3} and
  6393. @var{param4} accept floating point values.
  6394. The default value for @var{param1} is 3. The default value for the
  6395. other parameters is 0.
  6396. These parameters correspond to the parameters assigned to the
  6397. libopencv function @code{cvSmooth}.
  6398. @anchor{overlay}
  6399. @section overlay
  6400. Overlay one video on top of another.
  6401. It takes two inputs and has one output. The first input is the "main"
  6402. video on which the second input is overlaid.
  6403. It accepts the following parameters:
  6404. A description of the accepted options follows.
  6405. @table @option
  6406. @item x
  6407. @item y
  6408. Set the expression for the x and y coordinates of the overlaid video
  6409. on the main video. Default value is "0" for both expressions. In case
  6410. the expression is invalid, it is set to a huge value (meaning that the
  6411. overlay will not be displayed within the output visible area).
  6412. @item eof_action
  6413. The action to take when EOF is encountered on the secondary input; it accepts
  6414. one of the following values:
  6415. @table @option
  6416. @item repeat
  6417. Repeat the last frame (the default).
  6418. @item endall
  6419. End both streams.
  6420. @item pass
  6421. Pass the main input through.
  6422. @end table
  6423. @item eval
  6424. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6425. It accepts the following values:
  6426. @table @samp
  6427. @item init
  6428. only evaluate expressions once during the filter initialization or
  6429. when a command is processed
  6430. @item frame
  6431. evaluate expressions for each incoming frame
  6432. @end table
  6433. Default value is @samp{frame}.
  6434. @item shortest
  6435. If set to 1, force the output to terminate when the shortest input
  6436. terminates. Default value is 0.
  6437. @item format
  6438. Set the format for the output video.
  6439. It accepts the following values:
  6440. @table @samp
  6441. @item yuv420
  6442. force YUV420 output
  6443. @item yuv422
  6444. force YUV422 output
  6445. @item yuv444
  6446. force YUV444 output
  6447. @item rgb
  6448. force RGB output
  6449. @end table
  6450. Default value is @samp{yuv420}.
  6451. @item rgb @emph{(deprecated)}
  6452. If set to 1, force the filter to accept inputs in the RGB
  6453. color space. Default value is 0. This option is deprecated, use
  6454. @option{format} instead.
  6455. @item repeatlast
  6456. If set to 1, force the filter to draw the last overlay frame over the
  6457. main input until the end of the stream. A value of 0 disables this
  6458. behavior. Default value is 1.
  6459. @end table
  6460. The @option{x}, and @option{y} expressions can contain the following
  6461. parameters.
  6462. @table @option
  6463. @item main_w, W
  6464. @item main_h, H
  6465. The main input width and height.
  6466. @item overlay_w, w
  6467. @item overlay_h, h
  6468. The overlay input width and height.
  6469. @item x
  6470. @item y
  6471. The computed values for @var{x} and @var{y}. They are evaluated for
  6472. each new frame.
  6473. @item hsub
  6474. @item vsub
  6475. horizontal and vertical chroma subsample values of the output
  6476. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6477. @var{vsub} is 1.
  6478. @item n
  6479. the number of input frame, starting from 0
  6480. @item pos
  6481. the position in the file of the input frame, NAN if unknown
  6482. @item t
  6483. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6484. @end table
  6485. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6486. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6487. when @option{eval} is set to @samp{init}.
  6488. Be aware that frames are taken from each input video in timestamp
  6489. order, hence, if their initial timestamps differ, it is a good idea
  6490. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6491. have them begin in the same zero timestamp, as the example for
  6492. the @var{movie} filter does.
  6493. You can chain together more overlays but you should test the
  6494. efficiency of such approach.
  6495. @subsection Commands
  6496. This filter supports the following commands:
  6497. @table @option
  6498. @item x
  6499. @item y
  6500. Modify the x and y of the overlay input.
  6501. The command accepts the same syntax of the corresponding option.
  6502. If the specified expression is not valid, it is kept at its current
  6503. value.
  6504. @end table
  6505. @subsection Examples
  6506. @itemize
  6507. @item
  6508. Draw the overlay at 10 pixels from the bottom right corner of the main
  6509. video:
  6510. @example
  6511. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6512. @end example
  6513. Using named options the example above becomes:
  6514. @example
  6515. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6516. @end example
  6517. @item
  6518. Insert a transparent PNG logo in the bottom left corner of the input,
  6519. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6520. @example
  6521. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6522. @end example
  6523. @item
  6524. Insert 2 different transparent PNG logos (second logo on bottom
  6525. right corner) using the @command{ffmpeg} tool:
  6526. @example
  6527. 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
  6528. @end example
  6529. @item
  6530. Add a transparent color layer on top of the main video; @code{WxH}
  6531. must specify the size of the main input to the overlay filter:
  6532. @example
  6533. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6534. @end example
  6535. @item
  6536. Play an original video and a filtered version (here with the deshake
  6537. filter) side by side using the @command{ffplay} tool:
  6538. @example
  6539. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6540. @end example
  6541. The above command is the same as:
  6542. @example
  6543. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6544. @end example
  6545. @item
  6546. Make a sliding overlay appearing from the left to the right top part of the
  6547. screen starting since time 2:
  6548. @example
  6549. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6550. @end example
  6551. @item
  6552. Compose output by putting two input videos side to side:
  6553. @example
  6554. ffmpeg -i left.avi -i right.avi -filter_complex "
  6555. nullsrc=size=200x100 [background];
  6556. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6557. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6558. [background][left] overlay=shortest=1 [background+left];
  6559. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6560. "
  6561. @end example
  6562. @item
  6563. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6564. @example
  6565. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6566. -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]'
  6567. masked.avi
  6568. @end example
  6569. @item
  6570. Chain several overlays in cascade:
  6571. @example
  6572. nullsrc=s=200x200 [bg];
  6573. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6574. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6575. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6576. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6577. [in3] null, [mid2] overlay=100:100 [out0]
  6578. @end example
  6579. @end itemize
  6580. @section owdenoise
  6581. Apply Overcomplete Wavelet denoiser.
  6582. The filter accepts the following options:
  6583. @table @option
  6584. @item depth
  6585. Set depth.
  6586. Larger depth values will denoise lower frequency components more, but
  6587. slow down filtering.
  6588. Must be an int in the range 8-16, default is @code{8}.
  6589. @item luma_strength, ls
  6590. Set luma strength.
  6591. Must be a double value in the range 0-1000, default is @code{1.0}.
  6592. @item chroma_strength, cs
  6593. Set chroma strength.
  6594. Must be a double value in the range 0-1000, default is @code{1.0}.
  6595. @end table
  6596. @anchor{pad}
  6597. @section pad
  6598. Add paddings to the input image, and place the original input at the
  6599. provided @var{x}, @var{y} coordinates.
  6600. It accepts the following parameters:
  6601. @table @option
  6602. @item width, w
  6603. @item height, h
  6604. Specify an expression for the size of the output image with the
  6605. paddings added. If the value for @var{width} or @var{height} is 0, the
  6606. corresponding input size is used for the output.
  6607. The @var{width} expression can reference the value set by the
  6608. @var{height} expression, and vice versa.
  6609. The default value of @var{width} and @var{height} is 0.
  6610. @item x
  6611. @item y
  6612. Specify the offsets to place the input image at within the padded area,
  6613. with respect to the top/left border of the output image.
  6614. The @var{x} expression can reference the value set by the @var{y}
  6615. expression, and vice versa.
  6616. The default value of @var{x} and @var{y} is 0.
  6617. @item color
  6618. Specify the color of the padded area. For the syntax of this option,
  6619. check the "Color" section in the ffmpeg-utils manual.
  6620. The default value of @var{color} is "black".
  6621. @end table
  6622. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6623. options are expressions containing the following constants:
  6624. @table @option
  6625. @item in_w
  6626. @item in_h
  6627. The input video width and height.
  6628. @item iw
  6629. @item ih
  6630. These are the same as @var{in_w} and @var{in_h}.
  6631. @item out_w
  6632. @item out_h
  6633. The output width and height (the size of the padded area), as
  6634. specified by the @var{width} and @var{height} expressions.
  6635. @item ow
  6636. @item oh
  6637. These are the same as @var{out_w} and @var{out_h}.
  6638. @item x
  6639. @item y
  6640. The x and y offsets as specified by the @var{x} and @var{y}
  6641. expressions, or NAN if not yet specified.
  6642. @item a
  6643. same as @var{iw} / @var{ih}
  6644. @item sar
  6645. input sample aspect ratio
  6646. @item dar
  6647. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6648. @item hsub
  6649. @item vsub
  6650. The horizontal and vertical chroma subsample values. For example for the
  6651. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6652. @end table
  6653. @subsection Examples
  6654. @itemize
  6655. @item
  6656. Add paddings with the color "violet" to the input video. The output video
  6657. size is 640x480, and the top-left corner of the input video is placed at
  6658. column 0, row 40
  6659. @example
  6660. pad=640:480:0:40:violet
  6661. @end example
  6662. The example above is equivalent to the following command:
  6663. @example
  6664. pad=width=640:height=480:x=0:y=40:color=violet
  6665. @end example
  6666. @item
  6667. Pad the input to get an output with dimensions increased by 3/2,
  6668. and put the input video at the center of the padded area:
  6669. @example
  6670. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6671. @end example
  6672. @item
  6673. Pad the input to get a squared output with size equal to the maximum
  6674. value between the input width and height, and put the input video at
  6675. the center of the padded area:
  6676. @example
  6677. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6678. @end example
  6679. @item
  6680. Pad the input to get a final w/h ratio of 16:9:
  6681. @example
  6682. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6683. @end example
  6684. @item
  6685. In case of anamorphic video, in order to set the output display aspect
  6686. correctly, it is necessary to use @var{sar} in the expression,
  6687. according to the relation:
  6688. @example
  6689. (ih * X / ih) * sar = output_dar
  6690. X = output_dar / sar
  6691. @end example
  6692. Thus the previous example needs to be modified to:
  6693. @example
  6694. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6695. @end example
  6696. @item
  6697. Double the output size and put the input video in the bottom-right
  6698. corner of the output padded area:
  6699. @example
  6700. pad="2*iw:2*ih:ow-iw:oh-ih"
  6701. @end example
  6702. @end itemize
  6703. @anchor{palettegen}
  6704. @section palettegen
  6705. Generate one palette for a whole video stream.
  6706. It accepts the following options:
  6707. @table @option
  6708. @item max_colors
  6709. Set the maximum number of colors to quantize in the palette.
  6710. Note: the palette will still contain 256 colors; the unused palette entries
  6711. will be black.
  6712. @item reserve_transparent
  6713. Create a palette of 255 colors maximum and reserve the last one for
  6714. transparency. Reserving the transparency color is useful for GIF optimization.
  6715. If not set, the maximum of colors in the palette will be 256. You probably want
  6716. to disable this option for a standalone image.
  6717. Set by default.
  6718. @item stats_mode
  6719. Set statistics mode.
  6720. It accepts the following values:
  6721. @table @samp
  6722. @item full
  6723. Compute full frame histograms.
  6724. @item diff
  6725. Compute histograms only for the part that differs from previous frame. This
  6726. might be relevant to give more importance to the moving part of your input if
  6727. the background is static.
  6728. @end table
  6729. Default value is @var{full}.
  6730. @end table
  6731. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6732. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6733. color quantization of the palette. This information is also visible at
  6734. @var{info} logging level.
  6735. @subsection Examples
  6736. @itemize
  6737. @item
  6738. Generate a representative palette of a given video using @command{ffmpeg}:
  6739. @example
  6740. ffmpeg -i input.mkv -vf palettegen palette.png
  6741. @end example
  6742. @end itemize
  6743. @section paletteuse
  6744. Use a palette to downsample an input video stream.
  6745. The filter takes two inputs: one video stream and a palette. The palette must
  6746. be a 256 pixels image.
  6747. It accepts the following options:
  6748. @table @option
  6749. @item dither
  6750. Select dithering mode. Available algorithms are:
  6751. @table @samp
  6752. @item bayer
  6753. Ordered 8x8 bayer dithering (deterministic)
  6754. @item heckbert
  6755. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6756. Note: this dithering is sometimes considered "wrong" and is included as a
  6757. reference.
  6758. @item floyd_steinberg
  6759. Floyd and Steingberg dithering (error diffusion)
  6760. @item sierra2
  6761. Frankie Sierra dithering v2 (error diffusion)
  6762. @item sierra2_4a
  6763. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6764. @end table
  6765. Default is @var{sierra2_4a}.
  6766. @item bayer_scale
  6767. When @var{bayer} dithering is selected, this option defines the scale of the
  6768. pattern (how much the crosshatch pattern is visible). A low value means more
  6769. visible pattern for less banding, and higher value means less visible pattern
  6770. at the cost of more banding.
  6771. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6772. @item diff_mode
  6773. If set, define the zone to process
  6774. @table @samp
  6775. @item rectangle
  6776. Only the changing rectangle will be reprocessed. This is similar to GIF
  6777. cropping/offsetting compression mechanism. This option can be useful for speed
  6778. if only a part of the image is changing, and has use cases such as limiting the
  6779. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6780. moving scene (it leads to more deterministic output if the scene doesn't change
  6781. much, and as a result less moving noise and better GIF compression).
  6782. @end table
  6783. Default is @var{none}.
  6784. @end table
  6785. @subsection Examples
  6786. @itemize
  6787. @item
  6788. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6789. using @command{ffmpeg}:
  6790. @example
  6791. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6792. @end example
  6793. @end itemize
  6794. @section perspective
  6795. Correct perspective of video not recorded perpendicular to the screen.
  6796. A description of the accepted parameters follows.
  6797. @table @option
  6798. @item x0
  6799. @item y0
  6800. @item x1
  6801. @item y1
  6802. @item x2
  6803. @item y2
  6804. @item x3
  6805. @item y3
  6806. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6807. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6808. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6809. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6810. then the corners of the source will be sent to the specified coordinates.
  6811. The expressions can use the following variables:
  6812. @table @option
  6813. @item W
  6814. @item H
  6815. the width and height of video frame.
  6816. @end table
  6817. @item interpolation
  6818. Set interpolation for perspective correction.
  6819. It accepts the following values:
  6820. @table @samp
  6821. @item linear
  6822. @item cubic
  6823. @end table
  6824. Default value is @samp{linear}.
  6825. @item sense
  6826. Set interpretation of coordinate options.
  6827. It accepts the following values:
  6828. @table @samp
  6829. @item 0, source
  6830. Send point in the source specified by the given coordinates to
  6831. the corners of the destination.
  6832. @item 1, destination
  6833. Send the corners of the source to the point in the destination specified
  6834. by the given coordinates.
  6835. Default value is @samp{source}.
  6836. @end table
  6837. @end table
  6838. @section phase
  6839. Delay interlaced video by one field time so that the field order changes.
  6840. The intended use is to fix PAL movies that have been captured with the
  6841. opposite field order to the film-to-video transfer.
  6842. A description of the accepted parameters follows.
  6843. @table @option
  6844. @item mode
  6845. Set phase mode.
  6846. It accepts the following values:
  6847. @table @samp
  6848. @item t
  6849. Capture field order top-first, transfer bottom-first.
  6850. Filter will delay the bottom field.
  6851. @item b
  6852. Capture field order bottom-first, transfer top-first.
  6853. Filter will delay the top field.
  6854. @item p
  6855. Capture and transfer with the same field order. This mode only exists
  6856. for the documentation of the other options to refer to, but if you
  6857. actually select it, the filter will faithfully do nothing.
  6858. @item a
  6859. Capture field order determined automatically by field flags, transfer
  6860. opposite.
  6861. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6862. basis using field flags. If no field information is available,
  6863. then this works just like @samp{u}.
  6864. @item u
  6865. Capture unknown or varying, transfer opposite.
  6866. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6867. analyzing the images and selecting the alternative that produces best
  6868. match between the fields.
  6869. @item T
  6870. Capture top-first, transfer unknown or varying.
  6871. Filter selects among @samp{t} and @samp{p} using image analysis.
  6872. @item B
  6873. Capture bottom-first, transfer unknown or varying.
  6874. Filter selects among @samp{b} and @samp{p} using image analysis.
  6875. @item A
  6876. Capture determined by field flags, transfer unknown or varying.
  6877. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6878. image analysis. If no field information is available, then this works just
  6879. like @samp{U}. This is the default mode.
  6880. @item U
  6881. Both capture and transfer unknown or varying.
  6882. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6883. @end table
  6884. @end table
  6885. @section pixdesctest
  6886. Pixel format descriptor test filter, mainly useful for internal
  6887. testing. The output video should be equal to the input video.
  6888. For example:
  6889. @example
  6890. format=monow, pixdesctest
  6891. @end example
  6892. can be used to test the monowhite pixel format descriptor definition.
  6893. @section pp
  6894. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6895. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6896. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6897. Each subfilter and some options have a short and a long name that can be used
  6898. interchangeably, i.e. dr/dering are the same.
  6899. The filters accept the following options:
  6900. @table @option
  6901. @item subfilters
  6902. Set postprocessing subfilters string.
  6903. @end table
  6904. All subfilters share common options to determine their scope:
  6905. @table @option
  6906. @item a/autoq
  6907. Honor the quality commands for this subfilter.
  6908. @item c/chrom
  6909. Do chrominance filtering, too (default).
  6910. @item y/nochrom
  6911. Do luminance filtering only (no chrominance).
  6912. @item n/noluma
  6913. Do chrominance filtering only (no luminance).
  6914. @end table
  6915. These options can be appended after the subfilter name, separated by a '|'.
  6916. Available subfilters are:
  6917. @table @option
  6918. @item hb/hdeblock[|difference[|flatness]]
  6919. Horizontal deblocking filter
  6920. @table @option
  6921. @item difference
  6922. Difference factor where higher values mean more deblocking (default: @code{32}).
  6923. @item flatness
  6924. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6925. @end table
  6926. @item vb/vdeblock[|difference[|flatness]]
  6927. Vertical deblocking filter
  6928. @table @option
  6929. @item difference
  6930. Difference factor where higher values mean more deblocking (default: @code{32}).
  6931. @item flatness
  6932. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6933. @end table
  6934. @item ha/hadeblock[|difference[|flatness]]
  6935. Accurate horizontal deblocking filter
  6936. @table @option
  6937. @item difference
  6938. Difference factor where higher values mean more deblocking (default: @code{32}).
  6939. @item flatness
  6940. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6941. @end table
  6942. @item va/vadeblock[|difference[|flatness]]
  6943. Accurate vertical deblocking filter
  6944. @table @option
  6945. @item difference
  6946. Difference factor where higher values mean more deblocking (default: @code{32}).
  6947. @item flatness
  6948. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6949. @end table
  6950. @end table
  6951. The horizontal and vertical deblocking filters share the difference and
  6952. flatness values so you cannot set different horizontal and vertical
  6953. thresholds.
  6954. @table @option
  6955. @item h1/x1hdeblock
  6956. Experimental horizontal deblocking filter
  6957. @item v1/x1vdeblock
  6958. Experimental vertical deblocking filter
  6959. @item dr/dering
  6960. Deringing filter
  6961. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6962. @table @option
  6963. @item threshold1
  6964. larger -> stronger filtering
  6965. @item threshold2
  6966. larger -> stronger filtering
  6967. @item threshold3
  6968. larger -> stronger filtering
  6969. @end table
  6970. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6971. @table @option
  6972. @item f/fullyrange
  6973. Stretch luminance to @code{0-255}.
  6974. @end table
  6975. @item lb/linblenddeint
  6976. Linear blend deinterlacing filter that deinterlaces the given block by
  6977. filtering all lines with a @code{(1 2 1)} filter.
  6978. @item li/linipoldeint
  6979. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6980. linearly interpolating every second line.
  6981. @item ci/cubicipoldeint
  6982. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6983. cubically interpolating every second line.
  6984. @item md/mediandeint
  6985. Median deinterlacing filter that deinterlaces the given block by applying a
  6986. median filter to every second line.
  6987. @item fd/ffmpegdeint
  6988. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6989. second line with a @code{(-1 4 2 4 -1)} filter.
  6990. @item l5/lowpass5
  6991. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6992. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6993. @item fq/forceQuant[|quantizer]
  6994. Overrides the quantizer table from the input with the constant quantizer you
  6995. specify.
  6996. @table @option
  6997. @item quantizer
  6998. Quantizer to use
  6999. @end table
  7000. @item de/default
  7001. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7002. @item fa/fast
  7003. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7004. @item ac
  7005. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7006. @end table
  7007. @subsection Examples
  7008. @itemize
  7009. @item
  7010. Apply horizontal and vertical deblocking, deringing and automatic
  7011. brightness/contrast:
  7012. @example
  7013. pp=hb/vb/dr/al
  7014. @end example
  7015. @item
  7016. Apply default filters without brightness/contrast correction:
  7017. @example
  7018. pp=de/-al
  7019. @end example
  7020. @item
  7021. Apply default filters and temporal denoiser:
  7022. @example
  7023. pp=default/tmpnoise|1|2|3
  7024. @end example
  7025. @item
  7026. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7027. automatically depending on available CPU time:
  7028. @example
  7029. pp=hb|y/vb|a
  7030. @end example
  7031. @end itemize
  7032. @section pp7
  7033. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7034. similar to spp = 6 with 7 point DCT, where only the center sample is
  7035. used after IDCT.
  7036. The filter accepts the following options:
  7037. @table @option
  7038. @item qp
  7039. Force a constant quantization parameter. It accepts an integer in range
  7040. 0 to 63. If not set, the filter will use the QP from the video stream
  7041. (if available).
  7042. @item mode
  7043. Set thresholding mode. Available modes are:
  7044. @table @samp
  7045. @item hard
  7046. Set hard thresholding.
  7047. @item soft
  7048. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7049. @item medium
  7050. Set medium thresholding (good results, default).
  7051. @end table
  7052. @end table
  7053. @section psnr
  7054. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7055. Ratio) between two input videos.
  7056. This filter takes in input two input videos, the first input is
  7057. considered the "main" source and is passed unchanged to the
  7058. output. The second input is used as a "reference" video for computing
  7059. the PSNR.
  7060. Both video inputs must have the same resolution and pixel format for
  7061. this filter to work correctly. Also it assumes that both inputs
  7062. have the same number of frames, which are compared one by one.
  7063. The obtained average PSNR is printed through the logging system.
  7064. The filter stores the accumulated MSE (mean squared error) of each
  7065. frame, and at the end of the processing it is averaged across all frames
  7066. equally, and the following formula is applied to obtain the PSNR:
  7067. @example
  7068. PSNR = 10*log10(MAX^2/MSE)
  7069. @end example
  7070. Where MAX is the average of the maximum values of each component of the
  7071. image.
  7072. The description of the accepted parameters follows.
  7073. @table @option
  7074. @item stats_file, f
  7075. If specified the filter will use the named file to save the PSNR of
  7076. each individual frame. When filename equals "-" the data is sent to
  7077. standard output.
  7078. @end table
  7079. The file printed if @var{stats_file} is selected, contains a sequence of
  7080. key/value pairs of the form @var{key}:@var{value} for each compared
  7081. couple of frames.
  7082. A description of each shown parameter follows:
  7083. @table @option
  7084. @item n
  7085. sequential number of the input frame, starting from 1
  7086. @item mse_avg
  7087. Mean Square Error pixel-by-pixel average difference of the compared
  7088. frames, averaged over all the image components.
  7089. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7090. Mean Square Error pixel-by-pixel average difference of the compared
  7091. frames for the component specified by the suffix.
  7092. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7093. Peak Signal to Noise ratio of the compared frames for the component
  7094. specified by the suffix.
  7095. @end table
  7096. For example:
  7097. @example
  7098. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7099. [main][ref] psnr="stats_file=stats.log" [out]
  7100. @end example
  7101. On this example the input file being processed is compared with the
  7102. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7103. is stored in @file{stats.log}.
  7104. @anchor{pullup}
  7105. @section pullup
  7106. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7107. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7108. content.
  7109. The pullup filter is designed to take advantage of future context in making
  7110. its decisions. This filter is stateless in the sense that it does not lock
  7111. onto a pattern to follow, but it instead looks forward to the following
  7112. fields in order to identify matches and rebuild progressive frames.
  7113. To produce content with an even framerate, insert the fps filter after
  7114. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7115. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7116. The filter accepts the following options:
  7117. @table @option
  7118. @item jl
  7119. @item jr
  7120. @item jt
  7121. @item jb
  7122. These options set the amount of "junk" to ignore at the left, right, top, and
  7123. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7124. while top and bottom are in units of 2 lines.
  7125. The default is 8 pixels on each side.
  7126. @item sb
  7127. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7128. filter generating an occasional mismatched frame, but it may also cause an
  7129. excessive number of frames to be dropped during high motion sequences.
  7130. Conversely, setting it to -1 will make filter match fields more easily.
  7131. This may help processing of video where there is slight blurring between
  7132. the fields, but may also cause there to be interlaced frames in the output.
  7133. Default value is @code{0}.
  7134. @item mp
  7135. Set the metric plane to use. It accepts the following values:
  7136. @table @samp
  7137. @item l
  7138. Use luma plane.
  7139. @item u
  7140. Use chroma blue plane.
  7141. @item v
  7142. Use chroma red plane.
  7143. @end table
  7144. This option may be set to use chroma plane instead of the default luma plane
  7145. for doing filter's computations. This may improve accuracy on very clean
  7146. source material, but more likely will decrease accuracy, especially if there
  7147. is chroma noise (rainbow effect) or any grayscale video.
  7148. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7149. load and make pullup usable in realtime on slow machines.
  7150. @end table
  7151. For best results (without duplicated frames in the output file) it is
  7152. necessary to change the output frame rate. For example, to inverse
  7153. telecine NTSC input:
  7154. @example
  7155. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7156. @end example
  7157. @section qp
  7158. Change video quantization parameters (QP).
  7159. The filter accepts the following option:
  7160. @table @option
  7161. @item qp
  7162. Set expression for quantization parameter.
  7163. @end table
  7164. The expression is evaluated through the eval API and can contain, among others,
  7165. the following constants:
  7166. @table @var
  7167. @item known
  7168. 1 if index is not 129, 0 otherwise.
  7169. @item qp
  7170. Sequentional index starting from -129 to 128.
  7171. @end table
  7172. @subsection Examples
  7173. @itemize
  7174. @item
  7175. Some equation like:
  7176. @example
  7177. qp=2+2*sin(PI*qp)
  7178. @end example
  7179. @end itemize
  7180. @section random
  7181. Flush video frames from internal cache of frames into a random order.
  7182. No frame is discarded.
  7183. Inspired by @ref{frei0r} nervous filter.
  7184. @table @option
  7185. @item frames
  7186. Set size in number of frames of internal cache, in range from @code{2} to
  7187. @code{512}. Default is @code{30}.
  7188. @item seed
  7189. Set seed for random number generator, must be an integer included between
  7190. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7191. less than @code{0}, the filter will try to use a good random seed on a
  7192. best effort basis.
  7193. @end table
  7194. @section removegrain
  7195. The removegrain filter is a spatial denoiser for progressive video.
  7196. @table @option
  7197. @item m0
  7198. Set mode for the first plane.
  7199. @item m1
  7200. Set mode for the second plane.
  7201. @item m2
  7202. Set mode for the third plane.
  7203. @item m3
  7204. Set mode for the fourth plane.
  7205. @end table
  7206. Range of mode is from 0 to 24. Description of each mode follows:
  7207. @table @var
  7208. @item 0
  7209. Leave input plane unchanged. Default.
  7210. @item 1
  7211. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7212. @item 2
  7213. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7214. @item 3
  7215. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7216. @item 4
  7217. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7218. This is equivalent to a median filter.
  7219. @item 5
  7220. Line-sensitive clipping giving the minimal change.
  7221. @item 6
  7222. Line-sensitive clipping, intermediate.
  7223. @item 7
  7224. Line-sensitive clipping, intermediate.
  7225. @item 8
  7226. Line-sensitive clipping, intermediate.
  7227. @item 9
  7228. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7229. @item 10
  7230. Replaces the target pixel with the closest neighbour.
  7231. @item 11
  7232. [1 2 1] horizontal and vertical kernel blur.
  7233. @item 12
  7234. Same as mode 11.
  7235. @item 13
  7236. Bob mode, interpolates top field from the line where the neighbours
  7237. pixels are the closest.
  7238. @item 14
  7239. Bob mode, interpolates bottom field from the line where the neighbours
  7240. pixels are the closest.
  7241. @item 15
  7242. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7243. interpolation formula.
  7244. @item 16
  7245. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7246. interpolation formula.
  7247. @item 17
  7248. Clips the pixel with the minimum and maximum of respectively the maximum and
  7249. minimum of each pair of opposite neighbour pixels.
  7250. @item 18
  7251. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7252. the current pixel is minimal.
  7253. @item 19
  7254. Replaces the pixel with the average of its 8 neighbours.
  7255. @item 20
  7256. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7257. @item 21
  7258. Clips pixels using the averages of opposite neighbour.
  7259. @item 22
  7260. Same as mode 21 but simpler and faster.
  7261. @item 23
  7262. Small edge and halo removal, but reputed useless.
  7263. @item 24
  7264. Similar as 23.
  7265. @end table
  7266. @section removelogo
  7267. Suppress a TV station logo, using an image file to determine which
  7268. pixels comprise the logo. It works by filling in the pixels that
  7269. comprise the logo with neighboring pixels.
  7270. The filter accepts the following options:
  7271. @table @option
  7272. @item filename, f
  7273. Set the filter bitmap file, which can be any image format supported by
  7274. libavformat. The width and height of the image file must match those of the
  7275. video stream being processed.
  7276. @end table
  7277. Pixels in the provided bitmap image with a value of zero are not
  7278. considered part of the logo, non-zero pixels are considered part of
  7279. the logo. If you use white (255) for the logo and black (0) for the
  7280. rest, you will be safe. For making the filter bitmap, it is
  7281. recommended to take a screen capture of a black frame with the logo
  7282. visible, and then using a threshold filter followed by the erode
  7283. filter once or twice.
  7284. If needed, little splotches can be fixed manually. Remember that if
  7285. logo pixels are not covered, the filter quality will be much
  7286. reduced. Marking too many pixels as part of the logo does not hurt as
  7287. much, but it will increase the amount of blurring needed to cover over
  7288. the image and will destroy more information than necessary, and extra
  7289. pixels will slow things down on a large logo.
  7290. @section repeatfields
  7291. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7292. fields based on its value.
  7293. @section reverse, areverse
  7294. Reverse a clip.
  7295. Warning: This filter requires memory to buffer the entire clip, so trimming
  7296. is suggested.
  7297. @subsection Examples
  7298. @itemize
  7299. @item
  7300. Take the first 5 seconds of a clip, and reverse it.
  7301. @example
  7302. trim=end=5,reverse
  7303. @end example
  7304. @end itemize
  7305. @section rotate
  7306. Rotate video by an arbitrary angle expressed in radians.
  7307. The filter accepts the following options:
  7308. A description of the optional parameters follows.
  7309. @table @option
  7310. @item angle, a
  7311. Set an expression for the angle by which to rotate the input video
  7312. clockwise, expressed as a number of radians. A negative value will
  7313. result in a counter-clockwise rotation. By default it is set to "0".
  7314. This expression is evaluated for each frame.
  7315. @item out_w, ow
  7316. Set the output width expression, default value is "iw".
  7317. This expression is evaluated just once during configuration.
  7318. @item out_h, oh
  7319. Set the output height expression, default value is "ih".
  7320. This expression is evaluated just once during configuration.
  7321. @item bilinear
  7322. Enable bilinear interpolation if set to 1, a value of 0 disables
  7323. it. Default value is 1.
  7324. @item fillcolor, c
  7325. Set the color used to fill the output area not covered by the rotated
  7326. image. For the general syntax of this option, check the "Color" section in the
  7327. ffmpeg-utils manual. If the special value "none" is selected then no
  7328. background is printed (useful for example if the background is never shown).
  7329. Default value is "black".
  7330. @end table
  7331. The expressions for the angle and the output size can contain the
  7332. following constants and functions:
  7333. @table @option
  7334. @item n
  7335. sequential number of the input frame, starting from 0. It is always NAN
  7336. before the first frame is filtered.
  7337. @item t
  7338. time in seconds of the input frame, it is set to 0 when the filter is
  7339. configured. It is always NAN before the first frame is filtered.
  7340. @item hsub
  7341. @item vsub
  7342. horizontal and vertical chroma subsample values. For example for the
  7343. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7344. @item in_w, iw
  7345. @item in_h, ih
  7346. the input video width and height
  7347. @item out_w, ow
  7348. @item out_h, oh
  7349. the output width and height, that is the size of the padded area as
  7350. specified by the @var{width} and @var{height} expressions
  7351. @item rotw(a)
  7352. @item roth(a)
  7353. the minimal width/height required for completely containing the input
  7354. video rotated by @var{a} radians.
  7355. These are only available when computing the @option{out_w} and
  7356. @option{out_h} expressions.
  7357. @end table
  7358. @subsection Examples
  7359. @itemize
  7360. @item
  7361. Rotate the input by PI/6 radians clockwise:
  7362. @example
  7363. rotate=PI/6
  7364. @end example
  7365. @item
  7366. Rotate the input by PI/6 radians counter-clockwise:
  7367. @example
  7368. rotate=-PI/6
  7369. @end example
  7370. @item
  7371. Rotate the input by 45 degrees clockwise:
  7372. @example
  7373. rotate=45*PI/180
  7374. @end example
  7375. @item
  7376. Apply a constant rotation with period T, starting from an angle of PI/3:
  7377. @example
  7378. rotate=PI/3+2*PI*t/T
  7379. @end example
  7380. @item
  7381. Make the input video rotation oscillating with a period of T
  7382. seconds and an amplitude of A radians:
  7383. @example
  7384. rotate=A*sin(2*PI/T*t)
  7385. @end example
  7386. @item
  7387. Rotate the video, output size is chosen so that the whole rotating
  7388. input video is always completely contained in the output:
  7389. @example
  7390. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7391. @end example
  7392. @item
  7393. Rotate the video, reduce the output size so that no background is ever
  7394. shown:
  7395. @example
  7396. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7397. @end example
  7398. @end itemize
  7399. @subsection Commands
  7400. The filter supports the following commands:
  7401. @table @option
  7402. @item a, angle
  7403. Set the angle expression.
  7404. The command accepts the same syntax of the corresponding option.
  7405. If the specified expression is not valid, it is kept at its current
  7406. value.
  7407. @end table
  7408. @section sab
  7409. Apply Shape Adaptive Blur.
  7410. The filter accepts the following options:
  7411. @table @option
  7412. @item luma_radius, lr
  7413. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7414. value is 1.0. A greater value will result in a more blurred image, and
  7415. in slower processing.
  7416. @item luma_pre_filter_radius, lpfr
  7417. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7418. value is 1.0.
  7419. @item luma_strength, ls
  7420. Set luma maximum difference between pixels to still be considered, must
  7421. be a value in the 0.1-100.0 range, default value is 1.0.
  7422. @item chroma_radius, cr
  7423. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7424. greater value will result in a more blurred image, and in slower
  7425. processing.
  7426. @item chroma_pre_filter_radius, cpfr
  7427. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7428. @item chroma_strength, cs
  7429. Set chroma maximum difference between pixels to still be considered,
  7430. must be a value in the 0.1-100.0 range.
  7431. @end table
  7432. Each chroma option value, if not explicitly specified, is set to the
  7433. corresponding luma option value.
  7434. @anchor{scale}
  7435. @section scale
  7436. Scale (resize) the input video, using the libswscale library.
  7437. The scale filter forces the output display aspect ratio to be the same
  7438. of the input, by changing the output sample aspect ratio.
  7439. If the input image format is different from the format requested by
  7440. the next filter, the scale filter will convert the input to the
  7441. requested format.
  7442. @subsection Options
  7443. The filter accepts the following options, or any of the options
  7444. supported by the libswscale scaler.
  7445. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7446. the complete list of scaler options.
  7447. @table @option
  7448. @item width, w
  7449. @item height, h
  7450. Set the output video dimension expression. Default value is the input
  7451. dimension.
  7452. If the value is 0, the input width is used for the output.
  7453. If one of the values is -1, the scale filter will use a value that
  7454. maintains the aspect ratio of the input image, calculated from the
  7455. other specified dimension. If both of them are -1, the input size is
  7456. used
  7457. If one of the values is -n with n > 1, the scale filter will also use a value
  7458. that maintains the aspect ratio of the input image, calculated from the other
  7459. specified dimension. After that it will, however, make sure that the calculated
  7460. dimension is divisible by n and adjust the value if necessary.
  7461. See below for the list of accepted constants for use in the dimension
  7462. expression.
  7463. @item interl
  7464. Set the interlacing mode. It accepts the following values:
  7465. @table @samp
  7466. @item 1
  7467. Force interlaced aware scaling.
  7468. @item 0
  7469. Do not apply interlaced scaling.
  7470. @item -1
  7471. Select interlaced aware scaling depending on whether the source frames
  7472. are flagged as interlaced or not.
  7473. @end table
  7474. Default value is @samp{0}.
  7475. @item flags
  7476. Set libswscale scaling flags. See
  7477. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7478. complete list of values. If not explicitly specified the filter applies
  7479. the default flags.
  7480. @item size, s
  7481. Set the video size. For the syntax of this option, check the
  7482. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7483. @item in_color_matrix
  7484. @item out_color_matrix
  7485. Set in/output YCbCr color space type.
  7486. This allows the autodetected value to be overridden as well as allows forcing
  7487. a specific value used for the output and encoder.
  7488. If not specified, the color space type depends on the pixel format.
  7489. Possible values:
  7490. @table @samp
  7491. @item auto
  7492. Choose automatically.
  7493. @item bt709
  7494. Format conforming to International Telecommunication Union (ITU)
  7495. Recommendation BT.709.
  7496. @item fcc
  7497. Set color space conforming to the United States Federal Communications
  7498. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7499. @item bt601
  7500. Set color space conforming to:
  7501. @itemize
  7502. @item
  7503. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7504. @item
  7505. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7506. @item
  7507. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7508. @end itemize
  7509. @item smpte240m
  7510. Set color space conforming to SMPTE ST 240:1999.
  7511. @end table
  7512. @item in_range
  7513. @item out_range
  7514. Set in/output YCbCr sample range.
  7515. This allows the autodetected value to be overridden as well as allows forcing
  7516. a specific value used for the output and encoder. If not specified, the
  7517. range depends on the pixel format. Possible values:
  7518. @table @samp
  7519. @item auto
  7520. Choose automatically.
  7521. @item jpeg/full/pc
  7522. Set full range (0-255 in case of 8-bit luma).
  7523. @item mpeg/tv
  7524. Set "MPEG" range (16-235 in case of 8-bit luma).
  7525. @end table
  7526. @item force_original_aspect_ratio
  7527. Enable decreasing or increasing output video width or height if necessary to
  7528. keep the original aspect ratio. Possible values:
  7529. @table @samp
  7530. @item disable
  7531. Scale the video as specified and disable this feature.
  7532. @item decrease
  7533. The output video dimensions will automatically be decreased if needed.
  7534. @item increase
  7535. The output video dimensions will automatically be increased if needed.
  7536. @end table
  7537. One useful instance of this option is that when you know a specific device's
  7538. maximum allowed resolution, you can use this to limit the output video to
  7539. that, while retaining the aspect ratio. For example, device A allows
  7540. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7541. decrease) and specifying 1280x720 to the command line makes the output
  7542. 1280x533.
  7543. Please note that this is a different thing than specifying -1 for @option{w}
  7544. or @option{h}, you still need to specify the output resolution for this option
  7545. to work.
  7546. @end table
  7547. The values of the @option{w} and @option{h} options are expressions
  7548. containing the following constants:
  7549. @table @var
  7550. @item in_w
  7551. @item in_h
  7552. The input width and height
  7553. @item iw
  7554. @item ih
  7555. These are the same as @var{in_w} and @var{in_h}.
  7556. @item out_w
  7557. @item out_h
  7558. The output (scaled) width and height
  7559. @item ow
  7560. @item oh
  7561. These are the same as @var{out_w} and @var{out_h}
  7562. @item a
  7563. The same as @var{iw} / @var{ih}
  7564. @item sar
  7565. input sample aspect ratio
  7566. @item dar
  7567. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7568. @item hsub
  7569. @item vsub
  7570. horizontal and vertical input chroma subsample values. For example for the
  7571. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7572. @item ohsub
  7573. @item ovsub
  7574. horizontal and vertical output chroma subsample values. For example for the
  7575. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7576. @end table
  7577. @subsection Examples
  7578. @itemize
  7579. @item
  7580. Scale the input video to a size of 200x100
  7581. @example
  7582. scale=w=200:h=100
  7583. @end example
  7584. This is equivalent to:
  7585. @example
  7586. scale=200:100
  7587. @end example
  7588. or:
  7589. @example
  7590. scale=200x100
  7591. @end example
  7592. @item
  7593. Specify a size abbreviation for the output size:
  7594. @example
  7595. scale=qcif
  7596. @end example
  7597. which can also be written as:
  7598. @example
  7599. scale=size=qcif
  7600. @end example
  7601. @item
  7602. Scale the input to 2x:
  7603. @example
  7604. scale=w=2*iw:h=2*ih
  7605. @end example
  7606. @item
  7607. The above is the same as:
  7608. @example
  7609. scale=2*in_w:2*in_h
  7610. @end example
  7611. @item
  7612. Scale the input to 2x with forced interlaced scaling:
  7613. @example
  7614. scale=2*iw:2*ih:interl=1
  7615. @end example
  7616. @item
  7617. Scale the input to half size:
  7618. @example
  7619. scale=w=iw/2:h=ih/2
  7620. @end example
  7621. @item
  7622. Increase the width, and set the height to the same size:
  7623. @example
  7624. scale=3/2*iw:ow
  7625. @end example
  7626. @item
  7627. Seek Greek harmony:
  7628. @example
  7629. scale=iw:1/PHI*iw
  7630. scale=ih*PHI:ih
  7631. @end example
  7632. @item
  7633. Increase the height, and set the width to 3/2 of the height:
  7634. @example
  7635. scale=w=3/2*oh:h=3/5*ih
  7636. @end example
  7637. @item
  7638. Increase the size, making the size a multiple of the chroma
  7639. subsample values:
  7640. @example
  7641. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7642. @end example
  7643. @item
  7644. Increase the width to a maximum of 500 pixels,
  7645. keeping the same aspect ratio as the input:
  7646. @example
  7647. scale=w='min(500\, iw*3/2):h=-1'
  7648. @end example
  7649. @end itemize
  7650. @subsection Commands
  7651. This filter supports the following commands:
  7652. @table @option
  7653. @item width, w
  7654. @item height, h
  7655. Set the output video dimension expression.
  7656. The command accepts the same syntax of the corresponding option.
  7657. If the specified expression is not valid, it is kept at its current
  7658. value.
  7659. @end table
  7660. @section scale2ref
  7661. Scale (resize) the input video, based on a reference video.
  7662. See the scale filter for available options, scale2ref supports the same but
  7663. uses the reference video instead of the main input as basis.
  7664. @subsection Examples
  7665. @itemize
  7666. @item
  7667. Scale a subtitle stream to match the main video in size before overlaying
  7668. @example
  7669. 'scale2ref[b][a];[a][b]overlay'
  7670. @end example
  7671. @end itemize
  7672. @section separatefields
  7673. The @code{separatefields} takes a frame-based video input and splits
  7674. each frame into its components fields, producing a new half height clip
  7675. with twice the frame rate and twice the frame count.
  7676. This filter use field-dominance information in frame to decide which
  7677. of each pair of fields to place first in the output.
  7678. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7679. @section setdar, setsar
  7680. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7681. output video.
  7682. This is done by changing the specified Sample (aka Pixel) Aspect
  7683. Ratio, according to the following equation:
  7684. @example
  7685. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7686. @end example
  7687. Keep in mind that the @code{setdar} filter does not modify the pixel
  7688. dimensions of the video frame. Also, the display aspect ratio set by
  7689. this filter may be changed by later filters in the filterchain,
  7690. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7691. applied.
  7692. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7693. the filter output video.
  7694. Note that as a consequence of the application of this filter, the
  7695. output display aspect ratio will change according to the equation
  7696. above.
  7697. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7698. filter may be changed by later filters in the filterchain, e.g. if
  7699. another "setsar" or a "setdar" filter is applied.
  7700. It accepts the following parameters:
  7701. @table @option
  7702. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7703. Set the aspect ratio used by the filter.
  7704. The parameter can be a floating point number string, an expression, or
  7705. a string of the form @var{num}:@var{den}, where @var{num} and
  7706. @var{den} are the numerator and denominator of the aspect ratio. If
  7707. the parameter is not specified, it is assumed the value "0".
  7708. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7709. should be escaped.
  7710. @item max
  7711. Set the maximum integer value to use for expressing numerator and
  7712. denominator when reducing the expressed aspect ratio to a rational.
  7713. Default value is @code{100}.
  7714. @end table
  7715. The parameter @var{sar} is an expression containing
  7716. the following constants:
  7717. @table @option
  7718. @item E, PI, PHI
  7719. These are approximated values for the mathematical constants e
  7720. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7721. @item w, h
  7722. The input width and height.
  7723. @item a
  7724. These are the same as @var{w} / @var{h}.
  7725. @item sar
  7726. The input sample aspect ratio.
  7727. @item dar
  7728. The input display aspect ratio. It is the same as
  7729. (@var{w} / @var{h}) * @var{sar}.
  7730. @item hsub, vsub
  7731. Horizontal and vertical chroma subsample values. For example, for the
  7732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7733. @end table
  7734. @subsection Examples
  7735. @itemize
  7736. @item
  7737. To change the display aspect ratio to 16:9, specify one of the following:
  7738. @example
  7739. setdar=dar=1.77777
  7740. setdar=dar=16/9
  7741. setdar=dar=1.77777
  7742. @end example
  7743. @item
  7744. To change the sample aspect ratio to 10:11, specify:
  7745. @example
  7746. setsar=sar=10/11
  7747. @end example
  7748. @item
  7749. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7750. 1000 in the aspect ratio reduction, use the command:
  7751. @example
  7752. setdar=ratio=16/9:max=1000
  7753. @end example
  7754. @end itemize
  7755. @anchor{setfield}
  7756. @section setfield
  7757. Force field for the output video frame.
  7758. The @code{setfield} filter marks the interlace type field for the
  7759. output frames. It does not change the input frame, but only sets the
  7760. corresponding property, which affects how the frame is treated by
  7761. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7762. The filter accepts the following options:
  7763. @table @option
  7764. @item mode
  7765. Available values are:
  7766. @table @samp
  7767. @item auto
  7768. Keep the same field property.
  7769. @item bff
  7770. Mark the frame as bottom-field-first.
  7771. @item tff
  7772. Mark the frame as top-field-first.
  7773. @item prog
  7774. Mark the frame as progressive.
  7775. @end table
  7776. @end table
  7777. @section showinfo
  7778. Show a line containing various information for each input video frame.
  7779. The input video is not modified.
  7780. The shown line contains a sequence of key/value pairs of the form
  7781. @var{key}:@var{value}.
  7782. The following values are shown in the output:
  7783. @table @option
  7784. @item n
  7785. The (sequential) number of the input frame, starting from 0.
  7786. @item pts
  7787. The Presentation TimeStamp of the input frame, expressed as a number of
  7788. time base units. The time base unit depends on the filter input pad.
  7789. @item pts_time
  7790. The Presentation TimeStamp of the input frame, expressed as a number of
  7791. seconds.
  7792. @item pos
  7793. The position of the frame in the input stream, or -1 if this information is
  7794. unavailable and/or meaningless (for example in case of synthetic video).
  7795. @item fmt
  7796. The pixel format name.
  7797. @item sar
  7798. The sample aspect ratio of the input frame, expressed in the form
  7799. @var{num}/@var{den}.
  7800. @item s
  7801. The size of the input frame. For the syntax of this option, check the
  7802. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7803. @item i
  7804. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7805. for bottom field first).
  7806. @item iskey
  7807. This is 1 if the frame is a key frame, 0 otherwise.
  7808. @item type
  7809. The picture type of the input frame ("I" for an I-frame, "P" for a
  7810. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7811. Also refer to the documentation of the @code{AVPictureType} enum and of
  7812. the @code{av_get_picture_type_char} function defined in
  7813. @file{libavutil/avutil.h}.
  7814. @item checksum
  7815. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7816. @item plane_checksum
  7817. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7818. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7819. @end table
  7820. @section showpalette
  7821. Displays the 256 colors palette of each frame. This filter is only relevant for
  7822. @var{pal8} pixel format frames.
  7823. It accepts the following option:
  7824. @table @option
  7825. @item s
  7826. Set the size of the box used to represent one palette color entry. Default is
  7827. @code{30} (for a @code{30x30} pixel box).
  7828. @end table
  7829. @section shuffleframes
  7830. Reorder and/or duplicate video frames.
  7831. It accepts the following parameters:
  7832. @table @option
  7833. @item mapping
  7834. Set the destination indexes of input frames.
  7835. This is space or '|' separated list of indexes that maps input frames to output
  7836. frames. Number of indexes also sets maximal value that each index may have.
  7837. @end table
  7838. The first frame has the index 0. The default is to keep the input unchanged.
  7839. Swap second and third frame of every three frames of the input:
  7840. @example
  7841. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  7842. @end example
  7843. @section shuffleplanes
  7844. Reorder and/or duplicate video planes.
  7845. It accepts the following parameters:
  7846. @table @option
  7847. @item map0
  7848. The index of the input plane to be used as the first output plane.
  7849. @item map1
  7850. The index of the input plane to be used as the second output plane.
  7851. @item map2
  7852. The index of the input plane to be used as the third output plane.
  7853. @item map3
  7854. The index of the input plane to be used as the fourth output plane.
  7855. @end table
  7856. The first plane has the index 0. The default is to keep the input unchanged.
  7857. Swap the second and third planes of the input:
  7858. @example
  7859. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7860. @end example
  7861. @anchor{signalstats}
  7862. @section signalstats
  7863. Evaluate various visual metrics that assist in determining issues associated
  7864. with the digitization of analog video media.
  7865. By default the filter will log these metadata values:
  7866. @table @option
  7867. @item YMIN
  7868. Display the minimal Y value contained within the input frame. Expressed in
  7869. range of [0-255].
  7870. @item YLOW
  7871. Display the Y value at the 10% percentile within the input frame. Expressed in
  7872. range of [0-255].
  7873. @item YAVG
  7874. Display the average Y value within the input frame. Expressed in range of
  7875. [0-255].
  7876. @item YHIGH
  7877. Display the Y value at the 90% percentile within the input frame. Expressed in
  7878. range of [0-255].
  7879. @item YMAX
  7880. Display the maximum Y value contained within the input frame. Expressed in
  7881. range of [0-255].
  7882. @item UMIN
  7883. Display the minimal U value contained within the input frame. Expressed in
  7884. range of [0-255].
  7885. @item ULOW
  7886. Display the U value at the 10% percentile within the input frame. Expressed in
  7887. range of [0-255].
  7888. @item UAVG
  7889. Display the average U value within the input frame. Expressed in range of
  7890. [0-255].
  7891. @item UHIGH
  7892. Display the U value at the 90% percentile within the input frame. Expressed in
  7893. range of [0-255].
  7894. @item UMAX
  7895. Display the maximum U value contained within the input frame. Expressed in
  7896. range of [0-255].
  7897. @item VMIN
  7898. Display the minimal V value contained within the input frame. Expressed in
  7899. range of [0-255].
  7900. @item VLOW
  7901. Display the V value at the 10% percentile within the input frame. Expressed in
  7902. range of [0-255].
  7903. @item VAVG
  7904. Display the average V value within the input frame. Expressed in range of
  7905. [0-255].
  7906. @item VHIGH
  7907. Display the V value at the 90% percentile within the input frame. Expressed in
  7908. range of [0-255].
  7909. @item VMAX
  7910. Display the maximum V value contained within the input frame. Expressed in
  7911. range of [0-255].
  7912. @item SATMIN
  7913. Display the minimal saturation value contained within the input frame.
  7914. Expressed in range of [0-~181.02].
  7915. @item SATLOW
  7916. Display the saturation value at the 10% percentile within the input frame.
  7917. Expressed in range of [0-~181.02].
  7918. @item SATAVG
  7919. Display the average saturation value within the input frame. Expressed in range
  7920. of [0-~181.02].
  7921. @item SATHIGH
  7922. Display the saturation value at the 90% percentile within the input frame.
  7923. Expressed in range of [0-~181.02].
  7924. @item SATMAX
  7925. Display the maximum saturation value contained within the input frame.
  7926. Expressed in range of [0-~181.02].
  7927. @item HUEMED
  7928. Display the median value for hue within the input frame. Expressed in range of
  7929. [0-360].
  7930. @item HUEAVG
  7931. Display the average value for hue within the input frame. Expressed in range of
  7932. [0-360].
  7933. @item YDIF
  7934. Display the average of sample value difference between all values of the Y
  7935. plane in the current frame and corresponding values of the previous input frame.
  7936. Expressed in range of [0-255].
  7937. @item UDIF
  7938. Display the average of sample value difference between all values of the U
  7939. plane in the current frame and corresponding values of the previous input frame.
  7940. Expressed in range of [0-255].
  7941. @item VDIF
  7942. Display the average of sample value difference between all values of the V
  7943. plane in the current frame and corresponding values of the previous input frame.
  7944. Expressed in range of [0-255].
  7945. @end table
  7946. The filter accepts the following options:
  7947. @table @option
  7948. @item stat
  7949. @item out
  7950. @option{stat} specify an additional form of image analysis.
  7951. @option{out} output video with the specified type of pixel highlighted.
  7952. Both options accept the following values:
  7953. @table @samp
  7954. @item tout
  7955. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7956. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7957. include the results of video dropouts, head clogs, or tape tracking issues.
  7958. @item vrep
  7959. Identify @var{vertical line repetition}. Vertical line repetition includes
  7960. similar rows of pixels within a frame. In born-digital video vertical line
  7961. repetition is common, but this pattern is uncommon in video digitized from an
  7962. analog source. When it occurs in video that results from the digitization of an
  7963. analog source it can indicate concealment from a dropout compensator.
  7964. @item brng
  7965. Identify pixels that fall outside of legal broadcast range.
  7966. @end table
  7967. @item color, c
  7968. Set the highlight color for the @option{out} option. The default color is
  7969. yellow.
  7970. @end table
  7971. @subsection Examples
  7972. @itemize
  7973. @item
  7974. Output data of various video metrics:
  7975. @example
  7976. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7977. @end example
  7978. @item
  7979. Output specific data about the minimum and maximum values of the Y plane per frame:
  7980. @example
  7981. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7982. @end example
  7983. @item
  7984. Playback video while highlighting pixels that are outside of broadcast range in red.
  7985. @example
  7986. ffplay example.mov -vf signalstats="out=brng:color=red"
  7987. @end example
  7988. @item
  7989. Playback video with signalstats metadata drawn over the frame.
  7990. @example
  7991. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7992. @end example
  7993. The contents of signalstat_drawtext.txt used in the command are:
  7994. @example
  7995. time %@{pts:hms@}
  7996. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7997. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7998. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7999. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8000. @end example
  8001. @end itemize
  8002. @anchor{smartblur}
  8003. @section smartblur
  8004. Blur the input video without impacting the outlines.
  8005. It accepts the following options:
  8006. @table @option
  8007. @item luma_radius, lr
  8008. Set the luma radius. The option value must be a float number in
  8009. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8010. used to blur the image (slower if larger). Default value is 1.0.
  8011. @item luma_strength, ls
  8012. Set the luma strength. The option value must be a float number
  8013. in the range [-1.0,1.0] that configures the blurring. A value included
  8014. in [0.0,1.0] will blur the image whereas a value included in
  8015. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8016. @item luma_threshold, lt
  8017. Set the luma threshold used as a coefficient to determine
  8018. whether a pixel should be blurred or not. The option value must be an
  8019. integer in the range [-30,30]. A value of 0 will filter all the image,
  8020. a value included in [0,30] will filter flat areas and a value included
  8021. in [-30,0] will filter edges. Default value is 0.
  8022. @item chroma_radius, cr
  8023. Set the chroma radius. The option value must be a float number in
  8024. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8025. used to blur the image (slower if larger). Default value is 1.0.
  8026. @item chroma_strength, cs
  8027. Set the chroma strength. The option value must be a float number
  8028. in the range [-1.0,1.0] that configures the blurring. A value included
  8029. in [0.0,1.0] will blur the image whereas a value included in
  8030. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8031. @item chroma_threshold, ct
  8032. Set the chroma threshold used as a coefficient to determine
  8033. whether a pixel should be blurred or not. The option value must be an
  8034. integer in the range [-30,30]. A value of 0 will filter all the image,
  8035. a value included in [0,30] will filter flat areas and a value included
  8036. in [-30,0] will filter edges. Default value is 0.
  8037. @end table
  8038. If a chroma option is not explicitly set, the corresponding luma value
  8039. is set.
  8040. @section ssim
  8041. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8042. This filter takes in input two input videos, the first input is
  8043. considered the "main" source and is passed unchanged to the
  8044. output. The second input is used as a "reference" video for computing
  8045. the SSIM.
  8046. Both video inputs must have the same resolution and pixel format for
  8047. this filter to work correctly. Also it assumes that both inputs
  8048. have the same number of frames, which are compared one by one.
  8049. The filter stores the calculated SSIM of each frame.
  8050. The description of the accepted parameters follows.
  8051. @table @option
  8052. @item stats_file, f
  8053. If specified the filter will use the named file to save the SSIM of
  8054. each individual frame. When filename equals "-" the data is sent to
  8055. standard output.
  8056. @end table
  8057. The file printed if @var{stats_file} is selected, contains a sequence of
  8058. key/value pairs of the form @var{key}:@var{value} for each compared
  8059. couple of frames.
  8060. A description of each shown parameter follows:
  8061. @table @option
  8062. @item n
  8063. sequential number of the input frame, starting from 1
  8064. @item Y, U, V, R, G, B
  8065. SSIM of the compared frames for the component specified by the suffix.
  8066. @item All
  8067. SSIM of the compared frames for the whole frame.
  8068. @item dB
  8069. Same as above but in dB representation.
  8070. @end table
  8071. For example:
  8072. @example
  8073. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8074. [main][ref] ssim="stats_file=stats.log" [out]
  8075. @end example
  8076. On this example the input file being processed is compared with the
  8077. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8078. is stored in @file{stats.log}.
  8079. Another example with both psnr and ssim at same time:
  8080. @example
  8081. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8082. @end example
  8083. @section stereo3d
  8084. Convert between different stereoscopic image formats.
  8085. The filters accept the following options:
  8086. @table @option
  8087. @item in
  8088. Set stereoscopic image format of input.
  8089. Available values for input image formats are:
  8090. @table @samp
  8091. @item sbsl
  8092. side by side parallel (left eye left, right eye right)
  8093. @item sbsr
  8094. side by side crosseye (right eye left, left eye right)
  8095. @item sbs2l
  8096. side by side parallel with half width resolution
  8097. (left eye left, right eye right)
  8098. @item sbs2r
  8099. side by side crosseye with half width resolution
  8100. (right eye left, left eye right)
  8101. @item abl
  8102. above-below (left eye above, right eye below)
  8103. @item abr
  8104. above-below (right eye above, left eye below)
  8105. @item ab2l
  8106. above-below with half height resolution
  8107. (left eye above, right eye below)
  8108. @item ab2r
  8109. above-below with half height resolution
  8110. (right eye above, left eye below)
  8111. @item al
  8112. alternating frames (left eye first, right eye second)
  8113. @item ar
  8114. alternating frames (right eye first, left eye second)
  8115. @item irl
  8116. interleaved rows (left eye has top row, right eye starts on next row)
  8117. @item irr
  8118. interleaved rows (right eye has top row, left eye starts on next row)
  8119. Default value is @samp{sbsl}.
  8120. @end table
  8121. @item out
  8122. Set stereoscopic image format of output.
  8123. Available values for output image formats are all the input formats as well as:
  8124. @table @samp
  8125. @item arbg
  8126. anaglyph red/blue gray
  8127. (red filter on left eye, blue filter on right eye)
  8128. @item argg
  8129. anaglyph red/green gray
  8130. (red filter on left eye, green filter on right eye)
  8131. @item arcg
  8132. anaglyph red/cyan gray
  8133. (red filter on left eye, cyan filter on right eye)
  8134. @item arch
  8135. anaglyph red/cyan half colored
  8136. (red filter on left eye, cyan filter on right eye)
  8137. @item arcc
  8138. anaglyph red/cyan color
  8139. (red filter on left eye, cyan filter on right eye)
  8140. @item arcd
  8141. anaglyph red/cyan color optimized with the least squares projection of dubois
  8142. (red filter on left eye, cyan filter on right eye)
  8143. @item agmg
  8144. anaglyph green/magenta gray
  8145. (green filter on left eye, magenta filter on right eye)
  8146. @item agmh
  8147. anaglyph green/magenta half colored
  8148. (green filter on left eye, magenta filter on right eye)
  8149. @item agmc
  8150. anaglyph green/magenta colored
  8151. (green filter on left eye, magenta filter on right eye)
  8152. @item agmd
  8153. anaglyph green/magenta color optimized with the least squares projection of dubois
  8154. (green filter on left eye, magenta filter on right eye)
  8155. @item aybg
  8156. anaglyph yellow/blue gray
  8157. (yellow filter on left eye, blue filter on right eye)
  8158. @item aybh
  8159. anaglyph yellow/blue half colored
  8160. (yellow filter on left eye, blue filter on right eye)
  8161. @item aybc
  8162. anaglyph yellow/blue colored
  8163. (yellow filter on left eye, blue filter on right eye)
  8164. @item aybd
  8165. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8166. (yellow filter on left eye, blue filter on right eye)
  8167. @item ml
  8168. mono output (left eye only)
  8169. @item mr
  8170. mono output (right eye only)
  8171. @item chl
  8172. checkerboard, left eye first
  8173. @item chr
  8174. checkerboard, right eye first
  8175. @item icl
  8176. interleaved columns, left eye first
  8177. @item icr
  8178. interleaved columns, right eye first
  8179. @end table
  8180. Default value is @samp{arcd}.
  8181. @end table
  8182. @subsection Examples
  8183. @itemize
  8184. @item
  8185. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8186. @example
  8187. stereo3d=sbsl:aybd
  8188. @end example
  8189. @item
  8190. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8191. @example
  8192. stereo3d=abl:sbsr
  8193. @end example
  8194. @end itemize
  8195. @anchor{spp}
  8196. @section spp
  8197. Apply a simple postprocessing filter that compresses and decompresses the image
  8198. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8199. and average the results.
  8200. The filter accepts the following options:
  8201. @table @option
  8202. @item quality
  8203. Set quality. This option defines the number of levels for averaging. It accepts
  8204. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8205. effect. A value of @code{6} means the higher quality. For each increment of
  8206. that value the speed drops by a factor of approximately 2. Default value is
  8207. @code{3}.
  8208. @item qp
  8209. Force a constant quantization parameter. If not set, the filter will use the QP
  8210. from the video stream (if available).
  8211. @item mode
  8212. Set thresholding mode. Available modes are:
  8213. @table @samp
  8214. @item hard
  8215. Set hard thresholding (default).
  8216. @item soft
  8217. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8218. @end table
  8219. @item use_bframe_qp
  8220. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8221. option may cause flicker since the B-Frames have often larger QP. Default is
  8222. @code{0} (not enabled).
  8223. @end table
  8224. @anchor{subtitles}
  8225. @section subtitles
  8226. Draw subtitles on top of input video using the libass library.
  8227. To enable compilation of this filter you need to configure FFmpeg with
  8228. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8229. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8230. Alpha) subtitles format.
  8231. The filter accepts the following options:
  8232. @table @option
  8233. @item filename, f
  8234. Set the filename of the subtitle file to read. It must be specified.
  8235. @item original_size
  8236. Specify the size of the original video, the video for which the ASS file
  8237. was composed. For the syntax of this option, check the
  8238. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8239. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8240. correctly scale the fonts if the aspect ratio has been changed.
  8241. @item fontsdir
  8242. Set a directory path containing fonts that can be used by the filter.
  8243. These fonts will be used in addition to whatever the font provider uses.
  8244. @item charenc
  8245. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8246. useful if not UTF-8.
  8247. @item stream_index, si
  8248. Set subtitles stream index. @code{subtitles} filter only.
  8249. @item force_style
  8250. Override default style or script info parameters of the subtitles. It accepts a
  8251. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8252. @end table
  8253. If the first key is not specified, it is assumed that the first value
  8254. specifies the @option{filename}.
  8255. For example, to render the file @file{sub.srt} on top of the input
  8256. video, use the command:
  8257. @example
  8258. subtitles=sub.srt
  8259. @end example
  8260. which is equivalent to:
  8261. @example
  8262. subtitles=filename=sub.srt
  8263. @end example
  8264. To render the default subtitles stream from file @file{video.mkv}, use:
  8265. @example
  8266. subtitles=video.mkv
  8267. @end example
  8268. To render the second subtitles stream from that file, use:
  8269. @example
  8270. subtitles=video.mkv:si=1
  8271. @end example
  8272. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8273. @code{DejaVu Serif}, use:
  8274. @example
  8275. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8276. @end example
  8277. @section super2xsai
  8278. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8279. Interpolate) pixel art scaling algorithm.
  8280. Useful for enlarging pixel art images without reducing sharpness.
  8281. @section swapuv
  8282. Swap U & V plane.
  8283. @section telecine
  8284. Apply telecine process to the video.
  8285. This filter accepts the following options:
  8286. @table @option
  8287. @item first_field
  8288. @table @samp
  8289. @item top, t
  8290. top field first
  8291. @item bottom, b
  8292. bottom field first
  8293. The default value is @code{top}.
  8294. @end table
  8295. @item pattern
  8296. A string of numbers representing the pulldown pattern you wish to apply.
  8297. The default value is @code{23}.
  8298. @end table
  8299. @example
  8300. Some typical patterns:
  8301. NTSC output (30i):
  8302. 27.5p: 32222
  8303. 24p: 23 (classic)
  8304. 24p: 2332 (preferred)
  8305. 20p: 33
  8306. 18p: 334
  8307. 16p: 3444
  8308. PAL output (25i):
  8309. 27.5p: 12222
  8310. 24p: 222222222223 ("Euro pulldown")
  8311. 16.67p: 33
  8312. 16p: 33333334
  8313. @end example
  8314. @section thumbnail
  8315. Select the most representative frame in a given sequence of consecutive frames.
  8316. The filter accepts the following options:
  8317. @table @option
  8318. @item n
  8319. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8320. will pick one of them, and then handle the next batch of @var{n} frames until
  8321. the end. Default is @code{100}.
  8322. @end table
  8323. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8324. value will result in a higher memory usage, so a high value is not recommended.
  8325. @subsection Examples
  8326. @itemize
  8327. @item
  8328. Extract one picture each 50 frames:
  8329. @example
  8330. thumbnail=50
  8331. @end example
  8332. @item
  8333. Complete example of a thumbnail creation with @command{ffmpeg}:
  8334. @example
  8335. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8336. @end example
  8337. @end itemize
  8338. @section tile
  8339. Tile several successive frames together.
  8340. The filter accepts the following options:
  8341. @table @option
  8342. @item layout
  8343. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8344. this option, check the
  8345. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8346. @item nb_frames
  8347. Set the maximum number of frames to render in the given area. It must be less
  8348. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8349. the area will be used.
  8350. @item margin
  8351. Set the outer border margin in pixels.
  8352. @item padding
  8353. Set the inner border thickness (i.e. the number of pixels between frames). For
  8354. more advanced padding options (such as having different values for the edges),
  8355. refer to the pad video filter.
  8356. @item color
  8357. Specify the color of the unused area. For the syntax of this option, check the
  8358. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8359. is "black".
  8360. @end table
  8361. @subsection Examples
  8362. @itemize
  8363. @item
  8364. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8365. @example
  8366. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8367. @end example
  8368. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8369. duplicating each output frame to accommodate the originally detected frame
  8370. rate.
  8371. @item
  8372. Display @code{5} pictures in an area of @code{3x2} frames,
  8373. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8374. mixed flat and named options:
  8375. @example
  8376. tile=3x2:nb_frames=5:padding=7:margin=2
  8377. @end example
  8378. @end itemize
  8379. @section tinterlace
  8380. Perform various types of temporal field interlacing.
  8381. Frames are counted starting from 1, so the first input frame is
  8382. considered odd.
  8383. The filter accepts the following options:
  8384. @table @option
  8385. @item mode
  8386. Specify the mode of the interlacing. This option can also be specified
  8387. as a value alone. See below for a list of values for this option.
  8388. Available values are:
  8389. @table @samp
  8390. @item merge, 0
  8391. Move odd frames into the upper field, even into the lower field,
  8392. generating a double height frame at half frame rate.
  8393. @example
  8394. ------> time
  8395. Input:
  8396. Frame 1 Frame 2 Frame 3 Frame 4
  8397. 11111 22222 33333 44444
  8398. 11111 22222 33333 44444
  8399. 11111 22222 33333 44444
  8400. 11111 22222 33333 44444
  8401. Output:
  8402. 11111 33333
  8403. 22222 44444
  8404. 11111 33333
  8405. 22222 44444
  8406. 11111 33333
  8407. 22222 44444
  8408. 11111 33333
  8409. 22222 44444
  8410. @end example
  8411. @item drop_odd, 1
  8412. Only output even frames, odd frames are dropped, generating a frame with
  8413. unchanged height at half frame rate.
  8414. @example
  8415. ------> time
  8416. Input:
  8417. Frame 1 Frame 2 Frame 3 Frame 4
  8418. 11111 22222 33333 44444
  8419. 11111 22222 33333 44444
  8420. 11111 22222 33333 44444
  8421. 11111 22222 33333 44444
  8422. Output:
  8423. 22222 44444
  8424. 22222 44444
  8425. 22222 44444
  8426. 22222 44444
  8427. @end example
  8428. @item drop_even, 2
  8429. Only output odd frames, even frames are dropped, generating a frame with
  8430. unchanged height at half frame rate.
  8431. @example
  8432. ------> time
  8433. Input:
  8434. Frame 1 Frame 2 Frame 3 Frame 4
  8435. 11111 22222 33333 44444
  8436. 11111 22222 33333 44444
  8437. 11111 22222 33333 44444
  8438. 11111 22222 33333 44444
  8439. Output:
  8440. 11111 33333
  8441. 11111 33333
  8442. 11111 33333
  8443. 11111 33333
  8444. @end example
  8445. @item pad, 3
  8446. Expand each frame to full height, but pad alternate lines with black,
  8447. generating a frame with double height at the same input frame rate.
  8448. @example
  8449. ------> time
  8450. Input:
  8451. Frame 1 Frame 2 Frame 3 Frame 4
  8452. 11111 22222 33333 44444
  8453. 11111 22222 33333 44444
  8454. 11111 22222 33333 44444
  8455. 11111 22222 33333 44444
  8456. Output:
  8457. 11111 ..... 33333 .....
  8458. ..... 22222 ..... 44444
  8459. 11111 ..... 33333 .....
  8460. ..... 22222 ..... 44444
  8461. 11111 ..... 33333 .....
  8462. ..... 22222 ..... 44444
  8463. 11111 ..... 33333 .....
  8464. ..... 22222 ..... 44444
  8465. @end example
  8466. @item interleave_top, 4
  8467. Interleave the upper field from odd frames with the lower field from
  8468. even frames, generating a frame with unchanged height at half frame rate.
  8469. @example
  8470. ------> time
  8471. Input:
  8472. Frame 1 Frame 2 Frame 3 Frame 4
  8473. 11111<- 22222 33333<- 44444
  8474. 11111 22222<- 33333 44444<-
  8475. 11111<- 22222 33333<- 44444
  8476. 11111 22222<- 33333 44444<-
  8477. Output:
  8478. 11111 33333
  8479. 22222 44444
  8480. 11111 33333
  8481. 22222 44444
  8482. @end example
  8483. @item interleave_bottom, 5
  8484. Interleave the lower field from odd frames with the upper field from
  8485. even frames, generating a frame with unchanged height at half frame rate.
  8486. @example
  8487. ------> time
  8488. Input:
  8489. Frame 1 Frame 2 Frame 3 Frame 4
  8490. 11111 22222<- 33333 44444<-
  8491. 11111<- 22222 33333<- 44444
  8492. 11111 22222<- 33333 44444<-
  8493. 11111<- 22222 33333<- 44444
  8494. Output:
  8495. 22222 44444
  8496. 11111 33333
  8497. 22222 44444
  8498. 11111 33333
  8499. @end example
  8500. @item interlacex2, 6
  8501. Double frame rate with unchanged height. Frames are inserted each
  8502. containing the second temporal field from the previous input frame and
  8503. the first temporal field from the next input frame. This mode relies on
  8504. the top_field_first flag. Useful for interlaced video displays with no
  8505. field synchronisation.
  8506. @example
  8507. ------> time
  8508. Input:
  8509. Frame 1 Frame 2 Frame 3 Frame 4
  8510. 11111 22222 33333 44444
  8511. 11111 22222 33333 44444
  8512. 11111 22222 33333 44444
  8513. 11111 22222 33333 44444
  8514. Output:
  8515. 11111 22222 22222 33333 33333 44444 44444
  8516. 11111 11111 22222 22222 33333 33333 44444
  8517. 11111 22222 22222 33333 33333 44444 44444
  8518. 11111 11111 22222 22222 33333 33333 44444
  8519. @end example
  8520. @item mergex2, 7
  8521. Move odd frames into the upper field, even into the lower field,
  8522. generating a double height frame at same frame rate.
  8523. @example
  8524. ------> time
  8525. Input:
  8526. Frame 1 Frame 2 Frame 3 Frame 4
  8527. 11111 22222 33333 44444
  8528. 11111 22222 33333 44444
  8529. 11111 22222 33333 44444
  8530. 11111 22222 33333 44444
  8531. Output:
  8532. 11111 33333 33333 55555
  8533. 22222 22222 44444 44444
  8534. 11111 33333 33333 55555
  8535. 22222 22222 44444 44444
  8536. 11111 33333 33333 55555
  8537. 22222 22222 44444 44444
  8538. 11111 33333 33333 55555
  8539. 22222 22222 44444 44444
  8540. @end example
  8541. @end table
  8542. Numeric values are deprecated but are accepted for backward
  8543. compatibility reasons.
  8544. Default mode is @code{merge}.
  8545. @item flags
  8546. Specify flags influencing the filter process.
  8547. Available value for @var{flags} is:
  8548. @table @option
  8549. @item low_pass_filter, vlfp
  8550. Enable vertical low-pass filtering in the filter.
  8551. Vertical low-pass filtering is required when creating an interlaced
  8552. destination from a progressive source which contains high-frequency
  8553. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8554. patterning.
  8555. Vertical low-pass filtering can only be enabled for @option{mode}
  8556. @var{interleave_top} and @var{interleave_bottom}.
  8557. @end table
  8558. @end table
  8559. @section transpose
  8560. Transpose rows with columns in the input video and optionally flip it.
  8561. It accepts the following parameters:
  8562. @table @option
  8563. @item dir
  8564. Specify the transposition direction.
  8565. Can assume the following values:
  8566. @table @samp
  8567. @item 0, 4, cclock_flip
  8568. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8569. @example
  8570. L.R L.l
  8571. . . -> . .
  8572. l.r R.r
  8573. @end example
  8574. @item 1, 5, clock
  8575. Rotate by 90 degrees clockwise, that is:
  8576. @example
  8577. L.R l.L
  8578. . . -> . .
  8579. l.r r.R
  8580. @end example
  8581. @item 2, 6, cclock
  8582. Rotate by 90 degrees counterclockwise, that is:
  8583. @example
  8584. L.R R.r
  8585. . . -> . .
  8586. l.r L.l
  8587. @end example
  8588. @item 3, 7, clock_flip
  8589. Rotate by 90 degrees clockwise and vertically flip, that is:
  8590. @example
  8591. L.R r.R
  8592. . . -> . .
  8593. l.r l.L
  8594. @end example
  8595. @end table
  8596. For values between 4-7, the transposition is only done if the input
  8597. video geometry is portrait and not landscape. These values are
  8598. deprecated, the @code{passthrough} option should be used instead.
  8599. Numerical values are deprecated, and should be dropped in favor of
  8600. symbolic constants.
  8601. @item passthrough
  8602. Do not apply the transposition if the input geometry matches the one
  8603. specified by the specified value. It accepts the following values:
  8604. @table @samp
  8605. @item none
  8606. Always apply transposition.
  8607. @item portrait
  8608. Preserve portrait geometry (when @var{height} >= @var{width}).
  8609. @item landscape
  8610. Preserve landscape geometry (when @var{width} >= @var{height}).
  8611. @end table
  8612. Default value is @code{none}.
  8613. @end table
  8614. For example to rotate by 90 degrees clockwise and preserve portrait
  8615. layout:
  8616. @example
  8617. transpose=dir=1:passthrough=portrait
  8618. @end example
  8619. The command above can also be specified as:
  8620. @example
  8621. transpose=1:portrait
  8622. @end example
  8623. @section trim
  8624. Trim the input so that the output contains one continuous subpart of the input.
  8625. It accepts the following parameters:
  8626. @table @option
  8627. @item start
  8628. Specify the time of the start of the kept section, i.e. the frame with the
  8629. timestamp @var{start} will be the first frame in the output.
  8630. @item end
  8631. Specify the time of the first frame that will be dropped, i.e. the frame
  8632. immediately preceding the one with the timestamp @var{end} will be the last
  8633. frame in the output.
  8634. @item start_pts
  8635. This is the same as @var{start}, except this option sets the start timestamp
  8636. in timebase units instead of seconds.
  8637. @item end_pts
  8638. This is the same as @var{end}, except this option sets the end timestamp
  8639. in timebase units instead of seconds.
  8640. @item duration
  8641. The maximum duration of the output in seconds.
  8642. @item start_frame
  8643. The number of the first frame that should be passed to the output.
  8644. @item end_frame
  8645. The number of the first frame that should be dropped.
  8646. @end table
  8647. @option{start}, @option{end}, and @option{duration} are expressed as time
  8648. duration specifications; see
  8649. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8650. for the accepted syntax.
  8651. Note that the first two sets of the start/end options and the @option{duration}
  8652. option look at the frame timestamp, while the _frame variants simply count the
  8653. frames that pass through the filter. Also note that this filter does not modify
  8654. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8655. setpts filter after the trim filter.
  8656. If multiple start or end options are set, this filter tries to be greedy and
  8657. keep all the frames that match at least one of the specified constraints. To keep
  8658. only the part that matches all the constraints at once, chain multiple trim
  8659. filters.
  8660. The defaults are such that all the input is kept. So it is possible to set e.g.
  8661. just the end values to keep everything before the specified time.
  8662. Examples:
  8663. @itemize
  8664. @item
  8665. Drop everything except the second minute of input:
  8666. @example
  8667. ffmpeg -i INPUT -vf trim=60:120
  8668. @end example
  8669. @item
  8670. Keep only the first second:
  8671. @example
  8672. ffmpeg -i INPUT -vf trim=duration=1
  8673. @end example
  8674. @end itemize
  8675. @anchor{unsharp}
  8676. @section unsharp
  8677. Sharpen or blur the input video.
  8678. It accepts the following parameters:
  8679. @table @option
  8680. @item luma_msize_x, lx
  8681. Set the luma matrix horizontal size. It must be an odd integer between
  8682. 3 and 63. The default value is 5.
  8683. @item luma_msize_y, ly
  8684. Set the luma matrix vertical size. It must be an odd integer between 3
  8685. and 63. The default value is 5.
  8686. @item luma_amount, la
  8687. Set the luma effect strength. It must be a floating point number, reasonable
  8688. values lay between -1.5 and 1.5.
  8689. Negative values will blur the input video, while positive values will
  8690. sharpen it, a value of zero will disable the effect.
  8691. Default value is 1.0.
  8692. @item chroma_msize_x, cx
  8693. Set the chroma matrix horizontal size. It must be an odd integer
  8694. between 3 and 63. The default value is 5.
  8695. @item chroma_msize_y, cy
  8696. Set the chroma matrix vertical size. It must be an odd integer
  8697. between 3 and 63. The default value is 5.
  8698. @item chroma_amount, ca
  8699. Set the chroma effect strength. It must be a floating point number, reasonable
  8700. values lay between -1.5 and 1.5.
  8701. Negative values will blur the input video, while positive values will
  8702. sharpen it, a value of zero will disable the effect.
  8703. Default value is 0.0.
  8704. @item opencl
  8705. If set to 1, specify using OpenCL capabilities, only available if
  8706. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8707. @end table
  8708. All parameters are optional and default to the equivalent of the
  8709. string '5:5:1.0:5:5:0.0'.
  8710. @subsection Examples
  8711. @itemize
  8712. @item
  8713. Apply strong luma sharpen effect:
  8714. @example
  8715. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8716. @end example
  8717. @item
  8718. Apply a strong blur of both luma and chroma parameters:
  8719. @example
  8720. unsharp=7:7:-2:7:7:-2
  8721. @end example
  8722. @end itemize
  8723. @section uspp
  8724. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8725. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8726. shifts and average the results.
  8727. The way this differs from the behavior of spp is that uspp actually encodes &
  8728. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8729. DCT similar to MJPEG.
  8730. The filter accepts the following options:
  8731. @table @option
  8732. @item quality
  8733. Set quality. This option defines the number of levels for averaging. It accepts
  8734. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8735. effect. A value of @code{8} means the higher quality. For each increment of
  8736. that value the speed drops by a factor of approximately 2. Default value is
  8737. @code{3}.
  8738. @item qp
  8739. Force a constant quantization parameter. If not set, the filter will use the QP
  8740. from the video stream (if available).
  8741. @end table
  8742. @section vectorscope
  8743. Display 2 color component values in the two dimensional graph (which is called
  8744. a vectorscope).
  8745. This filter accepts the following options:
  8746. @table @option
  8747. @item mode, m
  8748. Set vectorscope mode.
  8749. It accepts the following values:
  8750. @table @samp
  8751. @item gray
  8752. Gray values are displayed on graph, higher brightness means more pixels have
  8753. same component color value on location in graph. This is the default mode.
  8754. @item color
  8755. Gray values are displayed on graph. Surrounding pixels values which are not
  8756. present in video frame are drawn in gradient of 2 color components which are
  8757. set by option @code{x} and @code{y}.
  8758. @item color2
  8759. Actual color components values present in video frame are displayed on graph.
  8760. @item color3
  8761. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8762. on graph increases value of another color component, which is luminance by
  8763. default values of @code{x} and @code{y}.
  8764. @item color4
  8765. Actual colors present in video frame are displayed on graph. If two different
  8766. colors map to same position on graph then color with higher value of component
  8767. not present in graph is picked.
  8768. @end table
  8769. @item x
  8770. Set which color component will be represented on X-axis. Default is @code{1}.
  8771. @item y
  8772. Set which color component will be represented on Y-axis. Default is @code{2}.
  8773. @item intensity, i
  8774. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8775. of color component which represents frequency of (X, Y) location in graph.
  8776. @item envelope, e
  8777. @table @samp
  8778. @item none
  8779. No envelope, this is default.
  8780. @item instant
  8781. Instant envelope, even darkest single pixel will be clearly highlighted.
  8782. @item peak
  8783. Hold maximum and minimum values presented in graph over time. This way you
  8784. can still spot out of range values without constantly looking at vectorscope.
  8785. @item peak+instant
  8786. Peak and instant envelope combined together.
  8787. @end table
  8788. @end table
  8789. @anchor{vidstabdetect}
  8790. @section vidstabdetect
  8791. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8792. @ref{vidstabtransform} for pass 2.
  8793. This filter generates a file with relative translation and rotation
  8794. transform information about subsequent frames, which is then used by
  8795. the @ref{vidstabtransform} filter.
  8796. To enable compilation of this filter you need to configure FFmpeg with
  8797. @code{--enable-libvidstab}.
  8798. This filter accepts the following options:
  8799. @table @option
  8800. @item result
  8801. Set the path to the file used to write the transforms information.
  8802. Default value is @file{transforms.trf}.
  8803. @item shakiness
  8804. Set how shaky the video is and how quick the camera is. It accepts an
  8805. integer in the range 1-10, a value of 1 means little shakiness, a
  8806. value of 10 means strong shakiness. Default value is 5.
  8807. @item accuracy
  8808. Set the accuracy of the detection process. It must be a value in the
  8809. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8810. accuracy. Default value is 15.
  8811. @item stepsize
  8812. Set stepsize of the search process. The region around minimum is
  8813. scanned with 1 pixel resolution. Default value is 6.
  8814. @item mincontrast
  8815. Set minimum contrast. Below this value a local measurement field is
  8816. discarded. Must be a floating point value in the range 0-1. Default
  8817. value is 0.3.
  8818. @item tripod
  8819. Set reference frame number for tripod mode.
  8820. If enabled, the motion of the frames is compared to a reference frame
  8821. in the filtered stream, identified by the specified number. The idea
  8822. is to compensate all movements in a more-or-less static scene and keep
  8823. the camera view absolutely still.
  8824. If set to 0, it is disabled. The frames are counted starting from 1.
  8825. @item show
  8826. Show fields and transforms in the resulting frames. It accepts an
  8827. integer in the range 0-2. Default value is 0, which disables any
  8828. visualization.
  8829. @end table
  8830. @subsection Examples
  8831. @itemize
  8832. @item
  8833. Use default values:
  8834. @example
  8835. vidstabdetect
  8836. @end example
  8837. @item
  8838. Analyze strongly shaky movie and put the results in file
  8839. @file{mytransforms.trf}:
  8840. @example
  8841. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8842. @end example
  8843. @item
  8844. Visualize the result of internal transformations in the resulting
  8845. video:
  8846. @example
  8847. vidstabdetect=show=1
  8848. @end example
  8849. @item
  8850. Analyze a video with medium shakiness using @command{ffmpeg}:
  8851. @example
  8852. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8853. @end example
  8854. @end itemize
  8855. @anchor{vidstabtransform}
  8856. @section vidstabtransform
  8857. Video stabilization/deshaking: pass 2 of 2,
  8858. see @ref{vidstabdetect} for pass 1.
  8859. Read a file with transform information for each frame and
  8860. apply/compensate them. Together with the @ref{vidstabdetect}
  8861. filter this can be used to deshake videos. See also
  8862. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8863. the @ref{unsharp} filter, see below.
  8864. To enable compilation of this filter you need to configure FFmpeg with
  8865. @code{--enable-libvidstab}.
  8866. @subsection Options
  8867. @table @option
  8868. @item input
  8869. Set path to the file used to read the transforms. Default value is
  8870. @file{transforms.trf}.
  8871. @item smoothing
  8872. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8873. camera movements. Default value is 10.
  8874. For example a number of 10 means that 21 frames are used (10 in the
  8875. past and 10 in the future) to smoothen the motion in the video. A
  8876. larger value leads to a smoother video, but limits the acceleration of
  8877. the camera (pan/tilt movements). 0 is a special case where a static
  8878. camera is simulated.
  8879. @item optalgo
  8880. Set the camera path optimization algorithm.
  8881. Accepted values are:
  8882. @table @samp
  8883. @item gauss
  8884. gaussian kernel low-pass filter on camera motion (default)
  8885. @item avg
  8886. averaging on transformations
  8887. @end table
  8888. @item maxshift
  8889. Set maximal number of pixels to translate frames. Default value is -1,
  8890. meaning no limit.
  8891. @item maxangle
  8892. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8893. value is -1, meaning no limit.
  8894. @item crop
  8895. Specify how to deal with borders that may be visible due to movement
  8896. compensation.
  8897. Available values are:
  8898. @table @samp
  8899. @item keep
  8900. keep image information from previous frame (default)
  8901. @item black
  8902. fill the border black
  8903. @end table
  8904. @item invert
  8905. Invert transforms if set to 1. Default value is 0.
  8906. @item relative
  8907. Consider transforms as relative to previous frame if set to 1,
  8908. absolute if set to 0. Default value is 0.
  8909. @item zoom
  8910. Set percentage to zoom. A positive value will result in a zoom-in
  8911. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8912. zoom).
  8913. @item optzoom
  8914. Set optimal zooming to avoid borders.
  8915. Accepted values are:
  8916. @table @samp
  8917. @item 0
  8918. disabled
  8919. @item 1
  8920. optimal static zoom value is determined (only very strong movements
  8921. will lead to visible borders) (default)
  8922. @item 2
  8923. optimal adaptive zoom value is determined (no borders will be
  8924. visible), see @option{zoomspeed}
  8925. @end table
  8926. Note that the value given at zoom is added to the one calculated here.
  8927. @item zoomspeed
  8928. Set percent to zoom maximally each frame (enabled when
  8929. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8930. 0.25.
  8931. @item interpol
  8932. Specify type of interpolation.
  8933. Available values are:
  8934. @table @samp
  8935. @item no
  8936. no interpolation
  8937. @item linear
  8938. linear only horizontal
  8939. @item bilinear
  8940. linear in both directions (default)
  8941. @item bicubic
  8942. cubic in both directions (slow)
  8943. @end table
  8944. @item tripod
  8945. Enable virtual tripod mode if set to 1, which is equivalent to
  8946. @code{relative=0:smoothing=0}. Default value is 0.
  8947. Use also @code{tripod} option of @ref{vidstabdetect}.
  8948. @item debug
  8949. Increase log verbosity if set to 1. Also the detected global motions
  8950. are written to the temporary file @file{global_motions.trf}. Default
  8951. value is 0.
  8952. @end table
  8953. @subsection Examples
  8954. @itemize
  8955. @item
  8956. Use @command{ffmpeg} for a typical stabilization with default values:
  8957. @example
  8958. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8959. @end example
  8960. Note the use of the @ref{unsharp} filter which is always recommended.
  8961. @item
  8962. Zoom in a bit more and load transform data from a given file:
  8963. @example
  8964. vidstabtransform=zoom=5:input="mytransforms.trf"
  8965. @end example
  8966. @item
  8967. Smoothen the video even more:
  8968. @example
  8969. vidstabtransform=smoothing=30
  8970. @end example
  8971. @end itemize
  8972. @section vflip
  8973. Flip the input video vertically.
  8974. For example, to vertically flip a video with @command{ffmpeg}:
  8975. @example
  8976. ffmpeg -i in.avi -vf "vflip" out.avi
  8977. @end example
  8978. @anchor{vignette}
  8979. @section vignette
  8980. Make or reverse a natural vignetting effect.
  8981. The filter accepts the following options:
  8982. @table @option
  8983. @item angle, a
  8984. Set lens angle expression as a number of radians.
  8985. The value is clipped in the @code{[0,PI/2]} range.
  8986. Default value: @code{"PI/5"}
  8987. @item x0
  8988. @item y0
  8989. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8990. by default.
  8991. @item mode
  8992. Set forward/backward mode.
  8993. Available modes are:
  8994. @table @samp
  8995. @item forward
  8996. The larger the distance from the central point, the darker the image becomes.
  8997. @item backward
  8998. The larger the distance from the central point, the brighter the image becomes.
  8999. This can be used to reverse a vignette effect, though there is no automatic
  9000. detection to extract the lens @option{angle} and other settings (yet). It can
  9001. also be used to create a burning effect.
  9002. @end table
  9003. Default value is @samp{forward}.
  9004. @item eval
  9005. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9006. It accepts the following values:
  9007. @table @samp
  9008. @item init
  9009. Evaluate expressions only once during the filter initialization.
  9010. @item frame
  9011. Evaluate expressions for each incoming frame. This is way slower than the
  9012. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9013. allows advanced dynamic expressions.
  9014. @end table
  9015. Default value is @samp{init}.
  9016. @item dither
  9017. Set dithering to reduce the circular banding effects. Default is @code{1}
  9018. (enabled).
  9019. @item aspect
  9020. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9021. Setting this value to the SAR of the input will make a rectangular vignetting
  9022. following the dimensions of the video.
  9023. Default is @code{1/1}.
  9024. @end table
  9025. @subsection Expressions
  9026. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9027. following parameters.
  9028. @table @option
  9029. @item w
  9030. @item h
  9031. input width and height
  9032. @item n
  9033. the number of input frame, starting from 0
  9034. @item pts
  9035. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9036. @var{TB} units, NAN if undefined
  9037. @item r
  9038. frame rate of the input video, NAN if the input frame rate is unknown
  9039. @item t
  9040. the PTS (Presentation TimeStamp) of the filtered video frame,
  9041. expressed in seconds, NAN if undefined
  9042. @item tb
  9043. time base of the input video
  9044. @end table
  9045. @subsection Examples
  9046. @itemize
  9047. @item
  9048. Apply simple strong vignetting effect:
  9049. @example
  9050. vignette=PI/4
  9051. @end example
  9052. @item
  9053. Make a flickering vignetting:
  9054. @example
  9055. vignette='PI/4+random(1)*PI/50':eval=frame
  9056. @end example
  9057. @end itemize
  9058. @section vstack
  9059. Stack input videos vertically.
  9060. All streams must be of same pixel format and of same width.
  9061. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9062. to create same output.
  9063. The filter accept the following option:
  9064. @table @option
  9065. @item inputs
  9066. Set number of input streams. Default is 2.
  9067. @item shortest
  9068. If set to 1, force the output to terminate when the shortest input
  9069. terminates. Default value is 0.
  9070. @end table
  9071. @section w3fdif
  9072. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9073. Deinterlacing Filter").
  9074. Based on the process described by Martin Weston for BBC R&D, and
  9075. implemented based on the de-interlace algorithm written by Jim
  9076. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9077. uses filter coefficients calculated by BBC R&D.
  9078. There are two sets of filter coefficients, so called "simple":
  9079. and "complex". Which set of filter coefficients is used can
  9080. be set by passing an optional parameter:
  9081. @table @option
  9082. @item filter
  9083. Set the interlacing filter coefficients. Accepts one of the following values:
  9084. @table @samp
  9085. @item simple
  9086. Simple filter coefficient set.
  9087. @item complex
  9088. More-complex filter coefficient set.
  9089. @end table
  9090. Default value is @samp{complex}.
  9091. @item deint
  9092. Specify which frames to deinterlace. Accept one of the following values:
  9093. @table @samp
  9094. @item all
  9095. Deinterlace all frames,
  9096. @item interlaced
  9097. Only deinterlace frames marked as interlaced.
  9098. @end table
  9099. Default value is @samp{all}.
  9100. @end table
  9101. @section waveform
  9102. Video waveform monitor.
  9103. The waveform monitor plots color component intensity. By default luminance
  9104. only. Each column of the waveform corresponds to a column of pixels in the
  9105. source video.
  9106. It accepts the following options:
  9107. @table @option
  9108. @item mode, m
  9109. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9110. In row mode, the graph on the left side represents color component value 0 and
  9111. the right side represents value = 255. In column mode, the top side represents
  9112. color component value = 0 and bottom side represents value = 255.
  9113. @item intensity, i
  9114. Set intensity. Smaller values are useful to find out how many values of the same
  9115. luminance are distributed across input rows/columns.
  9116. Default value is @code{0.04}. Allowed range is [0, 1].
  9117. @item mirror, r
  9118. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9119. In mirrored mode, higher values will be represented on the left
  9120. side for @code{row} mode and at the top for @code{column} mode. Default is
  9121. @code{1} (mirrored).
  9122. @item display, d
  9123. Set display mode.
  9124. It accepts the following values:
  9125. @table @samp
  9126. @item overlay
  9127. Presents information identical to that in the @code{parade}, except
  9128. that the graphs representing color components are superimposed directly
  9129. over one another.
  9130. This display mode makes it easier to spot relative differences or similarities
  9131. in overlapping areas of the color components that are supposed to be identical,
  9132. such as neutral whites, grays, or blacks.
  9133. @item parade
  9134. Display separate graph for the color components side by side in
  9135. @code{row} mode or one below the other in @code{column} mode.
  9136. Using this display mode makes it easy to spot color casts in the highlights
  9137. and shadows of an image, by comparing the contours of the top and the bottom
  9138. graphs of each waveform. Since whites, grays, and blacks are characterized
  9139. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9140. should display three waveforms of roughly equal width/height. If not, the
  9141. correction is easy to perform by making level adjustments the three waveforms.
  9142. @end table
  9143. Default is @code{parade}.
  9144. @item components, c
  9145. Set which color components to display. Default is 1, which means only luminance
  9146. or red color component if input is in RGB colorspace. If is set for example to
  9147. 7 it will display all 3 (if) available color components.
  9148. @item envelope, e
  9149. @table @samp
  9150. @item none
  9151. No envelope, this is default.
  9152. @item instant
  9153. Instant envelope, minimum and maximum values presented in graph will be easily
  9154. visible even with small @code{step} value.
  9155. @item peak
  9156. Hold minimum and maximum values presented in graph across time. This way you
  9157. can still spot out of range values without constantly looking at waveforms.
  9158. @item peak+instant
  9159. Peak and instant envelope combined together.
  9160. @end table
  9161. @item filter, f
  9162. @table @samp
  9163. @item lowpass
  9164. No filtering, this is default.
  9165. @item flat
  9166. Luma and chroma combined together.
  9167. @item aflat
  9168. Similar as above, but shows difference between blue and red chroma.
  9169. @item chroma
  9170. Displays only chroma.
  9171. @item achroma
  9172. Similar as above, but shows difference between blue and red chroma.
  9173. @item color
  9174. Displays actual color value on waveform.
  9175. @end table
  9176. @end table
  9177. @section xbr
  9178. Apply the xBR high-quality magnification filter which is designed for pixel
  9179. art. It follows a set of edge-detection rules, see
  9180. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9181. It accepts the following option:
  9182. @table @option
  9183. @item n
  9184. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9185. @code{3xBR} and @code{4} for @code{4xBR}.
  9186. Default is @code{3}.
  9187. @end table
  9188. @anchor{yadif}
  9189. @section yadif
  9190. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9191. filter").
  9192. It accepts the following parameters:
  9193. @table @option
  9194. @item mode
  9195. The interlacing mode to adopt. It accepts one of the following values:
  9196. @table @option
  9197. @item 0, send_frame
  9198. Output one frame for each frame.
  9199. @item 1, send_field
  9200. Output one frame for each field.
  9201. @item 2, send_frame_nospatial
  9202. Like @code{send_frame}, but it skips the spatial interlacing check.
  9203. @item 3, send_field_nospatial
  9204. Like @code{send_field}, but it skips the spatial interlacing check.
  9205. @end table
  9206. The default value is @code{send_frame}.
  9207. @item parity
  9208. The picture field parity assumed for the input interlaced video. It accepts one
  9209. of the following values:
  9210. @table @option
  9211. @item 0, tff
  9212. Assume the top field is first.
  9213. @item 1, bff
  9214. Assume the bottom field is first.
  9215. @item -1, auto
  9216. Enable automatic detection of field parity.
  9217. @end table
  9218. The default value is @code{auto}.
  9219. If the interlacing is unknown or the decoder does not export this information,
  9220. top field first will be assumed.
  9221. @item deint
  9222. Specify which frames to deinterlace. Accept one of the following
  9223. values:
  9224. @table @option
  9225. @item 0, all
  9226. Deinterlace all frames.
  9227. @item 1, interlaced
  9228. Only deinterlace frames marked as interlaced.
  9229. @end table
  9230. The default value is @code{all}.
  9231. @end table
  9232. @section zoompan
  9233. Apply Zoom & Pan effect.
  9234. This filter accepts the following options:
  9235. @table @option
  9236. @item zoom, z
  9237. Set the zoom expression. Default is 1.
  9238. @item x
  9239. @item y
  9240. Set the x and y expression. Default is 0.
  9241. @item d
  9242. Set the duration expression in number of frames.
  9243. This sets for how many number of frames effect will last for
  9244. single input image.
  9245. @item s
  9246. Set the output image size, default is 'hd720'.
  9247. @end table
  9248. Each expression can contain the following constants:
  9249. @table @option
  9250. @item in_w, iw
  9251. Input width.
  9252. @item in_h, ih
  9253. Input height.
  9254. @item out_w, ow
  9255. Output width.
  9256. @item out_h, oh
  9257. Output height.
  9258. @item in
  9259. Input frame count.
  9260. @item on
  9261. Output frame count.
  9262. @item x
  9263. @item y
  9264. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9265. for current input frame.
  9266. @item px
  9267. @item py
  9268. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9269. not yet such frame (first input frame).
  9270. @item zoom
  9271. Last calculated zoom from 'z' expression for current input frame.
  9272. @item pzoom
  9273. Last calculated zoom of last output frame of previous input frame.
  9274. @item duration
  9275. Number of output frames for current input frame. Calculated from 'd' expression
  9276. for each input frame.
  9277. @item pduration
  9278. number of output frames created for previous input frame
  9279. @item a
  9280. Rational number: input width / input height
  9281. @item sar
  9282. sample aspect ratio
  9283. @item dar
  9284. display aspect ratio
  9285. @end table
  9286. @subsection Examples
  9287. @itemize
  9288. @item
  9289. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9290. @example
  9291. 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
  9292. @end example
  9293. @item
  9294. Zoom-in up to 1.5 and pan always at center of picture:
  9295. @example
  9296. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9297. @end example
  9298. @end itemize
  9299. @section zscale
  9300. Scale (resize) the input video, using the z.lib library:
  9301. https://github.com/sekrit-twc/zimg.
  9302. The zscale filter forces the output display aspect ratio to be the same
  9303. as the input, by changing the output sample aspect ratio.
  9304. If the input image format is different from the format requested by
  9305. the next filter, the zscale filter will convert the input to the
  9306. requested format.
  9307. @subsection Options
  9308. The filter accepts the following options.
  9309. @table @option
  9310. @item width, w
  9311. @item height, h
  9312. Set the output video dimension expression. Default value is the input
  9313. dimension.
  9314. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9315. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9316. If one of the values is -1, the zscale filter will use a value that
  9317. maintains the aspect ratio of the input image, calculated from the
  9318. other specified dimension. If both of them are -1, the input size is
  9319. used
  9320. If one of the values is -n with n > 1, the zscale filter will also use a value
  9321. that maintains the aspect ratio of the input image, calculated from the other
  9322. specified dimension. After that it will, however, make sure that the calculated
  9323. dimension is divisible by n and adjust the value if necessary.
  9324. See below for the list of accepted constants for use in the dimension
  9325. expression.
  9326. @item size, s
  9327. Set the video size. For the syntax of this option, check the
  9328. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9329. @item dither, d
  9330. Set the dither type.
  9331. Possible values are:
  9332. @table @var
  9333. @item none
  9334. @item ordered
  9335. @item random
  9336. @item error_diffusion
  9337. @end table
  9338. Default is none.
  9339. @item filter, f
  9340. Set the resize filter type.
  9341. Possible values are:
  9342. @table @var
  9343. @item point
  9344. @item bilinear
  9345. @item bicubic
  9346. @item spline16
  9347. @item spline36
  9348. @item lanczos
  9349. @end table
  9350. Default is bilinear.
  9351. @item range, r
  9352. Set the color range.
  9353. Possible values are:
  9354. @table @var
  9355. @item input
  9356. @item limited
  9357. @item full
  9358. @end table
  9359. Default is same as input.
  9360. @item primaries, p
  9361. Set the color primaries.
  9362. Possible values are:
  9363. @table @var
  9364. @item input
  9365. @item 709
  9366. @item unspecified
  9367. @item 170m
  9368. @item 240m
  9369. @item 2020
  9370. @end table
  9371. Default is same as input.
  9372. @item transfer, t
  9373. Set the transfer characteristics.
  9374. Possible values are:
  9375. @table @var
  9376. @item input
  9377. @item 709
  9378. @item unspecified
  9379. @item 601
  9380. @item linear
  9381. @item 2020_10
  9382. @item 2020_12
  9383. @end table
  9384. Default is same as input.
  9385. @item matrix, m
  9386. Set the colorspace matrix.
  9387. Possible value are:
  9388. @table @var
  9389. @item input
  9390. @item 709
  9391. @item unspecified
  9392. @item 470bg
  9393. @item 170m
  9394. @item 2020_ncl
  9395. @item 2020_cl
  9396. @end table
  9397. Default is same as input.
  9398. @end table
  9399. The values of the @option{w} and @option{h} options are expressions
  9400. containing the following constants:
  9401. @table @var
  9402. @item in_w
  9403. @item in_h
  9404. The input width and height
  9405. @item iw
  9406. @item ih
  9407. These are the same as @var{in_w} and @var{in_h}.
  9408. @item out_w
  9409. @item out_h
  9410. The output (scaled) width and height
  9411. @item ow
  9412. @item oh
  9413. These are the same as @var{out_w} and @var{out_h}
  9414. @item a
  9415. The same as @var{iw} / @var{ih}
  9416. @item sar
  9417. input sample aspect ratio
  9418. @item dar
  9419. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9420. @item hsub
  9421. @item vsub
  9422. horizontal and vertical input chroma subsample values. For example for the
  9423. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9424. @item ohsub
  9425. @item ovsub
  9426. horizontal and vertical output chroma subsample values. For example for the
  9427. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9428. @end table
  9429. @table @option
  9430. @end table
  9431. @c man end VIDEO FILTERS
  9432. @chapter Video Sources
  9433. @c man begin VIDEO SOURCES
  9434. Below is a description of the currently available video sources.
  9435. @section buffer
  9436. Buffer video frames, and make them available to the filter chain.
  9437. This source is mainly intended for a programmatic use, in particular
  9438. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9439. It accepts the following parameters:
  9440. @table @option
  9441. @item video_size
  9442. Specify the size (width and height) of the buffered video frames. For the
  9443. syntax of this option, check the
  9444. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9445. @item width
  9446. The input video width.
  9447. @item height
  9448. The input video height.
  9449. @item pix_fmt
  9450. A string representing the pixel format of the buffered video frames.
  9451. It may be a number corresponding to a pixel format, or a pixel format
  9452. name.
  9453. @item time_base
  9454. Specify the timebase assumed by the timestamps of the buffered frames.
  9455. @item frame_rate
  9456. Specify the frame rate expected for the video stream.
  9457. @item pixel_aspect, sar
  9458. The sample (pixel) aspect ratio of the input video.
  9459. @item sws_param
  9460. Specify the optional parameters to be used for the scale filter which
  9461. is automatically inserted when an input change is detected in the
  9462. input size or format.
  9463. @end table
  9464. For example:
  9465. @example
  9466. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9467. @end example
  9468. will instruct the source to accept video frames with size 320x240 and
  9469. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9470. square pixels (1:1 sample aspect ratio).
  9471. Since the pixel format with name "yuv410p" corresponds to the number 6
  9472. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9473. this example corresponds to:
  9474. @example
  9475. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9476. @end example
  9477. Alternatively, the options can be specified as a flat string, but this
  9478. syntax is deprecated:
  9479. @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}]
  9480. @section cellauto
  9481. Create a pattern generated by an elementary cellular automaton.
  9482. The initial state of the cellular automaton can be defined through the
  9483. @option{filename}, and @option{pattern} options. If such options are
  9484. not specified an initial state is created randomly.
  9485. At each new frame a new row in the video is filled with the result of
  9486. the cellular automaton next generation. The behavior when the whole
  9487. frame is filled is defined by the @option{scroll} option.
  9488. This source accepts the following options:
  9489. @table @option
  9490. @item filename, f
  9491. Read the initial cellular automaton state, i.e. the starting row, from
  9492. the specified file.
  9493. In the file, each non-whitespace character is considered an alive
  9494. cell, a newline will terminate the row, and further characters in the
  9495. file will be ignored.
  9496. @item pattern, p
  9497. Read the initial cellular automaton state, i.e. the starting row, from
  9498. the specified string.
  9499. Each non-whitespace character in the string is considered an alive
  9500. cell, a newline will terminate the row, and further characters in the
  9501. string will be ignored.
  9502. @item rate, r
  9503. Set the video rate, that is the number of frames generated per second.
  9504. Default is 25.
  9505. @item random_fill_ratio, ratio
  9506. Set the random fill ratio for the initial cellular automaton row. It
  9507. is a floating point number value ranging from 0 to 1, defaults to
  9508. 1/PHI.
  9509. This option is ignored when a file or a pattern is specified.
  9510. @item random_seed, seed
  9511. Set the seed for filling randomly the initial row, must be an integer
  9512. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9513. set to -1, the filter will try to use a good random seed on a best
  9514. effort basis.
  9515. @item rule
  9516. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9517. Default value is 110.
  9518. @item size, s
  9519. Set the size of the output video. For the syntax of this option, check the
  9520. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9521. If @option{filename} or @option{pattern} is specified, the size is set
  9522. by default to the width of the specified initial state row, and the
  9523. height is set to @var{width} * PHI.
  9524. If @option{size} is set, it must contain the width of the specified
  9525. pattern string, and the specified pattern will be centered in the
  9526. larger row.
  9527. If a filename or a pattern string is not specified, the size value
  9528. defaults to "320x518" (used for a randomly generated initial state).
  9529. @item scroll
  9530. If set to 1, scroll the output upward when all the rows in the output
  9531. have been already filled. If set to 0, the new generated row will be
  9532. written over the top row just after the bottom row is filled.
  9533. Defaults to 1.
  9534. @item start_full, full
  9535. If set to 1, completely fill the output with generated rows before
  9536. outputting the first frame.
  9537. This is the default behavior, for disabling set the value to 0.
  9538. @item stitch
  9539. If set to 1, stitch the left and right row edges together.
  9540. This is the default behavior, for disabling set the value to 0.
  9541. @end table
  9542. @subsection Examples
  9543. @itemize
  9544. @item
  9545. Read the initial state from @file{pattern}, and specify an output of
  9546. size 200x400.
  9547. @example
  9548. cellauto=f=pattern:s=200x400
  9549. @end example
  9550. @item
  9551. Generate a random initial row with a width of 200 cells, with a fill
  9552. ratio of 2/3:
  9553. @example
  9554. cellauto=ratio=2/3:s=200x200
  9555. @end example
  9556. @item
  9557. Create a pattern generated by rule 18 starting by a single alive cell
  9558. centered on an initial row with width 100:
  9559. @example
  9560. cellauto=p=@@:s=100x400:full=0:rule=18
  9561. @end example
  9562. @item
  9563. Specify a more elaborated initial pattern:
  9564. @example
  9565. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9566. @end example
  9567. @end itemize
  9568. @section mandelbrot
  9569. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9570. point specified with @var{start_x} and @var{start_y}.
  9571. This source accepts the following options:
  9572. @table @option
  9573. @item end_pts
  9574. Set the terminal pts value. Default value is 400.
  9575. @item end_scale
  9576. Set the terminal scale value.
  9577. Must be a floating point value. Default value is 0.3.
  9578. @item inner
  9579. Set the inner coloring mode, that is the algorithm used to draw the
  9580. Mandelbrot fractal internal region.
  9581. It shall assume one of the following values:
  9582. @table @option
  9583. @item black
  9584. Set black mode.
  9585. @item convergence
  9586. Show time until convergence.
  9587. @item mincol
  9588. Set color based on point closest to the origin of the iterations.
  9589. @item period
  9590. Set period mode.
  9591. @end table
  9592. Default value is @var{mincol}.
  9593. @item bailout
  9594. Set the bailout value. Default value is 10.0.
  9595. @item maxiter
  9596. Set the maximum of iterations performed by the rendering
  9597. algorithm. Default value is 7189.
  9598. @item outer
  9599. Set outer coloring mode.
  9600. It shall assume one of following values:
  9601. @table @option
  9602. @item iteration_count
  9603. Set iteration cound mode.
  9604. @item normalized_iteration_count
  9605. set normalized iteration count mode.
  9606. @end table
  9607. Default value is @var{normalized_iteration_count}.
  9608. @item rate, r
  9609. Set frame rate, expressed as number of frames per second. Default
  9610. value is "25".
  9611. @item size, s
  9612. Set frame size. For the syntax of this option, check the "Video
  9613. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9614. @item start_scale
  9615. Set the initial scale value. Default value is 3.0.
  9616. @item start_x
  9617. Set the initial x position. Must be a floating point value between
  9618. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9619. @item start_y
  9620. Set the initial y position. Must be a floating point value between
  9621. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9622. @end table
  9623. @section mptestsrc
  9624. Generate various test patterns, as generated by the MPlayer test filter.
  9625. The size of the generated video is fixed, and is 256x256.
  9626. This source is useful in particular for testing encoding features.
  9627. This source accepts the following options:
  9628. @table @option
  9629. @item rate, r
  9630. Specify the frame rate of the sourced video, as the number of frames
  9631. generated per second. It has to be a string in the format
  9632. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9633. number or a valid video frame rate abbreviation. The default value is
  9634. "25".
  9635. @item duration, d
  9636. Set the duration of the sourced video. See
  9637. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9638. for the accepted syntax.
  9639. If not specified, or the expressed duration is negative, the video is
  9640. supposed to be generated forever.
  9641. @item test, t
  9642. Set the number or the name of the test to perform. Supported tests are:
  9643. @table @option
  9644. @item dc_luma
  9645. @item dc_chroma
  9646. @item freq_luma
  9647. @item freq_chroma
  9648. @item amp_luma
  9649. @item amp_chroma
  9650. @item cbp
  9651. @item mv
  9652. @item ring1
  9653. @item ring2
  9654. @item all
  9655. @end table
  9656. Default value is "all", which will cycle through the list of all tests.
  9657. @end table
  9658. Some examples:
  9659. @example
  9660. mptestsrc=t=dc_luma
  9661. @end example
  9662. will generate a "dc_luma" test pattern.
  9663. @section frei0r_src
  9664. Provide a frei0r source.
  9665. To enable compilation of this filter you need to install the frei0r
  9666. header and configure FFmpeg with @code{--enable-frei0r}.
  9667. This source accepts the following parameters:
  9668. @table @option
  9669. @item size
  9670. The size of the video to generate. For the syntax of this option, check the
  9671. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9672. @item framerate
  9673. The framerate of the generated video. It may be a string of the form
  9674. @var{num}/@var{den} or a frame rate abbreviation.
  9675. @item filter_name
  9676. The name to the frei0r source to load. For more information regarding frei0r and
  9677. how to set the parameters, read the @ref{frei0r} section in the video filters
  9678. documentation.
  9679. @item filter_params
  9680. A '|'-separated list of parameters to pass to the frei0r source.
  9681. @end table
  9682. For example, to generate a frei0r partik0l source with size 200x200
  9683. and frame rate 10 which is overlaid on the overlay filter main input:
  9684. @example
  9685. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9686. @end example
  9687. @section life
  9688. Generate a life pattern.
  9689. This source is based on a generalization of John Conway's life game.
  9690. The sourced input represents a life grid, each pixel represents a cell
  9691. which can be in one of two possible states, alive or dead. Every cell
  9692. interacts with its eight neighbours, which are the cells that are
  9693. horizontally, vertically, or diagonally adjacent.
  9694. At each interaction the grid evolves according to the adopted rule,
  9695. which specifies the number of neighbor alive cells which will make a
  9696. cell stay alive or born. The @option{rule} option allows one to specify
  9697. the rule to adopt.
  9698. This source accepts the following options:
  9699. @table @option
  9700. @item filename, f
  9701. Set the file from which to read the initial grid state. In the file,
  9702. each non-whitespace character is considered an alive cell, and newline
  9703. is used to delimit the end of each row.
  9704. If this option is not specified, the initial grid is generated
  9705. randomly.
  9706. @item rate, r
  9707. Set the video rate, that is the number of frames generated per second.
  9708. Default is 25.
  9709. @item random_fill_ratio, ratio
  9710. Set the random fill ratio for the initial random grid. It is a
  9711. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9712. It is ignored when a file is specified.
  9713. @item random_seed, seed
  9714. Set the seed for filling the initial random grid, must be an integer
  9715. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9716. set to -1, the filter will try to use a good random seed on a best
  9717. effort basis.
  9718. @item rule
  9719. Set the life rule.
  9720. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9721. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9722. @var{NS} specifies the number of alive neighbor cells which make a
  9723. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9724. which make a dead cell to become alive (i.e. to "born").
  9725. "s" and "b" can be used in place of "S" and "B", respectively.
  9726. Alternatively a rule can be specified by an 18-bits integer. The 9
  9727. high order bits are used to encode the next cell state if it is alive
  9728. for each number of neighbor alive cells, the low order bits specify
  9729. the rule for "borning" new cells. Higher order bits encode for an
  9730. higher number of neighbor cells.
  9731. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9732. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9733. Default value is "S23/B3", which is the original Conway's game of life
  9734. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9735. cells, and will born a new cell if there are three alive cells around
  9736. a dead cell.
  9737. @item size, s
  9738. Set the size of the output video. For the syntax of this option, check the
  9739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9740. If @option{filename} is specified, the size is set by default to the
  9741. same size of the input file. If @option{size} is set, it must contain
  9742. the size specified in the input file, and the initial grid defined in
  9743. that file is centered in the larger resulting area.
  9744. If a filename is not specified, the size value defaults to "320x240"
  9745. (used for a randomly generated initial grid).
  9746. @item stitch
  9747. If set to 1, stitch the left and right grid edges together, and the
  9748. top and bottom edges also. Defaults to 1.
  9749. @item mold
  9750. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9751. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9752. value from 0 to 255.
  9753. @item life_color
  9754. Set the color of living (or new born) cells.
  9755. @item death_color
  9756. Set the color of dead cells. If @option{mold} is set, this is the first color
  9757. used to represent a dead cell.
  9758. @item mold_color
  9759. Set mold color, for definitely dead and moldy cells.
  9760. For the syntax of these 3 color options, check the "Color" section in the
  9761. ffmpeg-utils manual.
  9762. @end table
  9763. @subsection Examples
  9764. @itemize
  9765. @item
  9766. Read a grid from @file{pattern}, and center it on a grid of size
  9767. 300x300 pixels:
  9768. @example
  9769. life=f=pattern:s=300x300
  9770. @end example
  9771. @item
  9772. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9773. @example
  9774. life=ratio=2/3:s=200x200
  9775. @end example
  9776. @item
  9777. Specify a custom rule for evolving a randomly generated grid:
  9778. @example
  9779. life=rule=S14/B34
  9780. @end example
  9781. @item
  9782. Full example with slow death effect (mold) using @command{ffplay}:
  9783. @example
  9784. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9785. @end example
  9786. @end itemize
  9787. @anchor{allrgb}
  9788. @anchor{allyuv}
  9789. @anchor{color}
  9790. @anchor{haldclutsrc}
  9791. @anchor{nullsrc}
  9792. @anchor{rgbtestsrc}
  9793. @anchor{smptebars}
  9794. @anchor{smptehdbars}
  9795. @anchor{testsrc}
  9796. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9797. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9798. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9799. The @code{color} source provides an uniformly colored input.
  9800. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9801. @ref{haldclut} filter.
  9802. The @code{nullsrc} source returns unprocessed video frames. It is
  9803. mainly useful to be employed in analysis / debugging tools, or as the
  9804. source for filters which ignore the input data.
  9805. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9806. detecting RGB vs BGR issues. You should see a red, green and blue
  9807. stripe from top to bottom.
  9808. The @code{smptebars} source generates a color bars pattern, based on
  9809. the SMPTE Engineering Guideline EG 1-1990.
  9810. The @code{smptehdbars} source generates a color bars pattern, based on
  9811. the SMPTE RP 219-2002.
  9812. The @code{testsrc} source generates a test video pattern, showing a
  9813. color pattern, a scrolling gradient and a timestamp. This is mainly
  9814. intended for testing purposes.
  9815. The sources accept the following parameters:
  9816. @table @option
  9817. @item color, c
  9818. Specify the color of the source, only available in the @code{color}
  9819. source. For the syntax of this option, check the "Color" section in the
  9820. ffmpeg-utils manual.
  9821. @item level
  9822. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9823. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9824. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9825. coded on a @code{1/(N*N)} scale.
  9826. @item size, s
  9827. Specify the size of the sourced video. For the syntax of this option, check the
  9828. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9829. The default value is @code{320x240}.
  9830. This option is not available with the @code{haldclutsrc} filter.
  9831. @item rate, r
  9832. Specify the frame rate of the sourced video, as the number of frames
  9833. generated per second. It has to be a string in the format
  9834. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9835. number or a valid video frame rate abbreviation. The default value is
  9836. "25".
  9837. @item sar
  9838. Set the sample aspect ratio of the sourced video.
  9839. @item duration, d
  9840. Set the duration of the sourced video. See
  9841. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9842. for the accepted syntax.
  9843. If not specified, or the expressed duration is negative, the video is
  9844. supposed to be generated forever.
  9845. @item decimals, n
  9846. Set the number of decimals to show in the timestamp, only available in the
  9847. @code{testsrc} source.
  9848. The displayed timestamp value will correspond to the original
  9849. timestamp value multiplied by the power of 10 of the specified
  9850. value. Default value is 0.
  9851. @end table
  9852. For example the following:
  9853. @example
  9854. testsrc=duration=5.3:size=qcif:rate=10
  9855. @end example
  9856. will generate a video with a duration of 5.3 seconds, with size
  9857. 176x144 and a frame rate of 10 frames per second.
  9858. The following graph description will generate a red source
  9859. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9860. frames per second.
  9861. @example
  9862. color=c=red@@0.2:s=qcif:r=10
  9863. @end example
  9864. If the input content is to be ignored, @code{nullsrc} can be used. The
  9865. following command generates noise in the luminance plane by employing
  9866. the @code{geq} filter:
  9867. @example
  9868. nullsrc=s=256x256, geq=random(1)*255:128:128
  9869. @end example
  9870. @subsection Commands
  9871. The @code{color} source supports the following commands:
  9872. @table @option
  9873. @item c, color
  9874. Set the color of the created image. Accepts the same syntax of the
  9875. corresponding @option{color} option.
  9876. @end table
  9877. @c man end VIDEO SOURCES
  9878. @chapter Video Sinks
  9879. @c man begin VIDEO SINKS
  9880. Below is a description of the currently available video sinks.
  9881. @section buffersink
  9882. Buffer video frames, and make them available to the end of the filter
  9883. graph.
  9884. This sink is mainly intended for programmatic use, in particular
  9885. through the interface defined in @file{libavfilter/buffersink.h}
  9886. or the options system.
  9887. It accepts a pointer to an AVBufferSinkContext structure, which
  9888. defines the incoming buffers' formats, to be passed as the opaque
  9889. parameter to @code{avfilter_init_filter} for initialization.
  9890. @section nullsink
  9891. Null video sink: do absolutely nothing with the input video. It is
  9892. mainly useful as a template and for use in analysis / debugging
  9893. tools.
  9894. @c man end VIDEO SINKS
  9895. @chapter Multimedia Filters
  9896. @c man begin MULTIMEDIA FILTERS
  9897. Below is a description of the currently available multimedia filters.
  9898. @section aphasemeter
  9899. Convert input audio to a video output, displaying the audio phase.
  9900. The filter accepts the following options:
  9901. @table @option
  9902. @item rate, r
  9903. Set the output frame rate. Default value is @code{25}.
  9904. @item size, s
  9905. Set the video size for the output. For the syntax of this option, check the
  9906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9907. Default value is @code{800x400}.
  9908. @item rc
  9909. @item gc
  9910. @item bc
  9911. Specify the red, green, blue contrast. Default values are @code{2},
  9912. @code{7} and @code{1}.
  9913. Allowed range is @code{[0, 255]}.
  9914. @item mpc
  9915. Set color which will be used for drawing median phase. If color is
  9916. @code{none} which is default, no median phase value will be drawn.
  9917. @end table
  9918. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9919. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9920. The @code{-1} means left and right channels are completely out of phase and
  9921. @code{1} means channels are in phase.
  9922. @section avectorscope
  9923. Convert input audio to a video output, representing the audio vector
  9924. scope.
  9925. The filter is used to measure the difference between channels of stereo
  9926. audio stream. A monoaural signal, consisting of identical left and right
  9927. signal, results in straight vertical line. Any stereo separation is visible
  9928. as a deviation from this line, creating a Lissajous figure.
  9929. If the straight (or deviation from it) but horizontal line appears this
  9930. indicates that the left and right channels are out of phase.
  9931. The filter accepts the following options:
  9932. @table @option
  9933. @item mode, m
  9934. Set the vectorscope mode.
  9935. Available values are:
  9936. @table @samp
  9937. @item lissajous
  9938. Lissajous rotated by 45 degrees.
  9939. @item lissajous_xy
  9940. Same as above but not rotated.
  9941. @item polar
  9942. Shape resembling half of circle.
  9943. @end table
  9944. Default value is @samp{lissajous}.
  9945. @item size, s
  9946. Set the video size for the output. For the syntax of this option, check the
  9947. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9948. Default value is @code{400x400}.
  9949. @item rate, r
  9950. Set the output frame rate. Default value is @code{25}.
  9951. @item rc
  9952. @item gc
  9953. @item bc
  9954. @item ac
  9955. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9956. @code{160}, @code{80} and @code{255}.
  9957. Allowed range is @code{[0, 255]}.
  9958. @item rf
  9959. @item gf
  9960. @item bf
  9961. @item af
  9962. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9963. @code{10}, @code{5} and @code{5}.
  9964. Allowed range is @code{[0, 255]}.
  9965. @item zoom
  9966. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9967. @end table
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Complete example using @command{ffplay}:
  9972. @example
  9973. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9974. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9975. @end example
  9976. @end itemize
  9977. @section concat
  9978. Concatenate audio and video streams, joining them together one after the
  9979. other.
  9980. The filter works on segments of synchronized video and audio streams. All
  9981. segments must have the same number of streams of each type, and that will
  9982. also be the number of streams at output.
  9983. The filter accepts the following options:
  9984. @table @option
  9985. @item n
  9986. Set the number of segments. Default is 2.
  9987. @item v
  9988. Set the number of output video streams, that is also the number of video
  9989. streams in each segment. Default is 1.
  9990. @item a
  9991. Set the number of output audio streams, that is also the number of audio
  9992. streams in each segment. Default is 0.
  9993. @item unsafe
  9994. Activate unsafe mode: do not fail if segments have a different format.
  9995. @end table
  9996. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9997. @var{a} audio outputs.
  9998. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9999. segment, in the same order as the outputs, then the inputs for the second
  10000. segment, etc.
  10001. Related streams do not always have exactly the same duration, for various
  10002. reasons including codec frame size or sloppy authoring. For that reason,
  10003. related synchronized streams (e.g. a video and its audio track) should be
  10004. concatenated at once. The concat filter will use the duration of the longest
  10005. stream in each segment (except the last one), and if necessary pad shorter
  10006. audio streams with silence.
  10007. For this filter to work correctly, all segments must start at timestamp 0.
  10008. All corresponding streams must have the same parameters in all segments; the
  10009. filtering system will automatically select a common pixel format for video
  10010. streams, and a common sample format, sample rate and channel layout for
  10011. audio streams, but other settings, such as resolution, must be converted
  10012. explicitly by the user.
  10013. Different frame rates are acceptable but will result in variable frame rate
  10014. at output; be sure to configure the output file to handle it.
  10015. @subsection Examples
  10016. @itemize
  10017. @item
  10018. Concatenate an opening, an episode and an ending, all in bilingual version
  10019. (video in stream 0, audio in streams 1 and 2):
  10020. @example
  10021. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10022. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10023. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10024. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10025. @end example
  10026. @item
  10027. Concatenate two parts, handling audio and video separately, using the
  10028. (a)movie sources, and adjusting the resolution:
  10029. @example
  10030. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10031. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10032. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10033. @end example
  10034. Note that a desync will happen at the stitch if the audio and video streams
  10035. do not have exactly the same duration in the first file.
  10036. @end itemize
  10037. @anchor{ebur128}
  10038. @section ebur128
  10039. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10040. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10041. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10042. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10043. The filter also has a video output (see the @var{video} option) with a real
  10044. time graph to observe the loudness evolution. The graphic contains the logged
  10045. message mentioned above, so it is not printed anymore when this option is set,
  10046. unless the verbose logging is set. The main graphing area contains the
  10047. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10048. the momentary loudness (400 milliseconds).
  10049. More information about the Loudness Recommendation EBU R128 on
  10050. @url{http://tech.ebu.ch/loudness}.
  10051. The filter accepts the following options:
  10052. @table @option
  10053. @item video
  10054. Activate the video output. The audio stream is passed unchanged whether this
  10055. option is set or no. The video stream will be the first output stream if
  10056. activated. Default is @code{0}.
  10057. @item size
  10058. Set the video size. This option is for video only. For the syntax of this
  10059. option, check the
  10060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10061. Default and minimum resolution is @code{640x480}.
  10062. @item meter
  10063. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10064. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10065. other integer value between this range is allowed.
  10066. @item metadata
  10067. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10068. into 100ms output frames, each of them containing various loudness information
  10069. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10070. Default is @code{0}.
  10071. @item framelog
  10072. Force the frame logging level.
  10073. Available values are:
  10074. @table @samp
  10075. @item info
  10076. information logging level
  10077. @item verbose
  10078. verbose logging level
  10079. @end table
  10080. By default, the logging level is set to @var{info}. If the @option{video} or
  10081. the @option{metadata} options are set, it switches to @var{verbose}.
  10082. @item peak
  10083. Set peak mode(s).
  10084. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10085. values are:
  10086. @table @samp
  10087. @item none
  10088. Disable any peak mode (default).
  10089. @item sample
  10090. Enable sample-peak mode.
  10091. Simple peak mode looking for the higher sample value. It logs a message
  10092. for sample-peak (identified by @code{SPK}).
  10093. @item true
  10094. Enable true-peak mode.
  10095. If enabled, the peak lookup is done on an over-sampled version of the input
  10096. stream for better peak accuracy. It logs a message for true-peak.
  10097. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10098. This mode requires a build with @code{libswresample}.
  10099. @end table
  10100. @item dualmono
  10101. Treat mono input files as "dual mono". If a mono file is intended for playback
  10102. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10103. If set to @code{true}, this option will compensate for this effect.
  10104. Multi-channel input files are not affected by this option.
  10105. @item panlaw
  10106. Set a specific pan law to be used for the measurement of dual mono files.
  10107. This parameter is optional, and has a default value of -3.01dB.
  10108. @end table
  10109. @subsection Examples
  10110. @itemize
  10111. @item
  10112. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10113. @example
  10114. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10115. @end example
  10116. @item
  10117. Run an analysis with @command{ffmpeg}:
  10118. @example
  10119. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10120. @end example
  10121. @end itemize
  10122. @section interleave, ainterleave
  10123. Temporally interleave frames from several inputs.
  10124. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10125. These filters read frames from several inputs and send the oldest
  10126. queued frame to the output.
  10127. Input streams must have a well defined, monotonically increasing frame
  10128. timestamp values.
  10129. In order to submit one frame to output, these filters need to enqueue
  10130. at least one frame for each input, so they cannot work in case one
  10131. input is not yet terminated and will not receive incoming frames.
  10132. For example consider the case when one input is a @code{select} filter
  10133. which always drop input frames. The @code{interleave} filter will keep
  10134. reading from that input, but it will never be able to send new frames
  10135. to output until the input will send an end-of-stream signal.
  10136. Also, depending on inputs synchronization, the filters will drop
  10137. frames in case one input receives more frames than the other ones, and
  10138. the queue is already filled.
  10139. These filters accept the following options:
  10140. @table @option
  10141. @item nb_inputs, n
  10142. Set the number of different inputs, it is 2 by default.
  10143. @end table
  10144. @subsection Examples
  10145. @itemize
  10146. @item
  10147. Interleave frames belonging to different streams using @command{ffmpeg}:
  10148. @example
  10149. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10150. @end example
  10151. @item
  10152. Add flickering blur effect:
  10153. @example
  10154. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10155. @end example
  10156. @end itemize
  10157. @section perms, aperms
  10158. Set read/write permissions for the output frames.
  10159. These filters are mainly aimed at developers to test direct path in the
  10160. following filter in the filtergraph.
  10161. The filters accept the following options:
  10162. @table @option
  10163. @item mode
  10164. Select the permissions mode.
  10165. It accepts the following values:
  10166. @table @samp
  10167. @item none
  10168. Do nothing. This is the default.
  10169. @item ro
  10170. Set all the output frames read-only.
  10171. @item rw
  10172. Set all the output frames directly writable.
  10173. @item toggle
  10174. Make the frame read-only if writable, and writable if read-only.
  10175. @item random
  10176. Set each output frame read-only or writable randomly.
  10177. @end table
  10178. @item seed
  10179. Set the seed for the @var{random} mode, must be an integer included between
  10180. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10181. @code{-1}, the filter will try to use a good random seed on a best effort
  10182. basis.
  10183. @end table
  10184. Note: in case of auto-inserted filter between the permission filter and the
  10185. following one, the permission might not be received as expected in that
  10186. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10187. perms/aperms filter can avoid this problem.
  10188. @section realtime, arealtime
  10189. Slow down filtering to match real time approximatively.
  10190. These filters will pause the filtering for a variable amount of time to
  10191. match the output rate with the input timestamps.
  10192. They are similar to the @option{re} option to @code{ffmpeg}.
  10193. They accept the following options:
  10194. @table @option
  10195. @item limit
  10196. Time limit for the pauses. Any pause longer than that will be considered
  10197. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10198. @end table
  10199. @section select, aselect
  10200. Select frames to pass in output.
  10201. This filter accepts the following options:
  10202. @table @option
  10203. @item expr, e
  10204. Set expression, which is evaluated for each input frame.
  10205. If the expression is evaluated to zero, the frame is discarded.
  10206. If the evaluation result is negative or NaN, the frame is sent to the
  10207. first output; otherwise it is sent to the output with index
  10208. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10209. For example a value of @code{1.2} corresponds to the output with index
  10210. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10211. @item outputs, n
  10212. Set the number of outputs. The output to which to send the selected
  10213. frame is based on the result of the evaluation. Default value is 1.
  10214. @end table
  10215. The expression can contain the following constants:
  10216. @table @option
  10217. @item n
  10218. The (sequential) number of the filtered frame, starting from 0.
  10219. @item selected_n
  10220. The (sequential) number of the selected frame, starting from 0.
  10221. @item prev_selected_n
  10222. The sequential number of the last selected frame. It's NAN if undefined.
  10223. @item TB
  10224. The timebase of the input timestamps.
  10225. @item pts
  10226. The PTS (Presentation TimeStamp) of the filtered video frame,
  10227. expressed in @var{TB} units. It's NAN if undefined.
  10228. @item t
  10229. The PTS of the filtered video frame,
  10230. expressed in seconds. It's NAN if undefined.
  10231. @item prev_pts
  10232. The PTS of the previously filtered video frame. It's NAN if undefined.
  10233. @item prev_selected_pts
  10234. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10235. @item prev_selected_t
  10236. The PTS of the last previously selected video frame. It's NAN if undefined.
  10237. @item start_pts
  10238. The PTS of the first video frame in the video. It's NAN if undefined.
  10239. @item start_t
  10240. The time of the first video frame in the video. It's NAN if undefined.
  10241. @item pict_type @emph{(video only)}
  10242. The type of the filtered frame. It can assume one of the following
  10243. values:
  10244. @table @option
  10245. @item I
  10246. @item P
  10247. @item B
  10248. @item S
  10249. @item SI
  10250. @item SP
  10251. @item BI
  10252. @end table
  10253. @item interlace_type @emph{(video only)}
  10254. The frame interlace type. It can assume one of the following values:
  10255. @table @option
  10256. @item PROGRESSIVE
  10257. The frame is progressive (not interlaced).
  10258. @item TOPFIRST
  10259. The frame is top-field-first.
  10260. @item BOTTOMFIRST
  10261. The frame is bottom-field-first.
  10262. @end table
  10263. @item consumed_sample_n @emph{(audio only)}
  10264. the number of selected samples before the current frame
  10265. @item samples_n @emph{(audio only)}
  10266. the number of samples in the current frame
  10267. @item sample_rate @emph{(audio only)}
  10268. the input sample rate
  10269. @item key
  10270. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10271. @item pos
  10272. the position in the file of the filtered frame, -1 if the information
  10273. is not available (e.g. for synthetic video)
  10274. @item scene @emph{(video only)}
  10275. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10276. probability for the current frame to introduce a new scene, while a higher
  10277. value means the current frame is more likely to be one (see the example below)
  10278. @item concatdec_select
  10279. The concat demuxer can select only part of a concat input file by setting an
  10280. inpoint and an outpoint, but the output packets may not be entirely contained
  10281. in the selected interval. By using this variable, it is possible to skip frames
  10282. generated by the concat demuxer which are not exactly contained in the selected
  10283. interval.
  10284. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10285. and the @var{lavf.concat.duration} packet metadata values which are also
  10286. present in the decoded frames.
  10287. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10288. start_time and either the duration metadata is missing or the frame pts is less
  10289. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10290. missing.
  10291. That basically means that an input frame is selected if its pts is within the
  10292. interval set by the concat demuxer.
  10293. @end table
  10294. The default value of the select expression is "1".
  10295. @subsection Examples
  10296. @itemize
  10297. @item
  10298. Select all frames in input:
  10299. @example
  10300. select
  10301. @end example
  10302. The example above is the same as:
  10303. @example
  10304. select=1
  10305. @end example
  10306. @item
  10307. Skip all frames:
  10308. @example
  10309. select=0
  10310. @end example
  10311. @item
  10312. Select only I-frames:
  10313. @example
  10314. select='eq(pict_type\,I)'
  10315. @end example
  10316. @item
  10317. Select one frame every 100:
  10318. @example
  10319. select='not(mod(n\,100))'
  10320. @end example
  10321. @item
  10322. Select only frames contained in the 10-20 time interval:
  10323. @example
  10324. select=between(t\,10\,20)
  10325. @end example
  10326. @item
  10327. Select only I frames contained in the 10-20 time interval:
  10328. @example
  10329. select=between(t\,10\,20)*eq(pict_type\,I)
  10330. @end example
  10331. @item
  10332. Select frames with a minimum distance of 10 seconds:
  10333. @example
  10334. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10335. @end example
  10336. @item
  10337. Use aselect to select only audio frames with samples number > 100:
  10338. @example
  10339. aselect='gt(samples_n\,100)'
  10340. @end example
  10341. @item
  10342. Create a mosaic of the first scenes:
  10343. @example
  10344. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10345. @end example
  10346. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10347. choice.
  10348. @item
  10349. Send even and odd frames to separate outputs, and compose them:
  10350. @example
  10351. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10352. @end example
  10353. @item
  10354. Select useful frames from an ffconcat file which is using inpoints and
  10355. outpoints but where the source files are not intra frame only.
  10356. @example
  10357. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10358. @end example
  10359. @end itemize
  10360. @section selectivecolor
  10361. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10362. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10363. by the "purity" of the color (that is, how saturated it already is).
  10364. This filter is similar to the Adobe Photoshop Selective Color tool.
  10365. The filter accepts the following options:
  10366. @table @option
  10367. @item correction_method
  10368. Select color correction method.
  10369. Available values are:
  10370. @table @samp
  10371. @item absolute
  10372. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10373. component value).
  10374. @item relative
  10375. Specified adjustments are relative to the original component value.
  10376. @end table
  10377. Default is @code{absolute}.
  10378. @item reds
  10379. Adjustments for red pixels (pixels where the red component is the maximum)
  10380. @item yellows
  10381. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10382. @item greens
  10383. Adjustments for green pixels (pixels where the green component is the maximum)
  10384. @item cyans
  10385. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10386. @item blues
  10387. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10388. @item magentas
  10389. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10390. @item whites
  10391. Adjustments for white pixels (pixels where all components are greater than 128)
  10392. @item neutrals
  10393. Adjustments for all pixels except pure black and pure white
  10394. @item blacks
  10395. Adjustments for black pixels (pixels where all components are lesser than 128)
  10396. @item psfile
  10397. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10398. @end table
  10399. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10400. 4 space separated floating point adjustment values in the [-1,1] range,
  10401. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10402. pixels of its range.
  10403. @subsection Examples
  10404. @itemize
  10405. @item
  10406. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10407. increase magenta by 27% in blue areas:
  10408. @example
  10409. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10410. @end example
  10411. @item
  10412. Use a Photoshop selective color preset:
  10413. @example
  10414. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10415. @end example
  10416. @end itemize
  10417. @section sendcmd, asendcmd
  10418. Send commands to filters in the filtergraph.
  10419. These filters read commands to be sent to other filters in the
  10420. filtergraph.
  10421. @code{sendcmd} must be inserted between two video filters,
  10422. @code{asendcmd} must be inserted between two audio filters, but apart
  10423. from that they act the same way.
  10424. The specification of commands can be provided in the filter arguments
  10425. with the @var{commands} option, or in a file specified by the
  10426. @var{filename} option.
  10427. These filters accept the following options:
  10428. @table @option
  10429. @item commands, c
  10430. Set the commands to be read and sent to the other filters.
  10431. @item filename, f
  10432. Set the filename of the commands to be read and sent to the other
  10433. filters.
  10434. @end table
  10435. @subsection Commands syntax
  10436. A commands description consists of a sequence of interval
  10437. specifications, comprising a list of commands to be executed when a
  10438. particular event related to that interval occurs. The occurring event
  10439. is typically the current frame time entering or leaving a given time
  10440. interval.
  10441. An interval is specified by the following syntax:
  10442. @example
  10443. @var{START}[-@var{END}] @var{COMMANDS};
  10444. @end example
  10445. The time interval is specified by the @var{START} and @var{END} times.
  10446. @var{END} is optional and defaults to the maximum time.
  10447. The current frame time is considered within the specified interval if
  10448. it is included in the interval [@var{START}, @var{END}), that is when
  10449. the time is greater or equal to @var{START} and is lesser than
  10450. @var{END}.
  10451. @var{COMMANDS} consists of a sequence of one or more command
  10452. specifications, separated by ",", relating to that interval. The
  10453. syntax of a command specification is given by:
  10454. @example
  10455. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10456. @end example
  10457. @var{FLAGS} is optional and specifies the type of events relating to
  10458. the time interval which enable sending the specified command, and must
  10459. be a non-null sequence of identifier flags separated by "+" or "|" and
  10460. enclosed between "[" and "]".
  10461. The following flags are recognized:
  10462. @table @option
  10463. @item enter
  10464. The command is sent when the current frame timestamp enters the
  10465. specified interval. In other words, the command is sent when the
  10466. previous frame timestamp was not in the given interval, and the
  10467. current is.
  10468. @item leave
  10469. The command is sent when the current frame timestamp leaves the
  10470. specified interval. In other words, the command is sent when the
  10471. previous frame timestamp was in the given interval, and the
  10472. current is not.
  10473. @end table
  10474. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10475. assumed.
  10476. @var{TARGET} specifies the target of the command, usually the name of
  10477. the filter class or a specific filter instance name.
  10478. @var{COMMAND} specifies the name of the command for the target filter.
  10479. @var{ARG} is optional and specifies the optional list of argument for
  10480. the given @var{COMMAND}.
  10481. Between one interval specification and another, whitespaces, or
  10482. sequences of characters starting with @code{#} until the end of line,
  10483. are ignored and can be used to annotate comments.
  10484. A simplified BNF description of the commands specification syntax
  10485. follows:
  10486. @example
  10487. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10488. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10489. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10490. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10491. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10492. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10493. @end example
  10494. @subsection Examples
  10495. @itemize
  10496. @item
  10497. Specify audio tempo change at second 4:
  10498. @example
  10499. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10500. @end example
  10501. @item
  10502. Specify a list of drawtext and hue commands in a file.
  10503. @example
  10504. # show text in the interval 5-10
  10505. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10506. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10507. # desaturate the image in the interval 15-20
  10508. 15.0-20.0 [enter] hue s 0,
  10509. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10510. [leave] hue s 1,
  10511. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10512. # apply an exponential saturation fade-out effect, starting from time 25
  10513. 25 [enter] hue s exp(25-t)
  10514. @end example
  10515. A filtergraph allowing to read and process the above command list
  10516. stored in a file @file{test.cmd}, can be specified with:
  10517. @example
  10518. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10519. @end example
  10520. @end itemize
  10521. @anchor{setpts}
  10522. @section setpts, asetpts
  10523. Change the PTS (presentation timestamp) of the input frames.
  10524. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10525. This filter accepts the following options:
  10526. @table @option
  10527. @item expr
  10528. The expression which is evaluated for each frame to construct its timestamp.
  10529. @end table
  10530. The expression is evaluated through the eval API and can contain the following
  10531. constants:
  10532. @table @option
  10533. @item FRAME_RATE
  10534. frame rate, only defined for constant frame-rate video
  10535. @item PTS
  10536. The presentation timestamp in input
  10537. @item N
  10538. The count of the input frame for video or the number of consumed samples,
  10539. not including the current frame for audio, starting from 0.
  10540. @item NB_CONSUMED_SAMPLES
  10541. The number of consumed samples, not including the current frame (only
  10542. audio)
  10543. @item NB_SAMPLES, S
  10544. The number of samples in the current frame (only audio)
  10545. @item SAMPLE_RATE, SR
  10546. The audio sample rate.
  10547. @item STARTPTS
  10548. The PTS of the first frame.
  10549. @item STARTT
  10550. the time in seconds of the first frame
  10551. @item INTERLACED
  10552. State whether the current frame is interlaced.
  10553. @item T
  10554. the time in seconds of the current frame
  10555. @item POS
  10556. original position in the file of the frame, or undefined if undefined
  10557. for the current frame
  10558. @item PREV_INPTS
  10559. The previous input PTS.
  10560. @item PREV_INT
  10561. previous input time in seconds
  10562. @item PREV_OUTPTS
  10563. The previous output PTS.
  10564. @item PREV_OUTT
  10565. previous output time in seconds
  10566. @item RTCTIME
  10567. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10568. instead.
  10569. @item RTCSTART
  10570. The wallclock (RTC) time at the start of the movie in microseconds.
  10571. @item TB
  10572. The timebase of the input timestamps.
  10573. @end table
  10574. @subsection Examples
  10575. @itemize
  10576. @item
  10577. Start counting PTS from zero
  10578. @example
  10579. setpts=PTS-STARTPTS
  10580. @end example
  10581. @item
  10582. Apply fast motion effect:
  10583. @example
  10584. setpts=0.5*PTS
  10585. @end example
  10586. @item
  10587. Apply slow motion effect:
  10588. @example
  10589. setpts=2.0*PTS
  10590. @end example
  10591. @item
  10592. Set fixed rate of 25 frames per second:
  10593. @example
  10594. setpts=N/(25*TB)
  10595. @end example
  10596. @item
  10597. Set fixed rate 25 fps with some jitter:
  10598. @example
  10599. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10600. @end example
  10601. @item
  10602. Apply an offset of 10 seconds to the input PTS:
  10603. @example
  10604. setpts=PTS+10/TB
  10605. @end example
  10606. @item
  10607. Generate timestamps from a "live source" and rebase onto the current timebase:
  10608. @example
  10609. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10610. @end example
  10611. @item
  10612. Generate timestamps by counting samples:
  10613. @example
  10614. asetpts=N/SR/TB
  10615. @end example
  10616. @end itemize
  10617. @section settb, asettb
  10618. Set the timebase to use for the output frames timestamps.
  10619. It is mainly useful for testing timebase configuration.
  10620. It accepts the following parameters:
  10621. @table @option
  10622. @item expr, tb
  10623. The expression which is evaluated into the output timebase.
  10624. @end table
  10625. The value for @option{tb} is an arithmetic expression representing a
  10626. rational. The expression can contain the constants "AVTB" (the default
  10627. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10628. audio only). Default value is "intb".
  10629. @subsection Examples
  10630. @itemize
  10631. @item
  10632. Set the timebase to 1/25:
  10633. @example
  10634. settb=expr=1/25
  10635. @end example
  10636. @item
  10637. Set the timebase to 1/10:
  10638. @example
  10639. settb=expr=0.1
  10640. @end example
  10641. @item
  10642. Set the timebase to 1001/1000:
  10643. @example
  10644. settb=1+0.001
  10645. @end example
  10646. @item
  10647. Set the timebase to 2*intb:
  10648. @example
  10649. settb=2*intb
  10650. @end example
  10651. @item
  10652. Set the default timebase value:
  10653. @example
  10654. settb=AVTB
  10655. @end example
  10656. @end itemize
  10657. @section showcqt
  10658. Convert input audio to a video output representing frequency spectrum
  10659. logarithmically using Brown-Puckette constant Q transform algorithm with
  10660. direct frequency domain coefficient calculation (but the transform itself
  10661. is not really constant Q, instead the Q factor is actually variable/clamped),
  10662. with musical tone scale, from E0 to D#10.
  10663. The filter accepts the following options:
  10664. @table @option
  10665. @item size, s
  10666. Specify the video size for the output. It must be even. For the syntax of this option,
  10667. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10668. Default value is @code{1920x1080}.
  10669. @item fps, rate, r
  10670. Set the output frame rate. Default value is @code{25}.
  10671. @item bar_h
  10672. Set the bargraph height. It must be even. Default value is @code{-1} which
  10673. computes the bargraph height automatically.
  10674. @item axis_h
  10675. Set the axis height. It must be even. Default value is @code{-1} which computes
  10676. the axis height automatically.
  10677. @item sono_h
  10678. Set the sonogram height. It must be even. Default value is @code{-1} which
  10679. computes the sonogram height automatically.
  10680. @item fullhd
  10681. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  10682. instead. Default value is @code{1}.
  10683. @item sono_v, volume
  10684. Specify the sonogram volume expression. It can contain variables:
  10685. @table @option
  10686. @item bar_v
  10687. the @var{bar_v} evaluated expression
  10688. @item frequency, freq, f
  10689. the frequency where it is evaluated
  10690. @item timeclamp, tc
  10691. the value of @var{timeclamp} option
  10692. @end table
  10693. and functions:
  10694. @table @option
  10695. @item a_weighting(f)
  10696. A-weighting of equal loudness
  10697. @item b_weighting(f)
  10698. B-weighting of equal loudness
  10699. @item c_weighting(f)
  10700. C-weighting of equal loudness.
  10701. @end table
  10702. Default value is @code{16}.
  10703. @item bar_v, volume2
  10704. Specify the bargraph volume expression. It can contain variables:
  10705. @table @option
  10706. @item sono_v
  10707. the @var{sono_v} evaluated expression
  10708. @item frequency, freq, f
  10709. the frequency where it is evaluated
  10710. @item timeclamp, tc
  10711. the value of @var{timeclamp} option
  10712. @end table
  10713. and functions:
  10714. @table @option
  10715. @item a_weighting(f)
  10716. A-weighting of equal loudness
  10717. @item b_weighting(f)
  10718. B-weighting of equal loudness
  10719. @item c_weighting(f)
  10720. C-weighting of equal loudness.
  10721. @end table
  10722. Default value is @code{sono_v}.
  10723. @item sono_g, gamma
  10724. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  10725. higher gamma makes the spectrum having more range. Default value is @code{3}.
  10726. Acceptable range is @code{[1, 7]}.
  10727. @item bar_g, gamma2
  10728. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  10729. @code{[1, 7]}.
  10730. @item timeclamp, tc
  10731. Specify the transform timeclamp. At low frequency, there is trade-off between
  10732. accuracy in time domain and frequency domain. If timeclamp is lower,
  10733. event in time domain is represented more accurately (such as fast bass drum),
  10734. otherwise event in frequency domain is represented more accurately
  10735. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  10736. @item basefreq
  10737. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  10738. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  10739. @item endfreq
  10740. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  10741. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  10742. @item coeffclamp
  10743. This option is deprecated and ignored.
  10744. @item tlength
  10745. Specify the transform length in time domain. Use this option to control accuracy
  10746. trade-off between time domain and frequency domain at every frequency sample.
  10747. It can contain variables:
  10748. @table @option
  10749. @item frequency, freq, f
  10750. the frequency where it is evaluated
  10751. @item timeclamp, tc
  10752. the value of @var{timeclamp} option.
  10753. @end table
  10754. Default value is @code{384*tc/(384+tc*f)}.
  10755. @item count
  10756. Specify the transform count for every video frame. Default value is @code{6}.
  10757. Acceptable range is @code{[1, 30]}.
  10758. @item fcount
  10759. Specify the transform count for every single pixel. Default value is @code{0},
  10760. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  10761. @item fontfile
  10762. Specify font file for use with freetype to draw the axis. If not specified,
  10763. use embedded font. Note that drawing with font file or embedded font is not
  10764. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  10765. option instead.
  10766. @item fontcolor
  10767. Specify font color expression. This is arithmetic expression that should return
  10768. integer value 0xRRGGBB. It can contain variables:
  10769. @table @option
  10770. @item frequency, freq, f
  10771. the frequency where it is evaluated
  10772. @item timeclamp, tc
  10773. the value of @var{timeclamp} option
  10774. @end table
  10775. and functions:
  10776. @table @option
  10777. @item midi(f)
  10778. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10779. @item r(x), g(x), b(x)
  10780. red, green, and blue value of intensity x.
  10781. @end table
  10782. Default value is @code{st(0, (midi(f)-59.5)/12);
  10783. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10784. r(1-ld(1)) + b(ld(1))}.
  10785. @item axisfile
  10786. Specify image file to draw the axis. This option override @var{fontfile} and
  10787. @var{fontcolor} option.
  10788. @item axis, text
  10789. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  10790. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  10791. Default value is @code{1}.
  10792. @end table
  10793. @subsection Examples
  10794. @itemize
  10795. @item
  10796. Playing audio while showing the spectrum:
  10797. @example
  10798. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10799. @end example
  10800. @item
  10801. Same as above, but with frame rate 30 fps:
  10802. @example
  10803. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10804. @end example
  10805. @item
  10806. Playing at 1280x720:
  10807. @example
  10808. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  10809. @end example
  10810. @item
  10811. Disable sonogram display:
  10812. @example
  10813. sono_h=0
  10814. @end example
  10815. @item
  10816. A1 and its harmonics: A1, A2, (near)E3, A3:
  10817. @example
  10818. 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),
  10819. asplit[a][out1]; [a] showcqt [out0]'
  10820. @end example
  10821. @item
  10822. Same as above, but with more accuracy in frequency domain:
  10823. @example
  10824. 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),
  10825. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10826. @end example
  10827. @item
  10828. Custom volume:
  10829. @example
  10830. bar_v=10:sono_v=bar_v*a_weighting(f)
  10831. @end example
  10832. @item
  10833. Custom gamma, now spectrum is linear to the amplitude.
  10834. @example
  10835. bar_g=2:sono_g=2
  10836. @end example
  10837. @item
  10838. Custom tlength equation:
  10839. @example
  10840. 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)))'
  10841. @end example
  10842. @item
  10843. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  10844. @example
  10845. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  10846. @end example
  10847. @item
  10848. Custom frequency range with custom axis using image file:
  10849. @example
  10850. axisfile=myaxis.png:basefreq=40:endfreq=10000
  10851. @end example
  10852. @end itemize
  10853. @section showfreqs
  10854. Convert input audio to video output representing the audio power spectrum.
  10855. Audio amplitude is on Y-axis while frequency is on X-axis.
  10856. The filter accepts the following options:
  10857. @table @option
  10858. @item size, s
  10859. Specify size of video. For the syntax of this option, check the
  10860. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10861. Default is @code{1024x512}.
  10862. @item mode
  10863. Set display mode.
  10864. This set how each frequency bin will be represented.
  10865. It accepts the following values:
  10866. @table @samp
  10867. @item line
  10868. @item bar
  10869. @item dot
  10870. @end table
  10871. Default is @code{bar}.
  10872. @item ascale
  10873. Set amplitude scale.
  10874. It accepts the following values:
  10875. @table @samp
  10876. @item lin
  10877. Linear scale.
  10878. @item sqrt
  10879. Square root scale.
  10880. @item cbrt
  10881. Cubic root scale.
  10882. @item log
  10883. Logarithmic scale.
  10884. @end table
  10885. Default is @code{log}.
  10886. @item fscale
  10887. Set frequency scale.
  10888. It accepts the following values:
  10889. @table @samp
  10890. @item lin
  10891. Linear scale.
  10892. @item log
  10893. Logarithmic scale.
  10894. @item rlog
  10895. Reverse logarithmic scale.
  10896. @end table
  10897. Default is @code{lin}.
  10898. @item win_size
  10899. Set window size.
  10900. It accepts the following values:
  10901. @table @samp
  10902. @item w16
  10903. @item w32
  10904. @item w64
  10905. @item w128
  10906. @item w256
  10907. @item w512
  10908. @item w1024
  10909. @item w2048
  10910. @item w4096
  10911. @item w8192
  10912. @item w16384
  10913. @item w32768
  10914. @item w65536
  10915. @end table
  10916. Default is @code{w2048}
  10917. @item win_func
  10918. Set windowing function.
  10919. It accepts the following values:
  10920. @table @samp
  10921. @item rect
  10922. @item bartlett
  10923. @item hanning
  10924. @item hamming
  10925. @item blackman
  10926. @item welch
  10927. @item flattop
  10928. @item bharris
  10929. @item bnuttall
  10930. @item bhann
  10931. @item sine
  10932. @item nuttall
  10933. @item lanczos
  10934. @item gauss
  10935. @end table
  10936. Default is @code{hanning}.
  10937. @item overlap
  10938. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10939. which means optimal overlap for selected window function will be picked.
  10940. @item averaging
  10941. Set time averaging. Setting this to 0 will display current maximal peaks.
  10942. Default is @code{1}, which means time averaging is disabled.
  10943. @item colors
  10944. Specify list of colors separated by space or by '|' which will be used to
  10945. draw channel frequencies. Unrecognized or missing colors will be replaced
  10946. by white color.
  10947. @end table
  10948. @section showspectrum
  10949. Convert input audio to a video output, representing the audio frequency
  10950. spectrum.
  10951. The filter accepts the following options:
  10952. @table @option
  10953. @item size, s
  10954. Specify the video size for the output. For the syntax of this option, check the
  10955. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10956. Default value is @code{640x512}.
  10957. @item slide
  10958. Specify how the spectrum should slide along the window.
  10959. It accepts the following values:
  10960. @table @samp
  10961. @item replace
  10962. the samples start again on the left when they reach the right
  10963. @item scroll
  10964. the samples scroll from right to left
  10965. @item fullframe
  10966. frames are only produced when the samples reach the right
  10967. @end table
  10968. Default value is @code{replace}.
  10969. @item mode
  10970. Specify display mode.
  10971. It accepts the following values:
  10972. @table @samp
  10973. @item combined
  10974. all channels are displayed in the same row
  10975. @item separate
  10976. all channels are displayed in separate rows
  10977. @end table
  10978. Default value is @samp{combined}.
  10979. @item color
  10980. Specify display color mode.
  10981. It accepts the following values:
  10982. @table @samp
  10983. @item channel
  10984. each channel is displayed in a separate color
  10985. @item intensity
  10986. each channel is is displayed using the same color scheme
  10987. @end table
  10988. Default value is @samp{channel}.
  10989. @item scale
  10990. Specify scale used for calculating intensity color values.
  10991. It accepts the following values:
  10992. @table @samp
  10993. @item lin
  10994. linear
  10995. @item sqrt
  10996. square root, default
  10997. @item cbrt
  10998. cubic root
  10999. @item log
  11000. logarithmic
  11001. @end table
  11002. Default value is @samp{sqrt}.
  11003. @item saturation
  11004. Set saturation modifier for displayed colors. Negative values provide
  11005. alternative color scheme. @code{0} is no saturation at all.
  11006. Saturation must be in [-10.0, 10.0] range.
  11007. Default value is @code{1}.
  11008. @item win_func
  11009. Set window function.
  11010. It accepts the following values:
  11011. @table @samp
  11012. @item none
  11013. No samples pre-processing (do not expect this to be faster)
  11014. @item hann
  11015. Hann window
  11016. @item hamming
  11017. Hamming window
  11018. @item blackman
  11019. Blackman window
  11020. @end table
  11021. Default value is @code{hann}.
  11022. @end table
  11023. The usage is very similar to the showwaves filter; see the examples in that
  11024. section.
  11025. @subsection Examples
  11026. @itemize
  11027. @item
  11028. Large window with logarithmic color scaling:
  11029. @example
  11030. showspectrum=s=1280x480:scale=log
  11031. @end example
  11032. @item
  11033. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11034. @example
  11035. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11036. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11037. @end example
  11038. @end itemize
  11039. @section showvolume
  11040. Convert input audio volume to a video output.
  11041. The filter accepts the following options:
  11042. @table @option
  11043. @item rate, r
  11044. Set video rate.
  11045. @item b
  11046. Set border width, allowed range is [0, 5]. Default is 1.
  11047. @item w
  11048. Set channel width, allowed range is [80, 1080]. Default is 400.
  11049. @item h
  11050. Set channel height, allowed range is [1, 100]. Default is 20.
  11051. @item f
  11052. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11053. @item c
  11054. Set volume color expression.
  11055. The expression can use the following variables:
  11056. @table @option
  11057. @item VOLUME
  11058. Current max volume of channel in dB.
  11059. @item CHANNEL
  11060. Current channel number, starting from 0.
  11061. @end table
  11062. @item t
  11063. If set, displays channel names. Default is enabled.
  11064. @item v
  11065. If set, displays volume values. Default is enabled.
  11066. @end table
  11067. @section showwaves
  11068. Convert input audio to a video output, representing the samples waves.
  11069. The filter accepts the following options:
  11070. @table @option
  11071. @item size, s
  11072. Specify the video size for the output. For the syntax of this option, check the
  11073. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11074. Default value is @code{600x240}.
  11075. @item mode
  11076. Set display mode.
  11077. Available values are:
  11078. @table @samp
  11079. @item point
  11080. Draw a point for each sample.
  11081. @item line
  11082. Draw a vertical line for each sample.
  11083. @item p2p
  11084. Draw a point for each sample and a line between them.
  11085. @item cline
  11086. Draw a centered vertical line for each sample.
  11087. @end table
  11088. Default value is @code{point}.
  11089. @item n
  11090. Set the number of samples which are printed on the same column. A
  11091. larger value will decrease the frame rate. Must be a positive
  11092. integer. This option can be set only if the value for @var{rate}
  11093. is not explicitly specified.
  11094. @item rate, r
  11095. Set the (approximate) output frame rate. This is done by setting the
  11096. option @var{n}. Default value is "25".
  11097. @item split_channels
  11098. Set if channels should be drawn separately or overlap. Default value is 0.
  11099. @end table
  11100. @subsection Examples
  11101. @itemize
  11102. @item
  11103. Output the input file audio and the corresponding video representation
  11104. at the same time:
  11105. @example
  11106. amovie=a.mp3,asplit[out0],showwaves[out1]
  11107. @end example
  11108. @item
  11109. Create a synthetic signal and show it with showwaves, forcing a
  11110. frame rate of 30 frames per second:
  11111. @example
  11112. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11113. @end example
  11114. @end itemize
  11115. @section showwavespic
  11116. Convert input audio to a single video frame, representing the samples waves.
  11117. The filter accepts the following options:
  11118. @table @option
  11119. @item size, s
  11120. Specify the video size for the output. For the syntax of this option, check the
  11121. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11122. Default value is @code{600x240}.
  11123. @item split_channels
  11124. Set if channels should be drawn separately or overlap. Default value is 0.
  11125. @end table
  11126. @subsection Examples
  11127. @itemize
  11128. @item
  11129. Extract a channel split representation of the wave form of a whole audio track
  11130. in a 1024x800 picture using @command{ffmpeg}:
  11131. @example
  11132. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11133. @end example
  11134. @end itemize
  11135. @section split, asplit
  11136. Split input into several identical outputs.
  11137. @code{asplit} works with audio input, @code{split} with video.
  11138. The filter accepts a single parameter which specifies the number of outputs. If
  11139. unspecified, it defaults to 2.
  11140. @subsection Examples
  11141. @itemize
  11142. @item
  11143. Create two separate outputs from the same input:
  11144. @example
  11145. [in] split [out0][out1]
  11146. @end example
  11147. @item
  11148. To create 3 or more outputs, you need to specify the number of
  11149. outputs, like in:
  11150. @example
  11151. [in] asplit=3 [out0][out1][out2]
  11152. @end example
  11153. @item
  11154. Create two separate outputs from the same input, one cropped and
  11155. one padded:
  11156. @example
  11157. [in] split [splitout1][splitout2];
  11158. [splitout1] crop=100:100:0:0 [cropout];
  11159. [splitout2] pad=200:200:100:100 [padout];
  11160. @end example
  11161. @item
  11162. Create 5 copies of the input audio with @command{ffmpeg}:
  11163. @example
  11164. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11165. @end example
  11166. @end itemize
  11167. @section zmq, azmq
  11168. Receive commands sent through a libzmq client, and forward them to
  11169. filters in the filtergraph.
  11170. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11171. must be inserted between two video filters, @code{azmq} between two
  11172. audio filters.
  11173. To enable these filters you need to install the libzmq library and
  11174. headers and configure FFmpeg with @code{--enable-libzmq}.
  11175. For more information about libzmq see:
  11176. @url{http://www.zeromq.org/}
  11177. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11178. receives messages sent through a network interface defined by the
  11179. @option{bind_address} option.
  11180. The received message must be in the form:
  11181. @example
  11182. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11183. @end example
  11184. @var{TARGET} specifies the target of the command, usually the name of
  11185. the filter class or a specific filter instance name.
  11186. @var{COMMAND} specifies the name of the command for the target filter.
  11187. @var{ARG} is optional and specifies the optional argument list for the
  11188. given @var{COMMAND}.
  11189. Upon reception, the message is processed and the corresponding command
  11190. is injected into the filtergraph. Depending on the result, the filter
  11191. will send a reply to the client, adopting the format:
  11192. @example
  11193. @var{ERROR_CODE} @var{ERROR_REASON}
  11194. @var{MESSAGE}
  11195. @end example
  11196. @var{MESSAGE} is optional.
  11197. @subsection Examples
  11198. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11199. be used to send commands processed by these filters.
  11200. Consider the following filtergraph generated by @command{ffplay}
  11201. @example
  11202. ffplay -dumpgraph 1 -f lavfi "
  11203. color=s=100x100:c=red [l];
  11204. color=s=100x100:c=blue [r];
  11205. nullsrc=s=200x100, zmq [bg];
  11206. [bg][l] overlay [bg+l];
  11207. [bg+l][r] overlay=x=100 "
  11208. @end example
  11209. To change the color of the left side of the video, the following
  11210. command can be used:
  11211. @example
  11212. echo Parsed_color_0 c yellow | tools/zmqsend
  11213. @end example
  11214. To change the right side:
  11215. @example
  11216. echo Parsed_color_1 c pink | tools/zmqsend
  11217. @end example
  11218. @c man end MULTIMEDIA FILTERS
  11219. @chapter Multimedia Sources
  11220. @c man begin MULTIMEDIA SOURCES
  11221. Below is a description of the currently available multimedia sources.
  11222. @section amovie
  11223. This is the same as @ref{movie} source, except it selects an audio
  11224. stream by default.
  11225. @anchor{movie}
  11226. @section movie
  11227. Read audio and/or video stream(s) from a movie container.
  11228. It accepts the following parameters:
  11229. @table @option
  11230. @item filename
  11231. The name of the resource to read (not necessarily a file; it can also be a
  11232. device or a stream accessed through some protocol).
  11233. @item format_name, f
  11234. Specifies the format assumed for the movie to read, and can be either
  11235. the name of a container or an input device. If not specified, the
  11236. format is guessed from @var{movie_name} or by probing.
  11237. @item seek_point, sp
  11238. Specifies the seek point in seconds. The frames will be output
  11239. starting from this seek point. The parameter is evaluated with
  11240. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11241. postfix. The default value is "0".
  11242. @item streams, s
  11243. Specifies the streams to read. Several streams can be specified,
  11244. separated by "+". The source will then have as many outputs, in the
  11245. same order. The syntax is explained in the ``Stream specifiers''
  11246. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11247. respectively the default (best suited) video and audio stream. Default
  11248. is "dv", or "da" if the filter is called as "amovie".
  11249. @item stream_index, si
  11250. Specifies the index of the video stream to read. If the value is -1,
  11251. the most suitable video stream will be automatically selected. The default
  11252. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11253. audio instead of video.
  11254. @item loop
  11255. Specifies how many times to read the stream in sequence.
  11256. If the value is less than 1, the stream will be read again and again.
  11257. Default value is "1".
  11258. Note that when the movie is looped the source timestamps are not
  11259. changed, so it will generate non monotonically increasing timestamps.
  11260. @end table
  11261. It allows overlaying a second video on top of the main input of
  11262. a filtergraph, as shown in this graph:
  11263. @example
  11264. input -----------> deltapts0 --> overlay --> output
  11265. ^
  11266. |
  11267. movie --> scale--> deltapts1 -------+
  11268. @end example
  11269. @subsection Examples
  11270. @itemize
  11271. @item
  11272. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11273. on top of the input labelled "in":
  11274. @example
  11275. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11276. [in] setpts=PTS-STARTPTS [main];
  11277. [main][over] overlay=16:16 [out]
  11278. @end example
  11279. @item
  11280. Read from a video4linux2 device, and overlay it on top of the input
  11281. labelled "in":
  11282. @example
  11283. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11284. [in] setpts=PTS-STARTPTS [main];
  11285. [main][over] overlay=16:16 [out]
  11286. @end example
  11287. @item
  11288. Read the first video stream and the audio stream with id 0x81 from
  11289. dvd.vob; the video is connected to the pad named "video" and the audio is
  11290. connected to the pad named "audio":
  11291. @example
  11292. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11293. @end example
  11294. @end itemize
  11295. @c man end MULTIMEDIA SOURCES