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.

13997 lines
382KB

  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 acrossfade
  256. Apply cross fade from one input audio stream to another input audio stream.
  257. The cross fade is applied for specified duration near the end of first stream.
  258. The filter accepts the following options:
  259. @table @option
  260. @item nb_samples, ns
  261. Specify the number of samples for which the cross fade effect has to last.
  262. At the end of the cross fade effect the first input audio will be completely
  263. silent. Default is 44100.
  264. @item duration, d
  265. Specify the duration of the cross fade effect. See
  266. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  267. for the accepted syntax.
  268. By default the duration is determined by @var{nb_samples}.
  269. If set this option is used instead of @var{nb_samples}.
  270. @item overlap, o
  271. Should first stream end overlap with second stream start. Default is enabled.
  272. @item curve1
  273. Set curve for cross fade transition for first stream.
  274. @item curve2
  275. Set curve for cross fade transition for second stream.
  276. For description of available curve types see @ref{afade} filter description.
  277. @end table
  278. @subsection Examples
  279. @itemize
  280. @item
  281. Cross fade from one input to another:
  282. @example
  283. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  284. @end example
  285. @item
  286. Cross fade from one input to another but without overlapping:
  287. @example
  288. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  289. @end example
  290. @end itemize
  291. @section adelay
  292. Delay one or more audio channels.
  293. Samples in delayed channel are filled with silence.
  294. The filter accepts the following option:
  295. @table @option
  296. @item delays
  297. Set list of delays in milliseconds for each channel separated by '|'.
  298. At least one delay greater than 0 should be provided.
  299. Unused delays will be silently ignored. If number of given delays is
  300. smaller than number of channels all remaining channels will not be delayed.
  301. @end table
  302. @subsection Examples
  303. @itemize
  304. @item
  305. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  306. the second channel (and any other channels that may be present) unchanged.
  307. @example
  308. adelay=1500|0|500
  309. @end example
  310. @end itemize
  311. @section aecho
  312. Apply echoing to the input audio.
  313. Echoes are reflected sound and can occur naturally amongst mountains
  314. (and sometimes large buildings) when talking or shouting; digital echo
  315. effects emulate this behaviour and are often used to help fill out the
  316. sound of a single instrument or vocal. The time difference between the
  317. original signal and the reflection is the @code{delay}, and the
  318. loudness of the reflected signal is the @code{decay}.
  319. Multiple echoes can have different delays and decays.
  320. A description of the accepted parameters follows.
  321. @table @option
  322. @item in_gain
  323. Set input gain of reflected signal. Default is @code{0.6}.
  324. @item out_gain
  325. Set output gain of reflected signal. Default is @code{0.3}.
  326. @item delays
  327. Set list of time intervals in milliseconds between original signal and reflections
  328. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  329. Default is @code{1000}.
  330. @item decays
  331. Set list of loudnesses of reflected signals separated by '|'.
  332. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  333. Default is @code{0.5}.
  334. @end table
  335. @subsection Examples
  336. @itemize
  337. @item
  338. Make it sound as if there are twice as many instruments as are actually playing:
  339. @example
  340. aecho=0.8:0.88:60:0.4
  341. @end example
  342. @item
  343. If delay is very short, then it sound like a (metallic) robot playing music:
  344. @example
  345. aecho=0.8:0.88:6:0.4
  346. @end example
  347. @item
  348. A longer delay will sound like an open air concert in the mountains:
  349. @example
  350. aecho=0.8:0.9:1000:0.3
  351. @end example
  352. @item
  353. Same as above but with one more mountain:
  354. @example
  355. aecho=0.8:0.9:1000|1800:0.3|0.25
  356. @end example
  357. @end itemize
  358. @section aeval
  359. Modify an audio signal according to the specified expressions.
  360. This filter accepts one or more expressions (one for each channel),
  361. which are evaluated and used to modify a corresponding audio signal.
  362. It accepts the following parameters:
  363. @table @option
  364. @item exprs
  365. Set the '|'-separated expressions list for each separate channel. If
  366. the number of input channels is greater than the number of
  367. expressions, the last specified expression is used for the remaining
  368. output channels.
  369. @item channel_layout, c
  370. Set output channel layout. If not specified, the channel layout is
  371. specified by the number of expressions. If set to @samp{same}, it will
  372. use by default the same input channel layout.
  373. @end table
  374. Each expression in @var{exprs} can contain the following constants and functions:
  375. @table @option
  376. @item ch
  377. channel number of the current expression
  378. @item n
  379. number of the evaluated sample, starting from 0
  380. @item s
  381. sample rate
  382. @item t
  383. time of the evaluated sample expressed in seconds
  384. @item nb_in_channels
  385. @item nb_out_channels
  386. input and output number of channels
  387. @item val(CH)
  388. the value of input channel with number @var{CH}
  389. @end table
  390. Note: this filter is slow. For faster processing you should use a
  391. dedicated filter.
  392. @subsection Examples
  393. @itemize
  394. @item
  395. Half volume:
  396. @example
  397. aeval=val(ch)/2:c=same
  398. @end example
  399. @item
  400. Invert phase of the second channel:
  401. @example
  402. aeval=val(0)|-val(1)
  403. @end example
  404. @end itemize
  405. @anchor{afade}
  406. @section afade
  407. Apply fade-in/out effect to input audio.
  408. A description of the accepted parameters follows.
  409. @table @option
  410. @item type, t
  411. Specify the effect type, can be either @code{in} for fade-in, or
  412. @code{out} for a fade-out effect. Default is @code{in}.
  413. @item start_sample, ss
  414. Specify the number of the start sample for starting to apply the fade
  415. effect. Default is 0.
  416. @item nb_samples, ns
  417. Specify the number of samples for which the fade effect has to last. At
  418. the end of the fade-in effect the output audio will have the same
  419. volume as the input audio, at the end of the fade-out transition
  420. the output audio will be silence. Default is 44100.
  421. @item start_time, st
  422. Specify the start time of the fade effect. Default is 0.
  423. The value must be specified as a time duration; see
  424. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  425. for the accepted syntax.
  426. If set this option is used instead of @var{start_sample}.
  427. @item duration, d
  428. Specify the duration of the fade effect. See
  429. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  430. for the accepted syntax.
  431. At the end of the fade-in effect the output audio will have the same
  432. volume as the input audio, at the end of the fade-out transition
  433. the output audio will be silence.
  434. By default the duration is determined by @var{nb_samples}.
  435. If set this option is used instead of @var{nb_samples}.
  436. @item curve
  437. Set curve for fade transition.
  438. It accepts the following values:
  439. @table @option
  440. @item tri
  441. select triangular, linear slope (default)
  442. @item qsin
  443. select quarter of sine wave
  444. @item hsin
  445. select half of sine wave
  446. @item esin
  447. select exponential sine wave
  448. @item log
  449. select logarithmic
  450. @item ipar
  451. select inverted parabola
  452. @item qua
  453. select quadratic
  454. @item cub
  455. select cubic
  456. @item squ
  457. select square root
  458. @item cbr
  459. select cubic root
  460. @item par
  461. select parabola
  462. @item exp
  463. select exponential
  464. @item iqsin
  465. select inverted quarter of sine wave
  466. @item ihsin
  467. select inverted half of sine wave
  468. @item dese
  469. select double-exponential seat
  470. @item desi
  471. select double-exponential sigmoid
  472. @end table
  473. @end table
  474. @subsection Examples
  475. @itemize
  476. @item
  477. Fade in first 15 seconds of audio:
  478. @example
  479. afade=t=in:ss=0:d=15
  480. @end example
  481. @item
  482. Fade out last 25 seconds of a 900 seconds audio:
  483. @example
  484. afade=t=out:st=875:d=25
  485. @end example
  486. @end itemize
  487. @anchor{aformat}
  488. @section aformat
  489. Set output format constraints for the input audio. The framework will
  490. negotiate the most appropriate format to minimize conversions.
  491. It accepts the following parameters:
  492. @table @option
  493. @item sample_fmts
  494. A '|'-separated list of requested sample formats.
  495. @item sample_rates
  496. A '|'-separated list of requested sample rates.
  497. @item channel_layouts
  498. A '|'-separated list of requested channel layouts.
  499. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  500. for the required syntax.
  501. @end table
  502. If a parameter is omitted, all values are allowed.
  503. Force the output to either unsigned 8-bit or signed 16-bit stereo
  504. @example
  505. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  506. @end example
  507. @section agate
  508. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  509. processing reduces disturbing noise between useful signals.
  510. Gating is done by detecting the volume below a chosen level @var{threshold}
  511. and divide it by the factor set with @var{ratio}. The bottom of the noise
  512. floor is set via @var{range}. Because an exact manipulation of the signal
  513. would cause distortion of the waveform the reduction can be levelled over
  514. time. This is done by setting @var{attack} and @var{release}.
  515. @var{attack} determines how long the signal has to fall below the threshold
  516. before any reduction will occur and @var{release} sets the time the signal
  517. has to raise above the threshold to reduce the reduction again.
  518. Shorter signals than the chosen attack time will be left untouched.
  519. @table @option
  520. @item level_in
  521. Set input level before filtering.
  522. @item range
  523. Set the level of gain reduction when the signal is below the threshold.
  524. @item threshold
  525. If a signal rises above this level the gain reduction is released.
  526. @item ratio
  527. Set a ratio about which the signal is reduced.
  528. @item attack
  529. Amount of milliseconds the signal has to rise above the threshold before gain
  530. reduction stops.
  531. @item release
  532. Amount of milliseconds the signal has to fall below the threshold before the
  533. reduction is increased again.
  534. @item makeup
  535. Set amount of amplification of signal after processing.
  536. @item knee
  537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  538. @item detection
  539. Choose if exact signal should be taken for detection or an RMS like one.
  540. @item link
  541. Choose if the average level between all channels or the louder channel affects
  542. the reduction.
  543. @end table
  544. @section alimiter
  545. The limiter prevents input signal from raising over a desired threshold.
  546. This limiter uses lookahead technology to prevent your signal from distorting.
  547. It means that there is a small delay after signal is processed. Keep in mind
  548. that the delay it produces is the attack time you set.
  549. The filter accepts the following options:
  550. @table @option
  551. @item limit
  552. Don't let signals above this level pass the limiter. The removed amplitude is
  553. added automatically. Default is 1.
  554. @item attack
  555. The limiter will reach its attenuation level in this amount of time in
  556. milliseconds. Default is 5 milliseconds.
  557. @item release
  558. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  559. Default is 50 milliseconds.
  560. @item asc
  561. When gain reduction is always needed ASC takes care of releasing to an
  562. average reduction level rather than reaching a reduction of 0 in the release
  563. time.
  564. @item asc_level
  565. Select how much the release time is affected by ASC, 0 means nearly no changes
  566. in release time while 1 produces higher release times.
  567. @end table
  568. Depending on picked setting it is recommended to upsample input 2x or 4x times
  569. with @ref{aresample} before applying this filter.
  570. @section allpass
  571. Apply a two-pole all-pass filter with central frequency (in Hz)
  572. @var{frequency}, and filter-width @var{width}.
  573. An all-pass filter changes the audio's frequency to phase relationship
  574. without changing its frequency to amplitude relationship.
  575. The filter accepts the following options:
  576. @table @option
  577. @item frequency, f
  578. Set frequency in Hz.
  579. @item width_type
  580. Set method to specify band-width of filter.
  581. @table @option
  582. @item h
  583. Hz
  584. @item q
  585. Q-Factor
  586. @item o
  587. octave
  588. @item s
  589. slope
  590. @end table
  591. @item width, w
  592. Specify the band-width of a filter in width_type units.
  593. @end table
  594. @anchor{amerge}
  595. @section amerge
  596. Merge two or more audio streams into a single multi-channel stream.
  597. The filter accepts the following options:
  598. @table @option
  599. @item inputs
  600. Set the number of inputs. Default is 2.
  601. @end table
  602. If the channel layouts of the inputs are disjoint, and therefore compatible,
  603. the channel layout of the output will be set accordingly and the channels
  604. will be reordered as necessary. If the channel layouts of the inputs are not
  605. disjoint, the output will have all the channels of the first input then all
  606. the channels of the second input, in that order, and the channel layout of
  607. the output will be the default value corresponding to the total number of
  608. channels.
  609. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  610. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  611. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  612. first input, b1 is the first channel of the second input).
  613. On the other hand, if both input are in stereo, the output channels will be
  614. in the default order: a1, a2, b1, b2, and the channel layout will be
  615. arbitrarily set to 4.0, which may or may not be the expected value.
  616. All inputs must have the same sample rate, and format.
  617. If inputs do not have the same duration, the output will stop with the
  618. shortest.
  619. @subsection Examples
  620. @itemize
  621. @item
  622. Merge two mono files into a stereo stream:
  623. @example
  624. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  625. @end example
  626. @item
  627. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  628. @example
  629. 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
  630. @end example
  631. @end itemize
  632. @section amix
  633. Mixes multiple audio inputs into a single output.
  634. Note that this filter only supports float samples (the @var{amerge}
  635. and @var{pan} audio filters support many formats). If the @var{amix}
  636. input has integer samples then @ref{aresample} will be automatically
  637. inserted to perform the conversion to float samples.
  638. For example
  639. @example
  640. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  641. @end example
  642. will mix 3 input audio streams to a single output with the same duration as the
  643. first input and a dropout transition time of 3 seconds.
  644. It accepts the following parameters:
  645. @table @option
  646. @item inputs
  647. The number of inputs. If unspecified, it defaults to 2.
  648. @item duration
  649. How to determine the end-of-stream.
  650. @table @option
  651. @item longest
  652. The duration of the longest input. (default)
  653. @item shortest
  654. The duration of the shortest input.
  655. @item first
  656. The duration of the first input.
  657. @end table
  658. @item dropout_transition
  659. The transition time, in seconds, for volume renormalization when an input
  660. stream ends. The default value is 2 seconds.
  661. @end table
  662. @section anull
  663. Pass the audio source unchanged to the output.
  664. @section apad
  665. Pad the end of an audio stream with silence.
  666. This can be used together with @command{ffmpeg} @option{-shortest} to
  667. extend audio streams to the same length as the video stream.
  668. A description of the accepted options follows.
  669. @table @option
  670. @item packet_size
  671. Set silence packet size. Default value is 4096.
  672. @item pad_len
  673. Set the number of samples of silence to add to the end. After the
  674. value is reached, the stream is terminated. This option is mutually
  675. exclusive with @option{whole_len}.
  676. @item whole_len
  677. Set the minimum total number of samples in the output audio stream. If
  678. the value is longer than the input audio length, silence is added to
  679. the end, until the value is reached. This option is mutually exclusive
  680. with @option{pad_len}.
  681. @end table
  682. If neither the @option{pad_len} nor the @option{whole_len} option is
  683. set, the filter will add silence to the end of the input stream
  684. indefinitely.
  685. @subsection Examples
  686. @itemize
  687. @item
  688. Add 1024 samples of silence to the end of the input:
  689. @example
  690. apad=pad_len=1024
  691. @end example
  692. @item
  693. Make sure the audio output will contain at least 10000 samples, pad
  694. the input with silence if required:
  695. @example
  696. apad=whole_len=10000
  697. @end example
  698. @item
  699. Use @command{ffmpeg} to pad the audio input with silence, so that the
  700. video stream will always result the shortest and will be converted
  701. until the end in the output file when using the @option{shortest}
  702. option:
  703. @example
  704. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  705. @end example
  706. @end itemize
  707. @section aphaser
  708. Add a phasing effect to the input audio.
  709. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  710. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  711. A description of the accepted parameters follows.
  712. @table @option
  713. @item in_gain
  714. Set input gain. Default is 0.4.
  715. @item out_gain
  716. Set output gain. Default is 0.74
  717. @item delay
  718. Set delay in milliseconds. Default is 3.0.
  719. @item decay
  720. Set decay. Default is 0.4.
  721. @item speed
  722. Set modulation speed in Hz. Default is 0.5.
  723. @item type
  724. Set modulation type. Default is triangular.
  725. It accepts the following values:
  726. @table @samp
  727. @item triangular, t
  728. @item sinusoidal, s
  729. @end table
  730. @end table
  731. @anchor{aresample}
  732. @section aresample
  733. Resample the input audio to the specified parameters, using the
  734. libswresample library. If none are specified then the filter will
  735. automatically convert between its input and output.
  736. This filter is also able to stretch/squeeze the audio data to make it match
  737. the timestamps or to inject silence / cut out audio to make it match the
  738. timestamps, do a combination of both or do neither.
  739. The filter accepts the syntax
  740. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  741. expresses a sample rate and @var{resampler_options} is a list of
  742. @var{key}=@var{value} pairs, separated by ":". See the
  743. ffmpeg-resampler manual for the complete list of supported options.
  744. @subsection Examples
  745. @itemize
  746. @item
  747. Resample the input audio to 44100Hz:
  748. @example
  749. aresample=44100
  750. @end example
  751. @item
  752. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  753. samples per second compensation:
  754. @example
  755. aresample=async=1000
  756. @end example
  757. @end itemize
  758. @section asetnsamples
  759. Set the number of samples per each output audio frame.
  760. The last output packet may contain a different number of samples, as
  761. the filter will flush all the remaining samples when the input audio
  762. signal its end.
  763. The filter accepts the following options:
  764. @table @option
  765. @item nb_out_samples, n
  766. Set the number of frames per each output audio frame. The number is
  767. intended as the number of samples @emph{per each channel}.
  768. Default value is 1024.
  769. @item pad, p
  770. If set to 1, the filter will pad the last audio frame with zeroes, so
  771. that the last frame will contain the same number of samples as the
  772. previous ones. Default value is 1.
  773. @end table
  774. For example, to set the number of per-frame samples to 1234 and
  775. disable padding for the last frame, use:
  776. @example
  777. asetnsamples=n=1234:p=0
  778. @end example
  779. @section asetrate
  780. Set the sample rate without altering the PCM data.
  781. This will result in a change of speed and pitch.
  782. The filter accepts the following options:
  783. @table @option
  784. @item sample_rate, r
  785. Set the output sample rate. Default is 44100 Hz.
  786. @end table
  787. @section ashowinfo
  788. Show a line containing various information for each input audio frame.
  789. The input audio is not modified.
  790. The shown line contains a sequence of key/value pairs of the form
  791. @var{key}:@var{value}.
  792. The following values are shown in the output:
  793. @table @option
  794. @item n
  795. The (sequential) number of the input frame, starting from 0.
  796. @item pts
  797. The presentation timestamp of the input frame, in time base units; the time base
  798. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  799. @item pts_time
  800. The presentation timestamp of the input frame in seconds.
  801. @item pos
  802. position of the frame in the input stream, -1 if this information in
  803. unavailable and/or meaningless (for example in case of synthetic audio)
  804. @item fmt
  805. The sample format.
  806. @item chlayout
  807. The channel layout.
  808. @item rate
  809. The sample rate for the audio frame.
  810. @item nb_samples
  811. The number of samples (per channel) in the frame.
  812. @item checksum
  813. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  814. audio, the data is treated as if all the planes were concatenated.
  815. @item plane_checksums
  816. A list of Adler-32 checksums for each data plane.
  817. @end table
  818. @anchor{astats}
  819. @section astats
  820. Display time domain statistical information about the audio channels.
  821. Statistics are calculated and displayed for each audio channel and,
  822. where applicable, an overall figure is also given.
  823. It accepts the following option:
  824. @table @option
  825. @item length
  826. Short window length in seconds, used for peak and trough RMS measurement.
  827. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  828. @item metadata
  829. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  830. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  831. disabled.
  832. Available keys for each channel are:
  833. DC_offset
  834. Min_level
  835. Max_level
  836. Min_difference
  837. Max_difference
  838. Mean_difference
  839. Peak_level
  840. RMS_peak
  841. RMS_trough
  842. Crest_factor
  843. Flat_factor
  844. Peak_count
  845. Bit_depth
  846. and for Overall:
  847. DC_offset
  848. Min_level
  849. Max_level
  850. Min_difference
  851. Max_difference
  852. Mean_difference
  853. Peak_level
  854. RMS_level
  855. RMS_peak
  856. RMS_trough
  857. Flat_factor
  858. Peak_count
  859. Bit_depth
  860. Number_of_samples
  861. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  862. this @code{lavfi.astats.Overall.Peak_count}.
  863. For description what each key means read bellow.
  864. @item reset
  865. Set number of frame after which stats are going to be recalculated.
  866. Default is disabled.
  867. @end table
  868. A description of each shown parameter follows:
  869. @table @option
  870. @item DC offset
  871. Mean amplitude displacement from zero.
  872. @item Min level
  873. Minimal sample level.
  874. @item Max level
  875. Maximal sample level.
  876. @item Min difference
  877. Minimal difference between two consecutive samples.
  878. @item Max difference
  879. Maximal difference between two consecutive samples.
  880. @item Mean difference
  881. Mean difference between two consecutive samples.
  882. The average of each difference between two consecutive samples.
  883. @item Peak level dB
  884. @item RMS level dB
  885. Standard peak and RMS level measured in dBFS.
  886. @item RMS peak dB
  887. @item RMS trough dB
  888. Peak and trough values for RMS level measured over a short window.
  889. @item Crest factor
  890. Standard ratio of peak to RMS level (note: not in dB).
  891. @item Flat factor
  892. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  893. (i.e. either @var{Min level} or @var{Max level}).
  894. @item Peak count
  895. Number of occasions (not the number of samples) that the signal attained either
  896. @var{Min level} or @var{Max level}.
  897. @item Bit depth
  898. Overall bit depth of audio. Number of bits used for each sample.
  899. @end table
  900. @section astreamsync
  901. Forward two audio streams and control the order the buffers are forwarded.
  902. The filter accepts the following options:
  903. @table @option
  904. @item expr, e
  905. Set the expression deciding which stream should be
  906. forwarded next: if the result is negative, the first stream is forwarded; if
  907. the result is positive or zero, the second stream is forwarded. It can use
  908. the following variables:
  909. @table @var
  910. @item b1 b2
  911. number of buffers forwarded so far on each stream
  912. @item s1 s2
  913. number of samples forwarded so far on each stream
  914. @item t1 t2
  915. current timestamp of each stream
  916. @end table
  917. The default value is @code{t1-t2}, which means to always forward the stream
  918. that has a smaller timestamp.
  919. @end table
  920. @subsection Examples
  921. Stress-test @code{amerge} by randomly sending buffers on the wrong
  922. input, while avoiding too much of a desynchronization:
  923. @example
  924. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  925. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  926. [a2] [b2] amerge
  927. @end example
  928. @section asyncts
  929. Synchronize audio data with timestamps by squeezing/stretching it and/or
  930. dropping samples/adding silence when needed.
  931. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  932. It accepts the following parameters:
  933. @table @option
  934. @item compensate
  935. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  936. by default. When disabled, time gaps are covered with silence.
  937. @item min_delta
  938. The minimum difference between timestamps and audio data (in seconds) to trigger
  939. adding/dropping samples. The default value is 0.1. If you get an imperfect
  940. sync with this filter, try setting this parameter to 0.
  941. @item max_comp
  942. The maximum compensation in samples per second. Only relevant with compensate=1.
  943. The default value is 500.
  944. @item first_pts
  945. Assume that the first PTS should be this value. The time base is 1 / sample
  946. rate. This allows for padding/trimming at the start of the stream. By default,
  947. no assumption is made about the first frame's expected PTS, so no padding or
  948. trimming is done. For example, this could be set to 0 to pad the beginning with
  949. silence if an audio stream starts after the video stream or to trim any samples
  950. with a negative PTS due to encoder delay.
  951. @end table
  952. @section atempo
  953. Adjust audio tempo.
  954. The filter accepts exactly one parameter, the audio tempo. If not
  955. specified then the filter will assume nominal 1.0 tempo. Tempo must
  956. be in the [0.5, 2.0] range.
  957. @subsection Examples
  958. @itemize
  959. @item
  960. Slow down audio to 80% tempo:
  961. @example
  962. atempo=0.8
  963. @end example
  964. @item
  965. To speed up audio to 125% tempo:
  966. @example
  967. atempo=1.25
  968. @end example
  969. @end itemize
  970. @section atrim
  971. Trim the input so that the output contains one continuous subpart of the input.
  972. It accepts the following parameters:
  973. @table @option
  974. @item start
  975. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  976. sample with the timestamp @var{start} will be the first sample in the output.
  977. @item end
  978. Specify time of the first audio sample that will be dropped, i.e. the
  979. audio sample immediately preceding the one with the timestamp @var{end} will be
  980. the last sample in the output.
  981. @item start_pts
  982. Same as @var{start}, except this option sets the start timestamp in samples
  983. instead of seconds.
  984. @item end_pts
  985. Same as @var{end}, except this option sets the end timestamp in samples instead
  986. of seconds.
  987. @item duration
  988. The maximum duration of the output in seconds.
  989. @item start_sample
  990. The number of the first sample that should be output.
  991. @item end_sample
  992. The number of the first sample that should be dropped.
  993. @end table
  994. @option{start}, @option{end}, and @option{duration} are expressed as time
  995. duration specifications; see
  996. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  997. Note that the first two sets of the start/end options and the @option{duration}
  998. option look at the frame timestamp, while the _sample options simply count the
  999. samples that pass through the filter. So start/end_pts and start/end_sample will
  1000. give different results when the timestamps are wrong, inexact or do not start at
  1001. zero. Also note that this filter does not modify the timestamps. If you wish
  1002. to have the output timestamps start at zero, insert the asetpts filter after the
  1003. atrim filter.
  1004. If multiple start or end options are set, this filter tries to be greedy and
  1005. keep all samples that match at least one of the specified constraints. To keep
  1006. only the part that matches all the constraints at once, chain multiple atrim
  1007. filters.
  1008. The defaults are such that all the input is kept. So it is possible to set e.g.
  1009. just the end values to keep everything before the specified time.
  1010. Examples:
  1011. @itemize
  1012. @item
  1013. Drop everything except the second minute of input:
  1014. @example
  1015. ffmpeg -i INPUT -af atrim=60:120
  1016. @end example
  1017. @item
  1018. Keep only the first 1000 samples:
  1019. @example
  1020. ffmpeg -i INPUT -af atrim=end_sample=1000
  1021. @end example
  1022. @end itemize
  1023. @section bandpass
  1024. Apply a two-pole Butterworth band-pass filter with central
  1025. frequency @var{frequency}, and (3dB-point) band-width width.
  1026. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1027. instead of the default: constant 0dB peak gain.
  1028. The filter roll off at 6dB per octave (20dB per decade).
  1029. The filter accepts the following options:
  1030. @table @option
  1031. @item frequency, f
  1032. Set the filter's central frequency. Default is @code{3000}.
  1033. @item csg
  1034. Constant skirt gain if set to 1. Defaults to 0.
  1035. @item width_type
  1036. Set method to specify band-width of filter.
  1037. @table @option
  1038. @item h
  1039. Hz
  1040. @item q
  1041. Q-Factor
  1042. @item o
  1043. octave
  1044. @item s
  1045. slope
  1046. @end table
  1047. @item width, w
  1048. Specify the band-width of a filter in width_type units.
  1049. @end table
  1050. @section bandreject
  1051. Apply a two-pole Butterworth band-reject filter with central
  1052. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1053. The filter roll off at 6dB per octave (20dB per decade).
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item frequency, f
  1057. Set the filter's central frequency. Default is @code{3000}.
  1058. @item width_type
  1059. Set method to specify band-width of filter.
  1060. @table @option
  1061. @item h
  1062. Hz
  1063. @item q
  1064. Q-Factor
  1065. @item o
  1066. octave
  1067. @item s
  1068. slope
  1069. @end table
  1070. @item width, w
  1071. Specify the band-width of a filter in width_type units.
  1072. @end table
  1073. @section bass
  1074. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1075. shelving filter with a response similar to that of a standard
  1076. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1077. The filter accepts the following options:
  1078. @table @option
  1079. @item gain, g
  1080. Give the gain at 0 Hz. Its useful range is about -20
  1081. (for a large cut) to +20 (for a large boost).
  1082. Beware of clipping when using a positive gain.
  1083. @item frequency, f
  1084. Set the filter's central frequency and so can be used
  1085. to extend or reduce the frequency range to be boosted or cut.
  1086. The default value is @code{100} Hz.
  1087. @item width_type
  1088. Set method to specify band-width of filter.
  1089. @table @option
  1090. @item h
  1091. Hz
  1092. @item q
  1093. Q-Factor
  1094. @item o
  1095. octave
  1096. @item s
  1097. slope
  1098. @end table
  1099. @item width, w
  1100. Determine how steep is the filter's shelf transition.
  1101. @end table
  1102. @section biquad
  1103. Apply a biquad IIR filter with the given coefficients.
  1104. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1105. are the numerator and denominator coefficients respectively.
  1106. @section bs2b
  1107. Bauer stereo to binaural transformation, which improves headphone listening of
  1108. stereo audio records.
  1109. It accepts the following parameters:
  1110. @table @option
  1111. @item profile
  1112. Pre-defined crossfeed level.
  1113. @table @option
  1114. @item default
  1115. Default level (fcut=700, feed=50).
  1116. @item cmoy
  1117. Chu Moy circuit (fcut=700, feed=60).
  1118. @item jmeier
  1119. Jan Meier circuit (fcut=650, feed=95).
  1120. @end table
  1121. @item fcut
  1122. Cut frequency (in Hz).
  1123. @item feed
  1124. Feed level (in Hz).
  1125. @end table
  1126. @section channelmap
  1127. Remap input channels to new locations.
  1128. It accepts the following parameters:
  1129. @table @option
  1130. @item channel_layout
  1131. The channel layout of the output stream.
  1132. @item map
  1133. Map channels from input to output. The argument is a '|'-separated list of
  1134. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1135. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1136. channel (e.g. FL for front left) or its index in the input channel layout.
  1137. @var{out_channel} is the name of the output channel or its index in the output
  1138. channel layout. If @var{out_channel} is not given then it is implicitly an
  1139. index, starting with zero and increasing by one for each mapping.
  1140. @end table
  1141. If no mapping is present, the filter will implicitly map input channels to
  1142. output channels, preserving indices.
  1143. For example, assuming a 5.1+downmix input MOV file,
  1144. @example
  1145. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1146. @end example
  1147. will create an output WAV file tagged as stereo from the downmix channels of
  1148. the input.
  1149. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1150. @example
  1151. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1152. @end example
  1153. @section channelsplit
  1154. Split each channel from an input audio stream into a separate output stream.
  1155. It accepts the following parameters:
  1156. @table @option
  1157. @item channel_layout
  1158. The channel layout of the input stream. The default is "stereo".
  1159. @end table
  1160. For example, assuming a stereo input MP3 file,
  1161. @example
  1162. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1163. @end example
  1164. will create an output Matroska file with two audio streams, one containing only
  1165. the left channel and the other the right channel.
  1166. Split a 5.1 WAV file into per-channel files:
  1167. @example
  1168. ffmpeg -i in.wav -filter_complex
  1169. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1170. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1171. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1172. side_right.wav
  1173. @end example
  1174. @section chorus
  1175. Add a chorus effect to the audio.
  1176. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1177. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1178. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1179. The modulation depth defines the range the modulated delay is played before or after
  1180. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1181. sound tuned around the original one, like in a chorus where some vocals are slightly
  1182. off key.
  1183. It accepts the following parameters:
  1184. @table @option
  1185. @item in_gain
  1186. Set input gain. Default is 0.4.
  1187. @item out_gain
  1188. Set output gain. Default is 0.4.
  1189. @item delays
  1190. Set delays. A typical delay is around 40ms to 60ms.
  1191. @item decays
  1192. Set decays.
  1193. @item speeds
  1194. Set speeds.
  1195. @item depths
  1196. Set depths.
  1197. @end table
  1198. @subsection Examples
  1199. @itemize
  1200. @item
  1201. A single delay:
  1202. @example
  1203. chorus=0.7:0.9:55:0.4:0.25:2
  1204. @end example
  1205. @item
  1206. Two delays:
  1207. @example
  1208. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1209. @end example
  1210. @item
  1211. Fuller sounding chorus with three delays:
  1212. @example
  1213. 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
  1214. @end example
  1215. @end itemize
  1216. @section compand
  1217. Compress or expand the audio's dynamic range.
  1218. It accepts the following parameters:
  1219. @table @option
  1220. @item attacks
  1221. @item decays
  1222. A list of times in seconds for each channel over which the instantaneous level
  1223. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1224. increase of volume and @var{decays} refers to decrease of volume. For most
  1225. situations, the attack time (response to the audio getting louder) should be
  1226. shorter than the decay time, because the human ear is more sensitive to sudden
  1227. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1228. a typical value for decay is 0.8 seconds.
  1229. If specified number of attacks & decays is lower than number of channels, the last
  1230. set attack/decay will be used for all remaining channels.
  1231. @item points
  1232. A list of points for the transfer function, specified in dB relative to the
  1233. maximum possible signal amplitude. Each key points list must be defined using
  1234. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1235. @code{x0/y0 x1/y1 x2/y2 ....}
  1236. The input values must be in strictly increasing order but the transfer function
  1237. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1238. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1239. function are @code{-70/-70|-60/-20}.
  1240. @item soft-knee
  1241. Set the curve radius in dB for all joints. It defaults to 0.01.
  1242. @item gain
  1243. Set the additional gain in dB to be applied at all points on the transfer
  1244. function. This allows for easy adjustment of the overall gain.
  1245. It defaults to 0.
  1246. @item volume
  1247. Set an initial volume, in dB, to be assumed for each channel when filtering
  1248. starts. This permits the user to supply a nominal level initially, so that, for
  1249. example, a very large gain is not applied to initial signal levels before the
  1250. companding has begun to operate. A typical value for audio which is initially
  1251. quiet is -90 dB. It defaults to 0.
  1252. @item delay
  1253. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1254. delayed before being fed to the volume adjuster. Specifying a delay
  1255. approximately equal to the attack/decay times allows the filter to effectively
  1256. operate in predictive rather than reactive mode. It defaults to 0.
  1257. @end table
  1258. @subsection Examples
  1259. @itemize
  1260. @item
  1261. Make music with both quiet and loud passages suitable for listening to in a
  1262. noisy environment:
  1263. @example
  1264. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1265. @end example
  1266. Another example for audio with whisper and explosion parts:
  1267. @example
  1268. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1269. @end example
  1270. @item
  1271. A noise gate for when the noise is at a lower level than the signal:
  1272. @example
  1273. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1274. @end example
  1275. @item
  1276. Here is another noise gate, this time for when the noise is at a higher level
  1277. than the signal (making it, in some ways, similar to squelch):
  1278. @example
  1279. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1280. @end example
  1281. @end itemize
  1282. @section dcshift
  1283. Apply a DC shift to the audio.
  1284. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1285. in the recording chain) from the audio. The effect of a DC offset is reduced
  1286. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1287. a signal has a DC offset.
  1288. @table @option
  1289. @item shift
  1290. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1291. the audio.
  1292. @item limitergain
  1293. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1294. used to prevent clipping.
  1295. @end table
  1296. @section dynaudnorm
  1297. Dynamic Audio Normalizer.
  1298. This filter applies a certain amount of gain to the input audio in order
  1299. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1300. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1301. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1302. This allows for applying extra gain to the "quiet" sections of the audio
  1303. while avoiding distortions or clipping the "loud" sections. In other words:
  1304. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1305. sections, in the sense that the volume of each section is brought to the
  1306. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1307. this goal *without* applying "dynamic range compressing". It will retain 100%
  1308. of the dynamic range *within* each section of the audio file.
  1309. @table @option
  1310. @item f
  1311. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1312. Default is 500 milliseconds.
  1313. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1314. referred to as frames. This is required, because a peak magnitude has no
  1315. meaning for just a single sample value. Instead, we need to determine the
  1316. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1317. normalizer would simply use the peak magnitude of the complete file, the
  1318. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1319. frame. The length of a frame is specified in milliseconds. By default, the
  1320. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1321. been found to give good results with most files.
  1322. Note that the exact frame length, in number of samples, will be determined
  1323. automatically, based on the sampling rate of the individual input audio file.
  1324. @item g
  1325. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1326. number. Default is 31.
  1327. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1328. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1329. is specified in frames, centered around the current frame. For the sake of
  1330. simplicity, this must be an odd number. Consequently, the default value of 31
  1331. takes into account the current frame, as well as the 15 preceding frames and
  1332. the 15 subsequent frames. Using a larger window results in a stronger
  1333. smoothing effect and thus in less gain variation, i.e. slower gain
  1334. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1335. effect and thus in more gain variation, i.e. faster gain adaptation.
  1336. In other words, the more you increase this value, the more the Dynamic Audio
  1337. Normalizer will behave like a "traditional" normalization filter. On the
  1338. contrary, the more you decrease this value, the more the Dynamic Audio
  1339. Normalizer will behave like a dynamic range compressor.
  1340. @item p
  1341. Set the target peak value. This specifies the highest permissible magnitude
  1342. level for the normalized audio input. This filter will try to approach the
  1343. target peak magnitude as closely as possible, but at the same time it also
  1344. makes sure that the normalized signal will never exceed the peak magnitude.
  1345. A frame's maximum local gain factor is imposed directly by the target peak
  1346. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1347. It is not recommended to go above this value.
  1348. @item m
  1349. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1350. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1351. factor for each input frame, i.e. the maximum gain factor that does not
  1352. result in clipping or distortion. The maximum gain factor is determined by
  1353. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1354. additionally bounds the frame's maximum gain factor by a predetermined
  1355. (global) maximum gain factor. This is done in order to avoid excessive gain
  1356. factors in "silent" or almost silent frames. By default, the maximum gain
  1357. factor is 10.0, For most inputs the default value should be sufficient and
  1358. it usually is not recommended to increase this value. Though, for input
  1359. with an extremely low overall volume level, it may be necessary to allow even
  1360. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1361. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1362. Instead, a "sigmoid" threshold function will be applied. This way, the
  1363. gain factors will smoothly approach the threshold value, but never exceed that
  1364. value.
  1365. @item r
  1366. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1367. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1368. This means that the maximum local gain factor for each frame is defined
  1369. (only) by the frame's highest magnitude sample. This way, the samples can
  1370. be amplified as much as possible without exceeding the maximum signal
  1371. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1372. Normalizer can also take into account the frame's root mean square,
  1373. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1374. determine the power of a time-varying signal. It is therefore considered
  1375. that the RMS is a better approximation of the "perceived loudness" than
  1376. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1377. frames to a constant RMS value, a uniform "perceived loudness" can be
  1378. established. If a target RMS value has been specified, a frame's local gain
  1379. factor is defined as the factor that would result in exactly that RMS value.
  1380. Note, however, that the maximum local gain factor is still restricted by the
  1381. frame's highest magnitude sample, in order to prevent clipping.
  1382. @item n
  1383. Enable channels coupling. By default is enabled.
  1384. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1385. amount. This means the same gain factor will be applied to all channels, i.e.
  1386. the maximum possible gain factor is determined by the "loudest" channel.
  1387. However, in some recordings, it may happen that the volume of the different
  1388. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1389. In this case, this option can be used to disable the channel coupling. This way,
  1390. the gain factor will be determined independently for each channel, depending
  1391. only on the individual channel's highest magnitude sample. This allows for
  1392. harmonizing the volume of the different channels.
  1393. @item c
  1394. Enable DC bias correction. By default is disabled.
  1395. An audio signal (in the time domain) is a sequence of sample values.
  1396. In the Dynamic Audio Normalizer these sample values are represented in the
  1397. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1398. audio signal, or "waveform", should be centered around the zero point.
  1399. That means if we calculate the mean value of all samples in a file, or in a
  1400. single frame, then the result should be 0.0 or at least very close to that
  1401. value. If, however, there is a significant deviation of the mean value from
  1402. 0.0, in either positive or negative direction, this is referred to as a
  1403. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1404. Audio Normalizer provides optional DC bias correction.
  1405. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1406. the mean value, or "DC correction" offset, of each input frame and subtract
  1407. that value from all of the frame's sample values which ensures those samples
  1408. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1409. boundaries, the DC correction offset values will be interpolated smoothly
  1410. between neighbouring frames.
  1411. @item b
  1412. Enable alternative boundary mode. By default is disabled.
  1413. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1414. around each frame. This includes the preceding frames as well as the
  1415. subsequent frames. However, for the "boundary" frames, located at the very
  1416. beginning and at the very end of the audio file, not all neighbouring
  1417. frames are available. In particular, for the first few frames in the audio
  1418. file, the preceding frames are not known. And, similarly, for the last few
  1419. frames in the audio file, the subsequent frames are not known. Thus, the
  1420. question arises which gain factors should be assumed for the missing frames
  1421. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1422. to deal with this situation. The default boundary mode assumes a gain factor
  1423. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1424. "fade out" at the beginning and at the end of the input, respectively.
  1425. @item s
  1426. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1427. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1428. compression. This means that signal peaks will not be pruned and thus the
  1429. full dynamic range will be retained within each local neighbourhood. However,
  1430. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1431. normalization algorithm with a more "traditional" compression.
  1432. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1433. (thresholding) function. If (and only if) the compression feature is enabled,
  1434. all input frames will be processed by a soft knee thresholding function prior
  1435. to the actual normalization process. Put simply, the thresholding function is
  1436. going to prune all samples whose magnitude exceeds a certain threshold value.
  1437. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1438. value. Instead, the threshold value will be adjusted for each individual
  1439. frame.
  1440. In general, smaller parameters result in stronger compression, and vice versa.
  1441. Values below 3.0 are not recommended, because audible distortion may appear.
  1442. @end table
  1443. @section earwax
  1444. Make audio easier to listen to on headphones.
  1445. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1446. so that when listened to on headphones the stereo image is moved from
  1447. inside your head (standard for headphones) to outside and in front of
  1448. the listener (standard for speakers).
  1449. Ported from SoX.
  1450. @section equalizer
  1451. Apply a two-pole peaking equalisation (EQ) filter. With this
  1452. filter, the signal-level at and around a selected frequency can
  1453. be increased or decreased, whilst (unlike bandpass and bandreject
  1454. filters) that at all other frequencies is unchanged.
  1455. In order to produce complex equalisation curves, this filter can
  1456. be given several times, each with a different central frequency.
  1457. The filter accepts the following options:
  1458. @table @option
  1459. @item frequency, f
  1460. Set the filter's central frequency in Hz.
  1461. @item width_type
  1462. Set method to specify band-width of filter.
  1463. @table @option
  1464. @item h
  1465. Hz
  1466. @item q
  1467. Q-Factor
  1468. @item o
  1469. octave
  1470. @item s
  1471. slope
  1472. @end table
  1473. @item width, w
  1474. Specify the band-width of a filter in width_type units.
  1475. @item gain, g
  1476. Set the required gain or attenuation in dB.
  1477. Beware of clipping when using a positive gain.
  1478. @end table
  1479. @subsection Examples
  1480. @itemize
  1481. @item
  1482. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1483. @example
  1484. equalizer=f=1000:width_type=h:width=200:g=-10
  1485. @end example
  1486. @item
  1487. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1488. @example
  1489. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1490. @end example
  1491. @end itemize
  1492. @section extrastereo
  1493. Linearly increases the difference between left and right channels which
  1494. adds some sort of "live" effect to playback.
  1495. The filter accepts the following option:
  1496. @table @option
  1497. @item m
  1498. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1499. (average of both channels), with 1.0 sound will be unchanged, with
  1500. -1.0 left and right channels will be swapped.
  1501. @item c
  1502. Enable clipping. By default is enabled.
  1503. @end table
  1504. @section flanger
  1505. Apply a flanging effect to the audio.
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item delay
  1509. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1510. @item depth
  1511. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1512. @item regen
  1513. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1514. Default value is 0.
  1515. @item width
  1516. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1517. Default value is 71.
  1518. @item speed
  1519. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1520. @item shape
  1521. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1522. Default value is @var{sinusoidal}.
  1523. @item phase
  1524. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1525. Default value is 25.
  1526. @item interp
  1527. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1528. Default is @var{linear}.
  1529. @end table
  1530. @section highpass
  1531. Apply a high-pass filter with 3dB point frequency.
  1532. The filter can be either single-pole, or double-pole (the default).
  1533. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item frequency, f
  1537. Set frequency in Hz. Default is 3000.
  1538. @item poles, p
  1539. Set number of poles. Default is 2.
  1540. @item width_type
  1541. Set method to specify band-width of filter.
  1542. @table @option
  1543. @item h
  1544. Hz
  1545. @item q
  1546. Q-Factor
  1547. @item o
  1548. octave
  1549. @item s
  1550. slope
  1551. @end table
  1552. @item width, w
  1553. Specify the band-width of a filter in width_type units.
  1554. Applies only to double-pole filter.
  1555. The default is 0.707q and gives a Butterworth response.
  1556. @end table
  1557. @section join
  1558. Join multiple input streams into one multi-channel stream.
  1559. It accepts the following parameters:
  1560. @table @option
  1561. @item inputs
  1562. The number of input streams. It defaults to 2.
  1563. @item channel_layout
  1564. The desired output channel layout. It defaults to stereo.
  1565. @item map
  1566. Map channels from inputs to output. The argument is a '|'-separated list of
  1567. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1568. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1569. can be either the name of the input channel (e.g. FL for front left) or its
  1570. index in the specified input stream. @var{out_channel} is the name of the output
  1571. channel.
  1572. @end table
  1573. The filter will attempt to guess the mappings when they are not specified
  1574. explicitly. It does so by first trying to find an unused matching input channel
  1575. and if that fails it picks the first unused input channel.
  1576. Join 3 inputs (with properly set channel layouts):
  1577. @example
  1578. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1579. @end example
  1580. Build a 5.1 output from 6 single-channel streams:
  1581. @example
  1582. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1583. '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'
  1584. out
  1585. @end example
  1586. @section ladspa
  1587. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1588. To enable compilation of this filter you need to configure FFmpeg with
  1589. @code{--enable-ladspa}.
  1590. @table @option
  1591. @item file, f
  1592. Specifies the name of LADSPA plugin library to load. If the environment
  1593. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1594. each one of the directories specified by the colon separated list in
  1595. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1596. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1597. @file{/usr/lib/ladspa/}.
  1598. @item plugin, p
  1599. Specifies the plugin within the library. Some libraries contain only
  1600. one plugin, but others contain many of them. If this is not set filter
  1601. will list all available plugins within the specified library.
  1602. @item controls, c
  1603. Set the '|' separated list of controls which are zero or more floating point
  1604. values that determine the behavior of the loaded plugin (for example delay,
  1605. threshold or gain).
  1606. Controls need to be defined using the following syntax:
  1607. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1608. @var{valuei} is the value set on the @var{i}-th control.
  1609. Alternatively they can be also defined using the following syntax:
  1610. @var{value0}|@var{value1}|@var{value2}|..., where
  1611. @var{valuei} is the value set on the @var{i}-th control.
  1612. If @option{controls} is set to @code{help}, all available controls and
  1613. their valid ranges are printed.
  1614. @item sample_rate, s
  1615. Specify the sample rate, default to 44100. Only used if plugin have
  1616. zero inputs.
  1617. @item nb_samples, n
  1618. Set the number of samples per channel per each output frame, default
  1619. is 1024. Only used if plugin have zero inputs.
  1620. @item duration, d
  1621. Set the minimum duration of the sourced audio. See
  1622. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1623. for the accepted syntax.
  1624. Note that the resulting duration may be greater than the specified duration,
  1625. as the generated audio is always cut at the end of a complete frame.
  1626. If not specified, or the expressed duration is negative, the audio is
  1627. supposed to be generated forever.
  1628. Only used if plugin have zero inputs.
  1629. @end table
  1630. @subsection Examples
  1631. @itemize
  1632. @item
  1633. List all available plugins within amp (LADSPA example plugin) library:
  1634. @example
  1635. ladspa=file=amp
  1636. @end example
  1637. @item
  1638. List all available controls and their valid ranges for @code{vcf_notch}
  1639. plugin from @code{VCF} library:
  1640. @example
  1641. ladspa=f=vcf:p=vcf_notch:c=help
  1642. @end example
  1643. @item
  1644. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1645. plugin library:
  1646. @example
  1647. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1648. @end example
  1649. @item
  1650. Add reverberation to the audio using TAP-plugins
  1651. (Tom's Audio Processing plugins):
  1652. @example
  1653. ladspa=file=tap_reverb:tap_reverb
  1654. @end example
  1655. @item
  1656. Generate white noise, with 0.2 amplitude:
  1657. @example
  1658. ladspa=file=cmt:noise_source_white:c=c0=.2
  1659. @end example
  1660. @item
  1661. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1662. @code{C* Audio Plugin Suite} (CAPS) library:
  1663. @example
  1664. ladspa=file=caps:Click:c=c1=20'
  1665. @end example
  1666. @item
  1667. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1668. @example
  1669. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1670. @end example
  1671. @item
  1672. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  1673. @code{SWH Plugins} collection:
  1674. @example
  1675. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  1676. @end example
  1677. @item
  1678. Attenuate low frequencies using Multiband EQ from Steve Harris
  1679. @code{SWH Plugins} collection:
  1680. @example
  1681. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  1682. @end example
  1683. @end itemize
  1684. @subsection Commands
  1685. This filter supports the following commands:
  1686. @table @option
  1687. @item cN
  1688. Modify the @var{N}-th control value.
  1689. If the specified value is not valid, it is ignored and prior one is kept.
  1690. @end table
  1691. @section lowpass
  1692. Apply a low-pass filter with 3dB point frequency.
  1693. The filter can be either single-pole or double-pole (the default).
  1694. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1695. The filter accepts the following options:
  1696. @table @option
  1697. @item frequency, f
  1698. Set frequency in Hz. Default is 500.
  1699. @item poles, p
  1700. Set number of poles. Default is 2.
  1701. @item width_type
  1702. Set method to specify band-width of filter.
  1703. @table @option
  1704. @item h
  1705. Hz
  1706. @item q
  1707. Q-Factor
  1708. @item o
  1709. octave
  1710. @item s
  1711. slope
  1712. @end table
  1713. @item width, w
  1714. Specify the band-width of a filter in width_type units.
  1715. Applies only to double-pole filter.
  1716. The default is 0.707q and gives a Butterworth response.
  1717. @end table
  1718. @anchor{pan}
  1719. @section pan
  1720. Mix channels with specific gain levels. The filter accepts the output
  1721. channel layout followed by a set of channels definitions.
  1722. This filter is also designed to efficiently remap the channels of an audio
  1723. stream.
  1724. The filter accepts parameters of the form:
  1725. "@var{l}|@var{outdef}|@var{outdef}|..."
  1726. @table @option
  1727. @item l
  1728. output channel layout or number of channels
  1729. @item outdef
  1730. output channel specification, of the form:
  1731. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1732. @item out_name
  1733. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1734. number (c0, c1, etc.)
  1735. @item gain
  1736. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1737. @item in_name
  1738. input channel to use, see out_name for details; it is not possible to mix
  1739. named and numbered input channels
  1740. @end table
  1741. If the `=' in a channel specification is replaced by `<', then the gains for
  1742. that specification will be renormalized so that the total is 1, thus
  1743. avoiding clipping noise.
  1744. @subsection Mixing examples
  1745. For example, if you want to down-mix from stereo to mono, but with a bigger
  1746. factor for the left channel:
  1747. @example
  1748. pan=1c|c0=0.9*c0+0.1*c1
  1749. @end example
  1750. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1751. 7-channels surround:
  1752. @example
  1753. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1754. @end example
  1755. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1756. that should be preferred (see "-ac" option) unless you have very specific
  1757. needs.
  1758. @subsection Remapping examples
  1759. The channel remapping will be effective if, and only if:
  1760. @itemize
  1761. @item gain coefficients are zeroes or ones,
  1762. @item only one input per channel output,
  1763. @end itemize
  1764. If all these conditions are satisfied, the filter will notify the user ("Pure
  1765. channel mapping detected"), and use an optimized and lossless method to do the
  1766. remapping.
  1767. For example, if you have a 5.1 source and want a stereo audio stream by
  1768. dropping the extra channels:
  1769. @example
  1770. pan="stereo| c0=FL | c1=FR"
  1771. @end example
  1772. Given the same source, you can also switch front left and front right channels
  1773. and keep the input channel layout:
  1774. @example
  1775. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  1776. @end example
  1777. If the input is a stereo audio stream, you can mute the front left channel (and
  1778. still keep the stereo channel layout) with:
  1779. @example
  1780. pan="stereo|c1=c1"
  1781. @end example
  1782. Still with a stereo audio stream input, you can copy the right channel in both
  1783. front left and right:
  1784. @example
  1785. pan="stereo| c0=FR | c1=FR"
  1786. @end example
  1787. @section replaygain
  1788. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1789. outputs it unchanged.
  1790. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1791. @section resample
  1792. Convert the audio sample format, sample rate and channel layout. It is
  1793. not meant to be used directly.
  1794. @section rubberband
  1795. Apply time-stretching and pitch-shifting with librubberband.
  1796. The filter accepts the following options:
  1797. @table @option
  1798. @item tempo
  1799. Set tempo scale factor.
  1800. @item pitch
  1801. Set pitch scale factor.
  1802. @item transients
  1803. Set transients detector.
  1804. Possible values are:
  1805. @table @var
  1806. @item crisp
  1807. @item mixed
  1808. @item smooth
  1809. @end table
  1810. @item detector
  1811. Set detector.
  1812. Possible values are:
  1813. @table @var
  1814. @item compound
  1815. @item percussive
  1816. @item soft
  1817. @end table
  1818. @item phase
  1819. Set phase.
  1820. Possible values are:
  1821. @table @var
  1822. @item laminar
  1823. @item independent
  1824. @end table
  1825. @item window
  1826. Set processing window size.
  1827. Possible values are:
  1828. @table @var
  1829. @item standard
  1830. @item short
  1831. @item long
  1832. @end table
  1833. @item smoothing
  1834. Set smoothing.
  1835. Possible values are:
  1836. @table @var
  1837. @item off
  1838. @item on
  1839. @end table
  1840. @item formant
  1841. Enable formant preservation when shift pitching.
  1842. Possible values are:
  1843. @table @var
  1844. @item shifted
  1845. @item preserved
  1846. @end table
  1847. @item pitchq
  1848. Set pitch quality.
  1849. Possible values are:
  1850. @table @var
  1851. @item quality
  1852. @item speed
  1853. @item consistency
  1854. @end table
  1855. @item channels
  1856. Set channels.
  1857. Possible values are:
  1858. @table @var
  1859. @item apart
  1860. @item together
  1861. @end table
  1862. @end table
  1863. @section sidechaincompress
  1864. This filter acts like normal compressor but has the ability to compress
  1865. detected signal using second input signal.
  1866. It needs two input streams and returns one output stream.
  1867. First input stream will be processed depending on second stream signal.
  1868. The filtered signal then can be filtered with other filters in later stages of
  1869. processing. See @ref{pan} and @ref{amerge} filter.
  1870. The filter accepts the following options:
  1871. @table @option
  1872. @item threshold
  1873. If a signal of second stream raises above this level it will affect the gain
  1874. reduction of first stream.
  1875. By default is 0.125. Range is between 0.00097563 and 1.
  1876. @item ratio
  1877. Set a ratio about which the signal is reduced. 1:2 means that if the level
  1878. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  1879. Default is 2. Range is between 1 and 20.
  1880. @item attack
  1881. Amount of milliseconds the signal has to rise above the threshold before gain
  1882. reduction starts. Default is 20. Range is between 0.01 and 2000.
  1883. @item release
  1884. Amount of milliseconds the signal has to fall bellow the threshold before
  1885. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  1886. @item makeup
  1887. Set the amount by how much signal will be amplified after processing.
  1888. Default is 2. Range is from 1 and 64.
  1889. @item knee
  1890. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1891. Default is 2.82843. Range is between 1 and 8.
  1892. @item link
  1893. Choose if the @code{average} level between all channels of side-chain stream
  1894. or the louder(@code{maximum}) channel of side-chain stream affects the
  1895. reduction. Default is @code{average}.
  1896. @item detection
  1897. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  1898. of @code{rms}. Default is @code{rms} which is mainly smoother.
  1899. @end table
  1900. @subsection Examples
  1901. @itemize
  1902. @item
  1903. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  1904. depending on the signal of 2nd input and later compressed signal to be
  1905. merged with 2nd input:
  1906. @example
  1907. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1908. @end example
  1909. @end itemize
  1910. @section silencedetect
  1911. Detect silence in an audio stream.
  1912. This filter logs a message when it detects that the input audio volume is less
  1913. or equal to a noise tolerance value for a duration greater or equal to the
  1914. minimum detected noise duration.
  1915. The printed times and duration are expressed in seconds.
  1916. The filter accepts the following options:
  1917. @table @option
  1918. @item duration, d
  1919. Set silence duration until notification (default is 2 seconds).
  1920. @item noise, n
  1921. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1922. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1923. @end table
  1924. @subsection Examples
  1925. @itemize
  1926. @item
  1927. Detect 5 seconds of silence with -50dB noise tolerance:
  1928. @example
  1929. silencedetect=n=-50dB:d=5
  1930. @end example
  1931. @item
  1932. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1933. tolerance in @file{silence.mp3}:
  1934. @example
  1935. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1936. @end example
  1937. @end itemize
  1938. @section silenceremove
  1939. Remove silence from the beginning, middle or end of the audio.
  1940. The filter accepts the following options:
  1941. @table @option
  1942. @item start_periods
  1943. This value is used to indicate if audio should be trimmed at beginning of
  1944. the audio. A value of zero indicates no silence should be trimmed from the
  1945. beginning. When specifying a non-zero value, it trims audio up until it
  1946. finds non-silence. Normally, when trimming silence from beginning of audio
  1947. the @var{start_periods} will be @code{1} but it can be increased to higher
  1948. values to trim all audio up to specific count of non-silence periods.
  1949. Default value is @code{0}.
  1950. @item start_duration
  1951. Specify the amount of time that non-silence must be detected before it stops
  1952. trimming audio. By increasing the duration, bursts of noises can be treated
  1953. as silence and trimmed off. Default value is @code{0}.
  1954. @item start_threshold
  1955. This indicates what sample value should be treated as silence. For digital
  1956. audio, a value of @code{0} may be fine but for audio recorded from analog,
  1957. you may wish to increase the value to account for background noise.
  1958. Can be specified in dB (in case "dB" is appended to the specified value)
  1959. or amplitude ratio. Default value is @code{0}.
  1960. @item stop_periods
  1961. Set the count for trimming silence from the end of audio.
  1962. To remove silence from the middle of a file, specify a @var{stop_periods}
  1963. that is negative. This value is then treated as a positive value and is
  1964. used to indicate the effect should restart processing as specified by
  1965. @var{start_periods}, making it suitable for removing periods of silence
  1966. in the middle of the audio.
  1967. Default value is @code{0}.
  1968. @item stop_duration
  1969. Specify a duration of silence that must exist before audio is not copied any
  1970. more. By specifying a higher duration, silence that is wanted can be left in
  1971. the audio.
  1972. Default value is @code{0}.
  1973. @item stop_threshold
  1974. This is the same as @option{start_threshold} but for trimming silence from
  1975. the end of audio.
  1976. Can be specified in dB (in case "dB" is appended to the specified value)
  1977. or amplitude ratio. Default value is @code{0}.
  1978. @item leave_silence
  1979. This indicate that @var{stop_duration} length of audio should be left intact
  1980. at the beginning of each period of silence.
  1981. For example, if you want to remove long pauses between words but do not want
  1982. to remove the pauses completely. Default value is @code{0}.
  1983. @end table
  1984. @subsection Examples
  1985. @itemize
  1986. @item
  1987. The following example shows how this filter can be used to start a recording
  1988. that does not contain the delay at the start which usually occurs between
  1989. pressing the record button and the start of the performance:
  1990. @example
  1991. silenceremove=1:5:0.02
  1992. @end example
  1993. @end itemize
  1994. @section stereotools
  1995. This filter has some handy utilities to manage stereo signals, for converting
  1996. M/S stereo recordings to L/R signal while having control over the parameters
  1997. or spreading the stereo image of master track.
  1998. The filter accepts the following options:
  1999. @table @option
  2000. @item level_in
  2001. Set input level before filtering for both channels. Defaults is 1.
  2002. Allowed range is from 0.015625 to 64.
  2003. @item level_out
  2004. Set output level after filtering for both channels. Defaults is 1.
  2005. Allowed range is from 0.015625 to 64.
  2006. @item balance_in
  2007. Set input balance between both channels. Default is 0.
  2008. Allowed range is from -1 to 1.
  2009. @item balance_out
  2010. Set output balance between both channels. Default is 0.
  2011. Allowed range is from -1 to 1.
  2012. @item softclip
  2013. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2014. clipping. Disabled by default.
  2015. @item mutel
  2016. Mute the left channel. Disabled by default.
  2017. @item muter
  2018. Mute the right channel. Disabled by default.
  2019. @item phasel
  2020. Change the phase of the left channel. Disabled by default.
  2021. @item phaser
  2022. Change the phase of the right channel. Disabled by default.
  2023. @item mode
  2024. Set stereo mode. Available values are:
  2025. @table @samp
  2026. @item lr>lr
  2027. Left/Right to Left/Right, this is default.
  2028. @item lr>ms
  2029. Left/Right to Mid/Side.
  2030. @item ms>lr
  2031. Mid/Side to Left/Right.
  2032. @item lr>ll
  2033. Left/Right to Left/Left.
  2034. @item lr>rr
  2035. Left/Right to Right/Right.
  2036. @item lr>l+r
  2037. Left/Right to Left + Right.
  2038. @item lr>rl
  2039. Left/Right to Right/Left.
  2040. @end table
  2041. @item slev
  2042. Set level of side signal. Default is 1.
  2043. Allowed range is from 0.015625 to 64.
  2044. @item sbal
  2045. Set balance of side signal. Default is 0.
  2046. Allowed range is from -1 to 1.
  2047. @item mlev
  2048. Set level of the middle signal. Default is 1.
  2049. Allowed range is from 0.015625 to 64.
  2050. @item mpan
  2051. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2052. @item base
  2053. Set stereo base between mono and inversed channels. Default is 0.
  2054. Allowed range is from -1 to 1.
  2055. @item delay
  2056. Set delay in milliseconds how much to delay left from right channel and
  2057. vice versa. Default is 0. Allowed range is from -20 to 20.
  2058. @item sclevel
  2059. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2060. @item phase
  2061. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2062. @end table
  2063. @section stereowiden
  2064. This filter enhance the stereo effect by suppressing signal common to both
  2065. channels and by delaying the signal of left into right and vice versa,
  2066. thereby widening the stereo effect.
  2067. The filter accepts the following options:
  2068. @table @option
  2069. @item delay
  2070. Time in milliseconds of the delay of left signal into right and vice versa.
  2071. Default is 20 milliseconds.
  2072. @item feedback
  2073. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2074. effect of left signal in right output and vice versa which gives widening
  2075. effect. Default is 0.3.
  2076. @item crossfeed
  2077. Cross feed of left into right with inverted phase. This helps in suppressing
  2078. the mono. If the value is 1 it will cancel all the signal common to both
  2079. channels. Default is 0.3.
  2080. @item drymix
  2081. Set level of input signal of original channel. Default is 0.8.
  2082. @end table
  2083. @section treble
  2084. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2085. shelving filter with a response similar to that of a standard
  2086. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2087. The filter accepts the following options:
  2088. @table @option
  2089. @item gain, g
  2090. Give the gain at whichever is the lower of ~22 kHz and the
  2091. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2092. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2093. @item frequency, f
  2094. Set the filter's central frequency and so can be used
  2095. to extend or reduce the frequency range to be boosted or cut.
  2096. The default value is @code{3000} Hz.
  2097. @item width_type
  2098. Set method to specify band-width of filter.
  2099. @table @option
  2100. @item h
  2101. Hz
  2102. @item q
  2103. Q-Factor
  2104. @item o
  2105. octave
  2106. @item s
  2107. slope
  2108. @end table
  2109. @item width, w
  2110. Determine how steep is the filter's shelf transition.
  2111. @end table
  2112. @section tremolo
  2113. Sinusoidal amplitude modulation.
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item f
  2117. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2118. (20 Hz or lower) will result in a tremolo effect.
  2119. This filter may also be used as a ring modulator by specifying
  2120. a modulation frequency higher than 20 Hz.
  2121. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2122. @item d
  2123. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2124. Default value is 0.5.
  2125. @end table
  2126. @section volume
  2127. Adjust the input audio volume.
  2128. It accepts the following parameters:
  2129. @table @option
  2130. @item volume
  2131. Set audio volume expression.
  2132. Output values are clipped to the maximum value.
  2133. The output audio volume is given by the relation:
  2134. @example
  2135. @var{output_volume} = @var{volume} * @var{input_volume}
  2136. @end example
  2137. The default value for @var{volume} is "1.0".
  2138. @item precision
  2139. This parameter represents the mathematical precision.
  2140. It determines which input sample formats will be allowed, which affects the
  2141. precision of the volume scaling.
  2142. @table @option
  2143. @item fixed
  2144. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2145. @item float
  2146. 32-bit floating-point; this limits input sample format to FLT. (default)
  2147. @item double
  2148. 64-bit floating-point; this limits input sample format to DBL.
  2149. @end table
  2150. @item replaygain
  2151. Choose the behaviour on encountering ReplayGain side data in input frames.
  2152. @table @option
  2153. @item drop
  2154. Remove ReplayGain side data, ignoring its contents (the default).
  2155. @item ignore
  2156. Ignore ReplayGain side data, but leave it in the frame.
  2157. @item track
  2158. Prefer the track gain, if present.
  2159. @item album
  2160. Prefer the album gain, if present.
  2161. @end table
  2162. @item replaygain_preamp
  2163. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2164. Default value for @var{replaygain_preamp} is 0.0.
  2165. @item eval
  2166. Set when the volume expression is evaluated.
  2167. It accepts the following values:
  2168. @table @samp
  2169. @item once
  2170. only evaluate expression once during the filter initialization, or
  2171. when the @samp{volume} command is sent
  2172. @item frame
  2173. evaluate expression for each incoming frame
  2174. @end table
  2175. Default value is @samp{once}.
  2176. @end table
  2177. The volume expression can contain the following parameters.
  2178. @table @option
  2179. @item n
  2180. frame number (starting at zero)
  2181. @item nb_channels
  2182. number of channels
  2183. @item nb_consumed_samples
  2184. number of samples consumed by the filter
  2185. @item nb_samples
  2186. number of samples in the current frame
  2187. @item pos
  2188. original frame position in the file
  2189. @item pts
  2190. frame PTS
  2191. @item sample_rate
  2192. sample rate
  2193. @item startpts
  2194. PTS at start of stream
  2195. @item startt
  2196. time at start of stream
  2197. @item t
  2198. frame time
  2199. @item tb
  2200. timestamp timebase
  2201. @item volume
  2202. last set volume value
  2203. @end table
  2204. Note that when @option{eval} is set to @samp{once} only the
  2205. @var{sample_rate} and @var{tb} variables are available, all other
  2206. variables will evaluate to NAN.
  2207. @subsection Commands
  2208. This filter supports the following commands:
  2209. @table @option
  2210. @item volume
  2211. Modify the volume expression.
  2212. The command accepts the same syntax of the corresponding option.
  2213. If the specified expression is not valid, it is kept at its current
  2214. value.
  2215. @item replaygain_noclip
  2216. Prevent clipping by limiting the gain applied.
  2217. Default value for @var{replaygain_noclip} is 1.
  2218. @end table
  2219. @subsection Examples
  2220. @itemize
  2221. @item
  2222. Halve the input audio volume:
  2223. @example
  2224. volume=volume=0.5
  2225. volume=volume=1/2
  2226. volume=volume=-6.0206dB
  2227. @end example
  2228. In all the above example the named key for @option{volume} can be
  2229. omitted, for example like in:
  2230. @example
  2231. volume=0.5
  2232. @end example
  2233. @item
  2234. Increase input audio power by 6 decibels using fixed-point precision:
  2235. @example
  2236. volume=volume=6dB:precision=fixed
  2237. @end example
  2238. @item
  2239. Fade volume after time 10 with an annihilation period of 5 seconds:
  2240. @example
  2241. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2242. @end example
  2243. @end itemize
  2244. @section volumedetect
  2245. Detect the volume of the input video.
  2246. The filter has no parameters. The input is not modified. Statistics about
  2247. the volume will be printed in the log when the input stream end is reached.
  2248. In particular it will show the mean volume (root mean square), maximum
  2249. volume (on a per-sample basis), and the beginning of a histogram of the
  2250. registered volume values (from the maximum value to a cumulated 1/1000 of
  2251. the samples).
  2252. All volumes are in decibels relative to the maximum PCM value.
  2253. @subsection Examples
  2254. Here is an excerpt of the output:
  2255. @example
  2256. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2257. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2258. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2259. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2260. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2261. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2262. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2263. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2264. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2265. @end example
  2266. It means that:
  2267. @itemize
  2268. @item
  2269. The mean square energy is approximately -27 dB, or 10^-2.7.
  2270. @item
  2271. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2272. @item
  2273. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2274. @end itemize
  2275. In other words, raising the volume by +4 dB does not cause any clipping,
  2276. raising it by +5 dB causes clipping for 6 samples, etc.
  2277. @c man end AUDIO FILTERS
  2278. @chapter Audio Sources
  2279. @c man begin AUDIO SOURCES
  2280. Below is a description of the currently available audio sources.
  2281. @section abuffer
  2282. Buffer audio frames, and make them available to the filter chain.
  2283. This source is mainly intended for a programmatic use, in particular
  2284. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2285. It accepts the following parameters:
  2286. @table @option
  2287. @item time_base
  2288. The timebase which will be used for timestamps of submitted frames. It must be
  2289. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2290. @item sample_rate
  2291. The sample rate of the incoming audio buffers.
  2292. @item sample_fmt
  2293. The sample format of the incoming audio buffers.
  2294. Either a sample format name or its corresponding integer representation from
  2295. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2296. @item channel_layout
  2297. The channel layout of the incoming audio buffers.
  2298. Either a channel layout name from channel_layout_map in
  2299. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2300. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2301. @item channels
  2302. The number of channels of the incoming audio buffers.
  2303. If both @var{channels} and @var{channel_layout} are specified, then they
  2304. must be consistent.
  2305. @end table
  2306. @subsection Examples
  2307. @example
  2308. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2309. @end example
  2310. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2311. Since the sample format with name "s16p" corresponds to the number
  2312. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2313. equivalent to:
  2314. @example
  2315. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2316. @end example
  2317. @section aevalsrc
  2318. Generate an audio signal specified by an expression.
  2319. This source accepts in input one or more expressions (one for each
  2320. channel), which are evaluated and used to generate a corresponding
  2321. audio signal.
  2322. This source accepts the following options:
  2323. @table @option
  2324. @item exprs
  2325. Set the '|'-separated expressions list for each separate channel. In case the
  2326. @option{channel_layout} option is not specified, the selected channel layout
  2327. depends on the number of provided expressions. Otherwise the last
  2328. specified expression is applied to the remaining output channels.
  2329. @item channel_layout, c
  2330. Set the channel layout. The number of channels in the specified layout
  2331. must be equal to the number of specified expressions.
  2332. @item duration, d
  2333. Set the minimum duration of the sourced audio. See
  2334. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2335. for the accepted syntax.
  2336. Note that the resulting duration may be greater than the specified
  2337. duration, as the generated audio is always cut at the end of a
  2338. complete frame.
  2339. If not specified, or the expressed duration is negative, the audio is
  2340. supposed to be generated forever.
  2341. @item nb_samples, n
  2342. Set the number of samples per channel per each output frame,
  2343. default to 1024.
  2344. @item sample_rate, s
  2345. Specify the sample rate, default to 44100.
  2346. @end table
  2347. Each expression in @var{exprs} can contain the following constants:
  2348. @table @option
  2349. @item n
  2350. number of the evaluated sample, starting from 0
  2351. @item t
  2352. time of the evaluated sample expressed in seconds, starting from 0
  2353. @item s
  2354. sample rate
  2355. @end table
  2356. @subsection Examples
  2357. @itemize
  2358. @item
  2359. Generate silence:
  2360. @example
  2361. aevalsrc=0
  2362. @end example
  2363. @item
  2364. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2365. 8000 Hz:
  2366. @example
  2367. aevalsrc="sin(440*2*PI*t):s=8000"
  2368. @end example
  2369. @item
  2370. Generate a two channels signal, specify the channel layout (Front
  2371. Center + Back Center) explicitly:
  2372. @example
  2373. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2374. @end example
  2375. @item
  2376. Generate white noise:
  2377. @example
  2378. aevalsrc="-2+random(0)"
  2379. @end example
  2380. @item
  2381. Generate an amplitude modulated signal:
  2382. @example
  2383. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2384. @end example
  2385. @item
  2386. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2387. @example
  2388. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2389. @end example
  2390. @end itemize
  2391. @section anullsrc
  2392. The null audio source, return unprocessed audio frames. It is mainly useful
  2393. as a template and to be employed in analysis / debugging tools, or as
  2394. the source for filters which ignore the input data (for example the sox
  2395. synth filter).
  2396. This source accepts the following options:
  2397. @table @option
  2398. @item channel_layout, cl
  2399. Specifies the channel layout, and can be either an integer or a string
  2400. representing a channel layout. The default value of @var{channel_layout}
  2401. is "stereo".
  2402. Check the channel_layout_map definition in
  2403. @file{libavutil/channel_layout.c} for the mapping between strings and
  2404. channel layout values.
  2405. @item sample_rate, r
  2406. Specifies the sample rate, and defaults to 44100.
  2407. @item nb_samples, n
  2408. Set the number of samples per requested frames.
  2409. @end table
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2414. @example
  2415. anullsrc=r=48000:cl=4
  2416. @end example
  2417. @item
  2418. Do the same operation with a more obvious syntax:
  2419. @example
  2420. anullsrc=r=48000:cl=mono
  2421. @end example
  2422. @end itemize
  2423. All the parameters need to be explicitly defined.
  2424. @section flite
  2425. Synthesize a voice utterance using the libflite library.
  2426. To enable compilation of this filter you need to configure FFmpeg with
  2427. @code{--enable-libflite}.
  2428. Note that the flite library is not thread-safe.
  2429. The filter accepts the following options:
  2430. @table @option
  2431. @item list_voices
  2432. If set to 1, list the names of the available voices and exit
  2433. immediately. Default value is 0.
  2434. @item nb_samples, n
  2435. Set the maximum number of samples per frame. Default value is 512.
  2436. @item textfile
  2437. Set the filename containing the text to speak.
  2438. @item text
  2439. Set the text to speak.
  2440. @item voice, v
  2441. Set the voice to use for the speech synthesis. Default value is
  2442. @code{kal}. See also the @var{list_voices} option.
  2443. @end table
  2444. @subsection Examples
  2445. @itemize
  2446. @item
  2447. Read from file @file{speech.txt}, and synthesize the text using the
  2448. standard flite voice:
  2449. @example
  2450. flite=textfile=speech.txt
  2451. @end example
  2452. @item
  2453. Read the specified text selecting the @code{slt} voice:
  2454. @example
  2455. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2456. @end example
  2457. @item
  2458. Input text to ffmpeg:
  2459. @example
  2460. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2461. @end example
  2462. @item
  2463. Make @file{ffplay} speak the specified text, using @code{flite} and
  2464. the @code{lavfi} device:
  2465. @example
  2466. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2467. @end example
  2468. @end itemize
  2469. For more information about libflite, check:
  2470. @url{http://www.speech.cs.cmu.edu/flite/}
  2471. @section sine
  2472. Generate an audio signal made of a sine wave with amplitude 1/8.
  2473. The audio signal is bit-exact.
  2474. The filter accepts the following options:
  2475. @table @option
  2476. @item frequency, f
  2477. Set the carrier frequency. Default is 440 Hz.
  2478. @item beep_factor, b
  2479. Enable a periodic beep every second with frequency @var{beep_factor} times
  2480. the carrier frequency. Default is 0, meaning the beep is disabled.
  2481. @item sample_rate, r
  2482. Specify the sample rate, default is 44100.
  2483. @item duration, d
  2484. Specify the duration of the generated audio stream.
  2485. @item samples_per_frame
  2486. Set the number of samples per output frame.
  2487. The expression can contain the following constants:
  2488. @table @option
  2489. @item n
  2490. The (sequential) number of the output audio frame, starting from 0.
  2491. @item pts
  2492. The PTS (Presentation TimeStamp) of the output audio frame,
  2493. expressed in @var{TB} units.
  2494. @item t
  2495. The PTS of the output audio frame, expressed in seconds.
  2496. @item TB
  2497. The timebase of the output audio frames.
  2498. @end table
  2499. Default is @code{1024}.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. Generate a simple 440 Hz sine wave:
  2505. @example
  2506. sine
  2507. @end example
  2508. @item
  2509. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  2510. @example
  2511. sine=220:4:d=5
  2512. sine=f=220:b=4:d=5
  2513. sine=frequency=220:beep_factor=4:duration=5
  2514. @end example
  2515. @item
  2516. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  2517. pattern:
  2518. @example
  2519. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  2520. @end example
  2521. @end itemize
  2522. @c man end AUDIO SOURCES
  2523. @chapter Audio Sinks
  2524. @c man begin AUDIO SINKS
  2525. Below is a description of the currently available audio sinks.
  2526. @section abuffersink
  2527. Buffer audio frames, and make them available to the end of filter chain.
  2528. This sink is mainly intended for programmatic use, in particular
  2529. through the interface defined in @file{libavfilter/buffersink.h}
  2530. or the options system.
  2531. It accepts a pointer to an AVABufferSinkContext structure, which
  2532. defines the incoming buffers' formats, to be passed as the opaque
  2533. parameter to @code{avfilter_init_filter} for initialization.
  2534. @section anullsink
  2535. Null audio sink; do absolutely nothing with the input audio. It is
  2536. mainly useful as a template and for use in analysis / debugging
  2537. tools.
  2538. @c man end AUDIO SINKS
  2539. @chapter Video Filters
  2540. @c man begin VIDEO FILTERS
  2541. When you configure your FFmpeg build, you can disable any of the
  2542. existing filters using @code{--disable-filters}.
  2543. The configure output will show the video filters included in your
  2544. build.
  2545. Below is a description of the currently available video filters.
  2546. @section alphaextract
  2547. Extract the alpha component from the input as a grayscale video. This
  2548. is especially useful with the @var{alphamerge} filter.
  2549. @section alphamerge
  2550. Add or replace the alpha component of the primary input with the
  2551. grayscale value of a second input. This is intended for use with
  2552. @var{alphaextract} to allow the transmission or storage of frame
  2553. sequences that have alpha in a format that doesn't support an alpha
  2554. channel.
  2555. For example, to reconstruct full frames from a normal YUV-encoded video
  2556. and a separate video created with @var{alphaextract}, you might use:
  2557. @example
  2558. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  2559. @end example
  2560. Since this filter is designed for reconstruction, it operates on frame
  2561. sequences without considering timestamps, and terminates when either
  2562. input reaches end of stream. This will cause problems if your encoding
  2563. pipeline drops frames. If you're trying to apply an image as an
  2564. overlay to a video stream, consider the @var{overlay} filter instead.
  2565. @section ass
  2566. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  2567. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  2568. Substation Alpha) subtitles files.
  2569. This filter accepts the following option in addition to the common options from
  2570. the @ref{subtitles} filter:
  2571. @table @option
  2572. @item shaping
  2573. Set the shaping engine
  2574. Available values are:
  2575. @table @samp
  2576. @item auto
  2577. The default libass shaping engine, which is the best available.
  2578. @item simple
  2579. Fast, font-agnostic shaper that can do only substitutions
  2580. @item complex
  2581. Slower shaper using OpenType for substitutions and positioning
  2582. @end table
  2583. The default is @code{auto}.
  2584. @end table
  2585. @section atadenoise
  2586. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  2587. The filter accepts the following options:
  2588. @table @option
  2589. @item 0a
  2590. Set threshold A for 1st plane. Default is 0.02.
  2591. Valid range is 0 to 0.3.
  2592. @item 0b
  2593. Set threshold B for 1st plane. Default is 0.04.
  2594. Valid range is 0 to 5.
  2595. @item 1a
  2596. Set threshold A for 2nd plane. Default is 0.02.
  2597. Valid range is 0 to 0.3.
  2598. @item 1b
  2599. Set threshold B for 2nd plane. Default is 0.04.
  2600. Valid range is 0 to 5.
  2601. @item 2a
  2602. Set threshold A for 3rd plane. Default is 0.02.
  2603. Valid range is 0 to 0.3.
  2604. @item 2b
  2605. Set threshold B for 3rd plane. Default is 0.04.
  2606. Valid range is 0 to 5.
  2607. Threshold A is designed to react on abrupt changes in the input signal and
  2608. threshold B is designed to react on continuous changes in the input signal.
  2609. @item s
  2610. Set number of frames filter will use for averaging. Default is 33. Must be odd
  2611. number in range [5, 129].
  2612. @end table
  2613. @section bbox
  2614. Compute the bounding box for the non-black pixels in the input frame
  2615. luminance plane.
  2616. This filter computes the bounding box containing all the pixels with a
  2617. luminance value greater than the minimum allowed value.
  2618. The parameters describing the bounding box are printed on the filter
  2619. log.
  2620. The filter accepts the following option:
  2621. @table @option
  2622. @item min_val
  2623. Set the minimal luminance value. Default is @code{16}.
  2624. @end table
  2625. @section blackdetect
  2626. Detect video intervals that are (almost) completely black. Can be
  2627. useful to detect chapter transitions, commercials, or invalid
  2628. recordings. Output lines contains the time for the start, end and
  2629. duration of the detected black interval expressed in seconds.
  2630. In order to display the output lines, you need to set the loglevel at
  2631. least to the AV_LOG_INFO value.
  2632. The filter accepts the following options:
  2633. @table @option
  2634. @item black_min_duration, d
  2635. Set the minimum detected black duration expressed in seconds. It must
  2636. be a non-negative floating point number.
  2637. Default value is 2.0.
  2638. @item picture_black_ratio_th, pic_th
  2639. Set the threshold for considering a picture "black".
  2640. Express the minimum value for the ratio:
  2641. @example
  2642. @var{nb_black_pixels} / @var{nb_pixels}
  2643. @end example
  2644. for which a picture is considered black.
  2645. Default value is 0.98.
  2646. @item pixel_black_th, pix_th
  2647. Set the threshold for considering a pixel "black".
  2648. The threshold expresses the maximum pixel luminance value for which a
  2649. pixel is considered "black". The provided value is scaled according to
  2650. the following equation:
  2651. @example
  2652. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  2653. @end example
  2654. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  2655. the input video format, the range is [0-255] for YUV full-range
  2656. formats and [16-235] for YUV non full-range formats.
  2657. Default value is 0.10.
  2658. @end table
  2659. The following example sets the maximum pixel threshold to the minimum
  2660. value, and detects only black intervals of 2 or more seconds:
  2661. @example
  2662. blackdetect=d=2:pix_th=0.00
  2663. @end example
  2664. @section blackframe
  2665. Detect frames that are (almost) completely black. Can be useful to
  2666. detect chapter transitions or commercials. Output lines consist of
  2667. the frame number of the detected frame, the percentage of blackness,
  2668. the position in the file if known or -1 and the timestamp in seconds.
  2669. In order to display the output lines, you need to set the loglevel at
  2670. least to the AV_LOG_INFO value.
  2671. It accepts the following parameters:
  2672. @table @option
  2673. @item amount
  2674. The percentage of the pixels that have to be below the threshold; it defaults to
  2675. @code{98}.
  2676. @item threshold, thresh
  2677. The threshold below which a pixel value is considered black; it defaults to
  2678. @code{32}.
  2679. @end table
  2680. @section blend, tblend
  2681. Blend two video frames into each other.
  2682. The @code{blend} filter takes two input streams and outputs one
  2683. stream, the first input is the "top" layer and second input is
  2684. "bottom" layer. Output terminates when shortest input terminates.
  2685. The @code{tblend} (time blend) filter takes two consecutive frames
  2686. from one single stream, and outputs the result obtained by blending
  2687. the new frame on top of the old frame.
  2688. A description of the accepted options follows.
  2689. @table @option
  2690. @item c0_mode
  2691. @item c1_mode
  2692. @item c2_mode
  2693. @item c3_mode
  2694. @item all_mode
  2695. Set blend mode for specific pixel component or all pixel components in case
  2696. of @var{all_mode}. Default value is @code{normal}.
  2697. Available values for component modes are:
  2698. @table @samp
  2699. @item addition
  2700. @item addition128
  2701. @item and
  2702. @item average
  2703. @item burn
  2704. @item darken
  2705. @item difference
  2706. @item difference128
  2707. @item divide
  2708. @item dodge
  2709. @item exclusion
  2710. @item glow
  2711. @item hardlight
  2712. @item hardmix
  2713. @item lighten
  2714. @item linearlight
  2715. @item multiply
  2716. @item negation
  2717. @item normal
  2718. @item or
  2719. @item overlay
  2720. @item phoenix
  2721. @item pinlight
  2722. @item reflect
  2723. @item screen
  2724. @item softlight
  2725. @item subtract
  2726. @item vividlight
  2727. @item xor
  2728. @end table
  2729. @item c0_opacity
  2730. @item c1_opacity
  2731. @item c2_opacity
  2732. @item c3_opacity
  2733. @item all_opacity
  2734. Set blend opacity for specific pixel component or all pixel components in case
  2735. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2736. @item c0_expr
  2737. @item c1_expr
  2738. @item c2_expr
  2739. @item c3_expr
  2740. @item all_expr
  2741. Set blend expression for specific pixel component or all pixel components in case
  2742. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2743. The expressions can use the following variables:
  2744. @table @option
  2745. @item N
  2746. The sequential number of the filtered frame, starting from @code{0}.
  2747. @item X
  2748. @item Y
  2749. the coordinates of the current sample
  2750. @item W
  2751. @item H
  2752. the width and height of currently filtered plane
  2753. @item SW
  2754. @item SH
  2755. Width and height scale depending on the currently filtered plane. It is the
  2756. ratio between the corresponding luma plane number of pixels and the current
  2757. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2758. @code{0.5,0.5} for chroma planes.
  2759. @item T
  2760. Time of the current frame, expressed in seconds.
  2761. @item TOP, A
  2762. Value of pixel component at current location for first video frame (top layer).
  2763. @item BOTTOM, B
  2764. Value of pixel component at current location for second video frame (bottom layer).
  2765. @end table
  2766. @item shortest
  2767. Force termination when the shortest input terminates. Default is
  2768. @code{0}. This option is only defined for the @code{blend} filter.
  2769. @item repeatlast
  2770. Continue applying the last bottom frame after the end of the stream. A value of
  2771. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2772. Default is @code{1}. This option is only defined for the @code{blend} filter.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Apply transition from bottom layer to top layer in first 10 seconds:
  2778. @example
  2779. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2780. @end example
  2781. @item
  2782. Apply 1x1 checkerboard effect:
  2783. @example
  2784. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2785. @end example
  2786. @item
  2787. Apply uncover left effect:
  2788. @example
  2789. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2790. @end example
  2791. @item
  2792. Apply uncover down effect:
  2793. @example
  2794. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2795. @end example
  2796. @item
  2797. Apply uncover up-left effect:
  2798. @example
  2799. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2800. @end example
  2801. @item
  2802. Display differences between the current and the previous frame:
  2803. @example
  2804. tblend=all_mode=difference128
  2805. @end example
  2806. @end itemize
  2807. @section boxblur
  2808. Apply a boxblur algorithm to the input video.
  2809. It accepts the following parameters:
  2810. @table @option
  2811. @item luma_radius, lr
  2812. @item luma_power, lp
  2813. @item chroma_radius, cr
  2814. @item chroma_power, cp
  2815. @item alpha_radius, ar
  2816. @item alpha_power, ap
  2817. @end table
  2818. A description of the accepted options follows.
  2819. @table @option
  2820. @item luma_radius, lr
  2821. @item chroma_radius, cr
  2822. @item alpha_radius, ar
  2823. Set an expression for the box radius in pixels used for blurring the
  2824. corresponding input plane.
  2825. The radius value must be a non-negative number, and must not be
  2826. greater than the value of the expression @code{min(w,h)/2} for the
  2827. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2828. planes.
  2829. Default value for @option{luma_radius} is "2". If not specified,
  2830. @option{chroma_radius} and @option{alpha_radius} default to the
  2831. corresponding value set for @option{luma_radius}.
  2832. The expressions can contain the following constants:
  2833. @table @option
  2834. @item w
  2835. @item h
  2836. The input width and height in pixels.
  2837. @item cw
  2838. @item ch
  2839. The input chroma image width and height in pixels.
  2840. @item hsub
  2841. @item vsub
  2842. The horizontal and vertical chroma subsample values. For example, for the
  2843. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2844. @end table
  2845. @item luma_power, lp
  2846. @item chroma_power, cp
  2847. @item alpha_power, ap
  2848. Specify how many times the boxblur filter is applied to the
  2849. corresponding plane.
  2850. Default value for @option{luma_power} is 2. If not specified,
  2851. @option{chroma_power} and @option{alpha_power} default to the
  2852. corresponding value set for @option{luma_power}.
  2853. A value of 0 will disable the effect.
  2854. @end table
  2855. @subsection Examples
  2856. @itemize
  2857. @item
  2858. Apply a boxblur filter with the luma, chroma, and alpha radii
  2859. set to 2:
  2860. @example
  2861. boxblur=luma_radius=2:luma_power=1
  2862. boxblur=2:1
  2863. @end example
  2864. @item
  2865. Set the luma radius to 2, and alpha and chroma radius to 0:
  2866. @example
  2867. boxblur=2:1:cr=0:ar=0
  2868. @end example
  2869. @item
  2870. Set the luma and chroma radii to a fraction of the video dimension:
  2871. @example
  2872. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2873. @end example
  2874. @end itemize
  2875. @section chromakey
  2876. YUV colorspace color/chroma keying.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item color
  2880. The color which will be replaced with transparency.
  2881. @item similarity
  2882. Similarity percentage with the key color.
  2883. 0.01 matches only the exact key color, while 1.0 matches everything.
  2884. @item blend
  2885. Blend percentage.
  2886. 0.0 makes pixels either fully transparent, or not transparent at all.
  2887. Higher values result in semi-transparent pixels, with a higher transparency
  2888. the more similar the pixels color is to the key color.
  2889. @item yuv
  2890. Signals that the color passed is already in YUV instead of RGB.
  2891. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  2892. This can be used to pass exact YUV values as hexadecimal numbers.
  2893. @end table
  2894. @subsection Examples
  2895. @itemize
  2896. @item
  2897. Make every green pixel in the input image transparent:
  2898. @example
  2899. ffmpeg -i input.png -vf chromakey=green out.png
  2900. @end example
  2901. @item
  2902. Overlay a greenscreen-video on top of a static black background.
  2903. @example
  2904. 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
  2905. @end example
  2906. @end itemize
  2907. @section codecview
  2908. Visualize information exported by some codecs.
  2909. Some codecs can export information through frames using side-data or other
  2910. means. For example, some MPEG based codecs export motion vectors through the
  2911. @var{export_mvs} flag in the codec @option{flags2} option.
  2912. The filter accepts the following option:
  2913. @table @option
  2914. @item mv
  2915. Set motion vectors to visualize.
  2916. Available flags for @var{mv} are:
  2917. @table @samp
  2918. @item pf
  2919. forward predicted MVs of P-frames
  2920. @item bf
  2921. forward predicted MVs of B-frames
  2922. @item bb
  2923. backward predicted MVs of B-frames
  2924. @end table
  2925. @end table
  2926. @subsection Examples
  2927. @itemize
  2928. @item
  2929. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  2930. @example
  2931. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  2932. @end example
  2933. @end itemize
  2934. @section colorbalance
  2935. Modify intensity of primary colors (red, green and blue) of input frames.
  2936. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2937. regions for the red-cyan, green-magenta or blue-yellow balance.
  2938. A positive adjustment value shifts the balance towards the primary color, a negative
  2939. value towards the complementary color.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item rs
  2943. @item gs
  2944. @item bs
  2945. Adjust red, green and blue shadows (darkest pixels).
  2946. @item rm
  2947. @item gm
  2948. @item bm
  2949. Adjust red, green and blue midtones (medium pixels).
  2950. @item rh
  2951. @item gh
  2952. @item bh
  2953. Adjust red, green and blue highlights (brightest pixels).
  2954. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2955. @end table
  2956. @subsection Examples
  2957. @itemize
  2958. @item
  2959. Add red color cast to shadows:
  2960. @example
  2961. colorbalance=rs=.3
  2962. @end example
  2963. @end itemize
  2964. @section colorkey
  2965. RGB colorspace color keying.
  2966. The filter accepts the following options:
  2967. @table @option
  2968. @item color
  2969. The color which will be replaced with transparency.
  2970. @item similarity
  2971. Similarity percentage with the key color.
  2972. 0.01 matches only the exact key color, while 1.0 matches everything.
  2973. @item blend
  2974. Blend percentage.
  2975. 0.0 makes pixels either fully transparent, or not transparent at all.
  2976. Higher values result in semi-transparent pixels, with a higher transparency
  2977. the more similar the pixels color is to the key color.
  2978. @end table
  2979. @subsection Examples
  2980. @itemize
  2981. @item
  2982. Make every green pixel in the input image transparent:
  2983. @example
  2984. ffmpeg -i input.png -vf colorkey=green out.png
  2985. @end example
  2986. @item
  2987. Overlay a greenscreen-video on top of a static background image.
  2988. @example
  2989. 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
  2990. @end example
  2991. @end itemize
  2992. @section colorlevels
  2993. Adjust video input frames using levels.
  2994. The filter accepts the following options:
  2995. @table @option
  2996. @item rimin
  2997. @item gimin
  2998. @item bimin
  2999. @item aimin
  3000. Adjust red, green, blue and alpha input black point.
  3001. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3002. @item rimax
  3003. @item gimax
  3004. @item bimax
  3005. @item aimax
  3006. Adjust red, green, blue and alpha input white point.
  3007. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3008. Input levels are used to lighten highlights (bright tones), darken shadows
  3009. (dark tones), change the balance of bright and dark tones.
  3010. @item romin
  3011. @item gomin
  3012. @item bomin
  3013. @item aomin
  3014. Adjust red, green, blue and alpha output black point.
  3015. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3016. @item romax
  3017. @item gomax
  3018. @item bomax
  3019. @item aomax
  3020. Adjust red, green, blue and alpha output white point.
  3021. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3022. Output levels allows manual selection of a constrained output level range.
  3023. @end table
  3024. @subsection Examples
  3025. @itemize
  3026. @item
  3027. Make video output darker:
  3028. @example
  3029. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3030. @end example
  3031. @item
  3032. Increase contrast:
  3033. @example
  3034. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3035. @end example
  3036. @item
  3037. Make video output lighter:
  3038. @example
  3039. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3040. @end example
  3041. @item
  3042. Increase brightness:
  3043. @example
  3044. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3045. @end example
  3046. @end itemize
  3047. @section colorchannelmixer
  3048. Adjust video input frames by re-mixing color channels.
  3049. This filter modifies a color channel by adding the values associated to
  3050. the other channels of the same pixels. For example if the value to
  3051. modify is red, the output value will be:
  3052. @example
  3053. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3054. @end example
  3055. The filter accepts the following options:
  3056. @table @option
  3057. @item rr
  3058. @item rg
  3059. @item rb
  3060. @item ra
  3061. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3062. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3063. @item gr
  3064. @item gg
  3065. @item gb
  3066. @item ga
  3067. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3068. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3069. @item br
  3070. @item bg
  3071. @item bb
  3072. @item ba
  3073. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3074. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3075. @item ar
  3076. @item ag
  3077. @item ab
  3078. @item aa
  3079. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3080. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3081. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3082. @end table
  3083. @subsection Examples
  3084. @itemize
  3085. @item
  3086. Convert source to grayscale:
  3087. @example
  3088. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3089. @end example
  3090. @item
  3091. Simulate sepia tones:
  3092. @example
  3093. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3094. @end example
  3095. @end itemize
  3096. @section colormatrix
  3097. Convert color matrix.
  3098. The filter accepts the following options:
  3099. @table @option
  3100. @item src
  3101. @item dst
  3102. Specify the source and destination color matrix. Both values must be
  3103. specified.
  3104. The accepted values are:
  3105. @table @samp
  3106. @item bt709
  3107. BT.709
  3108. @item bt601
  3109. BT.601
  3110. @item smpte240m
  3111. SMPTE-240M
  3112. @item fcc
  3113. FCC
  3114. @end table
  3115. @end table
  3116. For example to convert from BT.601 to SMPTE-240M, use the command:
  3117. @example
  3118. colormatrix=bt601:smpte240m
  3119. @end example
  3120. @section copy
  3121. Copy the input source unchanged to the output. This is mainly useful for
  3122. testing purposes.
  3123. @section crop
  3124. Crop the input video to given dimensions.
  3125. It accepts the following parameters:
  3126. @table @option
  3127. @item w, out_w
  3128. The width of the output video. It defaults to @code{iw}.
  3129. This expression is evaluated only once during the filter
  3130. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3131. @item h, out_h
  3132. The height of the output video. It defaults to @code{ih}.
  3133. This expression is evaluated only once during the filter
  3134. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3135. @item x
  3136. The horizontal position, in the input video, of the left edge of the output
  3137. video. It defaults to @code{(in_w-out_w)/2}.
  3138. This expression is evaluated per-frame.
  3139. @item y
  3140. The vertical position, in the input video, of the top edge of the output video.
  3141. It defaults to @code{(in_h-out_h)/2}.
  3142. This expression is evaluated per-frame.
  3143. @item keep_aspect
  3144. If set to 1 will force the output display aspect ratio
  3145. to be the same of the input, by changing the output sample aspect
  3146. ratio. It defaults to 0.
  3147. @end table
  3148. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3149. expressions containing the following constants:
  3150. @table @option
  3151. @item x
  3152. @item y
  3153. The computed values for @var{x} and @var{y}. They are evaluated for
  3154. each new frame.
  3155. @item in_w
  3156. @item in_h
  3157. The input width and height.
  3158. @item iw
  3159. @item ih
  3160. These are the same as @var{in_w} and @var{in_h}.
  3161. @item out_w
  3162. @item out_h
  3163. The output (cropped) width and height.
  3164. @item ow
  3165. @item oh
  3166. These are the same as @var{out_w} and @var{out_h}.
  3167. @item a
  3168. same as @var{iw} / @var{ih}
  3169. @item sar
  3170. input sample aspect ratio
  3171. @item dar
  3172. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3173. @item hsub
  3174. @item vsub
  3175. horizontal and vertical chroma subsample values. For example for the
  3176. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3177. @item n
  3178. The number of the input frame, starting from 0.
  3179. @item pos
  3180. the position in the file of the input frame, NAN if unknown
  3181. @item t
  3182. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3183. @end table
  3184. The expression for @var{out_w} may depend on the value of @var{out_h},
  3185. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3186. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3187. evaluated after @var{out_w} and @var{out_h}.
  3188. The @var{x} and @var{y} parameters specify the expressions for the
  3189. position of the top-left corner of the output (non-cropped) area. They
  3190. are evaluated for each frame. If the evaluated value is not valid, it
  3191. is approximated to the nearest valid value.
  3192. The expression for @var{x} may depend on @var{y}, and the expression
  3193. for @var{y} may depend on @var{x}.
  3194. @subsection Examples
  3195. @itemize
  3196. @item
  3197. Crop area with size 100x100 at position (12,34).
  3198. @example
  3199. crop=100:100:12:34
  3200. @end example
  3201. Using named options, the example above becomes:
  3202. @example
  3203. crop=w=100:h=100:x=12:y=34
  3204. @end example
  3205. @item
  3206. Crop the central input area with size 100x100:
  3207. @example
  3208. crop=100:100
  3209. @end example
  3210. @item
  3211. Crop the central input area with size 2/3 of the input video:
  3212. @example
  3213. crop=2/3*in_w:2/3*in_h
  3214. @end example
  3215. @item
  3216. Crop the input video central square:
  3217. @example
  3218. crop=out_w=in_h
  3219. crop=in_h
  3220. @end example
  3221. @item
  3222. Delimit the rectangle with the top-left corner placed at position
  3223. 100:100 and the right-bottom corner corresponding to the right-bottom
  3224. corner of the input image.
  3225. @example
  3226. crop=in_w-100:in_h-100:100:100
  3227. @end example
  3228. @item
  3229. Crop 10 pixels from the left and right borders, and 20 pixels from
  3230. the top and bottom borders
  3231. @example
  3232. crop=in_w-2*10:in_h-2*20
  3233. @end example
  3234. @item
  3235. Keep only the bottom right quarter of the input image:
  3236. @example
  3237. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3238. @end example
  3239. @item
  3240. Crop height for getting Greek harmony:
  3241. @example
  3242. crop=in_w:1/PHI*in_w
  3243. @end example
  3244. @item
  3245. Apply trembling effect:
  3246. @example
  3247. 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)
  3248. @end example
  3249. @item
  3250. Apply erratic camera effect depending on timestamp:
  3251. @example
  3252. 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)"
  3253. @end example
  3254. @item
  3255. Set x depending on the value of y:
  3256. @example
  3257. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3258. @end example
  3259. @end itemize
  3260. @subsection Commands
  3261. This filter supports the following commands:
  3262. @table @option
  3263. @item w, out_w
  3264. @item h, out_h
  3265. @item x
  3266. @item y
  3267. Set width/height of the output video and the horizontal/vertical position
  3268. in the input video.
  3269. The command accepts the same syntax of the corresponding option.
  3270. If the specified expression is not valid, it is kept at its current
  3271. value.
  3272. @end table
  3273. @section cropdetect
  3274. Auto-detect the crop size.
  3275. It calculates the necessary cropping parameters and prints the
  3276. recommended parameters via the logging system. The detected dimensions
  3277. correspond to the non-black area of the input video.
  3278. It accepts the following parameters:
  3279. @table @option
  3280. @item limit
  3281. Set higher black value threshold, which can be optionally specified
  3282. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3283. value greater to the set value is considered non-black. It defaults to 24.
  3284. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3285. on the bitdepth of the pixel format.
  3286. @item round
  3287. The value which the width/height should be divisible by. It defaults to
  3288. 16. The offset is automatically adjusted to center the video. Use 2 to
  3289. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3290. encoding to most video codecs.
  3291. @item reset_count, reset
  3292. Set the counter that determines after how many frames cropdetect will
  3293. reset the previously detected largest video area and start over to
  3294. detect the current optimal crop area. Default value is 0.
  3295. This can be useful when channel logos distort the video area. 0
  3296. indicates 'never reset', and returns the largest area encountered during
  3297. playback.
  3298. @end table
  3299. @anchor{curves}
  3300. @section curves
  3301. Apply color adjustments using curves.
  3302. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3303. component (red, green and blue) has its values defined by @var{N} key points
  3304. tied from each other using a smooth curve. The x-axis represents the pixel
  3305. values from the input frame, and the y-axis the new pixel values to be set for
  3306. the output frame.
  3307. By default, a component curve is defined by the two points @var{(0;0)} and
  3308. @var{(1;1)}. This creates a straight line where each original pixel value is
  3309. "adjusted" to its own value, which means no change to the image.
  3310. The filter allows you to redefine these two points and add some more. A new
  3311. curve (using a natural cubic spline interpolation) will be define to pass
  3312. smoothly through all these new coordinates. The new defined points needs to be
  3313. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3314. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3315. the vector spaces, the values will be clipped accordingly.
  3316. If there is no key point defined in @code{x=0}, the filter will automatically
  3317. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3318. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3319. The filter accepts the following options:
  3320. @table @option
  3321. @item preset
  3322. Select one of the available color presets. This option can be used in addition
  3323. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3324. options takes priority on the preset values.
  3325. Available presets are:
  3326. @table @samp
  3327. @item none
  3328. @item color_negative
  3329. @item cross_process
  3330. @item darker
  3331. @item increase_contrast
  3332. @item lighter
  3333. @item linear_contrast
  3334. @item medium_contrast
  3335. @item negative
  3336. @item strong_contrast
  3337. @item vintage
  3338. @end table
  3339. Default is @code{none}.
  3340. @item master, m
  3341. Set the master key points. These points will define a second pass mapping. It
  3342. is sometimes called a "luminance" or "value" mapping. It can be used with
  3343. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3344. post-processing LUT.
  3345. @item red, r
  3346. Set the key points for the red component.
  3347. @item green, g
  3348. Set the key points for the green component.
  3349. @item blue, b
  3350. Set the key points for the blue component.
  3351. @item all
  3352. Set the key points for all components (not including master).
  3353. Can be used in addition to the other key points component
  3354. options. In this case, the unset component(s) will fallback on this
  3355. @option{all} setting.
  3356. @item psfile
  3357. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3358. @end table
  3359. To avoid some filtergraph syntax conflicts, each key points list need to be
  3360. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3361. @subsection Examples
  3362. @itemize
  3363. @item
  3364. Increase slightly the middle level of blue:
  3365. @example
  3366. curves=blue='0.5/0.58'
  3367. @end example
  3368. @item
  3369. Vintage effect:
  3370. @example
  3371. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3372. @end example
  3373. Here we obtain the following coordinates for each components:
  3374. @table @var
  3375. @item red
  3376. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3377. @item green
  3378. @code{(0;0) (0.50;0.48) (1;1)}
  3379. @item blue
  3380. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3381. @end table
  3382. @item
  3383. The previous example can also be achieved with the associated built-in preset:
  3384. @example
  3385. curves=preset=vintage
  3386. @end example
  3387. @item
  3388. Or simply:
  3389. @example
  3390. curves=vintage
  3391. @end example
  3392. @item
  3393. Use a Photoshop preset and redefine the points of the green component:
  3394. @example
  3395. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3396. @end example
  3397. @end itemize
  3398. @section dctdnoiz
  3399. Denoise frames using 2D DCT (frequency domain filtering).
  3400. This filter is not designed for real time.
  3401. The filter accepts the following options:
  3402. @table @option
  3403. @item sigma, s
  3404. Set the noise sigma constant.
  3405. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3406. coefficient (absolute value) below this threshold with be dropped.
  3407. If you need a more advanced filtering, see @option{expr}.
  3408. Default is @code{0}.
  3409. @item overlap
  3410. Set number overlapping pixels for each block. Since the filter can be slow, you
  3411. may want to reduce this value, at the cost of a less effective filter and the
  3412. risk of various artefacts.
  3413. If the overlapping value doesn't permit processing the whole input width or
  3414. height, a warning will be displayed and according borders won't be denoised.
  3415. Default value is @var{blocksize}-1, which is the best possible setting.
  3416. @item expr, e
  3417. Set the coefficient factor expression.
  3418. For each coefficient of a DCT block, this expression will be evaluated as a
  3419. multiplier value for the coefficient.
  3420. If this is option is set, the @option{sigma} option will be ignored.
  3421. The absolute value of the coefficient can be accessed through the @var{c}
  3422. variable.
  3423. @item n
  3424. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3425. @var{blocksize}, which is the width and height of the processed blocks.
  3426. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3427. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3428. on the speed processing. Also, a larger block size does not necessarily means a
  3429. better de-noising.
  3430. @end table
  3431. @subsection Examples
  3432. Apply a denoise with a @option{sigma} of @code{4.5}:
  3433. @example
  3434. dctdnoiz=4.5
  3435. @end example
  3436. The same operation can be achieved using the expression system:
  3437. @example
  3438. dctdnoiz=e='gte(c, 4.5*3)'
  3439. @end example
  3440. Violent denoise using a block size of @code{16x16}:
  3441. @example
  3442. dctdnoiz=15:n=4
  3443. @end example
  3444. @section deband
  3445. Remove banding artifacts from input video.
  3446. It works by replacing banded pixels with average value of referenced pixels.
  3447. The filter accepts the following options:
  3448. @table @option
  3449. @item 1thr
  3450. @item 2thr
  3451. @item 3thr
  3452. @item 4thr
  3453. Set banding detection threshold for each plane. Default is 0.02.
  3454. Valid range is 0.00003 to 0.5.
  3455. If difference between current pixel and reference pixel is less than threshold,
  3456. it will be considered as banded.
  3457. @item range, r
  3458. Banding detection range in pixels. Default is 16. If positive, random number
  3459. in range 0 to set value will be used. If negative, exact absolute value
  3460. will be used.
  3461. The range defines square of four pixels around current pixel.
  3462. @item direction, d
  3463. Set direction in radians from which four pixel will be compared. If positive,
  3464. random direction from 0 to set direction will be picked. If negative, exact of
  3465. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  3466. will pick only pixels on same row and -PI/2 will pick only pixels on same
  3467. column.
  3468. @item blur
  3469. If enabled, current pixel is compared with average value of all four
  3470. surrounding pixels. The default is enabled. If disabled current pixel is
  3471. compared with all four surrounding pixels. The pixel is considered banded
  3472. if only all four differences with surrounding pixels are less than threshold.
  3473. @end table
  3474. @anchor{decimate}
  3475. @section decimate
  3476. Drop duplicated frames at regular intervals.
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item cycle
  3480. Set the number of frames from which one will be dropped. Setting this to
  3481. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  3482. Default is @code{5}.
  3483. @item dupthresh
  3484. Set the threshold for duplicate detection. If the difference metric for a frame
  3485. is less than or equal to this value, then it is declared as duplicate. Default
  3486. is @code{1.1}
  3487. @item scthresh
  3488. Set scene change threshold. Default is @code{15}.
  3489. @item blockx
  3490. @item blocky
  3491. Set the size of the x and y-axis blocks used during metric calculations.
  3492. Larger blocks give better noise suppression, but also give worse detection of
  3493. small movements. Must be a power of two. Default is @code{32}.
  3494. @item ppsrc
  3495. Mark main input as a pre-processed input and activate clean source input
  3496. stream. This allows the input to be pre-processed with various filters to help
  3497. the metrics calculation while keeping the frame selection lossless. When set to
  3498. @code{1}, the first stream is for the pre-processed input, and the second
  3499. stream is the clean source from where the kept frames are chosen. Default is
  3500. @code{0}.
  3501. @item chroma
  3502. Set whether or not chroma is considered in the metric calculations. Default is
  3503. @code{1}.
  3504. @end table
  3505. @section deflate
  3506. Apply deflate effect to the video.
  3507. This filter replaces the pixel by the local(3x3) average by taking into account
  3508. only values lower than the pixel.
  3509. It accepts the following options:
  3510. @table @option
  3511. @item threshold0
  3512. @item threshold1
  3513. @item threshold2
  3514. @item threshold3
  3515. Allows to limit the maximum change for each plane, default is 65535.
  3516. If 0, plane will remain unchanged.
  3517. @end table
  3518. @section dejudder
  3519. Remove judder produced by partially interlaced telecined content.
  3520. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  3521. source was partially telecined content then the output of @code{pullup,dejudder}
  3522. will have a variable frame rate. May change the recorded frame rate of the
  3523. container. Aside from that change, this filter will not affect constant frame
  3524. rate video.
  3525. The option available in this filter is:
  3526. @table @option
  3527. @item cycle
  3528. Specify the length of the window over which the judder repeats.
  3529. Accepts any integer greater than 1. Useful values are:
  3530. @table @samp
  3531. @item 4
  3532. If the original was telecined from 24 to 30 fps (Film to NTSC).
  3533. @item 5
  3534. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  3535. @item 20
  3536. If a mixture of the two.
  3537. @end table
  3538. The default is @samp{4}.
  3539. @end table
  3540. @section delogo
  3541. Suppress a TV station logo by a simple interpolation of the surrounding
  3542. pixels. Just set a rectangle covering the logo and watch it disappear
  3543. (and sometimes something even uglier appear - your mileage may vary).
  3544. It accepts the following parameters:
  3545. @table @option
  3546. @item x
  3547. @item y
  3548. Specify the top left corner coordinates of the logo. They must be
  3549. specified.
  3550. @item w
  3551. @item h
  3552. Specify the width and height of the logo to clear. They must be
  3553. specified.
  3554. @item band, t
  3555. Specify the thickness of the fuzzy edge of the rectangle (added to
  3556. @var{w} and @var{h}). The default value is 4.
  3557. @item show
  3558. When set to 1, a green rectangle is drawn on the screen to simplify
  3559. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  3560. The default value is 0.
  3561. The rectangle is drawn on the outermost pixels which will be (partly)
  3562. replaced with interpolated values. The values of the next pixels
  3563. immediately outside this rectangle in each direction will be used to
  3564. compute the interpolated pixel values inside the rectangle.
  3565. @end table
  3566. @subsection Examples
  3567. @itemize
  3568. @item
  3569. Set a rectangle covering the area with top left corner coordinates 0,0
  3570. and size 100x77, and a band of size 10:
  3571. @example
  3572. delogo=x=0:y=0:w=100:h=77:band=10
  3573. @end example
  3574. @end itemize
  3575. @section deshake
  3576. Attempt to fix small changes in horizontal and/or vertical shift. This
  3577. filter helps remove camera shake from hand-holding a camera, bumping a
  3578. tripod, moving on a vehicle, etc.
  3579. The filter accepts the following options:
  3580. @table @option
  3581. @item x
  3582. @item y
  3583. @item w
  3584. @item h
  3585. Specify a rectangular area where to limit the search for motion
  3586. vectors.
  3587. If desired the search for motion vectors can be limited to a
  3588. rectangular area of the frame defined by its top left corner, width
  3589. and height. These parameters have the same meaning as the drawbox
  3590. filter which can be used to visualise the position of the bounding
  3591. box.
  3592. This is useful when simultaneous movement of subjects within the frame
  3593. might be confused for camera motion by the motion vector search.
  3594. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  3595. then the full frame is used. This allows later options to be set
  3596. without specifying the bounding box for the motion vector search.
  3597. Default - search the whole frame.
  3598. @item rx
  3599. @item ry
  3600. Specify the maximum extent of movement in x and y directions in the
  3601. range 0-64 pixels. Default 16.
  3602. @item edge
  3603. Specify how to generate pixels to fill blanks at the edge of the
  3604. frame. Available values are:
  3605. @table @samp
  3606. @item blank, 0
  3607. Fill zeroes at blank locations
  3608. @item original, 1
  3609. Original image at blank locations
  3610. @item clamp, 2
  3611. Extruded edge value at blank locations
  3612. @item mirror, 3
  3613. Mirrored edge at blank locations
  3614. @end table
  3615. Default value is @samp{mirror}.
  3616. @item blocksize
  3617. Specify the blocksize to use for motion search. Range 4-128 pixels,
  3618. default 8.
  3619. @item contrast
  3620. Specify the contrast threshold for blocks. Only blocks with more than
  3621. the specified contrast (difference between darkest and lightest
  3622. pixels) will be considered. Range 1-255, default 125.
  3623. @item search
  3624. Specify the search strategy. Available values are:
  3625. @table @samp
  3626. @item exhaustive, 0
  3627. Set exhaustive search
  3628. @item less, 1
  3629. Set less exhaustive search.
  3630. @end table
  3631. Default value is @samp{exhaustive}.
  3632. @item filename
  3633. If set then a detailed log of the motion search is written to the
  3634. specified file.
  3635. @item opencl
  3636. If set to 1, specify using OpenCL capabilities, only available if
  3637. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  3638. @end table
  3639. @section detelecine
  3640. Apply an exact inverse of the telecine operation. It requires a predefined
  3641. pattern specified using the pattern option which must be the same as that passed
  3642. to the telecine filter.
  3643. This filter accepts the following options:
  3644. @table @option
  3645. @item first_field
  3646. @table @samp
  3647. @item top, t
  3648. top field first
  3649. @item bottom, b
  3650. bottom field first
  3651. The default value is @code{top}.
  3652. @end table
  3653. @item pattern
  3654. A string of numbers representing the pulldown pattern you wish to apply.
  3655. The default value is @code{23}.
  3656. @item start_frame
  3657. A number representing position of the first frame with respect to the telecine
  3658. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  3659. @end table
  3660. @section dilation
  3661. Apply dilation effect to the video.
  3662. This filter replaces the pixel by the local(3x3) maximum.
  3663. It accepts the following options:
  3664. @table @option
  3665. @item threshold0
  3666. @item threshold1
  3667. @item threshold2
  3668. @item threshold3
  3669. Allows to limit the maximum change for each plane, default is 65535.
  3670. If 0, plane will remain unchanged.
  3671. @item coordinates
  3672. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  3673. pixels are used.
  3674. Flags to local 3x3 coordinates maps like this:
  3675. 1 2 3
  3676. 4 5
  3677. 6 7 8
  3678. @end table
  3679. @section drawbox
  3680. Draw a colored box on the input image.
  3681. It accepts the following parameters:
  3682. @table @option
  3683. @item x
  3684. @item y
  3685. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  3686. @item width, w
  3687. @item height, h
  3688. The expressions which specify the width and height of the box; if 0 they are interpreted as
  3689. the input width and height. It defaults to 0.
  3690. @item color, c
  3691. Specify the color of the box to write. For the general syntax of this option,
  3692. check the "Color" section in the ffmpeg-utils manual. If the special
  3693. value @code{invert} is used, the box edge color is the same as the
  3694. video with inverted luma.
  3695. @item thickness, t
  3696. The expression which sets the thickness of the box edge. Default value is @code{3}.
  3697. See below for the list of accepted constants.
  3698. @end table
  3699. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3700. following constants:
  3701. @table @option
  3702. @item dar
  3703. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3704. @item hsub
  3705. @item vsub
  3706. horizontal and vertical chroma subsample values. For example for the
  3707. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3708. @item in_h, ih
  3709. @item in_w, iw
  3710. The input width and height.
  3711. @item sar
  3712. The input sample aspect ratio.
  3713. @item x
  3714. @item y
  3715. The x and y offset coordinates where the box is drawn.
  3716. @item w
  3717. @item h
  3718. The width and height of the drawn box.
  3719. @item t
  3720. The thickness of the drawn box.
  3721. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3722. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3723. @end table
  3724. @subsection Examples
  3725. @itemize
  3726. @item
  3727. Draw a black box around the edge of the input image:
  3728. @example
  3729. drawbox
  3730. @end example
  3731. @item
  3732. Draw a box with color red and an opacity of 50%:
  3733. @example
  3734. drawbox=10:20:200:60:red@@0.5
  3735. @end example
  3736. The previous example can be specified as:
  3737. @example
  3738. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  3739. @end example
  3740. @item
  3741. Fill the box with pink color:
  3742. @example
  3743. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  3744. @end example
  3745. @item
  3746. Draw a 2-pixel red 2.40:1 mask:
  3747. @example
  3748. 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
  3749. @end example
  3750. @end itemize
  3751. @section drawgraph, adrawgraph
  3752. Draw a graph using input video or audio metadata.
  3753. It accepts the following parameters:
  3754. @table @option
  3755. @item m1
  3756. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  3757. @item fg1
  3758. Set 1st foreground color expression.
  3759. @item m2
  3760. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  3761. @item fg2
  3762. Set 2nd foreground color expression.
  3763. @item m3
  3764. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  3765. @item fg3
  3766. Set 3rd foreground color expression.
  3767. @item m4
  3768. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  3769. @item fg4
  3770. Set 4th foreground color expression.
  3771. @item min
  3772. Set minimal value of metadata value.
  3773. @item max
  3774. Set maximal value of metadata value.
  3775. @item bg
  3776. Set graph background color. Default is white.
  3777. @item mode
  3778. Set graph mode.
  3779. Available values for mode is:
  3780. @table @samp
  3781. @item bar
  3782. @item dot
  3783. @item line
  3784. @end table
  3785. Default is @code{line}.
  3786. @item slide
  3787. Set slide mode.
  3788. Available values for slide is:
  3789. @table @samp
  3790. @item frame
  3791. Draw new frame when right border is reached.
  3792. @item replace
  3793. Replace old columns with new ones.
  3794. @item scroll
  3795. Scroll from right to left.
  3796. @item rscroll
  3797. Scroll from left to right.
  3798. @end table
  3799. Default is @code{frame}.
  3800. @item size
  3801. Set size of graph video. For the syntax of this option, check the
  3802. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  3803. The default value is @code{900x256}.
  3804. The foreground color expressions can use the following variables:
  3805. @table @option
  3806. @item MIN
  3807. Minimal value of metadata value.
  3808. @item MAX
  3809. Maximal value of metadata value.
  3810. @item VAL
  3811. Current metadata key value.
  3812. @end table
  3813. The color is defined as 0xAABBGGRR.
  3814. @end table
  3815. Example using metadata from @ref{signalstats} filter:
  3816. @example
  3817. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  3818. @end example
  3819. Example using metadata from @ref{ebur128} filter:
  3820. @example
  3821. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  3822. @end example
  3823. @section drawgrid
  3824. Draw a grid on the input image.
  3825. It accepts the following parameters:
  3826. @table @option
  3827. @item x
  3828. @item y
  3829. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  3830. @item width, w
  3831. @item height, h
  3832. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  3833. input width and height, respectively, minus @code{thickness}, so image gets
  3834. framed. Default to 0.
  3835. @item color, c
  3836. Specify the color of the grid. For the general syntax of this option,
  3837. check the "Color" section in the ffmpeg-utils manual. If the special
  3838. value @code{invert} is used, the grid color is the same as the
  3839. video with inverted luma.
  3840. @item thickness, t
  3841. The expression which sets the thickness of the grid line. Default value is @code{1}.
  3842. See below for the list of accepted constants.
  3843. @end table
  3844. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  3845. following constants:
  3846. @table @option
  3847. @item dar
  3848. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  3849. @item hsub
  3850. @item vsub
  3851. horizontal and vertical chroma subsample values. For example for the
  3852. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3853. @item in_h, ih
  3854. @item in_w, iw
  3855. The input grid cell width and height.
  3856. @item sar
  3857. The input sample aspect ratio.
  3858. @item x
  3859. @item y
  3860. The x and y coordinates of some point of grid intersection (meant to configure offset).
  3861. @item w
  3862. @item h
  3863. The width and height of the drawn cell.
  3864. @item t
  3865. The thickness of the drawn cell.
  3866. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  3867. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  3868. @end table
  3869. @subsection Examples
  3870. @itemize
  3871. @item
  3872. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  3873. @example
  3874. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  3875. @end example
  3876. @item
  3877. Draw a white 3x3 grid with an opacity of 50%:
  3878. @example
  3879. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  3880. @end example
  3881. @end itemize
  3882. @anchor{drawtext}
  3883. @section drawtext
  3884. Draw a text string or text from a specified file on top of a video, using the
  3885. libfreetype library.
  3886. To enable compilation of this filter, you need to configure FFmpeg with
  3887. @code{--enable-libfreetype}.
  3888. To enable default font fallback and the @var{font} option you need to
  3889. configure FFmpeg with @code{--enable-libfontconfig}.
  3890. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  3891. @code{--enable-libfribidi}.
  3892. @subsection Syntax
  3893. It accepts the following parameters:
  3894. @table @option
  3895. @item box
  3896. Used to draw a box around text using the background color.
  3897. The value must be either 1 (enable) or 0 (disable).
  3898. The default value of @var{box} is 0.
  3899. @item boxborderw
  3900. Set the width of the border to be drawn around the box using @var{boxcolor}.
  3901. The default value of @var{boxborderw} is 0.
  3902. @item boxcolor
  3903. The color to be used for drawing box around text. For the syntax of this
  3904. option, check the "Color" section in the ffmpeg-utils manual.
  3905. The default value of @var{boxcolor} is "white".
  3906. @item borderw
  3907. Set the width of the border to be drawn around the text using @var{bordercolor}.
  3908. The default value of @var{borderw} is 0.
  3909. @item bordercolor
  3910. Set the color to be used for drawing border around text. For the syntax of this
  3911. option, check the "Color" section in the ffmpeg-utils manual.
  3912. The default value of @var{bordercolor} is "black".
  3913. @item expansion
  3914. Select how the @var{text} is expanded. Can be either @code{none},
  3915. @code{strftime} (deprecated) or
  3916. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  3917. below for details.
  3918. @item fix_bounds
  3919. If true, check and fix text coords to avoid clipping.
  3920. @item fontcolor
  3921. The color to be used for drawing fonts. For the syntax of this option, check
  3922. the "Color" section in the ffmpeg-utils manual.
  3923. The default value of @var{fontcolor} is "black".
  3924. @item fontcolor_expr
  3925. String which is expanded the same way as @var{text} to obtain dynamic
  3926. @var{fontcolor} value. By default this option has empty value and is not
  3927. processed. When this option is set, it overrides @var{fontcolor} option.
  3928. @item font
  3929. The font family to be used for drawing text. By default Sans.
  3930. @item fontfile
  3931. The font file to be used for drawing text. The path must be included.
  3932. This parameter is mandatory if the fontconfig support is disabled.
  3933. @item draw
  3934. This option does not exist, please see the timeline system
  3935. @item alpha
  3936. Draw the text applying alpha blending. The value can
  3937. be either a number between 0.0 and 1.0
  3938. The expression accepts the same variables @var{x, y} do.
  3939. The default value is 1.
  3940. Please see fontcolor_expr
  3941. @item fontsize
  3942. The font size to be used for drawing text.
  3943. The default value of @var{fontsize} is 16.
  3944. @item text_shaping
  3945. If set to 1, attempt to shape the text (for example, reverse the order of
  3946. right-to-left text and join Arabic characters) before drawing it.
  3947. Otherwise, just draw the text exactly as given.
  3948. By default 1 (if supported).
  3949. @item ft_load_flags
  3950. The flags to be used for loading the fonts.
  3951. The flags map the corresponding flags supported by libfreetype, and are
  3952. a combination of the following values:
  3953. @table @var
  3954. @item default
  3955. @item no_scale
  3956. @item no_hinting
  3957. @item render
  3958. @item no_bitmap
  3959. @item vertical_layout
  3960. @item force_autohint
  3961. @item crop_bitmap
  3962. @item pedantic
  3963. @item ignore_global_advance_width
  3964. @item no_recurse
  3965. @item ignore_transform
  3966. @item monochrome
  3967. @item linear_design
  3968. @item no_autohint
  3969. @end table
  3970. Default value is "default".
  3971. For more information consult the documentation for the FT_LOAD_*
  3972. libfreetype flags.
  3973. @item shadowcolor
  3974. The color to be used for drawing a shadow behind the drawn text. For the
  3975. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  3976. The default value of @var{shadowcolor} is "black".
  3977. @item shadowx
  3978. @item shadowy
  3979. The x and y offsets for the text shadow position with respect to the
  3980. position of the text. They can be either positive or negative
  3981. values. The default value for both is "0".
  3982. @item start_number
  3983. The starting frame number for the n/frame_num variable. The default value
  3984. is "0".
  3985. @item tabsize
  3986. The size in number of spaces to use for rendering the tab.
  3987. Default value is 4.
  3988. @item timecode
  3989. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  3990. format. It can be used with or without text parameter. @var{timecode_rate}
  3991. option must be specified.
  3992. @item timecode_rate, rate, r
  3993. Set the timecode frame rate (timecode only).
  3994. @item text
  3995. The text string to be drawn. The text must be a sequence of UTF-8
  3996. encoded characters.
  3997. This parameter is mandatory if no file is specified with the parameter
  3998. @var{textfile}.
  3999. @item textfile
  4000. A text file containing text to be drawn. The text must be a sequence
  4001. of UTF-8 encoded characters.
  4002. This parameter is mandatory if no text string is specified with the
  4003. parameter @var{text}.
  4004. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4005. @item reload
  4006. If set to 1, the @var{textfile} will be reloaded before each frame.
  4007. Be sure to update it atomically, or it may be read partially, or even fail.
  4008. @item x
  4009. @item y
  4010. The expressions which specify the offsets where text will be drawn
  4011. within the video frame. They are relative to the top/left border of the
  4012. output image.
  4013. The default value of @var{x} and @var{y} is "0".
  4014. See below for the list of accepted constants and functions.
  4015. @end table
  4016. The parameters for @var{x} and @var{y} are expressions containing the
  4017. following constants and functions:
  4018. @table @option
  4019. @item dar
  4020. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4021. @item hsub
  4022. @item vsub
  4023. horizontal and vertical chroma subsample values. For example for the
  4024. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4025. @item line_h, lh
  4026. the height of each text line
  4027. @item main_h, h, H
  4028. the input height
  4029. @item main_w, w, W
  4030. the input width
  4031. @item max_glyph_a, ascent
  4032. the maximum distance from the baseline to the highest/upper grid
  4033. coordinate used to place a glyph outline point, for all the rendered
  4034. glyphs.
  4035. It is a positive value, due to the grid's orientation with the Y axis
  4036. upwards.
  4037. @item max_glyph_d, descent
  4038. the maximum distance from the baseline to the lowest grid coordinate
  4039. used to place a glyph outline point, for all the rendered glyphs.
  4040. This is a negative value, due to the grid's orientation, with the Y axis
  4041. upwards.
  4042. @item max_glyph_h
  4043. maximum glyph height, that is the maximum height for all the glyphs
  4044. contained in the rendered text, it is equivalent to @var{ascent} -
  4045. @var{descent}.
  4046. @item max_glyph_w
  4047. maximum glyph width, that is the maximum width for all the glyphs
  4048. contained in the rendered text
  4049. @item n
  4050. the number of input frame, starting from 0
  4051. @item rand(min, max)
  4052. return a random number included between @var{min} and @var{max}
  4053. @item sar
  4054. The input sample aspect ratio.
  4055. @item t
  4056. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4057. @item text_h, th
  4058. the height of the rendered text
  4059. @item text_w, tw
  4060. the width of the rendered text
  4061. @item x
  4062. @item y
  4063. the x and y offset coordinates where the text is drawn.
  4064. These parameters allow the @var{x} and @var{y} expressions to refer
  4065. each other, so you can for example specify @code{y=x/dar}.
  4066. @end table
  4067. @anchor{drawtext_expansion}
  4068. @subsection Text expansion
  4069. If @option{expansion} is set to @code{strftime},
  4070. the filter recognizes strftime() sequences in the provided text and
  4071. expands them accordingly. Check the documentation of strftime(). This
  4072. feature is deprecated.
  4073. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4074. If @option{expansion} is set to @code{normal} (which is the default),
  4075. the following expansion mechanism is used.
  4076. The backslash character @samp{\}, followed by any character, always expands to
  4077. the second character.
  4078. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4079. braces is a function name, possibly followed by arguments separated by ':'.
  4080. If the arguments contain special characters or delimiters (':' or '@}'),
  4081. they should be escaped.
  4082. Note that they probably must also be escaped as the value for the
  4083. @option{text} option in the filter argument string and as the filter
  4084. argument in the filtergraph description, and possibly also for the shell,
  4085. that makes up to four levels of escaping; using a text file avoids these
  4086. problems.
  4087. The following functions are available:
  4088. @table @command
  4089. @item expr, e
  4090. The expression evaluation result.
  4091. It must take one argument specifying the expression to be evaluated,
  4092. which accepts the same constants and functions as the @var{x} and
  4093. @var{y} values. Note that not all constants should be used, for
  4094. example the text size is not known when evaluating the expression, so
  4095. the constants @var{text_w} and @var{text_h} will have an undefined
  4096. value.
  4097. @item expr_int_format, eif
  4098. Evaluate the expression's value and output as formatted integer.
  4099. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4100. The second argument specifies the output format. Allowed values are @samp{x},
  4101. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4102. @code{printf} function.
  4103. The third parameter is optional and sets the number of positions taken by the output.
  4104. It can be used to add padding with zeros from the left.
  4105. @item gmtime
  4106. The time at which the filter is running, expressed in UTC.
  4107. It can accept an argument: a strftime() format string.
  4108. @item localtime
  4109. The time at which the filter is running, expressed in the local time zone.
  4110. It can accept an argument: a strftime() format string.
  4111. @item metadata
  4112. Frame metadata. It must take one argument specifying metadata key.
  4113. @item n, frame_num
  4114. The frame number, starting from 0.
  4115. @item pict_type
  4116. A 1 character description of the current picture type.
  4117. @item pts
  4118. The timestamp of the current frame.
  4119. It can take up to two arguments.
  4120. The first argument is the format of the timestamp; it defaults to @code{flt}
  4121. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4122. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4123. The second argument is an offset added to the timestamp.
  4124. @end table
  4125. @subsection Examples
  4126. @itemize
  4127. @item
  4128. Draw "Test Text" with font FreeSerif, using the default values for the
  4129. optional parameters.
  4130. @example
  4131. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4132. @end example
  4133. @item
  4134. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4135. and y=50 (counting from the top-left corner of the screen), text is
  4136. yellow with a red box around it. Both the text and the box have an
  4137. opacity of 20%.
  4138. @example
  4139. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4140. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4141. @end example
  4142. Note that the double quotes are not necessary if spaces are not used
  4143. within the parameter list.
  4144. @item
  4145. Show the text at the center of the video frame:
  4146. @example
  4147. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  4148. @end example
  4149. @item
  4150. Show a text line sliding from right to left in the last row of the video
  4151. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4152. with no newlines.
  4153. @example
  4154. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4155. @end example
  4156. @item
  4157. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4158. @example
  4159. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4160. @end example
  4161. @item
  4162. Draw a single green letter "g", at the center of the input video.
  4163. The glyph baseline is placed at half screen height.
  4164. @example
  4165. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4166. @end example
  4167. @item
  4168. Show text for 1 second every 3 seconds:
  4169. @example
  4170. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4171. @end example
  4172. @item
  4173. Use fontconfig to set the font. Note that the colons need to be escaped.
  4174. @example
  4175. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4176. @end example
  4177. @item
  4178. Print the date of a real-time encoding (see strftime(3)):
  4179. @example
  4180. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4181. @end example
  4182. @item
  4183. Show text fading in and out (appearing/disappearing):
  4184. @example
  4185. #!/bin/sh
  4186. DS=1.0 # display start
  4187. DE=10.0 # display end
  4188. FID=1.5 # fade in duration
  4189. FOD=5 # fade out duration
  4190. 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 @}"
  4191. @end example
  4192. @end itemize
  4193. For more information about libfreetype, check:
  4194. @url{http://www.freetype.org/}.
  4195. For more information about fontconfig, check:
  4196. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4197. For more information about libfribidi, check:
  4198. @url{http://fribidi.org/}.
  4199. @section edgedetect
  4200. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4201. The filter accepts the following options:
  4202. @table @option
  4203. @item low
  4204. @item high
  4205. Set low and high threshold values used by the Canny thresholding
  4206. algorithm.
  4207. The high threshold selects the "strong" edge pixels, which are then
  4208. connected through 8-connectivity with the "weak" edge pixels selected
  4209. by the low threshold.
  4210. @var{low} and @var{high} threshold values must be chosen in the range
  4211. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4212. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4213. is @code{50/255}.
  4214. @item mode
  4215. Define the drawing mode.
  4216. @table @samp
  4217. @item wires
  4218. Draw white/gray wires on black background.
  4219. @item colormix
  4220. Mix the colors to create a paint/cartoon effect.
  4221. @end table
  4222. Default value is @var{wires}.
  4223. @end table
  4224. @subsection Examples
  4225. @itemize
  4226. @item
  4227. Standard edge detection with custom values for the hysteresis thresholding:
  4228. @example
  4229. edgedetect=low=0.1:high=0.4
  4230. @end example
  4231. @item
  4232. Painting effect without thresholding:
  4233. @example
  4234. edgedetect=mode=colormix:high=0
  4235. @end example
  4236. @end itemize
  4237. @section eq
  4238. Set brightness, contrast, saturation and approximate gamma adjustment.
  4239. The filter accepts the following options:
  4240. @table @option
  4241. @item contrast
  4242. Set the contrast expression. The value must be a float value in range
  4243. @code{-2.0} to @code{2.0}. The default value is "1".
  4244. @item brightness
  4245. Set the brightness expression. The value must be a float value in
  4246. range @code{-1.0} to @code{1.0}. The default value is "0".
  4247. @item saturation
  4248. Set the saturation expression. The value must be a float in
  4249. range @code{0.0} to @code{3.0}. The default value is "1".
  4250. @item gamma
  4251. Set the gamma expression. The value must be a float in range
  4252. @code{0.1} to @code{10.0}. The default value is "1".
  4253. @item gamma_r
  4254. Set the gamma expression for red. The value must be a float in
  4255. range @code{0.1} to @code{10.0}. The default value is "1".
  4256. @item gamma_g
  4257. Set the gamma expression for green. The value must be a float in range
  4258. @code{0.1} to @code{10.0}. The default value is "1".
  4259. @item gamma_b
  4260. Set the gamma expression for blue. The value must be a float in range
  4261. @code{0.1} to @code{10.0}. The default value is "1".
  4262. @item gamma_weight
  4263. Set the gamma weight expression. It can be used to reduce the effect
  4264. of a high gamma value on bright image areas, e.g. keep them from
  4265. getting overamplified and just plain white. The value must be a float
  4266. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4267. gamma correction all the way down while @code{1.0} leaves it at its
  4268. full strength. Default is "1".
  4269. @item eval
  4270. Set when the expressions for brightness, contrast, saturation and
  4271. gamma expressions are evaluated.
  4272. It accepts the following values:
  4273. @table @samp
  4274. @item init
  4275. only evaluate expressions once during the filter initialization or
  4276. when a command is processed
  4277. @item frame
  4278. evaluate expressions for each incoming frame
  4279. @end table
  4280. Default value is @samp{init}.
  4281. @end table
  4282. The expressions accept the following parameters:
  4283. @table @option
  4284. @item n
  4285. frame count of the input frame starting from 0
  4286. @item pos
  4287. byte position of the corresponding packet in the input file, NAN if
  4288. unspecified
  4289. @item r
  4290. frame rate of the input video, NAN if the input frame rate is unknown
  4291. @item t
  4292. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4293. @end table
  4294. @subsection Commands
  4295. The filter supports the following commands:
  4296. @table @option
  4297. @item contrast
  4298. Set the contrast expression.
  4299. @item brightness
  4300. Set the brightness expression.
  4301. @item saturation
  4302. Set the saturation expression.
  4303. @item gamma
  4304. Set the gamma expression.
  4305. @item gamma_r
  4306. Set the gamma_r expression.
  4307. @item gamma_g
  4308. Set gamma_g expression.
  4309. @item gamma_b
  4310. Set gamma_b expression.
  4311. @item gamma_weight
  4312. Set gamma_weight expression.
  4313. The command accepts the same syntax of the corresponding option.
  4314. If the specified expression is not valid, it is kept at its current
  4315. value.
  4316. @end table
  4317. @section erosion
  4318. Apply erosion effect to the video.
  4319. This filter replaces the pixel by the local(3x3) minimum.
  4320. It accepts the following options:
  4321. @table @option
  4322. @item threshold0
  4323. @item threshold1
  4324. @item threshold2
  4325. @item threshold3
  4326. Allows to limit the maximum change for each plane, default is 65535.
  4327. If 0, plane will remain unchanged.
  4328. @item coordinates
  4329. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4330. pixels are used.
  4331. Flags to local 3x3 coordinates maps like this:
  4332. 1 2 3
  4333. 4 5
  4334. 6 7 8
  4335. @end table
  4336. @section extractplanes
  4337. Extract color channel components from input video stream into
  4338. separate grayscale video streams.
  4339. The filter accepts the following option:
  4340. @table @option
  4341. @item planes
  4342. Set plane(s) to extract.
  4343. Available values for planes are:
  4344. @table @samp
  4345. @item y
  4346. @item u
  4347. @item v
  4348. @item a
  4349. @item r
  4350. @item g
  4351. @item b
  4352. @end table
  4353. Choosing planes not available in the input will result in an error.
  4354. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4355. with @code{y}, @code{u}, @code{v} planes at same time.
  4356. @end table
  4357. @subsection Examples
  4358. @itemize
  4359. @item
  4360. Extract luma, u and v color channel component from input video frame
  4361. into 3 grayscale outputs:
  4362. @example
  4363. 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
  4364. @end example
  4365. @end itemize
  4366. @section elbg
  4367. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4368. For each input image, the filter will compute the optimal mapping from
  4369. the input to the output given the codebook length, that is the number
  4370. of distinct output colors.
  4371. This filter accepts the following options.
  4372. @table @option
  4373. @item codebook_length, l
  4374. Set codebook length. The value must be a positive integer, and
  4375. represents the number of distinct output colors. Default value is 256.
  4376. @item nb_steps, n
  4377. Set the maximum number of iterations to apply for computing the optimal
  4378. mapping. The higher the value the better the result and the higher the
  4379. computation time. Default value is 1.
  4380. @item seed, s
  4381. Set a random seed, must be an integer included between 0 and
  4382. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4383. will try to use a good random seed on a best effort basis.
  4384. @item pal8
  4385. Set pal8 output pixel format. This option does not work with codebook
  4386. length greater than 256.
  4387. @end table
  4388. @section fade
  4389. Apply a fade-in/out effect to the input video.
  4390. It accepts the following parameters:
  4391. @table @option
  4392. @item type, t
  4393. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4394. effect.
  4395. Default is @code{in}.
  4396. @item start_frame, s
  4397. Specify the number of the frame to start applying the fade
  4398. effect at. Default is 0.
  4399. @item nb_frames, n
  4400. The number of frames that the fade effect lasts. At the end of the
  4401. fade-in effect, the output video will have the same intensity as the input video.
  4402. At the end of the fade-out transition, the output video will be filled with the
  4403. selected @option{color}.
  4404. Default is 25.
  4405. @item alpha
  4406. If set to 1, fade only alpha channel, if one exists on the input.
  4407. Default value is 0.
  4408. @item start_time, st
  4409. Specify the timestamp (in seconds) of the frame to start to apply the fade
  4410. effect. If both start_frame and start_time are specified, the fade will start at
  4411. whichever comes last. Default is 0.
  4412. @item duration, d
  4413. The number of seconds for which the fade effect has to last. At the end of the
  4414. fade-in effect the output video will have the same intensity as the input video,
  4415. at the end of the fade-out transition the output video will be filled with the
  4416. selected @option{color}.
  4417. If both duration and nb_frames are specified, duration is used. Default is 0
  4418. (nb_frames is used by default).
  4419. @item color, c
  4420. Specify the color of the fade. Default is "black".
  4421. @end table
  4422. @subsection Examples
  4423. @itemize
  4424. @item
  4425. Fade in the first 30 frames of video:
  4426. @example
  4427. fade=in:0:30
  4428. @end example
  4429. The command above is equivalent to:
  4430. @example
  4431. fade=t=in:s=0:n=30
  4432. @end example
  4433. @item
  4434. Fade out the last 45 frames of a 200-frame video:
  4435. @example
  4436. fade=out:155:45
  4437. fade=type=out:start_frame=155:nb_frames=45
  4438. @end example
  4439. @item
  4440. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  4441. @example
  4442. fade=in:0:25, fade=out:975:25
  4443. @end example
  4444. @item
  4445. Make the first 5 frames yellow, then fade in from frame 5-24:
  4446. @example
  4447. fade=in:5:20:color=yellow
  4448. @end example
  4449. @item
  4450. Fade in alpha over first 25 frames of video:
  4451. @example
  4452. fade=in:0:25:alpha=1
  4453. @end example
  4454. @item
  4455. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  4456. @example
  4457. fade=t=in:st=5.5:d=0.5
  4458. @end example
  4459. @end itemize
  4460. @section fftfilt
  4461. Apply arbitrary expressions to samples in frequency domain
  4462. @table @option
  4463. @item dc_Y
  4464. Adjust the dc value (gain) of the luma plane of the image. The filter
  4465. accepts an integer value in range @code{0} to @code{1000}. The default
  4466. value is set to @code{0}.
  4467. @item dc_U
  4468. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  4469. filter accepts an integer value in range @code{0} to @code{1000}. The
  4470. default value is set to @code{0}.
  4471. @item dc_V
  4472. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  4473. filter accepts an integer value in range @code{0} to @code{1000}. The
  4474. default value is set to @code{0}.
  4475. @item weight_Y
  4476. Set the frequency domain weight expression for the luma plane.
  4477. @item weight_U
  4478. Set the frequency domain weight expression for the 1st chroma plane.
  4479. @item weight_V
  4480. Set the frequency domain weight expression for the 2nd chroma plane.
  4481. The filter accepts the following variables:
  4482. @item X
  4483. @item Y
  4484. The coordinates of the current sample.
  4485. @item W
  4486. @item H
  4487. The width and height of the image.
  4488. @end table
  4489. @subsection Examples
  4490. @itemize
  4491. @item
  4492. High-pass:
  4493. @example
  4494. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  4495. @end example
  4496. @item
  4497. Low-pass:
  4498. @example
  4499. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  4500. @end example
  4501. @item
  4502. Sharpen:
  4503. @example
  4504. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  4505. @end example
  4506. @end itemize
  4507. @section field
  4508. Extract a single field from an interlaced image using stride
  4509. arithmetic to avoid wasting CPU time. The output frames are marked as
  4510. non-interlaced.
  4511. The filter accepts the following options:
  4512. @table @option
  4513. @item type
  4514. Specify whether to extract the top (if the value is @code{0} or
  4515. @code{top}) or the bottom field (if the value is @code{1} or
  4516. @code{bottom}).
  4517. @end table
  4518. @section fieldmatch
  4519. Field matching filter for inverse telecine. It is meant to reconstruct the
  4520. progressive frames from a telecined stream. The filter does not drop duplicated
  4521. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  4522. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  4523. The separation of the field matching and the decimation is notably motivated by
  4524. the possibility of inserting a de-interlacing filter fallback between the two.
  4525. If the source has mixed telecined and real interlaced content,
  4526. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  4527. But these remaining combed frames will be marked as interlaced, and thus can be
  4528. de-interlaced by a later filter such as @ref{yadif} before decimation.
  4529. In addition to the various configuration options, @code{fieldmatch} can take an
  4530. optional second stream, activated through the @option{ppsrc} option. If
  4531. enabled, the frames reconstruction will be based on the fields and frames from
  4532. this second stream. This allows the first input to be pre-processed in order to
  4533. help the various algorithms of the filter, while keeping the output lossless
  4534. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  4535. or brightness/contrast adjustments can help.
  4536. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  4537. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  4538. which @code{fieldmatch} is based on. While the semantic and usage are very
  4539. close, some behaviour and options names can differ.
  4540. The @ref{decimate} filter currently only works for constant frame rate input.
  4541. If your input has mixed telecined (30fps) and progressive content with a lower
  4542. framerate like 24fps use the following filterchain to produce the necessary cfr
  4543. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  4544. The filter accepts the following options:
  4545. @table @option
  4546. @item order
  4547. Specify the assumed field order of the input stream. Available values are:
  4548. @table @samp
  4549. @item auto
  4550. Auto detect parity (use FFmpeg's internal parity value).
  4551. @item bff
  4552. Assume bottom field first.
  4553. @item tff
  4554. Assume top field first.
  4555. @end table
  4556. Note that it is sometimes recommended not to trust the parity announced by the
  4557. stream.
  4558. Default value is @var{auto}.
  4559. @item mode
  4560. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  4561. sense that it won't risk creating jerkiness due to duplicate frames when
  4562. possible, but if there are bad edits or blended fields it will end up
  4563. outputting combed frames when a good match might actually exist. On the other
  4564. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  4565. but will almost always find a good frame if there is one. The other values are
  4566. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  4567. jerkiness and creating duplicate frames versus finding good matches in sections
  4568. with bad edits, orphaned fields, blended fields, etc.
  4569. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  4570. Available values are:
  4571. @table @samp
  4572. @item pc
  4573. 2-way matching (p/c)
  4574. @item pc_n
  4575. 2-way matching, and trying 3rd match if still combed (p/c + n)
  4576. @item pc_u
  4577. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  4578. @item pc_n_ub
  4579. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  4580. still combed (p/c + n + u/b)
  4581. @item pcn
  4582. 3-way matching (p/c/n)
  4583. @item pcn_ub
  4584. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  4585. detected as combed (p/c/n + u/b)
  4586. @end table
  4587. The parenthesis at the end indicate the matches that would be used for that
  4588. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  4589. @var{top}).
  4590. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  4591. the slowest.
  4592. Default value is @var{pc_n}.
  4593. @item ppsrc
  4594. Mark the main input stream as a pre-processed input, and enable the secondary
  4595. input stream as the clean source to pick the fields from. See the filter
  4596. introduction for more details. It is similar to the @option{clip2} feature from
  4597. VFM/TFM.
  4598. Default value is @code{0} (disabled).
  4599. @item field
  4600. Set the field to match from. It is recommended to set this to the same value as
  4601. @option{order} unless you experience matching failures with that setting. In
  4602. certain circumstances changing the field that is used to match from can have a
  4603. large impact on matching performance. Available values are:
  4604. @table @samp
  4605. @item auto
  4606. Automatic (same value as @option{order}).
  4607. @item bottom
  4608. Match from the bottom field.
  4609. @item top
  4610. Match from the top field.
  4611. @end table
  4612. Default value is @var{auto}.
  4613. @item mchroma
  4614. Set whether or not chroma is included during the match comparisons. In most
  4615. cases it is recommended to leave this enabled. You should set this to @code{0}
  4616. only if your clip has bad chroma problems such as heavy rainbowing or other
  4617. artifacts. Setting this to @code{0} could also be used to speed things up at
  4618. the cost of some accuracy.
  4619. Default value is @code{1}.
  4620. @item y0
  4621. @item y1
  4622. These define an exclusion band which excludes the lines between @option{y0} and
  4623. @option{y1} from being included in the field matching decision. An exclusion
  4624. band can be used to ignore subtitles, a logo, or other things that may
  4625. interfere with the matching. @option{y0} sets the starting scan line and
  4626. @option{y1} sets the ending line; all lines in between @option{y0} and
  4627. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  4628. @option{y0} and @option{y1} to the same value will disable the feature.
  4629. @option{y0} and @option{y1} defaults to @code{0}.
  4630. @item scthresh
  4631. Set the scene change detection threshold as a percentage of maximum change on
  4632. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  4633. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  4634. @option{scthresh} is @code{[0.0, 100.0]}.
  4635. Default value is @code{12.0}.
  4636. @item combmatch
  4637. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  4638. account the combed scores of matches when deciding what match to use as the
  4639. final match. Available values are:
  4640. @table @samp
  4641. @item none
  4642. No final matching based on combed scores.
  4643. @item sc
  4644. Combed scores are only used when a scene change is detected.
  4645. @item full
  4646. Use combed scores all the time.
  4647. @end table
  4648. Default is @var{sc}.
  4649. @item combdbg
  4650. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  4651. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  4652. Available values are:
  4653. @table @samp
  4654. @item none
  4655. No forced calculation.
  4656. @item pcn
  4657. Force p/c/n calculations.
  4658. @item pcnub
  4659. Force p/c/n/u/b calculations.
  4660. @end table
  4661. Default value is @var{none}.
  4662. @item cthresh
  4663. This is the area combing threshold used for combed frame detection. This
  4664. essentially controls how "strong" or "visible" combing must be to be detected.
  4665. Larger values mean combing must be more visible and smaller values mean combing
  4666. can be less visible or strong and still be detected. Valid settings are from
  4667. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  4668. be detected as combed). This is basically a pixel difference value. A good
  4669. range is @code{[8, 12]}.
  4670. Default value is @code{9}.
  4671. @item chroma
  4672. Sets whether or not chroma is considered in the combed frame decision. Only
  4673. disable this if your source has chroma problems (rainbowing, etc.) that are
  4674. causing problems for the combed frame detection with chroma enabled. Actually,
  4675. using @option{chroma}=@var{0} is usually more reliable, except for the case
  4676. where there is chroma only combing in the source.
  4677. Default value is @code{0}.
  4678. @item blockx
  4679. @item blocky
  4680. Respectively set the x-axis and y-axis size of the window used during combed
  4681. frame detection. This has to do with the size of the area in which
  4682. @option{combpel} pixels are required to be detected as combed for a frame to be
  4683. declared combed. See the @option{combpel} parameter description for more info.
  4684. Possible values are any number that is a power of 2 starting at 4 and going up
  4685. to 512.
  4686. Default value is @code{16}.
  4687. @item combpel
  4688. The number of combed pixels inside any of the @option{blocky} by
  4689. @option{blockx} size blocks on the frame for the frame to be detected as
  4690. combed. While @option{cthresh} controls how "visible" the combing must be, this
  4691. setting controls "how much" combing there must be in any localized area (a
  4692. window defined by the @option{blockx} and @option{blocky} settings) on the
  4693. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  4694. which point no frames will ever be detected as combed). This setting is known
  4695. as @option{MI} in TFM/VFM vocabulary.
  4696. Default value is @code{80}.
  4697. @end table
  4698. @anchor{p/c/n/u/b meaning}
  4699. @subsection p/c/n/u/b meaning
  4700. @subsubsection p/c/n
  4701. We assume the following telecined stream:
  4702. @example
  4703. Top fields: 1 2 2 3 4
  4704. Bottom fields: 1 2 3 4 4
  4705. @end example
  4706. The numbers correspond to the progressive frame the fields relate to. Here, the
  4707. first two frames are progressive, the 3rd and 4th are combed, and so on.
  4708. When @code{fieldmatch} is configured to run a matching from bottom
  4709. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  4710. @example
  4711. Input stream:
  4712. T 1 2 2 3 4
  4713. B 1 2 3 4 4 <-- matching reference
  4714. Matches: c c n n c
  4715. Output stream:
  4716. T 1 2 3 4 4
  4717. B 1 2 3 4 4
  4718. @end example
  4719. As a result of the field matching, we can see that some frames get duplicated.
  4720. To perform a complete inverse telecine, you need to rely on a decimation filter
  4721. after this operation. See for instance the @ref{decimate} filter.
  4722. The same operation now matching from top fields (@option{field}=@var{top})
  4723. looks like this:
  4724. @example
  4725. Input stream:
  4726. T 1 2 2 3 4 <-- matching reference
  4727. B 1 2 3 4 4
  4728. Matches: c c p p c
  4729. Output stream:
  4730. T 1 2 2 3 4
  4731. B 1 2 2 3 4
  4732. @end example
  4733. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  4734. basically, they refer to the frame and field of the opposite parity:
  4735. @itemize
  4736. @item @var{p} matches the field of the opposite parity in the previous frame
  4737. @item @var{c} matches the field of the opposite parity in the current frame
  4738. @item @var{n} matches the field of the opposite parity in the next frame
  4739. @end itemize
  4740. @subsubsection u/b
  4741. The @var{u} and @var{b} matching are a bit special in the sense that they match
  4742. from the opposite parity flag. In the following examples, we assume that we are
  4743. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  4744. 'x' is placed above and below each matched fields.
  4745. With bottom matching (@option{field}=@var{bottom}):
  4746. @example
  4747. Match: c p n b u
  4748. x x x x x
  4749. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4750. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4751. x x x x x
  4752. Output frames:
  4753. 2 1 2 2 2
  4754. 2 2 2 1 3
  4755. @end example
  4756. With top matching (@option{field}=@var{top}):
  4757. @example
  4758. Match: c p n b u
  4759. x x x x x
  4760. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  4761. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  4762. x x x x x
  4763. Output frames:
  4764. 2 2 2 1 2
  4765. 2 1 3 2 2
  4766. @end example
  4767. @subsection Examples
  4768. Simple IVTC of a top field first telecined stream:
  4769. @example
  4770. fieldmatch=order=tff:combmatch=none, decimate
  4771. @end example
  4772. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  4773. @example
  4774. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  4775. @end example
  4776. @section fieldorder
  4777. Transform the field order of the input video.
  4778. It accepts the following parameters:
  4779. @table @option
  4780. @item order
  4781. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  4782. for bottom field first.
  4783. @end table
  4784. The default value is @samp{tff}.
  4785. The transformation is done by shifting the picture content up or down
  4786. by one line, and filling the remaining line with appropriate picture content.
  4787. This method is consistent with most broadcast field order converters.
  4788. If the input video is not flagged as being interlaced, or it is already
  4789. flagged as being of the required output field order, then this filter does
  4790. not alter the incoming video.
  4791. It is very useful when converting to or from PAL DV material,
  4792. which is bottom field first.
  4793. For example:
  4794. @example
  4795. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  4796. @end example
  4797. @section fifo
  4798. Buffer input images and send them when they are requested.
  4799. It is mainly useful when auto-inserted by the libavfilter
  4800. framework.
  4801. It does not take parameters.
  4802. @section find_rect
  4803. Find a rectangular object
  4804. It accepts the following options:
  4805. @table @option
  4806. @item object
  4807. Filepath of the object image, needs to be in gray8.
  4808. @item threshold
  4809. Detection threshold, default is 0.5.
  4810. @item mipmaps
  4811. Number of mipmaps, default is 3.
  4812. @item xmin, ymin, xmax, ymax
  4813. Specifies the rectangle in which to search.
  4814. @end table
  4815. @subsection Examples
  4816. @itemize
  4817. @item
  4818. Generate a representative palette of a given video using @command{ffmpeg}:
  4819. @example
  4820. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4821. @end example
  4822. @end itemize
  4823. @section cover_rect
  4824. Cover a rectangular object
  4825. It accepts the following options:
  4826. @table @option
  4827. @item cover
  4828. Filepath of the optional cover image, needs to be in yuv420.
  4829. @item mode
  4830. Set covering mode.
  4831. It accepts the following values:
  4832. @table @samp
  4833. @item cover
  4834. cover it by the supplied image
  4835. @item blur
  4836. cover it by interpolating the surrounding pixels
  4837. @end table
  4838. Default value is @var{blur}.
  4839. @end table
  4840. @subsection Examples
  4841. @itemize
  4842. @item
  4843. Generate a representative palette of a given video using @command{ffmpeg}:
  4844. @example
  4845. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  4846. @end example
  4847. @end itemize
  4848. @anchor{format}
  4849. @section format
  4850. Convert the input video to one of the specified pixel formats.
  4851. Libavfilter will try to pick one that is suitable as input to
  4852. the next filter.
  4853. It accepts the following parameters:
  4854. @table @option
  4855. @item pix_fmts
  4856. A '|'-separated list of pixel format names, such as
  4857. "pix_fmts=yuv420p|monow|rgb24".
  4858. @end table
  4859. @subsection Examples
  4860. @itemize
  4861. @item
  4862. Convert the input video to the @var{yuv420p} format
  4863. @example
  4864. format=pix_fmts=yuv420p
  4865. @end example
  4866. Convert the input video to any of the formats in the list
  4867. @example
  4868. format=pix_fmts=yuv420p|yuv444p|yuv410p
  4869. @end example
  4870. @end itemize
  4871. @anchor{fps}
  4872. @section fps
  4873. Convert the video to specified constant frame rate by duplicating or dropping
  4874. frames as necessary.
  4875. It accepts the following parameters:
  4876. @table @option
  4877. @item fps
  4878. The desired output frame rate. The default is @code{25}.
  4879. @item round
  4880. Rounding method.
  4881. Possible values are:
  4882. @table @option
  4883. @item zero
  4884. zero round towards 0
  4885. @item inf
  4886. round away from 0
  4887. @item down
  4888. round towards -infinity
  4889. @item up
  4890. round towards +infinity
  4891. @item near
  4892. round to nearest
  4893. @end table
  4894. The default is @code{near}.
  4895. @item start_time
  4896. Assume the first PTS should be the given value, in seconds. This allows for
  4897. padding/trimming at the start of stream. By default, no assumption is made
  4898. about the first frame's expected PTS, so no padding or trimming is done.
  4899. For example, this could be set to 0 to pad the beginning with duplicates of
  4900. the first frame if a video stream starts after the audio stream or to trim any
  4901. frames with a negative PTS.
  4902. @end table
  4903. Alternatively, the options can be specified as a flat string:
  4904. @var{fps}[:@var{round}].
  4905. See also the @ref{setpts} filter.
  4906. @subsection Examples
  4907. @itemize
  4908. @item
  4909. A typical usage in order to set the fps to 25:
  4910. @example
  4911. fps=fps=25
  4912. @end example
  4913. @item
  4914. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  4915. @example
  4916. fps=fps=film:round=near
  4917. @end example
  4918. @end itemize
  4919. @section framepack
  4920. Pack two different video streams into a stereoscopic video, setting proper
  4921. metadata on supported codecs. The two views should have the same size and
  4922. framerate and processing will stop when the shorter video ends. Please note
  4923. that you may conveniently adjust view properties with the @ref{scale} and
  4924. @ref{fps} filters.
  4925. It accepts the following parameters:
  4926. @table @option
  4927. @item format
  4928. The desired packing format. Supported values are:
  4929. @table @option
  4930. @item sbs
  4931. The views are next to each other (default).
  4932. @item tab
  4933. The views are on top of each other.
  4934. @item lines
  4935. The views are packed by line.
  4936. @item columns
  4937. The views are packed by column.
  4938. @item frameseq
  4939. The views are temporally interleaved.
  4940. @end table
  4941. @end table
  4942. Some examples:
  4943. @example
  4944. # Convert left and right views into a frame-sequential video
  4945. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  4946. # Convert views into a side-by-side video with the same output resolution as the input
  4947. 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
  4948. @end example
  4949. @section framerate
  4950. Change the frame rate by interpolating new video output frames from the source
  4951. frames.
  4952. This filter is not designed to function correctly with interlaced media. If
  4953. you wish to change the frame rate of interlaced media then you are required
  4954. to deinterlace before this filter and re-interlace after this filter.
  4955. A description of the accepted options follows.
  4956. @table @option
  4957. @item fps
  4958. Specify the output frames per second. This option can also be specified
  4959. as a value alone. The default is @code{50}.
  4960. @item interp_start
  4961. Specify the start of a range where the output frame will be created as a
  4962. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  4963. the default is @code{15}.
  4964. @item interp_end
  4965. Specify the end of a range where the output frame will be created as a
  4966. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  4967. the default is @code{240}.
  4968. @item scene
  4969. Specify the level at which a scene change is detected as a value between
  4970. 0 and 100 to indicate a new scene; a low value reflects a low
  4971. probability for the current frame to introduce a new scene, while a higher
  4972. value means the current frame is more likely to be one.
  4973. The default is @code{7}.
  4974. @item flags
  4975. Specify flags influencing the filter process.
  4976. Available value for @var{flags} is:
  4977. @table @option
  4978. @item scene_change_detect, scd
  4979. Enable scene change detection using the value of the option @var{scene}.
  4980. This flag is enabled by default.
  4981. @end table
  4982. @end table
  4983. @section framestep
  4984. Select one frame every N-th frame.
  4985. This filter accepts the following option:
  4986. @table @option
  4987. @item step
  4988. Select frame after every @code{step} frames.
  4989. Allowed values are positive integers higher than 0. Default value is @code{1}.
  4990. @end table
  4991. @anchor{frei0r}
  4992. @section frei0r
  4993. Apply a frei0r effect to the input video.
  4994. To enable the compilation of this filter, you need to install the frei0r
  4995. header and configure FFmpeg with @code{--enable-frei0r}.
  4996. It accepts the following parameters:
  4997. @table @option
  4998. @item filter_name
  4999. The name of the frei0r effect to load. If the environment variable
  5000. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5001. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5002. Otherwise, the standard frei0r paths are searched, in this order:
  5003. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5004. @file{/usr/lib/frei0r-1/}.
  5005. @item filter_params
  5006. A '|'-separated list of parameters to pass to the frei0r effect.
  5007. @end table
  5008. A frei0r effect parameter can be a boolean (its value is either
  5009. "y" or "n"), a double, a color (specified as
  5010. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5011. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5012. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5013. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5014. The number and types of parameters depend on the loaded effect. If an
  5015. effect parameter is not specified, the default value is set.
  5016. @subsection Examples
  5017. @itemize
  5018. @item
  5019. Apply the distort0r effect, setting the first two double parameters:
  5020. @example
  5021. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5022. @end example
  5023. @item
  5024. Apply the colordistance effect, taking a color as the first parameter:
  5025. @example
  5026. frei0r=colordistance:0.2/0.3/0.4
  5027. frei0r=colordistance:violet
  5028. frei0r=colordistance:0x112233
  5029. @end example
  5030. @item
  5031. Apply the perspective effect, specifying the top left and top right image
  5032. positions:
  5033. @example
  5034. frei0r=perspective:0.2/0.2|0.8/0.2
  5035. @end example
  5036. @end itemize
  5037. For more information, see
  5038. @url{http://frei0r.dyne.org}
  5039. @section fspp
  5040. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5041. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5042. processing filter, one of them is performed once per block, not per pixel.
  5043. This allows for much higher speed.
  5044. The filter accepts the following options:
  5045. @table @option
  5046. @item quality
  5047. Set quality. This option defines the number of levels for averaging. It accepts
  5048. an integer in the range 4-5. Default value is @code{4}.
  5049. @item qp
  5050. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5051. If not set, the filter will use the QP from the video stream (if available).
  5052. @item strength
  5053. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5054. more details but also more artifacts, while higher values make the image smoother
  5055. but also blurrier. Default value is @code{0} − PSNR optimal.
  5056. @item use_bframe_qp
  5057. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5058. option may cause flicker since the B-Frames have often larger QP. Default is
  5059. @code{0} (not enabled).
  5060. @end table
  5061. @section geq
  5062. The filter accepts the following options:
  5063. @table @option
  5064. @item lum_expr, lum
  5065. Set the luminance expression.
  5066. @item cb_expr, cb
  5067. Set the chrominance blue expression.
  5068. @item cr_expr, cr
  5069. Set the chrominance red expression.
  5070. @item alpha_expr, a
  5071. Set the alpha expression.
  5072. @item red_expr, r
  5073. Set the red expression.
  5074. @item green_expr, g
  5075. Set the green expression.
  5076. @item blue_expr, b
  5077. Set the blue expression.
  5078. @end table
  5079. The colorspace is selected according to the specified options. If one
  5080. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5081. options is specified, the filter will automatically select a YCbCr
  5082. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5083. @option{blue_expr} options is specified, it will select an RGB
  5084. colorspace.
  5085. If one of the chrominance expression is not defined, it falls back on the other
  5086. one. If no alpha expression is specified it will evaluate to opaque value.
  5087. If none of chrominance expressions are specified, they will evaluate
  5088. to the luminance expression.
  5089. The expressions can use the following variables and functions:
  5090. @table @option
  5091. @item N
  5092. The sequential number of the filtered frame, starting from @code{0}.
  5093. @item X
  5094. @item Y
  5095. The coordinates of the current sample.
  5096. @item W
  5097. @item H
  5098. The width and height of the image.
  5099. @item SW
  5100. @item SH
  5101. Width and height scale depending on the currently filtered plane. It is the
  5102. ratio between the corresponding luma plane number of pixels and the current
  5103. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5104. @code{0.5,0.5} for chroma planes.
  5105. @item T
  5106. Time of the current frame, expressed in seconds.
  5107. @item p(x, y)
  5108. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5109. plane.
  5110. @item lum(x, y)
  5111. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5112. plane.
  5113. @item cb(x, y)
  5114. Return the value of the pixel at location (@var{x},@var{y}) of the
  5115. blue-difference chroma plane. Return 0 if there is no such plane.
  5116. @item cr(x, y)
  5117. Return the value of the pixel at location (@var{x},@var{y}) of the
  5118. red-difference chroma plane. Return 0 if there is no such plane.
  5119. @item r(x, y)
  5120. @item g(x, y)
  5121. @item b(x, y)
  5122. Return the value of the pixel at location (@var{x},@var{y}) of the
  5123. red/green/blue component. Return 0 if there is no such component.
  5124. @item alpha(x, y)
  5125. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5126. plane. Return 0 if there is no such plane.
  5127. @end table
  5128. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5129. automatically clipped to the closer edge.
  5130. @subsection Examples
  5131. @itemize
  5132. @item
  5133. Flip the image horizontally:
  5134. @example
  5135. geq=p(W-X\,Y)
  5136. @end example
  5137. @item
  5138. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5139. wavelength of 100 pixels:
  5140. @example
  5141. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5142. @end example
  5143. @item
  5144. Generate a fancy enigmatic moving light:
  5145. @example
  5146. 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
  5147. @end example
  5148. @item
  5149. Generate a quick emboss effect:
  5150. @example
  5151. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5152. @end example
  5153. @item
  5154. Modify RGB components depending on pixel position:
  5155. @example
  5156. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5157. @end example
  5158. @item
  5159. Create a radial gradient that is the same size as the input (also see
  5160. the @ref{vignette} filter):
  5161. @example
  5162. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5163. @end example
  5164. @item
  5165. Create a linear gradient to use as a mask for another filter, then
  5166. compose with @ref{overlay}. In this example the video will gradually
  5167. become more blurry from the top to the bottom of the y-axis as defined
  5168. by the linear gradient:
  5169. @example
  5170. 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
  5171. @end example
  5172. @end itemize
  5173. @section gradfun
  5174. Fix the banding artifacts that are sometimes introduced into nearly flat
  5175. regions by truncation to 8bit color depth.
  5176. Interpolate the gradients that should go where the bands are, and
  5177. dither them.
  5178. It is designed for playback only. Do not use it prior to
  5179. lossy compression, because compression tends to lose the dither and
  5180. bring back the bands.
  5181. It accepts the following parameters:
  5182. @table @option
  5183. @item strength
  5184. The maximum amount by which the filter will change any one pixel. This is also
  5185. the threshold for detecting nearly flat regions. Acceptable values range from
  5186. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5187. valid range.
  5188. @item radius
  5189. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5190. gradients, but also prevents the filter from modifying the pixels near detailed
  5191. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5192. values will be clipped to the valid range.
  5193. @end table
  5194. Alternatively, the options can be specified as a flat string:
  5195. @var{strength}[:@var{radius}]
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5200. @example
  5201. gradfun=3.5:8
  5202. @end example
  5203. @item
  5204. Specify radius, omitting the strength (which will fall-back to the default
  5205. value):
  5206. @example
  5207. gradfun=radius=8
  5208. @end example
  5209. @end itemize
  5210. @anchor{haldclut}
  5211. @section haldclut
  5212. Apply a Hald CLUT to a video stream.
  5213. First input is the video stream to process, and second one is the Hald CLUT.
  5214. The Hald CLUT input can be a simple picture or a complete video stream.
  5215. The filter accepts the following options:
  5216. @table @option
  5217. @item shortest
  5218. Force termination when the shortest input terminates. Default is @code{0}.
  5219. @item repeatlast
  5220. Continue applying the last CLUT after the end of the stream. A value of
  5221. @code{0} disable the filter after the last frame of the CLUT is reached.
  5222. Default is @code{1}.
  5223. @end table
  5224. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5225. filters share the same internals).
  5226. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5227. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5228. @subsection Workflow examples
  5229. @subsubsection Hald CLUT video stream
  5230. Generate an identity Hald CLUT stream altered with various effects:
  5231. @example
  5232. 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
  5233. @end example
  5234. Note: make sure you use a lossless codec.
  5235. Then use it with @code{haldclut} to apply it on some random stream:
  5236. @example
  5237. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5238. @end example
  5239. The Hald CLUT will be applied to the 10 first seconds (duration of
  5240. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5241. to the remaining frames of the @code{mandelbrot} stream.
  5242. @subsubsection Hald CLUT with preview
  5243. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5244. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5245. biggest possible square starting at the top left of the picture. The remaining
  5246. padding pixels (bottom or right) will be ignored. This area can be used to add
  5247. a preview of the Hald CLUT.
  5248. Typically, the following generated Hald CLUT will be supported by the
  5249. @code{haldclut} filter:
  5250. @example
  5251. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5252. pad=iw+320 [padded_clut];
  5253. smptebars=s=320x256, split [a][b];
  5254. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5255. [main][b] overlay=W-320" -frames:v 1 clut.png
  5256. @end example
  5257. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5258. bars are displayed on the right-top, and below the same color bars processed by
  5259. the color changes.
  5260. Then, the effect of this Hald CLUT can be visualized with:
  5261. @example
  5262. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5263. @end example
  5264. @section hflip
  5265. Flip the input video horizontally.
  5266. For example, to horizontally flip the input video with @command{ffmpeg}:
  5267. @example
  5268. ffmpeg -i in.avi -vf "hflip" out.avi
  5269. @end example
  5270. @section histeq
  5271. This filter applies a global color histogram equalization on a
  5272. per-frame basis.
  5273. It can be used to correct video that has a compressed range of pixel
  5274. intensities. The filter redistributes the pixel intensities to
  5275. equalize their distribution across the intensity range. It may be
  5276. viewed as an "automatically adjusting contrast filter". This filter is
  5277. useful only for correcting degraded or poorly captured source
  5278. video.
  5279. The filter accepts the following options:
  5280. @table @option
  5281. @item strength
  5282. Determine the amount of equalization to be applied. As the strength
  5283. is reduced, the distribution of pixel intensities more-and-more
  5284. approaches that of the input frame. The value must be a float number
  5285. in the range [0,1] and defaults to 0.200.
  5286. @item intensity
  5287. Set the maximum intensity that can generated and scale the output
  5288. values appropriately. The strength should be set as desired and then
  5289. the intensity can be limited if needed to avoid washing-out. The value
  5290. must be a float number in the range [0,1] and defaults to 0.210.
  5291. @item antibanding
  5292. Set the antibanding level. If enabled the filter will randomly vary
  5293. the luminance of output pixels by a small amount to avoid banding of
  5294. the histogram. Possible values are @code{none}, @code{weak} or
  5295. @code{strong}. It defaults to @code{none}.
  5296. @end table
  5297. @section histogram
  5298. Compute and draw a color distribution histogram for the input video.
  5299. The computed histogram is a representation of the color component
  5300. distribution in an image.
  5301. The filter accepts the following options:
  5302. @table @option
  5303. @item mode
  5304. Set histogram mode.
  5305. It accepts the following values:
  5306. @table @samp
  5307. @item levels
  5308. Standard histogram that displays the color components distribution in an
  5309. image. Displays color graph for each color component. Shows distribution of
  5310. the Y, U, V, A or R, G, B components, depending on input format, in the
  5311. current frame. Below each graph a color component scale meter is shown.
  5312. @item color
  5313. Displays chroma values (U/V color placement) in a two dimensional
  5314. graph (which is called a vectorscope). The brighter a pixel in the
  5315. vectorscope, the more pixels of the input frame correspond to that pixel
  5316. (i.e., more pixels have this chroma value). The V component is displayed on
  5317. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  5318. side being V = 255. The U component is displayed on the vertical (Y) axis,
  5319. with the top representing U = 0 and the bottom representing U = 255.
  5320. The position of a white pixel in the graph corresponds to the chroma value of
  5321. a pixel of the input clip. The graph can therefore be used to read the hue
  5322. (color flavor) and the saturation (the dominance of the hue in the color). As
  5323. the hue of a color changes, it moves around the square. At the center of the
  5324. square the saturation is zero, which means that the corresponding pixel has no
  5325. color. If the amount of a specific color is increased (while leaving the other
  5326. colors unchanged) the saturation increases, and the indicator moves towards
  5327. the edge of the square.
  5328. @item color2
  5329. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  5330. are displayed.
  5331. @item waveform
  5332. Per row/column color component graph. In row mode, the graph on the left side
  5333. represents color component value 0 and the right side represents value = 255.
  5334. In column mode, the top side represents color component value = 0 and bottom
  5335. side represents value = 255.
  5336. @end table
  5337. Default value is @code{levels}.
  5338. @item level_height
  5339. Set height of level in @code{levels}. Default value is @code{200}.
  5340. Allowed range is [50, 2048].
  5341. @item scale_height
  5342. Set height of color scale in @code{levels}. Default value is @code{12}.
  5343. Allowed range is [0, 40].
  5344. @item step
  5345. Set step for @code{waveform} mode. Smaller values are useful to find out how
  5346. many values of the same luminance are distributed across input rows/columns.
  5347. Default value is @code{10}. Allowed range is [1, 255].
  5348. @item waveform_mode
  5349. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  5350. Default is @code{row}.
  5351. @item waveform_mirror
  5352. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  5353. means mirrored. In mirrored mode, higher values will be represented on the left
  5354. side for @code{row} mode and at the top for @code{column} mode. Default is
  5355. @code{0} (unmirrored).
  5356. @item display_mode
  5357. Set display mode for @code{waveform} and @code{levels}.
  5358. It accepts the following values:
  5359. @table @samp
  5360. @item parade
  5361. Display separate graph for the color components side by side in
  5362. @code{row} waveform mode or one below the other in @code{column} waveform mode
  5363. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  5364. per color component graphs are placed below each other.
  5365. Using this display mode in @code{waveform} histogram mode makes it easy to
  5366. spot color casts in the highlights and shadows of an image, by comparing the
  5367. contours of the top and the bottom graphs of each waveform. Since whites,
  5368. grays, and blacks are characterized by exactly equal amounts of red, green,
  5369. and blue, neutral areas of the picture should display three waveforms of
  5370. roughly equal width/height. If not, the correction is easy to perform by
  5371. making level adjustments the three waveforms.
  5372. @item overlay
  5373. Presents information identical to that in the @code{parade}, except
  5374. that the graphs representing color components are superimposed directly
  5375. over one another.
  5376. This display mode in @code{waveform} histogram mode makes it easier to spot
  5377. relative differences or similarities in overlapping areas of the color
  5378. components that are supposed to be identical, such as neutral whites, grays,
  5379. or blacks.
  5380. @end table
  5381. Default is @code{parade}.
  5382. @item levels_mode
  5383. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  5384. Default is @code{linear}.
  5385. @item components
  5386. Set what color components to display for mode @code{levels}.
  5387. Default is @code{7}.
  5388. @end table
  5389. @subsection Examples
  5390. @itemize
  5391. @item
  5392. Calculate and draw histogram:
  5393. @example
  5394. ffplay -i input -vf histogram
  5395. @end example
  5396. @end itemize
  5397. @anchor{hqdn3d}
  5398. @section hqdn3d
  5399. This is a high precision/quality 3d denoise filter. It aims to reduce
  5400. image noise, producing smooth images and making still images really
  5401. still. It should enhance compressibility.
  5402. It accepts the following optional parameters:
  5403. @table @option
  5404. @item luma_spatial
  5405. A non-negative floating point number which specifies spatial luma strength.
  5406. It defaults to 4.0.
  5407. @item chroma_spatial
  5408. A non-negative floating point number which specifies spatial chroma strength.
  5409. It defaults to 3.0*@var{luma_spatial}/4.0.
  5410. @item luma_tmp
  5411. A floating point number which specifies luma temporal strength. It defaults to
  5412. 6.0*@var{luma_spatial}/4.0.
  5413. @item chroma_tmp
  5414. A floating point number which specifies chroma temporal strength. It defaults to
  5415. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5416. @end table
  5417. @section hqx
  5418. Apply a high-quality magnification filter designed for pixel art. This filter
  5419. was originally created by Maxim Stepin.
  5420. It accepts the following option:
  5421. @table @option
  5422. @item n
  5423. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5424. @code{hq3x} and @code{4} for @code{hq4x}.
  5425. Default is @code{3}.
  5426. @end table
  5427. @section hstack
  5428. Stack input videos horizontally.
  5429. All streams must be of same pixel format and of same height.
  5430. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5431. to create same output.
  5432. The filter accept the following option:
  5433. @table @option
  5434. @item nb_inputs
  5435. Set number of input streams. Default is 2.
  5436. @end table
  5437. @section hue
  5438. Modify the hue and/or the saturation of the input.
  5439. It accepts the following parameters:
  5440. @table @option
  5441. @item h
  5442. Specify the hue angle as a number of degrees. It accepts an expression,
  5443. and defaults to "0".
  5444. @item s
  5445. Specify the saturation in the [-10,10] range. It accepts an expression and
  5446. defaults to "1".
  5447. @item H
  5448. Specify the hue angle as a number of radians. It accepts an
  5449. expression, and defaults to "0".
  5450. @item b
  5451. Specify the brightness in the [-10,10] range. It accepts an expression and
  5452. defaults to "0".
  5453. @end table
  5454. @option{h} and @option{H} are mutually exclusive, and can't be
  5455. specified at the same time.
  5456. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5457. expressions containing the following constants:
  5458. @table @option
  5459. @item n
  5460. frame count of the input frame starting from 0
  5461. @item pts
  5462. presentation timestamp of the input frame expressed in time base units
  5463. @item r
  5464. frame rate of the input video, NAN if the input frame rate is unknown
  5465. @item t
  5466. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5467. @item tb
  5468. time base of the input video
  5469. @end table
  5470. @subsection Examples
  5471. @itemize
  5472. @item
  5473. Set the hue to 90 degrees and the saturation to 1.0:
  5474. @example
  5475. hue=h=90:s=1
  5476. @end example
  5477. @item
  5478. Same command but expressing the hue in radians:
  5479. @example
  5480. hue=H=PI/2:s=1
  5481. @end example
  5482. @item
  5483. Rotate hue and make the saturation swing between 0
  5484. and 2 over a period of 1 second:
  5485. @example
  5486. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  5487. @end example
  5488. @item
  5489. Apply a 3 seconds saturation fade-in effect starting at 0:
  5490. @example
  5491. hue="s=min(t/3\,1)"
  5492. @end example
  5493. The general fade-in expression can be written as:
  5494. @example
  5495. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  5496. @end example
  5497. @item
  5498. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  5499. @example
  5500. hue="s=max(0\, min(1\, (8-t)/3))"
  5501. @end example
  5502. The general fade-out expression can be written as:
  5503. @example
  5504. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  5505. @end example
  5506. @end itemize
  5507. @subsection Commands
  5508. This filter supports the following commands:
  5509. @table @option
  5510. @item b
  5511. @item s
  5512. @item h
  5513. @item H
  5514. Modify the hue and/or the saturation and/or brightness of the input video.
  5515. The command accepts the same syntax of the corresponding option.
  5516. If the specified expression is not valid, it is kept at its current
  5517. value.
  5518. @end table
  5519. @section idet
  5520. Detect video interlacing type.
  5521. This filter tries to detect if the input frames as interlaced, progressive,
  5522. top or bottom field first. It will also try and detect fields that are
  5523. repeated between adjacent frames (a sign of telecine).
  5524. Single frame detection considers only immediately adjacent frames when classifying each frame.
  5525. Multiple frame detection incorporates the classification history of previous frames.
  5526. The filter will log these metadata values:
  5527. @table @option
  5528. @item single.current_frame
  5529. Detected type of current frame using single-frame detection. One of:
  5530. ``tff'' (top field first), ``bff'' (bottom field first),
  5531. ``progressive'', or ``undetermined''
  5532. @item single.tff
  5533. Cumulative number of frames detected as top field first using single-frame detection.
  5534. @item multiple.tff
  5535. Cumulative number of frames detected as top field first using multiple-frame detection.
  5536. @item single.bff
  5537. Cumulative number of frames detected as bottom field first using single-frame detection.
  5538. @item multiple.current_frame
  5539. Detected type of current frame using multiple-frame detection. One of:
  5540. ``tff'' (top field first), ``bff'' (bottom field first),
  5541. ``progressive'', or ``undetermined''
  5542. @item multiple.bff
  5543. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  5544. @item single.progressive
  5545. Cumulative number of frames detected as progressive using single-frame detection.
  5546. @item multiple.progressive
  5547. Cumulative number of frames detected as progressive using multiple-frame detection.
  5548. @item single.undetermined
  5549. Cumulative number of frames that could not be classified using single-frame detection.
  5550. @item multiple.undetermined
  5551. Cumulative number of frames that could not be classified using multiple-frame detection.
  5552. @item repeated.current_frame
  5553. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  5554. @item repeated.neither
  5555. Cumulative number of frames with no repeated field.
  5556. @item repeated.top
  5557. Cumulative number of frames with the top field repeated from the previous frame's top field.
  5558. @item repeated.bottom
  5559. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  5560. @end table
  5561. The filter accepts the following options:
  5562. @table @option
  5563. @item intl_thres
  5564. Set interlacing threshold.
  5565. @item prog_thres
  5566. Set progressive threshold.
  5567. @item repeat_thres
  5568. Threshold for repeated field detection.
  5569. @item half_life
  5570. Number of frames after which a given frame's contribution to the
  5571. statistics is halved (i.e., it contributes only 0.5 to it's
  5572. classification). The default of 0 means that all frames seen are given
  5573. full weight of 1.0 forever.
  5574. @item analyze_interlaced_flag
  5575. When this is not 0 then idet will use the specified number of frames to determine
  5576. if the interlaced flag is accurate, it will not count undetermined frames.
  5577. If the flag is found to be accurate it will be used without any further
  5578. computations, if it is found to be inaccurate it will be cleared without any
  5579. further computations. This allows inserting the idet filter as a low computational
  5580. method to clean up the interlaced flag
  5581. @end table
  5582. @section il
  5583. Deinterleave or interleave fields.
  5584. This filter allows one to process interlaced images fields without
  5585. deinterlacing them. Deinterleaving splits the input frame into 2
  5586. fields (so called half pictures). Odd lines are moved to the top
  5587. half of the output image, even lines to the bottom half.
  5588. You can process (filter) them independently and then re-interleave them.
  5589. The filter accepts the following options:
  5590. @table @option
  5591. @item luma_mode, l
  5592. @item chroma_mode, c
  5593. @item alpha_mode, a
  5594. Available values for @var{luma_mode}, @var{chroma_mode} and
  5595. @var{alpha_mode} are:
  5596. @table @samp
  5597. @item none
  5598. Do nothing.
  5599. @item deinterleave, d
  5600. Deinterleave fields, placing one above the other.
  5601. @item interleave, i
  5602. Interleave fields. Reverse the effect of deinterleaving.
  5603. @end table
  5604. Default value is @code{none}.
  5605. @item luma_swap, ls
  5606. @item chroma_swap, cs
  5607. @item alpha_swap, as
  5608. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  5609. @end table
  5610. @section inflate
  5611. Apply inflate effect to the video.
  5612. This filter replaces the pixel by the local(3x3) average by taking into account
  5613. only values higher than the pixel.
  5614. It accepts the following options:
  5615. @table @option
  5616. @item threshold0
  5617. @item threshold1
  5618. @item threshold2
  5619. @item threshold3
  5620. Allows to limit the maximum change for each plane, default is 65535.
  5621. If 0, plane will remain unchanged.
  5622. @end table
  5623. @section interlace
  5624. Simple interlacing filter from progressive contents. This interleaves upper (or
  5625. lower) lines from odd frames with lower (or upper) lines from even frames,
  5626. halving the frame rate and preserving image height.
  5627. @example
  5628. Original Original New Frame
  5629. Frame 'j' Frame 'j+1' (tff)
  5630. ========== =========== ==================
  5631. Line 0 --------------------> Frame 'j' Line 0
  5632. Line 1 Line 1 ----> Frame 'j+1' Line 1
  5633. Line 2 ---------------------> Frame 'j' Line 2
  5634. Line 3 Line 3 ----> Frame 'j+1' Line 3
  5635. ... ... ...
  5636. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  5637. @end example
  5638. It accepts the following optional parameters:
  5639. @table @option
  5640. @item scan
  5641. This determines whether the interlaced frame is taken from the even
  5642. (tff - default) or odd (bff) lines of the progressive frame.
  5643. @item lowpass
  5644. Enable (default) or disable the vertical lowpass filter to avoid twitter
  5645. interlacing and reduce moire patterns.
  5646. @end table
  5647. @section kerndeint
  5648. Deinterlace input video by applying Donald Graft's adaptive kernel
  5649. deinterling. Work on interlaced parts of a video to produce
  5650. progressive frames.
  5651. The description of the accepted parameters follows.
  5652. @table @option
  5653. @item thresh
  5654. Set the threshold which affects the filter's tolerance when
  5655. determining if a pixel line must be processed. It must be an integer
  5656. in the range [0,255] and defaults to 10. A value of 0 will result in
  5657. applying the process on every pixels.
  5658. @item map
  5659. Paint pixels exceeding the threshold value to white if set to 1.
  5660. Default is 0.
  5661. @item order
  5662. Set the fields order. Swap fields if set to 1, leave fields alone if
  5663. 0. Default is 0.
  5664. @item sharp
  5665. Enable additional sharpening if set to 1. Default is 0.
  5666. @item twoway
  5667. Enable twoway sharpening if set to 1. Default is 0.
  5668. @end table
  5669. @subsection Examples
  5670. @itemize
  5671. @item
  5672. Apply default values:
  5673. @example
  5674. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  5675. @end example
  5676. @item
  5677. Enable additional sharpening:
  5678. @example
  5679. kerndeint=sharp=1
  5680. @end example
  5681. @item
  5682. Paint processed pixels in white:
  5683. @example
  5684. kerndeint=map=1
  5685. @end example
  5686. @end itemize
  5687. @section lenscorrection
  5688. Correct radial lens distortion
  5689. This filter can be used to correct for radial distortion as can result from the use
  5690. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  5691. one can use tools available for example as part of opencv or simply trial-and-error.
  5692. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  5693. and extract the k1 and k2 coefficients from the resulting matrix.
  5694. Note that effectively the same filter is available in the open-source tools Krita and
  5695. Digikam from the KDE project.
  5696. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  5697. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  5698. brightness distribution, so you may want to use both filters together in certain
  5699. cases, though you will have to take care of ordering, i.e. whether vignetting should
  5700. be applied before or after lens correction.
  5701. @subsection Options
  5702. The filter accepts the following options:
  5703. @table @option
  5704. @item cx
  5705. Relative x-coordinate of the focal point of the image, and thereby the center of the
  5706. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5707. width.
  5708. @item cy
  5709. Relative y-coordinate of the focal point of the image, and thereby the center of the
  5710. distortion. This value has a range [0,1] and is expressed as fractions of the image
  5711. height.
  5712. @item k1
  5713. Coefficient of the quadratic correction term. 0.5 means no correction.
  5714. @item k2
  5715. Coefficient of the double quadratic correction term. 0.5 means no correction.
  5716. @end table
  5717. The formula that generates the correction is:
  5718. @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)
  5719. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  5720. distances from the focal point in the source and target images, respectively.
  5721. @anchor{lut3d}
  5722. @section lut3d
  5723. Apply a 3D LUT to an input video.
  5724. The filter accepts the following options:
  5725. @table @option
  5726. @item file
  5727. Set the 3D LUT file name.
  5728. Currently supported formats:
  5729. @table @samp
  5730. @item 3dl
  5731. AfterEffects
  5732. @item cube
  5733. Iridas
  5734. @item dat
  5735. DaVinci
  5736. @item m3d
  5737. Pandora
  5738. @end table
  5739. @item interp
  5740. Select interpolation mode.
  5741. Available values are:
  5742. @table @samp
  5743. @item nearest
  5744. Use values from the nearest defined point.
  5745. @item trilinear
  5746. Interpolate values using the 8 points defining a cube.
  5747. @item tetrahedral
  5748. Interpolate values using a tetrahedron.
  5749. @end table
  5750. @end table
  5751. @section lut, lutrgb, lutyuv
  5752. Compute a look-up table for binding each pixel component input value
  5753. to an output value, and apply it to the input video.
  5754. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  5755. to an RGB input video.
  5756. These filters accept the following parameters:
  5757. @table @option
  5758. @item c0
  5759. set first pixel component expression
  5760. @item c1
  5761. set second pixel component expression
  5762. @item c2
  5763. set third pixel component expression
  5764. @item c3
  5765. set fourth pixel component expression, corresponds to the alpha component
  5766. @item r
  5767. set red component expression
  5768. @item g
  5769. set green component expression
  5770. @item b
  5771. set blue component expression
  5772. @item a
  5773. alpha component expression
  5774. @item y
  5775. set Y/luminance component expression
  5776. @item u
  5777. set U/Cb component expression
  5778. @item v
  5779. set V/Cr component expression
  5780. @end table
  5781. Each of them specifies the expression to use for computing the lookup table for
  5782. the corresponding pixel component values.
  5783. The exact component associated to each of the @var{c*} options depends on the
  5784. format in input.
  5785. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  5786. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  5787. The expressions can contain the following constants and functions:
  5788. @table @option
  5789. @item w
  5790. @item h
  5791. The input width and height.
  5792. @item val
  5793. The input value for the pixel component.
  5794. @item clipval
  5795. The input value, clipped to the @var{minval}-@var{maxval} range.
  5796. @item maxval
  5797. The maximum value for the pixel component.
  5798. @item minval
  5799. The minimum value for the pixel component.
  5800. @item negval
  5801. The negated value for the pixel component value, clipped to the
  5802. @var{minval}-@var{maxval} range; it corresponds to the expression
  5803. "maxval-clipval+minval".
  5804. @item clip(val)
  5805. The computed value in @var{val}, clipped to the
  5806. @var{minval}-@var{maxval} range.
  5807. @item gammaval(gamma)
  5808. The computed gamma correction value of the pixel component value,
  5809. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  5810. expression
  5811. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  5812. @end table
  5813. All expressions default to "val".
  5814. @subsection Examples
  5815. @itemize
  5816. @item
  5817. Negate input video:
  5818. @example
  5819. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  5820. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  5821. @end example
  5822. The above is the same as:
  5823. @example
  5824. lutrgb="r=negval:g=negval:b=negval"
  5825. lutyuv="y=negval:u=negval:v=negval"
  5826. @end example
  5827. @item
  5828. Negate luminance:
  5829. @example
  5830. lutyuv=y=negval
  5831. @end example
  5832. @item
  5833. Remove chroma components, turning the video into a graytone image:
  5834. @example
  5835. lutyuv="u=128:v=128"
  5836. @end example
  5837. @item
  5838. Apply a luma burning effect:
  5839. @example
  5840. lutyuv="y=2*val"
  5841. @end example
  5842. @item
  5843. Remove green and blue components:
  5844. @example
  5845. lutrgb="g=0:b=0"
  5846. @end example
  5847. @item
  5848. Set a constant alpha channel value on input:
  5849. @example
  5850. format=rgba,lutrgb=a="maxval-minval/2"
  5851. @end example
  5852. @item
  5853. Correct luminance gamma by a factor of 0.5:
  5854. @example
  5855. lutyuv=y=gammaval(0.5)
  5856. @end example
  5857. @item
  5858. Discard least significant bits of luma:
  5859. @example
  5860. lutyuv=y='bitand(val, 128+64+32)'
  5861. @end example
  5862. @end itemize
  5863. @section maskedmerge
  5864. Merge the first input stream with the second input stream using per pixel
  5865. weights in the third input stream.
  5866. A value of 0 in the third stream pixel component means that pixel component
  5867. from first stream is returned unchanged, while maximum value (eg. 255 for
  5868. 8-bit videos) means that pixel component from second stream is returned
  5869. unchanged. Intermediate values define the amount of merging between both
  5870. input stream's pixel components.
  5871. This filter accepts the following options:
  5872. @table @option
  5873. @item planes
  5874. Set which planes will be processed as bitmap, unprocessed planes will be
  5875. copied from first stream.
  5876. By default value 0xf, all planes will be processed.
  5877. @end table
  5878. @section mcdeint
  5879. Apply motion-compensation deinterlacing.
  5880. It needs one field per frame as input and must thus be used together
  5881. with yadif=1/3 or equivalent.
  5882. This filter accepts the following options:
  5883. @table @option
  5884. @item mode
  5885. Set the deinterlacing mode.
  5886. It accepts one of the following values:
  5887. @table @samp
  5888. @item fast
  5889. @item medium
  5890. @item slow
  5891. use iterative motion estimation
  5892. @item extra_slow
  5893. like @samp{slow}, but use multiple reference frames.
  5894. @end table
  5895. Default value is @samp{fast}.
  5896. @item parity
  5897. Set the picture field parity assumed for the input video. It must be
  5898. one of the following values:
  5899. @table @samp
  5900. @item 0, tff
  5901. assume top field first
  5902. @item 1, bff
  5903. assume bottom field first
  5904. @end table
  5905. Default value is @samp{bff}.
  5906. @item qp
  5907. Set per-block quantization parameter (QP) used by the internal
  5908. encoder.
  5909. Higher values should result in a smoother motion vector field but less
  5910. optimal individual vectors. Default value is 1.
  5911. @end table
  5912. @section mergeplanes
  5913. Merge color channel components from several video streams.
  5914. The filter accepts up to 4 input streams, and merge selected input
  5915. planes to the output video.
  5916. This filter accepts the following options:
  5917. @table @option
  5918. @item mapping
  5919. Set input to output plane mapping. Default is @code{0}.
  5920. The mappings is specified as a bitmap. It should be specified as a
  5921. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  5922. mapping for the first plane of the output stream. 'A' sets the number of
  5923. the input stream to use (from 0 to 3), and 'a' the plane number of the
  5924. corresponding input to use (from 0 to 3). The rest of the mappings is
  5925. similar, 'Bb' describes the mapping for the output stream second
  5926. plane, 'Cc' describes the mapping for the output stream third plane and
  5927. 'Dd' describes the mapping for the output stream fourth plane.
  5928. @item format
  5929. Set output pixel format. Default is @code{yuva444p}.
  5930. @end table
  5931. @subsection Examples
  5932. @itemize
  5933. @item
  5934. Merge three gray video streams of same width and height into single video stream:
  5935. @example
  5936. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  5937. @end example
  5938. @item
  5939. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  5940. @example
  5941. [a0][a1]mergeplanes=0x00010210:yuva444p
  5942. @end example
  5943. @item
  5944. Swap Y and A plane in yuva444p stream:
  5945. @example
  5946. format=yuva444p,mergeplanes=0x03010200:yuva444p
  5947. @end example
  5948. @item
  5949. Swap U and V plane in yuv420p stream:
  5950. @example
  5951. format=yuv420p,mergeplanes=0x000201:yuv420p
  5952. @end example
  5953. @item
  5954. Cast a rgb24 clip to yuv444p:
  5955. @example
  5956. format=rgb24,mergeplanes=0x000102:yuv444p
  5957. @end example
  5958. @end itemize
  5959. @section mpdecimate
  5960. Drop frames that do not differ greatly from the previous frame in
  5961. order to reduce frame rate.
  5962. The main use of this filter is for very-low-bitrate encoding
  5963. (e.g. streaming over dialup modem), but it could in theory be used for
  5964. fixing movies that were inverse-telecined incorrectly.
  5965. A description of the accepted options follows.
  5966. @table @option
  5967. @item max
  5968. Set the maximum number of consecutive frames which can be dropped (if
  5969. positive), or the minimum interval between dropped frames (if
  5970. negative). If the value is 0, the frame is dropped unregarding the
  5971. number of previous sequentially dropped frames.
  5972. Default value is 0.
  5973. @item hi
  5974. @item lo
  5975. @item frac
  5976. Set the dropping threshold values.
  5977. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  5978. represent actual pixel value differences, so a threshold of 64
  5979. corresponds to 1 unit of difference for each pixel, or the same spread
  5980. out differently over the block.
  5981. A frame is a candidate for dropping if no 8x8 blocks differ by more
  5982. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  5983. meaning the whole image) differ by more than a threshold of @option{lo}.
  5984. Default value for @option{hi} is 64*12, default value for @option{lo} is
  5985. 64*5, and default value for @option{frac} is 0.33.
  5986. @end table
  5987. @section negate
  5988. Negate input video.
  5989. It accepts an integer in input; if non-zero it negates the
  5990. alpha component (if available). The default value in input is 0.
  5991. @section noformat
  5992. Force libavfilter not to use any of the specified pixel formats for the
  5993. input to the next filter.
  5994. It accepts the following parameters:
  5995. @table @option
  5996. @item pix_fmts
  5997. A '|'-separated list of pixel format names, such as
  5998. apix_fmts=yuv420p|monow|rgb24".
  5999. @end table
  6000. @subsection Examples
  6001. @itemize
  6002. @item
  6003. Force libavfilter to use a format different from @var{yuv420p} for the
  6004. input to the vflip filter:
  6005. @example
  6006. noformat=pix_fmts=yuv420p,vflip
  6007. @end example
  6008. @item
  6009. Convert the input video to any of the formats not contained in the list:
  6010. @example
  6011. noformat=yuv420p|yuv444p|yuv410p
  6012. @end example
  6013. @end itemize
  6014. @section noise
  6015. Add noise on video input frame.
  6016. The filter accepts the following options:
  6017. @table @option
  6018. @item all_seed
  6019. @item c0_seed
  6020. @item c1_seed
  6021. @item c2_seed
  6022. @item c3_seed
  6023. Set noise seed for specific pixel component or all pixel components in case
  6024. of @var{all_seed}. Default value is @code{123457}.
  6025. @item all_strength, alls
  6026. @item c0_strength, c0s
  6027. @item c1_strength, c1s
  6028. @item c2_strength, c2s
  6029. @item c3_strength, c3s
  6030. Set noise strength for specific pixel component or all pixel components in case
  6031. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6032. @item all_flags, allf
  6033. @item c0_flags, c0f
  6034. @item c1_flags, c1f
  6035. @item c2_flags, c2f
  6036. @item c3_flags, c3f
  6037. Set pixel component flags or set flags for all components if @var{all_flags}.
  6038. Available values for component flags are:
  6039. @table @samp
  6040. @item a
  6041. averaged temporal noise (smoother)
  6042. @item p
  6043. mix random noise with a (semi)regular pattern
  6044. @item t
  6045. temporal noise (noise pattern changes between frames)
  6046. @item u
  6047. uniform noise (gaussian otherwise)
  6048. @end table
  6049. @end table
  6050. @subsection Examples
  6051. Add temporal and uniform noise to input video:
  6052. @example
  6053. noise=alls=20:allf=t+u
  6054. @end example
  6055. @section null
  6056. Pass the video source unchanged to the output.
  6057. @section ocr
  6058. Optical Character Recognition
  6059. This filter uses Tesseract for optical character recognition.
  6060. It accepts the following options:
  6061. @table @option
  6062. @item datapath
  6063. Set datapath to tesseract data. Default is to use whatever was
  6064. set at installation.
  6065. @item language
  6066. Set language, default is "eng".
  6067. @item whitelist
  6068. Set character whitelist.
  6069. @item blacklist
  6070. Set character blacklist.
  6071. @end table
  6072. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6073. @section ocv
  6074. Apply a video transform using libopencv.
  6075. To enable this filter, install the libopencv library and headers and
  6076. configure FFmpeg with @code{--enable-libopencv}.
  6077. It accepts the following parameters:
  6078. @table @option
  6079. @item filter_name
  6080. The name of the libopencv filter to apply.
  6081. @item filter_params
  6082. The parameters to pass to the libopencv filter. If not specified, the default
  6083. values are assumed.
  6084. @end table
  6085. Refer to the official libopencv documentation for more precise
  6086. information:
  6087. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6088. Several libopencv filters are supported; see the following subsections.
  6089. @anchor{dilate}
  6090. @subsection dilate
  6091. Dilate an image by using a specific structuring element.
  6092. It corresponds to the libopencv function @code{cvDilate}.
  6093. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6094. @var{struct_el} represents a structuring element, and has the syntax:
  6095. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6096. @var{cols} and @var{rows} represent the number of columns and rows of
  6097. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6098. point, and @var{shape} the shape for the structuring element. @var{shape}
  6099. must be "rect", "cross", "ellipse", or "custom".
  6100. If the value for @var{shape} is "custom", it must be followed by a
  6101. string of the form "=@var{filename}". The file with name
  6102. @var{filename} is assumed to represent a binary image, with each
  6103. printable character corresponding to a bright pixel. When a custom
  6104. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6105. or columns and rows of the read file are assumed instead.
  6106. The default value for @var{struct_el} is "3x3+0x0/rect".
  6107. @var{nb_iterations} specifies the number of times the transform is
  6108. applied to the image, and defaults to 1.
  6109. Some examples:
  6110. @example
  6111. # Use the default values
  6112. ocv=dilate
  6113. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6114. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6115. # Read the shape from the file diamond.shape, iterating two times.
  6116. # The file diamond.shape may contain a pattern of characters like this
  6117. # *
  6118. # ***
  6119. # *****
  6120. # ***
  6121. # *
  6122. # The specified columns and rows are ignored
  6123. # but the anchor point coordinates are not
  6124. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6125. @end example
  6126. @subsection erode
  6127. Erode an image by using a specific structuring element.
  6128. It corresponds to the libopencv function @code{cvErode}.
  6129. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6130. with the same syntax and semantics as the @ref{dilate} filter.
  6131. @subsection smooth
  6132. Smooth the input video.
  6133. The filter takes the following parameters:
  6134. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6135. @var{type} is the type of smooth filter to apply, and must be one of
  6136. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6137. or "bilateral". The default value is "gaussian".
  6138. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6139. depend on the smooth type. @var{param1} and
  6140. @var{param2} accept integer positive values or 0. @var{param3} and
  6141. @var{param4} accept floating point values.
  6142. The default value for @var{param1} is 3. The default value for the
  6143. other parameters is 0.
  6144. These parameters correspond to the parameters assigned to the
  6145. libopencv function @code{cvSmooth}.
  6146. @anchor{overlay}
  6147. @section overlay
  6148. Overlay one video on top of another.
  6149. It takes two inputs and has one output. The first input is the "main"
  6150. video on which the second input is overlaid.
  6151. It accepts the following parameters:
  6152. A description of the accepted options follows.
  6153. @table @option
  6154. @item x
  6155. @item y
  6156. Set the expression for the x and y coordinates of the overlaid video
  6157. on the main video. Default value is "0" for both expressions. In case
  6158. the expression is invalid, it is set to a huge value (meaning that the
  6159. overlay will not be displayed within the output visible area).
  6160. @item eof_action
  6161. The action to take when EOF is encountered on the secondary input; it accepts
  6162. one of the following values:
  6163. @table @option
  6164. @item repeat
  6165. Repeat the last frame (the default).
  6166. @item endall
  6167. End both streams.
  6168. @item pass
  6169. Pass the main input through.
  6170. @end table
  6171. @item eval
  6172. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6173. It accepts the following values:
  6174. @table @samp
  6175. @item init
  6176. only evaluate expressions once during the filter initialization or
  6177. when a command is processed
  6178. @item frame
  6179. evaluate expressions for each incoming frame
  6180. @end table
  6181. Default value is @samp{frame}.
  6182. @item shortest
  6183. If set to 1, force the output to terminate when the shortest input
  6184. terminates. Default value is 0.
  6185. @item format
  6186. Set the format for the output video.
  6187. It accepts the following values:
  6188. @table @samp
  6189. @item yuv420
  6190. force YUV420 output
  6191. @item yuv422
  6192. force YUV422 output
  6193. @item yuv444
  6194. force YUV444 output
  6195. @item rgb
  6196. force RGB output
  6197. @end table
  6198. Default value is @samp{yuv420}.
  6199. @item rgb @emph{(deprecated)}
  6200. If set to 1, force the filter to accept inputs in the RGB
  6201. color space. Default value is 0. This option is deprecated, use
  6202. @option{format} instead.
  6203. @item repeatlast
  6204. If set to 1, force the filter to draw the last overlay frame over the
  6205. main input until the end of the stream. A value of 0 disables this
  6206. behavior. Default value is 1.
  6207. @end table
  6208. The @option{x}, and @option{y} expressions can contain the following
  6209. parameters.
  6210. @table @option
  6211. @item main_w, W
  6212. @item main_h, H
  6213. The main input width and height.
  6214. @item overlay_w, w
  6215. @item overlay_h, h
  6216. The overlay input width and height.
  6217. @item x
  6218. @item y
  6219. The computed values for @var{x} and @var{y}. They are evaluated for
  6220. each new frame.
  6221. @item hsub
  6222. @item vsub
  6223. horizontal and vertical chroma subsample values of the output
  6224. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6225. @var{vsub} is 1.
  6226. @item n
  6227. the number of input frame, starting from 0
  6228. @item pos
  6229. the position in the file of the input frame, NAN if unknown
  6230. @item t
  6231. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6232. @end table
  6233. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6234. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6235. when @option{eval} is set to @samp{init}.
  6236. Be aware that frames are taken from each input video in timestamp
  6237. order, hence, if their initial timestamps differ, it is a good idea
  6238. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6239. have them begin in the same zero timestamp, as the example for
  6240. the @var{movie} filter does.
  6241. You can chain together more overlays but you should test the
  6242. efficiency of such approach.
  6243. @subsection Commands
  6244. This filter supports the following commands:
  6245. @table @option
  6246. @item x
  6247. @item y
  6248. Modify the x and y of the overlay input.
  6249. The command accepts the same syntax of the corresponding option.
  6250. If the specified expression is not valid, it is kept at its current
  6251. value.
  6252. @end table
  6253. @subsection Examples
  6254. @itemize
  6255. @item
  6256. Draw the overlay at 10 pixels from the bottom right corner of the main
  6257. video:
  6258. @example
  6259. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6260. @end example
  6261. Using named options the example above becomes:
  6262. @example
  6263. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6264. @end example
  6265. @item
  6266. Insert a transparent PNG logo in the bottom left corner of the input,
  6267. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6268. @example
  6269. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6270. @end example
  6271. @item
  6272. Insert 2 different transparent PNG logos (second logo on bottom
  6273. right corner) using the @command{ffmpeg} tool:
  6274. @example
  6275. 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
  6276. @end example
  6277. @item
  6278. Add a transparent color layer on top of the main video; @code{WxH}
  6279. must specify the size of the main input to the overlay filter:
  6280. @example
  6281. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6282. @end example
  6283. @item
  6284. Play an original video and a filtered version (here with the deshake
  6285. filter) side by side using the @command{ffplay} tool:
  6286. @example
  6287. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6288. @end example
  6289. The above command is the same as:
  6290. @example
  6291. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6292. @end example
  6293. @item
  6294. Make a sliding overlay appearing from the left to the right top part of the
  6295. screen starting since time 2:
  6296. @example
  6297. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6298. @end example
  6299. @item
  6300. Compose output by putting two input videos side to side:
  6301. @example
  6302. ffmpeg -i left.avi -i right.avi -filter_complex "
  6303. nullsrc=size=200x100 [background];
  6304. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6305. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6306. [background][left] overlay=shortest=1 [background+left];
  6307. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6308. "
  6309. @end example
  6310. @item
  6311. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6312. @example
  6313. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6314. -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]'
  6315. masked.avi
  6316. @end example
  6317. @item
  6318. Chain several overlays in cascade:
  6319. @example
  6320. nullsrc=s=200x200 [bg];
  6321. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6322. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6323. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6324. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6325. [in3] null, [mid2] overlay=100:100 [out0]
  6326. @end example
  6327. @end itemize
  6328. @section owdenoise
  6329. Apply Overcomplete Wavelet denoiser.
  6330. The filter accepts the following options:
  6331. @table @option
  6332. @item depth
  6333. Set depth.
  6334. Larger depth values will denoise lower frequency components more, but
  6335. slow down filtering.
  6336. Must be an int in the range 8-16, default is @code{8}.
  6337. @item luma_strength, ls
  6338. Set luma strength.
  6339. Must be a double value in the range 0-1000, default is @code{1.0}.
  6340. @item chroma_strength, cs
  6341. Set chroma strength.
  6342. Must be a double value in the range 0-1000, default is @code{1.0}.
  6343. @end table
  6344. @anchor{pad}
  6345. @section pad
  6346. Add paddings to the input image, and place the original input at the
  6347. provided @var{x}, @var{y} coordinates.
  6348. It accepts the following parameters:
  6349. @table @option
  6350. @item width, w
  6351. @item height, h
  6352. Specify an expression for the size of the output image with the
  6353. paddings added. If the value for @var{width} or @var{height} is 0, the
  6354. corresponding input size is used for the output.
  6355. The @var{width} expression can reference the value set by the
  6356. @var{height} expression, and vice versa.
  6357. The default value of @var{width} and @var{height} is 0.
  6358. @item x
  6359. @item y
  6360. Specify the offsets to place the input image at within the padded area,
  6361. with respect to the top/left border of the output image.
  6362. The @var{x} expression can reference the value set by the @var{y}
  6363. expression, and vice versa.
  6364. The default value of @var{x} and @var{y} is 0.
  6365. @item color
  6366. Specify the color of the padded area. For the syntax of this option,
  6367. check the "Color" section in the ffmpeg-utils manual.
  6368. The default value of @var{color} is "black".
  6369. @end table
  6370. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6371. options are expressions containing the following constants:
  6372. @table @option
  6373. @item in_w
  6374. @item in_h
  6375. The input video width and height.
  6376. @item iw
  6377. @item ih
  6378. These are the same as @var{in_w} and @var{in_h}.
  6379. @item out_w
  6380. @item out_h
  6381. The output width and height (the size of the padded area), as
  6382. specified by the @var{width} and @var{height} expressions.
  6383. @item ow
  6384. @item oh
  6385. These are the same as @var{out_w} and @var{out_h}.
  6386. @item x
  6387. @item y
  6388. The x and y offsets as specified by the @var{x} and @var{y}
  6389. expressions, or NAN if not yet specified.
  6390. @item a
  6391. same as @var{iw} / @var{ih}
  6392. @item sar
  6393. input sample aspect ratio
  6394. @item dar
  6395. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6396. @item hsub
  6397. @item vsub
  6398. The horizontal and vertical chroma subsample values. For example for the
  6399. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6400. @end table
  6401. @subsection Examples
  6402. @itemize
  6403. @item
  6404. Add paddings with the color "violet" to the input video. The output video
  6405. size is 640x480, and the top-left corner of the input video is placed at
  6406. column 0, row 40
  6407. @example
  6408. pad=640:480:0:40:violet
  6409. @end example
  6410. The example above is equivalent to the following command:
  6411. @example
  6412. pad=width=640:height=480:x=0:y=40:color=violet
  6413. @end example
  6414. @item
  6415. Pad the input to get an output with dimensions increased by 3/2,
  6416. and put the input video at the center of the padded area:
  6417. @example
  6418. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6419. @end example
  6420. @item
  6421. Pad the input to get a squared output with size equal to the maximum
  6422. value between the input width and height, and put the input video at
  6423. the center of the padded area:
  6424. @example
  6425. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6426. @end example
  6427. @item
  6428. Pad the input to get a final w/h ratio of 16:9:
  6429. @example
  6430. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6431. @end example
  6432. @item
  6433. In case of anamorphic video, in order to set the output display aspect
  6434. correctly, it is necessary to use @var{sar} in the expression,
  6435. according to the relation:
  6436. @example
  6437. (ih * X / ih) * sar = output_dar
  6438. X = output_dar / sar
  6439. @end example
  6440. Thus the previous example needs to be modified to:
  6441. @example
  6442. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6443. @end example
  6444. @item
  6445. Double the output size and put the input video in the bottom-right
  6446. corner of the output padded area:
  6447. @example
  6448. pad="2*iw:2*ih:ow-iw:oh-ih"
  6449. @end example
  6450. @end itemize
  6451. @anchor{palettegen}
  6452. @section palettegen
  6453. Generate one palette for a whole video stream.
  6454. It accepts the following options:
  6455. @table @option
  6456. @item max_colors
  6457. Set the maximum number of colors to quantize in the palette.
  6458. Note: the palette will still contain 256 colors; the unused palette entries
  6459. will be black.
  6460. @item reserve_transparent
  6461. Create a palette of 255 colors maximum and reserve the last one for
  6462. transparency. Reserving the transparency color is useful for GIF optimization.
  6463. If not set, the maximum of colors in the palette will be 256. You probably want
  6464. to disable this option for a standalone image.
  6465. Set by default.
  6466. @item stats_mode
  6467. Set statistics mode.
  6468. It accepts the following values:
  6469. @table @samp
  6470. @item full
  6471. Compute full frame histograms.
  6472. @item diff
  6473. Compute histograms only for the part that differs from previous frame. This
  6474. might be relevant to give more importance to the moving part of your input if
  6475. the background is static.
  6476. @end table
  6477. Default value is @var{full}.
  6478. @end table
  6479. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  6480. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  6481. color quantization of the palette. This information is also visible at
  6482. @var{info} logging level.
  6483. @subsection Examples
  6484. @itemize
  6485. @item
  6486. Generate a representative palette of a given video using @command{ffmpeg}:
  6487. @example
  6488. ffmpeg -i input.mkv -vf palettegen palette.png
  6489. @end example
  6490. @end itemize
  6491. @section paletteuse
  6492. Use a palette to downsample an input video stream.
  6493. The filter takes two inputs: one video stream and a palette. The palette must
  6494. be a 256 pixels image.
  6495. It accepts the following options:
  6496. @table @option
  6497. @item dither
  6498. Select dithering mode. Available algorithms are:
  6499. @table @samp
  6500. @item bayer
  6501. Ordered 8x8 bayer dithering (deterministic)
  6502. @item heckbert
  6503. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  6504. Note: this dithering is sometimes considered "wrong" and is included as a
  6505. reference.
  6506. @item floyd_steinberg
  6507. Floyd and Steingberg dithering (error diffusion)
  6508. @item sierra2
  6509. Frankie Sierra dithering v2 (error diffusion)
  6510. @item sierra2_4a
  6511. Frankie Sierra dithering v2 "Lite" (error diffusion)
  6512. @end table
  6513. Default is @var{sierra2_4a}.
  6514. @item bayer_scale
  6515. When @var{bayer} dithering is selected, this option defines the scale of the
  6516. pattern (how much the crosshatch pattern is visible). A low value means more
  6517. visible pattern for less banding, and higher value means less visible pattern
  6518. at the cost of more banding.
  6519. The option must be an integer value in the range [0,5]. Default is @var{2}.
  6520. @item diff_mode
  6521. If set, define the zone to process
  6522. @table @samp
  6523. @item rectangle
  6524. Only the changing rectangle will be reprocessed. This is similar to GIF
  6525. cropping/offsetting compression mechanism. This option can be useful for speed
  6526. if only a part of the image is changing, and has use cases such as limiting the
  6527. scope of the error diffusal @option{dither} to the rectangle that bounds the
  6528. moving scene (it leads to more deterministic output if the scene doesn't change
  6529. much, and as a result less moving noise and better GIF compression).
  6530. @end table
  6531. Default is @var{none}.
  6532. @end table
  6533. @subsection Examples
  6534. @itemize
  6535. @item
  6536. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  6537. using @command{ffmpeg}:
  6538. @example
  6539. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  6540. @end example
  6541. @end itemize
  6542. @section perspective
  6543. Correct perspective of video not recorded perpendicular to the screen.
  6544. A description of the accepted parameters follows.
  6545. @table @option
  6546. @item x0
  6547. @item y0
  6548. @item x1
  6549. @item y1
  6550. @item x2
  6551. @item y2
  6552. @item x3
  6553. @item y3
  6554. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  6555. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  6556. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  6557. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  6558. then the corners of the source will be sent to the specified coordinates.
  6559. The expressions can use the following variables:
  6560. @table @option
  6561. @item W
  6562. @item H
  6563. the width and height of video frame.
  6564. @end table
  6565. @item interpolation
  6566. Set interpolation for perspective correction.
  6567. It accepts the following values:
  6568. @table @samp
  6569. @item linear
  6570. @item cubic
  6571. @end table
  6572. Default value is @samp{linear}.
  6573. @item sense
  6574. Set interpretation of coordinate options.
  6575. It accepts the following values:
  6576. @table @samp
  6577. @item 0, source
  6578. Send point in the source specified by the given coordinates to
  6579. the corners of the destination.
  6580. @item 1, destination
  6581. Send the corners of the source to the point in the destination specified
  6582. by the given coordinates.
  6583. Default value is @samp{source}.
  6584. @end table
  6585. @end table
  6586. @section phase
  6587. Delay interlaced video by one field time so that the field order changes.
  6588. The intended use is to fix PAL movies that have been captured with the
  6589. opposite field order to the film-to-video transfer.
  6590. A description of the accepted parameters follows.
  6591. @table @option
  6592. @item mode
  6593. Set phase mode.
  6594. It accepts the following values:
  6595. @table @samp
  6596. @item t
  6597. Capture field order top-first, transfer bottom-first.
  6598. Filter will delay the bottom field.
  6599. @item b
  6600. Capture field order bottom-first, transfer top-first.
  6601. Filter will delay the top field.
  6602. @item p
  6603. Capture and transfer with the same field order. This mode only exists
  6604. for the documentation of the other options to refer to, but if you
  6605. actually select it, the filter will faithfully do nothing.
  6606. @item a
  6607. Capture field order determined automatically by field flags, transfer
  6608. opposite.
  6609. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  6610. basis using field flags. If no field information is available,
  6611. then this works just like @samp{u}.
  6612. @item u
  6613. Capture unknown or varying, transfer opposite.
  6614. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  6615. analyzing the images and selecting the alternative that produces best
  6616. match between the fields.
  6617. @item T
  6618. Capture top-first, transfer unknown or varying.
  6619. Filter selects among @samp{t} and @samp{p} using image analysis.
  6620. @item B
  6621. Capture bottom-first, transfer unknown or varying.
  6622. Filter selects among @samp{b} and @samp{p} using image analysis.
  6623. @item A
  6624. Capture determined by field flags, transfer unknown or varying.
  6625. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  6626. image analysis. If no field information is available, then this works just
  6627. like @samp{U}. This is the default mode.
  6628. @item U
  6629. Both capture and transfer unknown or varying.
  6630. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  6631. @end table
  6632. @end table
  6633. @section pixdesctest
  6634. Pixel format descriptor test filter, mainly useful for internal
  6635. testing. The output video should be equal to the input video.
  6636. For example:
  6637. @example
  6638. format=monow, pixdesctest
  6639. @end example
  6640. can be used to test the monowhite pixel format descriptor definition.
  6641. @section pp
  6642. Enable the specified chain of postprocessing subfilters using libpostproc. This
  6643. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  6644. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  6645. Each subfilter and some options have a short and a long name that can be used
  6646. interchangeably, i.e. dr/dering are the same.
  6647. The filters accept the following options:
  6648. @table @option
  6649. @item subfilters
  6650. Set postprocessing subfilters string.
  6651. @end table
  6652. All subfilters share common options to determine their scope:
  6653. @table @option
  6654. @item a/autoq
  6655. Honor the quality commands for this subfilter.
  6656. @item c/chrom
  6657. Do chrominance filtering, too (default).
  6658. @item y/nochrom
  6659. Do luminance filtering only (no chrominance).
  6660. @item n/noluma
  6661. Do chrominance filtering only (no luminance).
  6662. @end table
  6663. These options can be appended after the subfilter name, separated by a '|'.
  6664. Available subfilters are:
  6665. @table @option
  6666. @item hb/hdeblock[|difference[|flatness]]
  6667. Horizontal deblocking filter
  6668. @table @option
  6669. @item difference
  6670. Difference factor where higher values mean more deblocking (default: @code{32}).
  6671. @item flatness
  6672. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6673. @end table
  6674. @item vb/vdeblock[|difference[|flatness]]
  6675. Vertical deblocking filter
  6676. @table @option
  6677. @item difference
  6678. Difference factor where higher values mean more deblocking (default: @code{32}).
  6679. @item flatness
  6680. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6681. @end table
  6682. @item ha/hadeblock[|difference[|flatness]]
  6683. Accurate horizontal deblocking filter
  6684. @table @option
  6685. @item difference
  6686. Difference factor where higher values mean more deblocking (default: @code{32}).
  6687. @item flatness
  6688. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6689. @end table
  6690. @item va/vadeblock[|difference[|flatness]]
  6691. Accurate vertical deblocking filter
  6692. @table @option
  6693. @item difference
  6694. Difference factor where higher values mean more deblocking (default: @code{32}).
  6695. @item flatness
  6696. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  6697. @end table
  6698. @end table
  6699. The horizontal and vertical deblocking filters share the difference and
  6700. flatness values so you cannot set different horizontal and vertical
  6701. thresholds.
  6702. @table @option
  6703. @item h1/x1hdeblock
  6704. Experimental horizontal deblocking filter
  6705. @item v1/x1vdeblock
  6706. Experimental vertical deblocking filter
  6707. @item dr/dering
  6708. Deringing filter
  6709. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  6710. @table @option
  6711. @item threshold1
  6712. larger -> stronger filtering
  6713. @item threshold2
  6714. larger -> stronger filtering
  6715. @item threshold3
  6716. larger -> stronger filtering
  6717. @end table
  6718. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  6719. @table @option
  6720. @item f/fullyrange
  6721. Stretch luminance to @code{0-255}.
  6722. @end table
  6723. @item lb/linblenddeint
  6724. Linear blend deinterlacing filter that deinterlaces the given block by
  6725. filtering all lines with a @code{(1 2 1)} filter.
  6726. @item li/linipoldeint
  6727. Linear interpolating deinterlacing filter that deinterlaces the given block by
  6728. linearly interpolating every second line.
  6729. @item ci/cubicipoldeint
  6730. Cubic interpolating deinterlacing filter deinterlaces the given block by
  6731. cubically interpolating every second line.
  6732. @item md/mediandeint
  6733. Median deinterlacing filter that deinterlaces the given block by applying a
  6734. median filter to every second line.
  6735. @item fd/ffmpegdeint
  6736. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  6737. second line with a @code{(-1 4 2 4 -1)} filter.
  6738. @item l5/lowpass5
  6739. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  6740. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  6741. @item fq/forceQuant[|quantizer]
  6742. Overrides the quantizer table from the input with the constant quantizer you
  6743. specify.
  6744. @table @option
  6745. @item quantizer
  6746. Quantizer to use
  6747. @end table
  6748. @item de/default
  6749. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  6750. @item fa/fast
  6751. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  6752. @item ac
  6753. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  6754. @end table
  6755. @subsection Examples
  6756. @itemize
  6757. @item
  6758. Apply horizontal and vertical deblocking, deringing and automatic
  6759. brightness/contrast:
  6760. @example
  6761. pp=hb/vb/dr/al
  6762. @end example
  6763. @item
  6764. Apply default filters without brightness/contrast correction:
  6765. @example
  6766. pp=de/-al
  6767. @end example
  6768. @item
  6769. Apply default filters and temporal denoiser:
  6770. @example
  6771. pp=default/tmpnoise|1|2|3
  6772. @end example
  6773. @item
  6774. Apply deblocking on luminance only, and switch vertical deblocking on or off
  6775. automatically depending on available CPU time:
  6776. @example
  6777. pp=hb|y/vb|a
  6778. @end example
  6779. @end itemize
  6780. @section pp7
  6781. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  6782. similar to spp = 6 with 7 point DCT, where only the center sample is
  6783. used after IDCT.
  6784. The filter accepts the following options:
  6785. @table @option
  6786. @item qp
  6787. Force a constant quantization parameter. It accepts an integer in range
  6788. 0 to 63. If not set, the filter will use the QP from the video stream
  6789. (if available).
  6790. @item mode
  6791. Set thresholding mode. Available modes are:
  6792. @table @samp
  6793. @item hard
  6794. Set hard thresholding.
  6795. @item soft
  6796. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6797. @item medium
  6798. Set medium thresholding (good results, default).
  6799. @end table
  6800. @end table
  6801. @section psnr
  6802. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  6803. Ratio) between two input videos.
  6804. This filter takes in input two input videos, the first input is
  6805. considered the "main" source and is passed unchanged to the
  6806. output. The second input is used as a "reference" video for computing
  6807. the PSNR.
  6808. Both video inputs must have the same resolution and pixel format for
  6809. this filter to work correctly. Also it assumes that both inputs
  6810. have the same number of frames, which are compared one by one.
  6811. The obtained average PSNR is printed through the logging system.
  6812. The filter stores the accumulated MSE (mean squared error) of each
  6813. frame, and at the end of the processing it is averaged across all frames
  6814. equally, and the following formula is applied to obtain the PSNR:
  6815. @example
  6816. PSNR = 10*log10(MAX^2/MSE)
  6817. @end example
  6818. Where MAX is the average of the maximum values of each component of the
  6819. image.
  6820. The description of the accepted parameters follows.
  6821. @table @option
  6822. @item stats_file, f
  6823. If specified the filter will use the named file to save the PSNR of
  6824. each individual frame.
  6825. @end table
  6826. The file printed if @var{stats_file} is selected, contains a sequence of
  6827. key/value pairs of the form @var{key}:@var{value} for each compared
  6828. couple of frames.
  6829. A description of each shown parameter follows:
  6830. @table @option
  6831. @item n
  6832. sequential number of the input frame, starting from 1
  6833. @item mse_avg
  6834. Mean Square Error pixel-by-pixel average difference of the compared
  6835. frames, averaged over all the image components.
  6836. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  6837. Mean Square Error pixel-by-pixel average difference of the compared
  6838. frames for the component specified by the suffix.
  6839. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  6840. Peak Signal to Noise ratio of the compared frames for the component
  6841. specified by the suffix.
  6842. @end table
  6843. For example:
  6844. @example
  6845. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  6846. [main][ref] psnr="stats_file=stats.log" [out]
  6847. @end example
  6848. On this example the input file being processed is compared with the
  6849. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  6850. is stored in @file{stats.log}.
  6851. @anchor{pullup}
  6852. @section pullup
  6853. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  6854. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  6855. content.
  6856. The pullup filter is designed to take advantage of future context in making
  6857. its decisions. This filter is stateless in the sense that it does not lock
  6858. onto a pattern to follow, but it instead looks forward to the following
  6859. fields in order to identify matches and rebuild progressive frames.
  6860. To produce content with an even framerate, insert the fps filter after
  6861. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  6862. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  6863. The filter accepts the following options:
  6864. @table @option
  6865. @item jl
  6866. @item jr
  6867. @item jt
  6868. @item jb
  6869. These options set the amount of "junk" to ignore at the left, right, top, and
  6870. bottom of the image, respectively. Left and right are in units of 8 pixels,
  6871. while top and bottom are in units of 2 lines.
  6872. The default is 8 pixels on each side.
  6873. @item sb
  6874. Set the strict breaks. Setting this option to 1 will reduce the chances of
  6875. filter generating an occasional mismatched frame, but it may also cause an
  6876. excessive number of frames to be dropped during high motion sequences.
  6877. Conversely, setting it to -1 will make filter match fields more easily.
  6878. This may help processing of video where there is slight blurring between
  6879. the fields, but may also cause there to be interlaced frames in the output.
  6880. Default value is @code{0}.
  6881. @item mp
  6882. Set the metric plane to use. It accepts the following values:
  6883. @table @samp
  6884. @item l
  6885. Use luma plane.
  6886. @item u
  6887. Use chroma blue plane.
  6888. @item v
  6889. Use chroma red plane.
  6890. @end table
  6891. This option may be set to use chroma plane instead of the default luma plane
  6892. for doing filter's computations. This may improve accuracy on very clean
  6893. source material, but more likely will decrease accuracy, especially if there
  6894. is chroma noise (rainbow effect) or any grayscale video.
  6895. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  6896. load and make pullup usable in realtime on slow machines.
  6897. @end table
  6898. For best results (without duplicated frames in the output file) it is
  6899. necessary to change the output frame rate. For example, to inverse
  6900. telecine NTSC input:
  6901. @example
  6902. ffmpeg -i input -vf pullup -r 24000/1001 ...
  6903. @end example
  6904. @section qp
  6905. Change video quantization parameters (QP).
  6906. The filter accepts the following option:
  6907. @table @option
  6908. @item qp
  6909. Set expression for quantization parameter.
  6910. @end table
  6911. The expression is evaluated through the eval API and can contain, among others,
  6912. the following constants:
  6913. @table @var
  6914. @item known
  6915. 1 if index is not 129, 0 otherwise.
  6916. @item qp
  6917. Sequentional index starting from -129 to 128.
  6918. @end table
  6919. @subsection Examples
  6920. @itemize
  6921. @item
  6922. Some equation like:
  6923. @example
  6924. qp=2+2*sin(PI*qp)
  6925. @end example
  6926. @end itemize
  6927. @section random
  6928. Flush video frames from internal cache of frames into a random order.
  6929. No frame is discarded.
  6930. Inspired by @ref{frei0r} nervous filter.
  6931. @table @option
  6932. @item frames
  6933. Set size in number of frames of internal cache, in range from @code{2} to
  6934. @code{512}. Default is @code{30}.
  6935. @item seed
  6936. Set seed for random number generator, must be an integer included between
  6937. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  6938. less than @code{0}, the filter will try to use a good random seed on a
  6939. best effort basis.
  6940. @end table
  6941. @section removegrain
  6942. The removegrain filter is a spatial denoiser for progressive video.
  6943. @table @option
  6944. @item m0
  6945. Set mode for the first plane.
  6946. @item m1
  6947. Set mode for the second plane.
  6948. @item m2
  6949. Set mode for the third plane.
  6950. @item m3
  6951. Set mode for the fourth plane.
  6952. @end table
  6953. Range of mode is from 0 to 24. Description of each mode follows:
  6954. @table @var
  6955. @item 0
  6956. Leave input plane unchanged. Default.
  6957. @item 1
  6958. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  6959. @item 2
  6960. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  6961. @item 3
  6962. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  6963. @item 4
  6964. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  6965. This is equivalent to a median filter.
  6966. @item 5
  6967. Line-sensitive clipping giving the minimal change.
  6968. @item 6
  6969. Line-sensitive clipping, intermediate.
  6970. @item 7
  6971. Line-sensitive clipping, intermediate.
  6972. @item 8
  6973. Line-sensitive clipping, intermediate.
  6974. @item 9
  6975. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  6976. @item 10
  6977. Replaces the target pixel with the closest neighbour.
  6978. @item 11
  6979. [1 2 1] horizontal and vertical kernel blur.
  6980. @item 12
  6981. Same as mode 11.
  6982. @item 13
  6983. Bob mode, interpolates top field from the line where the neighbours
  6984. pixels are the closest.
  6985. @item 14
  6986. Bob mode, interpolates bottom field from the line where the neighbours
  6987. pixels are the closest.
  6988. @item 15
  6989. Bob mode, interpolates top field. Same as 13 but with a more complicated
  6990. interpolation formula.
  6991. @item 16
  6992. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  6993. interpolation formula.
  6994. @item 17
  6995. Clips the pixel with the minimum and maximum of respectively the maximum and
  6996. minimum of each pair of opposite neighbour pixels.
  6997. @item 18
  6998. Line-sensitive clipping using opposite neighbours whose greatest distance from
  6999. the current pixel is minimal.
  7000. @item 19
  7001. Replaces the pixel with the average of its 8 neighbours.
  7002. @item 20
  7003. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7004. @item 21
  7005. Clips pixels using the averages of opposite neighbour.
  7006. @item 22
  7007. Same as mode 21 but simpler and faster.
  7008. @item 23
  7009. Small edge and halo removal, but reputed useless.
  7010. @item 24
  7011. Similar as 23.
  7012. @end table
  7013. @section removelogo
  7014. Suppress a TV station logo, using an image file to determine which
  7015. pixels comprise the logo. It works by filling in the pixels that
  7016. comprise the logo with neighboring pixels.
  7017. The filter accepts the following options:
  7018. @table @option
  7019. @item filename, f
  7020. Set the filter bitmap file, which can be any image format supported by
  7021. libavformat. The width and height of the image file must match those of the
  7022. video stream being processed.
  7023. @end table
  7024. Pixels in the provided bitmap image with a value of zero are not
  7025. considered part of the logo, non-zero pixels are considered part of
  7026. the logo. If you use white (255) for the logo and black (0) for the
  7027. rest, you will be safe. For making the filter bitmap, it is
  7028. recommended to take a screen capture of a black frame with the logo
  7029. visible, and then using a threshold filter followed by the erode
  7030. filter once or twice.
  7031. If needed, little splotches can be fixed manually. Remember that if
  7032. logo pixels are not covered, the filter quality will be much
  7033. reduced. Marking too many pixels as part of the logo does not hurt as
  7034. much, but it will increase the amount of blurring needed to cover over
  7035. the image and will destroy more information than necessary, and extra
  7036. pixels will slow things down on a large logo.
  7037. @section repeatfields
  7038. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7039. fields based on its value.
  7040. @section reverse, areverse
  7041. Reverse a clip.
  7042. Warning: This filter requires memory to buffer the entire clip, so trimming
  7043. is suggested.
  7044. @subsection Examples
  7045. @itemize
  7046. @item
  7047. Take the first 5 seconds of a clip, and reverse it.
  7048. @example
  7049. trim=end=5,reverse
  7050. @end example
  7051. @end itemize
  7052. @section rotate
  7053. Rotate video by an arbitrary angle expressed in radians.
  7054. The filter accepts the following options:
  7055. A description of the optional parameters follows.
  7056. @table @option
  7057. @item angle, a
  7058. Set an expression for the angle by which to rotate the input video
  7059. clockwise, expressed as a number of radians. A negative value will
  7060. result in a counter-clockwise rotation. By default it is set to "0".
  7061. This expression is evaluated for each frame.
  7062. @item out_w, ow
  7063. Set the output width expression, default value is "iw".
  7064. This expression is evaluated just once during configuration.
  7065. @item out_h, oh
  7066. Set the output height expression, default value is "ih".
  7067. This expression is evaluated just once during configuration.
  7068. @item bilinear
  7069. Enable bilinear interpolation if set to 1, a value of 0 disables
  7070. it. Default value is 1.
  7071. @item fillcolor, c
  7072. Set the color used to fill the output area not covered by the rotated
  7073. image. For the general syntax of this option, check the "Color" section in the
  7074. ffmpeg-utils manual. If the special value "none" is selected then no
  7075. background is printed (useful for example if the background is never shown).
  7076. Default value is "black".
  7077. @end table
  7078. The expressions for the angle and the output size can contain the
  7079. following constants and functions:
  7080. @table @option
  7081. @item n
  7082. sequential number of the input frame, starting from 0. It is always NAN
  7083. before the first frame is filtered.
  7084. @item t
  7085. time in seconds of the input frame, it is set to 0 when the filter is
  7086. configured. It is always NAN before the first frame is filtered.
  7087. @item hsub
  7088. @item vsub
  7089. horizontal and vertical chroma subsample values. For example for the
  7090. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7091. @item in_w, iw
  7092. @item in_h, ih
  7093. the input video width and height
  7094. @item out_w, ow
  7095. @item out_h, oh
  7096. the output width and height, that is the size of the padded area as
  7097. specified by the @var{width} and @var{height} expressions
  7098. @item rotw(a)
  7099. @item roth(a)
  7100. the minimal width/height required for completely containing the input
  7101. video rotated by @var{a} radians.
  7102. These are only available when computing the @option{out_w} and
  7103. @option{out_h} expressions.
  7104. @end table
  7105. @subsection Examples
  7106. @itemize
  7107. @item
  7108. Rotate the input by PI/6 radians clockwise:
  7109. @example
  7110. rotate=PI/6
  7111. @end example
  7112. @item
  7113. Rotate the input by PI/6 radians counter-clockwise:
  7114. @example
  7115. rotate=-PI/6
  7116. @end example
  7117. @item
  7118. Rotate the input by 45 degrees clockwise:
  7119. @example
  7120. rotate=45*PI/180
  7121. @end example
  7122. @item
  7123. Apply a constant rotation with period T, starting from an angle of PI/3:
  7124. @example
  7125. rotate=PI/3+2*PI*t/T
  7126. @end example
  7127. @item
  7128. Make the input video rotation oscillating with a period of T
  7129. seconds and an amplitude of A radians:
  7130. @example
  7131. rotate=A*sin(2*PI/T*t)
  7132. @end example
  7133. @item
  7134. Rotate the video, output size is chosen so that the whole rotating
  7135. input video is always completely contained in the output:
  7136. @example
  7137. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7138. @end example
  7139. @item
  7140. Rotate the video, reduce the output size so that no background is ever
  7141. shown:
  7142. @example
  7143. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7144. @end example
  7145. @end itemize
  7146. @subsection Commands
  7147. The filter supports the following commands:
  7148. @table @option
  7149. @item a, angle
  7150. Set the angle expression.
  7151. The command accepts the same syntax of the corresponding option.
  7152. If the specified expression is not valid, it is kept at its current
  7153. value.
  7154. @end table
  7155. @section sab
  7156. Apply Shape Adaptive Blur.
  7157. The filter accepts the following options:
  7158. @table @option
  7159. @item luma_radius, lr
  7160. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7161. value is 1.0. A greater value will result in a more blurred image, and
  7162. in slower processing.
  7163. @item luma_pre_filter_radius, lpfr
  7164. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7165. value is 1.0.
  7166. @item luma_strength, ls
  7167. Set luma maximum difference between pixels to still be considered, must
  7168. be a value in the 0.1-100.0 range, default value is 1.0.
  7169. @item chroma_radius, cr
  7170. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7171. greater value will result in a more blurred image, and in slower
  7172. processing.
  7173. @item chroma_pre_filter_radius, cpfr
  7174. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7175. @item chroma_strength, cs
  7176. Set chroma maximum difference between pixels to still be considered,
  7177. must be a value in the 0.1-100.0 range.
  7178. @end table
  7179. Each chroma option value, if not explicitly specified, is set to the
  7180. corresponding luma option value.
  7181. @anchor{scale}
  7182. @section scale
  7183. Scale (resize) the input video, using the libswscale library.
  7184. The scale filter forces the output display aspect ratio to be the same
  7185. of the input, by changing the output sample aspect ratio.
  7186. If the input image format is different from the format requested by
  7187. the next filter, the scale filter will convert the input to the
  7188. requested format.
  7189. @subsection Options
  7190. The filter accepts the following options, or any of the options
  7191. supported by the libswscale scaler.
  7192. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7193. the complete list of scaler options.
  7194. @table @option
  7195. @item width, w
  7196. @item height, h
  7197. Set the output video dimension expression. Default value is the input
  7198. dimension.
  7199. If the value is 0, the input width is used for the output.
  7200. If one of the values is -1, the scale filter will use a value that
  7201. maintains the aspect ratio of the input image, calculated from the
  7202. other specified dimension. If both of them are -1, the input size is
  7203. used
  7204. If one of the values is -n with n > 1, the scale filter will also use a value
  7205. that maintains the aspect ratio of the input image, calculated from the other
  7206. specified dimension. After that it will, however, make sure that the calculated
  7207. dimension is divisible by n and adjust the value if necessary.
  7208. See below for the list of accepted constants for use in the dimension
  7209. expression.
  7210. @item interl
  7211. Set the interlacing mode. It accepts the following values:
  7212. @table @samp
  7213. @item 1
  7214. Force interlaced aware scaling.
  7215. @item 0
  7216. Do not apply interlaced scaling.
  7217. @item -1
  7218. Select interlaced aware scaling depending on whether the source frames
  7219. are flagged as interlaced or not.
  7220. @end table
  7221. Default value is @samp{0}.
  7222. @item flags
  7223. Set libswscale scaling flags. See
  7224. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7225. complete list of values. If not explicitly specified the filter applies
  7226. the default flags.
  7227. @item size, s
  7228. Set the video size. For the syntax of this option, check the
  7229. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7230. @item in_color_matrix
  7231. @item out_color_matrix
  7232. Set in/output YCbCr color space type.
  7233. This allows the autodetected value to be overridden as well as allows forcing
  7234. a specific value used for the output and encoder.
  7235. If not specified, the color space type depends on the pixel format.
  7236. Possible values:
  7237. @table @samp
  7238. @item auto
  7239. Choose automatically.
  7240. @item bt709
  7241. Format conforming to International Telecommunication Union (ITU)
  7242. Recommendation BT.709.
  7243. @item fcc
  7244. Set color space conforming to the United States Federal Communications
  7245. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7246. @item bt601
  7247. Set color space conforming to:
  7248. @itemize
  7249. @item
  7250. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7251. @item
  7252. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7253. @item
  7254. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7255. @end itemize
  7256. @item smpte240m
  7257. Set color space conforming to SMPTE ST 240:1999.
  7258. @end table
  7259. @item in_range
  7260. @item out_range
  7261. Set in/output YCbCr sample range.
  7262. This allows the autodetected value to be overridden as well as allows forcing
  7263. a specific value used for the output and encoder. If not specified, the
  7264. range depends on the pixel format. Possible values:
  7265. @table @samp
  7266. @item auto
  7267. Choose automatically.
  7268. @item jpeg/full/pc
  7269. Set full range (0-255 in case of 8-bit luma).
  7270. @item mpeg/tv
  7271. Set "MPEG" range (16-235 in case of 8-bit luma).
  7272. @end table
  7273. @item force_original_aspect_ratio
  7274. Enable decreasing or increasing output video width or height if necessary to
  7275. keep the original aspect ratio. Possible values:
  7276. @table @samp
  7277. @item disable
  7278. Scale the video as specified and disable this feature.
  7279. @item decrease
  7280. The output video dimensions will automatically be decreased if needed.
  7281. @item increase
  7282. The output video dimensions will automatically be increased if needed.
  7283. @end table
  7284. One useful instance of this option is that when you know a specific device's
  7285. maximum allowed resolution, you can use this to limit the output video to
  7286. that, while retaining the aspect ratio. For example, device A allows
  7287. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7288. decrease) and specifying 1280x720 to the command line makes the output
  7289. 1280x533.
  7290. Please note that this is a different thing than specifying -1 for @option{w}
  7291. or @option{h}, you still need to specify the output resolution for this option
  7292. to work.
  7293. @end table
  7294. The values of the @option{w} and @option{h} options are expressions
  7295. containing the following constants:
  7296. @table @var
  7297. @item in_w
  7298. @item in_h
  7299. The input width and height
  7300. @item iw
  7301. @item ih
  7302. These are the same as @var{in_w} and @var{in_h}.
  7303. @item out_w
  7304. @item out_h
  7305. The output (scaled) width and height
  7306. @item ow
  7307. @item oh
  7308. These are the same as @var{out_w} and @var{out_h}
  7309. @item a
  7310. The same as @var{iw} / @var{ih}
  7311. @item sar
  7312. input sample aspect ratio
  7313. @item dar
  7314. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7315. @item hsub
  7316. @item vsub
  7317. horizontal and vertical input chroma subsample values. For example for the
  7318. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7319. @item ohsub
  7320. @item ovsub
  7321. horizontal and vertical output chroma subsample values. For example for the
  7322. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7323. @end table
  7324. @subsection Examples
  7325. @itemize
  7326. @item
  7327. Scale the input video to a size of 200x100
  7328. @example
  7329. scale=w=200:h=100
  7330. @end example
  7331. This is equivalent to:
  7332. @example
  7333. scale=200:100
  7334. @end example
  7335. or:
  7336. @example
  7337. scale=200x100
  7338. @end example
  7339. @item
  7340. Specify a size abbreviation for the output size:
  7341. @example
  7342. scale=qcif
  7343. @end example
  7344. which can also be written as:
  7345. @example
  7346. scale=size=qcif
  7347. @end example
  7348. @item
  7349. Scale the input to 2x:
  7350. @example
  7351. scale=w=2*iw:h=2*ih
  7352. @end example
  7353. @item
  7354. The above is the same as:
  7355. @example
  7356. scale=2*in_w:2*in_h
  7357. @end example
  7358. @item
  7359. Scale the input to 2x with forced interlaced scaling:
  7360. @example
  7361. scale=2*iw:2*ih:interl=1
  7362. @end example
  7363. @item
  7364. Scale the input to half size:
  7365. @example
  7366. scale=w=iw/2:h=ih/2
  7367. @end example
  7368. @item
  7369. Increase the width, and set the height to the same size:
  7370. @example
  7371. scale=3/2*iw:ow
  7372. @end example
  7373. @item
  7374. Seek Greek harmony:
  7375. @example
  7376. scale=iw:1/PHI*iw
  7377. scale=ih*PHI:ih
  7378. @end example
  7379. @item
  7380. Increase the height, and set the width to 3/2 of the height:
  7381. @example
  7382. scale=w=3/2*oh:h=3/5*ih
  7383. @end example
  7384. @item
  7385. Increase the size, making the size a multiple of the chroma
  7386. subsample values:
  7387. @example
  7388. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7389. @end example
  7390. @item
  7391. Increase the width to a maximum of 500 pixels,
  7392. keeping the same aspect ratio as the input:
  7393. @example
  7394. scale=w='min(500\, iw*3/2):h=-1'
  7395. @end example
  7396. @end itemize
  7397. @subsection Commands
  7398. This filter supports the following commands:
  7399. @table @option
  7400. @item width, w
  7401. @item height, h
  7402. Set the output video dimension expression.
  7403. The command accepts the same syntax of the corresponding option.
  7404. If the specified expression is not valid, it is kept at its current
  7405. value.
  7406. @end table
  7407. @section scale2ref
  7408. Scale (resize) the input video, based on a reference video.
  7409. See the scale filter for available options, scale2ref supports the same but
  7410. uses the reference video instead of the main input as basis.
  7411. @subsection Examples
  7412. @itemize
  7413. @item
  7414. Scale a subtitle stream to match the main video in size before overlaying
  7415. @example
  7416. 'scale2ref[b][a];[a][b]overlay'
  7417. @end example
  7418. @end itemize
  7419. @section separatefields
  7420. The @code{separatefields} takes a frame-based video input and splits
  7421. each frame into its components fields, producing a new half height clip
  7422. with twice the frame rate and twice the frame count.
  7423. This filter use field-dominance information in frame to decide which
  7424. of each pair of fields to place first in the output.
  7425. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  7426. @section setdar, setsar
  7427. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  7428. output video.
  7429. This is done by changing the specified Sample (aka Pixel) Aspect
  7430. Ratio, according to the following equation:
  7431. @example
  7432. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  7433. @end example
  7434. Keep in mind that the @code{setdar} filter does not modify the pixel
  7435. dimensions of the video frame. Also, the display aspect ratio set by
  7436. this filter may be changed by later filters in the filterchain,
  7437. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  7438. applied.
  7439. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  7440. the filter output video.
  7441. Note that as a consequence of the application of this filter, the
  7442. output display aspect ratio will change according to the equation
  7443. above.
  7444. Keep in mind that the sample aspect ratio set by the @code{setsar}
  7445. filter may be changed by later filters in the filterchain, e.g. if
  7446. another "setsar" or a "setdar" filter is applied.
  7447. It accepts the following parameters:
  7448. @table @option
  7449. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  7450. Set the aspect ratio used by the filter.
  7451. The parameter can be a floating point number string, an expression, or
  7452. a string of the form @var{num}:@var{den}, where @var{num} and
  7453. @var{den} are the numerator and denominator of the aspect ratio. If
  7454. the parameter is not specified, it is assumed the value "0".
  7455. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  7456. should be escaped.
  7457. @item max
  7458. Set the maximum integer value to use for expressing numerator and
  7459. denominator when reducing the expressed aspect ratio to a rational.
  7460. Default value is @code{100}.
  7461. @end table
  7462. The parameter @var{sar} is an expression containing
  7463. the following constants:
  7464. @table @option
  7465. @item E, PI, PHI
  7466. These are approximated values for the mathematical constants e
  7467. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  7468. @item w, h
  7469. The input width and height.
  7470. @item a
  7471. These are the same as @var{w} / @var{h}.
  7472. @item sar
  7473. The input sample aspect ratio.
  7474. @item dar
  7475. The input display aspect ratio. It is the same as
  7476. (@var{w} / @var{h}) * @var{sar}.
  7477. @item hsub, vsub
  7478. Horizontal and vertical chroma subsample values. For example, for the
  7479. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7480. @end table
  7481. @subsection Examples
  7482. @itemize
  7483. @item
  7484. To change the display aspect ratio to 16:9, specify one of the following:
  7485. @example
  7486. setdar=dar=1.77777
  7487. setdar=dar=16/9
  7488. setdar=dar=1.77777
  7489. @end example
  7490. @item
  7491. To change the sample aspect ratio to 10:11, specify:
  7492. @example
  7493. setsar=sar=10/11
  7494. @end example
  7495. @item
  7496. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  7497. 1000 in the aspect ratio reduction, use the command:
  7498. @example
  7499. setdar=ratio=16/9:max=1000
  7500. @end example
  7501. @end itemize
  7502. @anchor{setfield}
  7503. @section setfield
  7504. Force field for the output video frame.
  7505. The @code{setfield} filter marks the interlace type field for the
  7506. output frames. It does not change the input frame, but only sets the
  7507. corresponding property, which affects how the frame is treated by
  7508. following filters (e.g. @code{fieldorder} or @code{yadif}).
  7509. The filter accepts the following options:
  7510. @table @option
  7511. @item mode
  7512. Available values are:
  7513. @table @samp
  7514. @item auto
  7515. Keep the same field property.
  7516. @item bff
  7517. Mark the frame as bottom-field-first.
  7518. @item tff
  7519. Mark the frame as top-field-first.
  7520. @item prog
  7521. Mark the frame as progressive.
  7522. @end table
  7523. @end table
  7524. @section showinfo
  7525. Show a line containing various information for each input video frame.
  7526. The input video is not modified.
  7527. The shown line contains a sequence of key/value pairs of the form
  7528. @var{key}:@var{value}.
  7529. The following values are shown in the output:
  7530. @table @option
  7531. @item n
  7532. The (sequential) number of the input frame, starting from 0.
  7533. @item pts
  7534. The Presentation TimeStamp of the input frame, expressed as a number of
  7535. time base units. The time base unit depends on the filter input pad.
  7536. @item pts_time
  7537. The Presentation TimeStamp of the input frame, expressed as a number of
  7538. seconds.
  7539. @item pos
  7540. The position of the frame in the input stream, or -1 if this information is
  7541. unavailable and/or meaningless (for example in case of synthetic video).
  7542. @item fmt
  7543. The pixel format name.
  7544. @item sar
  7545. The sample aspect ratio of the input frame, expressed in the form
  7546. @var{num}/@var{den}.
  7547. @item s
  7548. The size of the input frame. For the syntax of this option, check the
  7549. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7550. @item i
  7551. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  7552. for bottom field first).
  7553. @item iskey
  7554. This is 1 if the frame is a key frame, 0 otherwise.
  7555. @item type
  7556. The picture type of the input frame ("I" for an I-frame, "P" for a
  7557. P-frame, "B" for a B-frame, or "?" for an unknown type).
  7558. Also refer to the documentation of the @code{AVPictureType} enum and of
  7559. the @code{av_get_picture_type_char} function defined in
  7560. @file{libavutil/avutil.h}.
  7561. @item checksum
  7562. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  7563. @item plane_checksum
  7564. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  7565. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  7566. @end table
  7567. @section showpalette
  7568. Displays the 256 colors palette of each frame. This filter is only relevant for
  7569. @var{pal8} pixel format frames.
  7570. It accepts the following option:
  7571. @table @option
  7572. @item s
  7573. Set the size of the box used to represent one palette color entry. Default is
  7574. @code{30} (for a @code{30x30} pixel box).
  7575. @end table
  7576. @section shuffleplanes
  7577. Reorder and/or duplicate video planes.
  7578. It accepts the following parameters:
  7579. @table @option
  7580. @item map0
  7581. The index of the input plane to be used as the first output plane.
  7582. @item map1
  7583. The index of the input plane to be used as the second output plane.
  7584. @item map2
  7585. The index of the input plane to be used as the third output plane.
  7586. @item map3
  7587. The index of the input plane to be used as the fourth output plane.
  7588. @end table
  7589. The first plane has the index 0. The default is to keep the input unchanged.
  7590. Swap the second and third planes of the input:
  7591. @example
  7592. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  7593. @end example
  7594. @anchor{signalstats}
  7595. @section signalstats
  7596. Evaluate various visual metrics that assist in determining issues associated
  7597. with the digitization of analog video media.
  7598. By default the filter will log these metadata values:
  7599. @table @option
  7600. @item YMIN
  7601. Display the minimal Y value contained within the input frame. Expressed in
  7602. range of [0-255].
  7603. @item YLOW
  7604. Display the Y value at the 10% percentile within the input frame. Expressed in
  7605. range of [0-255].
  7606. @item YAVG
  7607. Display the average Y value within the input frame. Expressed in range of
  7608. [0-255].
  7609. @item YHIGH
  7610. Display the Y value at the 90% percentile within the input frame. Expressed in
  7611. range of [0-255].
  7612. @item YMAX
  7613. Display the maximum Y value contained within the input frame. Expressed in
  7614. range of [0-255].
  7615. @item UMIN
  7616. Display the minimal U value contained within the input frame. Expressed in
  7617. range of [0-255].
  7618. @item ULOW
  7619. Display the U value at the 10% percentile within the input frame. Expressed in
  7620. range of [0-255].
  7621. @item UAVG
  7622. Display the average U value within the input frame. Expressed in range of
  7623. [0-255].
  7624. @item UHIGH
  7625. Display the U value at the 90% percentile within the input frame. Expressed in
  7626. range of [0-255].
  7627. @item UMAX
  7628. Display the maximum U value contained within the input frame. Expressed in
  7629. range of [0-255].
  7630. @item VMIN
  7631. Display the minimal V value contained within the input frame. Expressed in
  7632. range of [0-255].
  7633. @item VLOW
  7634. Display the V value at the 10% percentile within the input frame. Expressed in
  7635. range of [0-255].
  7636. @item VAVG
  7637. Display the average V value within the input frame. Expressed in range of
  7638. [0-255].
  7639. @item VHIGH
  7640. Display the V value at the 90% percentile within the input frame. Expressed in
  7641. range of [0-255].
  7642. @item VMAX
  7643. Display the maximum V value contained within the input frame. Expressed in
  7644. range of [0-255].
  7645. @item SATMIN
  7646. Display the minimal saturation value contained within the input frame.
  7647. Expressed in range of [0-~181.02].
  7648. @item SATLOW
  7649. Display the saturation value at the 10% percentile within the input frame.
  7650. Expressed in range of [0-~181.02].
  7651. @item SATAVG
  7652. Display the average saturation value within the input frame. Expressed in range
  7653. of [0-~181.02].
  7654. @item SATHIGH
  7655. Display the saturation value at the 90% percentile within the input frame.
  7656. Expressed in range of [0-~181.02].
  7657. @item SATMAX
  7658. Display the maximum saturation value contained within the input frame.
  7659. Expressed in range of [0-~181.02].
  7660. @item HUEMED
  7661. Display the median value for hue within the input frame. Expressed in range of
  7662. [0-360].
  7663. @item HUEAVG
  7664. Display the average value for hue within the input frame. Expressed in range of
  7665. [0-360].
  7666. @item YDIF
  7667. Display the average of sample value difference between all values of the Y
  7668. plane in the current frame and corresponding values of the previous input frame.
  7669. Expressed in range of [0-255].
  7670. @item UDIF
  7671. Display the average of sample value difference between all values of the U
  7672. plane in the current frame and corresponding values of the previous input frame.
  7673. Expressed in range of [0-255].
  7674. @item VDIF
  7675. Display the average of sample value difference between all values of the V
  7676. plane in the current frame and corresponding values of the previous input frame.
  7677. Expressed in range of [0-255].
  7678. @end table
  7679. The filter accepts the following options:
  7680. @table @option
  7681. @item stat
  7682. @item out
  7683. @option{stat} specify an additional form of image analysis.
  7684. @option{out} output video with the specified type of pixel highlighted.
  7685. Both options accept the following values:
  7686. @table @samp
  7687. @item tout
  7688. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  7689. unlike the neighboring pixels of the same field. Examples of temporal outliers
  7690. include the results of video dropouts, head clogs, or tape tracking issues.
  7691. @item vrep
  7692. Identify @var{vertical line repetition}. Vertical line repetition includes
  7693. similar rows of pixels within a frame. In born-digital video vertical line
  7694. repetition is common, but this pattern is uncommon in video digitized from an
  7695. analog source. When it occurs in video that results from the digitization of an
  7696. analog source it can indicate concealment from a dropout compensator.
  7697. @item brng
  7698. Identify pixels that fall outside of legal broadcast range.
  7699. @end table
  7700. @item color, c
  7701. Set the highlight color for the @option{out} option. The default color is
  7702. yellow.
  7703. @end table
  7704. @subsection Examples
  7705. @itemize
  7706. @item
  7707. Output data of various video metrics:
  7708. @example
  7709. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  7710. @end example
  7711. @item
  7712. Output specific data about the minimum and maximum values of the Y plane per frame:
  7713. @example
  7714. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  7715. @end example
  7716. @item
  7717. Playback video while highlighting pixels that are outside of broadcast range in red.
  7718. @example
  7719. ffplay example.mov -vf signalstats="out=brng:color=red"
  7720. @end example
  7721. @item
  7722. Playback video with signalstats metadata drawn over the frame.
  7723. @example
  7724. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  7725. @end example
  7726. The contents of signalstat_drawtext.txt used in the command are:
  7727. @example
  7728. time %@{pts:hms@}
  7729. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  7730. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  7731. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  7732. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  7733. @end example
  7734. @end itemize
  7735. @anchor{smartblur}
  7736. @section smartblur
  7737. Blur the input video without impacting the outlines.
  7738. It accepts the following options:
  7739. @table @option
  7740. @item luma_radius, lr
  7741. Set the luma radius. The option value must be a float number in
  7742. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7743. used to blur the image (slower if larger). Default value is 1.0.
  7744. @item luma_strength, ls
  7745. Set the luma strength. The option value must be a float number
  7746. in the range [-1.0,1.0] that configures the blurring. A value included
  7747. in [0.0,1.0] will blur the image whereas a value included in
  7748. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7749. @item luma_threshold, lt
  7750. Set the luma threshold used as a coefficient to determine
  7751. whether a pixel should be blurred or not. The option value must be an
  7752. integer in the range [-30,30]. A value of 0 will filter all the image,
  7753. a value included in [0,30] will filter flat areas and a value included
  7754. in [-30,0] will filter edges. Default value is 0.
  7755. @item chroma_radius, cr
  7756. Set the chroma radius. The option value must be a float number in
  7757. the range [0.1,5.0] that specifies the variance of the gaussian filter
  7758. used to blur the image (slower if larger). Default value is 1.0.
  7759. @item chroma_strength, cs
  7760. Set the chroma strength. The option value must be a float number
  7761. in the range [-1.0,1.0] that configures the blurring. A value included
  7762. in [0.0,1.0] will blur the image whereas a value included in
  7763. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  7764. @item chroma_threshold, ct
  7765. Set the chroma threshold used as a coefficient to determine
  7766. whether a pixel should be blurred or not. The option value must be an
  7767. integer in the range [-30,30]. A value of 0 will filter all the image,
  7768. a value included in [0,30] will filter flat areas and a value included
  7769. in [-30,0] will filter edges. Default value is 0.
  7770. @end table
  7771. If a chroma option is not explicitly set, the corresponding luma value
  7772. is set.
  7773. @section ssim
  7774. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  7775. This filter takes in input two input videos, the first input is
  7776. considered the "main" source and is passed unchanged to the
  7777. output. The second input is used as a "reference" video for computing
  7778. the SSIM.
  7779. Both video inputs must have the same resolution and pixel format for
  7780. this filter to work correctly. Also it assumes that both inputs
  7781. have the same number of frames, which are compared one by one.
  7782. The filter stores the calculated SSIM of each frame.
  7783. The description of the accepted parameters follows.
  7784. @table @option
  7785. @item stats_file, f
  7786. If specified the filter will use the named file to save the SSIM of
  7787. each individual frame.
  7788. @end table
  7789. The file printed if @var{stats_file} is selected, contains a sequence of
  7790. key/value pairs of the form @var{key}:@var{value} for each compared
  7791. couple of frames.
  7792. A description of each shown parameter follows:
  7793. @table @option
  7794. @item n
  7795. sequential number of the input frame, starting from 1
  7796. @item Y, U, V, R, G, B
  7797. SSIM of the compared frames for the component specified by the suffix.
  7798. @item All
  7799. SSIM of the compared frames for the whole frame.
  7800. @item dB
  7801. Same as above but in dB representation.
  7802. @end table
  7803. For example:
  7804. @example
  7805. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7806. [main][ref] ssim="stats_file=stats.log" [out]
  7807. @end example
  7808. On this example the input file being processed is compared with the
  7809. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  7810. is stored in @file{stats.log}.
  7811. Another example with both psnr and ssim at same time:
  7812. @example
  7813. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  7814. @end example
  7815. @section stereo3d
  7816. Convert between different stereoscopic image formats.
  7817. The filters accept the following options:
  7818. @table @option
  7819. @item in
  7820. Set stereoscopic image format of input.
  7821. Available values for input image formats are:
  7822. @table @samp
  7823. @item sbsl
  7824. side by side parallel (left eye left, right eye right)
  7825. @item sbsr
  7826. side by side crosseye (right eye left, left eye right)
  7827. @item sbs2l
  7828. side by side parallel with half width resolution
  7829. (left eye left, right eye right)
  7830. @item sbs2r
  7831. side by side crosseye with half width resolution
  7832. (right eye left, left eye right)
  7833. @item abl
  7834. above-below (left eye above, right eye below)
  7835. @item abr
  7836. above-below (right eye above, left eye below)
  7837. @item ab2l
  7838. above-below with half height resolution
  7839. (left eye above, right eye below)
  7840. @item ab2r
  7841. above-below with half height resolution
  7842. (right eye above, left eye below)
  7843. @item al
  7844. alternating frames (left eye first, right eye second)
  7845. @item ar
  7846. alternating frames (right eye first, left eye second)
  7847. @item irl
  7848. interleaved rows (left eye has top row, right eye starts on next row)
  7849. @item irr
  7850. interleaved rows (right eye has top row, left eye starts on next row)
  7851. Default value is @samp{sbsl}.
  7852. @end table
  7853. @item out
  7854. Set stereoscopic image format of output.
  7855. Available values for output image formats are all the input formats as well as:
  7856. @table @samp
  7857. @item arbg
  7858. anaglyph red/blue gray
  7859. (red filter on left eye, blue filter on right eye)
  7860. @item argg
  7861. anaglyph red/green gray
  7862. (red filter on left eye, green filter on right eye)
  7863. @item arcg
  7864. anaglyph red/cyan gray
  7865. (red filter on left eye, cyan filter on right eye)
  7866. @item arch
  7867. anaglyph red/cyan half colored
  7868. (red filter on left eye, cyan filter on right eye)
  7869. @item arcc
  7870. anaglyph red/cyan color
  7871. (red filter on left eye, cyan filter on right eye)
  7872. @item arcd
  7873. anaglyph red/cyan color optimized with the least squares projection of dubois
  7874. (red filter on left eye, cyan filter on right eye)
  7875. @item agmg
  7876. anaglyph green/magenta gray
  7877. (green filter on left eye, magenta filter on right eye)
  7878. @item agmh
  7879. anaglyph green/magenta half colored
  7880. (green filter on left eye, magenta filter on right eye)
  7881. @item agmc
  7882. anaglyph green/magenta colored
  7883. (green filter on left eye, magenta filter on right eye)
  7884. @item agmd
  7885. anaglyph green/magenta color optimized with the least squares projection of dubois
  7886. (green filter on left eye, magenta filter on right eye)
  7887. @item aybg
  7888. anaglyph yellow/blue gray
  7889. (yellow filter on left eye, blue filter on right eye)
  7890. @item aybh
  7891. anaglyph yellow/blue half colored
  7892. (yellow filter on left eye, blue filter on right eye)
  7893. @item aybc
  7894. anaglyph yellow/blue colored
  7895. (yellow filter on left eye, blue filter on right eye)
  7896. @item aybd
  7897. anaglyph yellow/blue color optimized with the least squares projection of dubois
  7898. (yellow filter on left eye, blue filter on right eye)
  7899. @item ml
  7900. mono output (left eye only)
  7901. @item mr
  7902. mono output (right eye only)
  7903. @item chl
  7904. checkerboard, left eye first
  7905. @item chr
  7906. checkerboard, right eye first
  7907. @item icl
  7908. interleaved columns, left eye first
  7909. @item icr
  7910. interleaved columns, right eye first
  7911. @end table
  7912. Default value is @samp{arcd}.
  7913. @end table
  7914. @subsection Examples
  7915. @itemize
  7916. @item
  7917. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  7918. @example
  7919. stereo3d=sbsl:aybd
  7920. @end example
  7921. @item
  7922. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  7923. @example
  7924. stereo3d=abl:sbsr
  7925. @end example
  7926. @end itemize
  7927. @anchor{spp}
  7928. @section spp
  7929. Apply a simple postprocessing filter that compresses and decompresses the image
  7930. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  7931. and average the results.
  7932. The filter accepts the following options:
  7933. @table @option
  7934. @item quality
  7935. Set quality. This option defines the number of levels for averaging. It accepts
  7936. an integer in the range 0-6. If set to @code{0}, the filter will have no
  7937. effect. A value of @code{6} means the higher quality. For each increment of
  7938. that value the speed drops by a factor of approximately 2. Default value is
  7939. @code{3}.
  7940. @item qp
  7941. Force a constant quantization parameter. If not set, the filter will use the QP
  7942. from the video stream (if available).
  7943. @item mode
  7944. Set thresholding mode. Available modes are:
  7945. @table @samp
  7946. @item hard
  7947. Set hard thresholding (default).
  7948. @item soft
  7949. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7950. @end table
  7951. @item use_bframe_qp
  7952. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7953. option may cause flicker since the B-Frames have often larger QP. Default is
  7954. @code{0} (not enabled).
  7955. @end table
  7956. @anchor{subtitles}
  7957. @section subtitles
  7958. Draw subtitles on top of input video using the libass library.
  7959. To enable compilation of this filter you need to configure FFmpeg with
  7960. @code{--enable-libass}. This filter also requires a build with libavcodec and
  7961. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  7962. Alpha) subtitles format.
  7963. The filter accepts the following options:
  7964. @table @option
  7965. @item filename, f
  7966. Set the filename of the subtitle file to read. It must be specified.
  7967. @item original_size
  7968. Specify the size of the original video, the video for which the ASS file
  7969. was composed. For the syntax of this option, check the
  7970. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7971. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  7972. correctly scale the fonts if the aspect ratio has been changed.
  7973. @item fontsdir
  7974. Set a directory path containing fonts that can be used by the filter.
  7975. These fonts will be used in addition to whatever the font provider uses.
  7976. @item charenc
  7977. Set subtitles input character encoding. @code{subtitles} filter only. Only
  7978. useful if not UTF-8.
  7979. @item stream_index, si
  7980. Set subtitles stream index. @code{subtitles} filter only.
  7981. @item force_style
  7982. Override default style or script info parameters of the subtitles. It accepts a
  7983. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  7984. @end table
  7985. If the first key is not specified, it is assumed that the first value
  7986. specifies the @option{filename}.
  7987. For example, to render the file @file{sub.srt} on top of the input
  7988. video, use the command:
  7989. @example
  7990. subtitles=sub.srt
  7991. @end example
  7992. which is equivalent to:
  7993. @example
  7994. subtitles=filename=sub.srt
  7995. @end example
  7996. To render the default subtitles stream from file @file{video.mkv}, use:
  7997. @example
  7998. subtitles=video.mkv
  7999. @end example
  8000. To render the second subtitles stream from that file, use:
  8001. @example
  8002. subtitles=video.mkv:si=1
  8003. @end example
  8004. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8005. @code{DejaVu Serif}, use:
  8006. @example
  8007. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8008. @end example
  8009. @section super2xsai
  8010. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8011. Interpolate) pixel art scaling algorithm.
  8012. Useful for enlarging pixel art images without reducing sharpness.
  8013. @section swapuv
  8014. Swap U & V plane.
  8015. @section telecine
  8016. Apply telecine process to the video.
  8017. This filter accepts the following options:
  8018. @table @option
  8019. @item first_field
  8020. @table @samp
  8021. @item top, t
  8022. top field first
  8023. @item bottom, b
  8024. bottom field first
  8025. The default value is @code{top}.
  8026. @end table
  8027. @item pattern
  8028. A string of numbers representing the pulldown pattern you wish to apply.
  8029. The default value is @code{23}.
  8030. @end table
  8031. @example
  8032. Some typical patterns:
  8033. NTSC output (30i):
  8034. 27.5p: 32222
  8035. 24p: 23 (classic)
  8036. 24p: 2332 (preferred)
  8037. 20p: 33
  8038. 18p: 334
  8039. 16p: 3444
  8040. PAL output (25i):
  8041. 27.5p: 12222
  8042. 24p: 222222222223 ("Euro pulldown")
  8043. 16.67p: 33
  8044. 16p: 33333334
  8045. @end example
  8046. @section thumbnail
  8047. Select the most representative frame in a given sequence of consecutive frames.
  8048. The filter accepts the following options:
  8049. @table @option
  8050. @item n
  8051. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8052. will pick one of them, and then handle the next batch of @var{n} frames until
  8053. the end. Default is @code{100}.
  8054. @end table
  8055. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8056. value will result in a higher memory usage, so a high value is not recommended.
  8057. @subsection Examples
  8058. @itemize
  8059. @item
  8060. Extract one picture each 50 frames:
  8061. @example
  8062. thumbnail=50
  8063. @end example
  8064. @item
  8065. Complete example of a thumbnail creation with @command{ffmpeg}:
  8066. @example
  8067. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8068. @end example
  8069. @end itemize
  8070. @section tile
  8071. Tile several successive frames together.
  8072. The filter accepts the following options:
  8073. @table @option
  8074. @item layout
  8075. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8076. this option, check the
  8077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8078. @item nb_frames
  8079. Set the maximum number of frames to render in the given area. It must be less
  8080. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8081. the area will be used.
  8082. @item margin
  8083. Set the outer border margin in pixels.
  8084. @item padding
  8085. Set the inner border thickness (i.e. the number of pixels between frames). For
  8086. more advanced padding options (such as having different values for the edges),
  8087. refer to the pad video filter.
  8088. @item color
  8089. Specify the color of the unused area. For the syntax of this option, check the
  8090. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8091. is "black".
  8092. @end table
  8093. @subsection Examples
  8094. @itemize
  8095. @item
  8096. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8097. @example
  8098. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8099. @end example
  8100. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8101. duplicating each output frame to accommodate the originally detected frame
  8102. rate.
  8103. @item
  8104. Display @code{5} pictures in an area of @code{3x2} frames,
  8105. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8106. mixed flat and named options:
  8107. @example
  8108. tile=3x2:nb_frames=5:padding=7:margin=2
  8109. @end example
  8110. @end itemize
  8111. @section tinterlace
  8112. Perform various types of temporal field interlacing.
  8113. Frames are counted starting from 1, so the first input frame is
  8114. considered odd.
  8115. The filter accepts the following options:
  8116. @table @option
  8117. @item mode
  8118. Specify the mode of the interlacing. This option can also be specified
  8119. as a value alone. See below for a list of values for this option.
  8120. Available values are:
  8121. @table @samp
  8122. @item merge, 0
  8123. Move odd frames into the upper field, even into the lower field,
  8124. generating a double height frame at half frame rate.
  8125. @example
  8126. ------> time
  8127. Input:
  8128. Frame 1 Frame 2 Frame 3 Frame 4
  8129. 11111 22222 33333 44444
  8130. 11111 22222 33333 44444
  8131. 11111 22222 33333 44444
  8132. 11111 22222 33333 44444
  8133. Output:
  8134. 11111 33333
  8135. 22222 44444
  8136. 11111 33333
  8137. 22222 44444
  8138. 11111 33333
  8139. 22222 44444
  8140. 11111 33333
  8141. 22222 44444
  8142. @end example
  8143. @item drop_odd, 1
  8144. Only output even frames, odd frames are dropped, generating a frame with
  8145. unchanged height at half frame rate.
  8146. @example
  8147. ------> time
  8148. Input:
  8149. Frame 1 Frame 2 Frame 3 Frame 4
  8150. 11111 22222 33333 44444
  8151. 11111 22222 33333 44444
  8152. 11111 22222 33333 44444
  8153. 11111 22222 33333 44444
  8154. Output:
  8155. 22222 44444
  8156. 22222 44444
  8157. 22222 44444
  8158. 22222 44444
  8159. @end example
  8160. @item drop_even, 2
  8161. Only output odd frames, even frames are dropped, generating a frame with
  8162. unchanged height at half frame rate.
  8163. @example
  8164. ------> time
  8165. Input:
  8166. Frame 1 Frame 2 Frame 3 Frame 4
  8167. 11111 22222 33333 44444
  8168. 11111 22222 33333 44444
  8169. 11111 22222 33333 44444
  8170. 11111 22222 33333 44444
  8171. Output:
  8172. 11111 33333
  8173. 11111 33333
  8174. 11111 33333
  8175. 11111 33333
  8176. @end example
  8177. @item pad, 3
  8178. Expand each frame to full height, but pad alternate lines with black,
  8179. generating a frame with double height at the same input frame rate.
  8180. @example
  8181. ------> time
  8182. Input:
  8183. Frame 1 Frame 2 Frame 3 Frame 4
  8184. 11111 22222 33333 44444
  8185. 11111 22222 33333 44444
  8186. 11111 22222 33333 44444
  8187. 11111 22222 33333 44444
  8188. Output:
  8189. 11111 ..... 33333 .....
  8190. ..... 22222 ..... 44444
  8191. 11111 ..... 33333 .....
  8192. ..... 22222 ..... 44444
  8193. 11111 ..... 33333 .....
  8194. ..... 22222 ..... 44444
  8195. 11111 ..... 33333 .....
  8196. ..... 22222 ..... 44444
  8197. @end example
  8198. @item interleave_top, 4
  8199. Interleave the upper field from odd frames with the lower field from
  8200. even frames, generating a frame with unchanged height at half frame rate.
  8201. @example
  8202. ------> time
  8203. Input:
  8204. Frame 1 Frame 2 Frame 3 Frame 4
  8205. 11111<- 22222 33333<- 44444
  8206. 11111 22222<- 33333 44444<-
  8207. 11111<- 22222 33333<- 44444
  8208. 11111 22222<- 33333 44444<-
  8209. Output:
  8210. 11111 33333
  8211. 22222 44444
  8212. 11111 33333
  8213. 22222 44444
  8214. @end example
  8215. @item interleave_bottom, 5
  8216. Interleave the lower field from odd frames with the upper field from
  8217. even frames, generating a frame with unchanged height at half frame rate.
  8218. @example
  8219. ------> time
  8220. Input:
  8221. Frame 1 Frame 2 Frame 3 Frame 4
  8222. 11111 22222<- 33333 44444<-
  8223. 11111<- 22222 33333<- 44444
  8224. 11111 22222<- 33333 44444<-
  8225. 11111<- 22222 33333<- 44444
  8226. Output:
  8227. 22222 44444
  8228. 11111 33333
  8229. 22222 44444
  8230. 11111 33333
  8231. @end example
  8232. @item interlacex2, 6
  8233. Double frame rate with unchanged height. Frames are inserted each
  8234. containing the second temporal field from the previous input frame and
  8235. the first temporal field from the next input frame. This mode relies on
  8236. the top_field_first flag. Useful for interlaced video displays with no
  8237. field synchronisation.
  8238. @example
  8239. ------> time
  8240. Input:
  8241. Frame 1 Frame 2 Frame 3 Frame 4
  8242. 11111 22222 33333 44444
  8243. 11111 22222 33333 44444
  8244. 11111 22222 33333 44444
  8245. 11111 22222 33333 44444
  8246. Output:
  8247. 11111 22222 22222 33333 33333 44444 44444
  8248. 11111 11111 22222 22222 33333 33333 44444
  8249. 11111 22222 22222 33333 33333 44444 44444
  8250. 11111 11111 22222 22222 33333 33333 44444
  8251. @end example
  8252. @end table
  8253. Numeric values are deprecated but are accepted for backward
  8254. compatibility reasons.
  8255. Default mode is @code{merge}.
  8256. @item flags
  8257. Specify flags influencing the filter process.
  8258. Available value for @var{flags} is:
  8259. @table @option
  8260. @item low_pass_filter, vlfp
  8261. Enable vertical low-pass filtering in the filter.
  8262. Vertical low-pass filtering is required when creating an interlaced
  8263. destination from a progressive source which contains high-frequency
  8264. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8265. patterning.
  8266. Vertical low-pass filtering can only be enabled for @option{mode}
  8267. @var{interleave_top} and @var{interleave_bottom}.
  8268. @end table
  8269. @end table
  8270. @section transpose
  8271. Transpose rows with columns in the input video and optionally flip it.
  8272. It accepts the following parameters:
  8273. @table @option
  8274. @item dir
  8275. Specify the transposition direction.
  8276. Can assume the following values:
  8277. @table @samp
  8278. @item 0, 4, cclock_flip
  8279. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8280. @example
  8281. L.R L.l
  8282. . . -> . .
  8283. l.r R.r
  8284. @end example
  8285. @item 1, 5, clock
  8286. Rotate by 90 degrees clockwise, that is:
  8287. @example
  8288. L.R l.L
  8289. . . -> . .
  8290. l.r r.R
  8291. @end example
  8292. @item 2, 6, cclock
  8293. Rotate by 90 degrees counterclockwise, that is:
  8294. @example
  8295. L.R R.r
  8296. . . -> . .
  8297. l.r L.l
  8298. @end example
  8299. @item 3, 7, clock_flip
  8300. Rotate by 90 degrees clockwise and vertically flip, that is:
  8301. @example
  8302. L.R r.R
  8303. . . -> . .
  8304. l.r l.L
  8305. @end example
  8306. @end table
  8307. For values between 4-7, the transposition is only done if the input
  8308. video geometry is portrait and not landscape. These values are
  8309. deprecated, the @code{passthrough} option should be used instead.
  8310. Numerical values are deprecated, and should be dropped in favor of
  8311. symbolic constants.
  8312. @item passthrough
  8313. Do not apply the transposition if the input geometry matches the one
  8314. specified by the specified value. It accepts the following values:
  8315. @table @samp
  8316. @item none
  8317. Always apply transposition.
  8318. @item portrait
  8319. Preserve portrait geometry (when @var{height} >= @var{width}).
  8320. @item landscape
  8321. Preserve landscape geometry (when @var{width} >= @var{height}).
  8322. @end table
  8323. Default value is @code{none}.
  8324. @end table
  8325. For example to rotate by 90 degrees clockwise and preserve portrait
  8326. layout:
  8327. @example
  8328. transpose=dir=1:passthrough=portrait
  8329. @end example
  8330. The command above can also be specified as:
  8331. @example
  8332. transpose=1:portrait
  8333. @end example
  8334. @section trim
  8335. Trim the input so that the output contains one continuous subpart of the input.
  8336. It accepts the following parameters:
  8337. @table @option
  8338. @item start
  8339. Specify the time of the start of the kept section, i.e. the frame with the
  8340. timestamp @var{start} will be the first frame in the output.
  8341. @item end
  8342. Specify the time of the first frame that will be dropped, i.e. the frame
  8343. immediately preceding the one with the timestamp @var{end} will be the last
  8344. frame in the output.
  8345. @item start_pts
  8346. This is the same as @var{start}, except this option sets the start timestamp
  8347. in timebase units instead of seconds.
  8348. @item end_pts
  8349. This is the same as @var{end}, except this option sets the end timestamp
  8350. in timebase units instead of seconds.
  8351. @item duration
  8352. The maximum duration of the output in seconds.
  8353. @item start_frame
  8354. The number of the first frame that should be passed to the output.
  8355. @item end_frame
  8356. The number of the first frame that should be dropped.
  8357. @end table
  8358. @option{start}, @option{end}, and @option{duration} are expressed as time
  8359. duration specifications; see
  8360. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  8361. for the accepted syntax.
  8362. Note that the first two sets of the start/end options and the @option{duration}
  8363. option look at the frame timestamp, while the _frame variants simply count the
  8364. frames that pass through the filter. Also note that this filter does not modify
  8365. the timestamps. If you wish for the output timestamps to start at zero, insert a
  8366. setpts filter after the trim filter.
  8367. If multiple start or end options are set, this filter tries to be greedy and
  8368. keep all the frames that match at least one of the specified constraints. To keep
  8369. only the part that matches all the constraints at once, chain multiple trim
  8370. filters.
  8371. The defaults are such that all the input is kept. So it is possible to set e.g.
  8372. just the end values to keep everything before the specified time.
  8373. Examples:
  8374. @itemize
  8375. @item
  8376. Drop everything except the second minute of input:
  8377. @example
  8378. ffmpeg -i INPUT -vf trim=60:120
  8379. @end example
  8380. @item
  8381. Keep only the first second:
  8382. @example
  8383. ffmpeg -i INPUT -vf trim=duration=1
  8384. @end example
  8385. @end itemize
  8386. @anchor{unsharp}
  8387. @section unsharp
  8388. Sharpen or blur the input video.
  8389. It accepts the following parameters:
  8390. @table @option
  8391. @item luma_msize_x, lx
  8392. Set the luma matrix horizontal size. It must be an odd integer between
  8393. 3 and 63. The default value is 5.
  8394. @item luma_msize_y, ly
  8395. Set the luma matrix vertical size. It must be an odd integer between 3
  8396. and 63. The default value is 5.
  8397. @item luma_amount, la
  8398. Set the luma effect strength. It must be a floating point number, reasonable
  8399. values lay between -1.5 and 1.5.
  8400. Negative values will blur the input video, while positive values will
  8401. sharpen it, a value of zero will disable the effect.
  8402. Default value is 1.0.
  8403. @item chroma_msize_x, cx
  8404. Set the chroma matrix horizontal size. It must be an odd integer
  8405. between 3 and 63. The default value is 5.
  8406. @item chroma_msize_y, cy
  8407. Set the chroma matrix vertical size. It must be an odd integer
  8408. between 3 and 63. The default value is 5.
  8409. @item chroma_amount, ca
  8410. Set the chroma effect strength. It must be a floating point number, reasonable
  8411. values lay between -1.5 and 1.5.
  8412. Negative values will blur the input video, while positive values will
  8413. sharpen it, a value of zero will disable the effect.
  8414. Default value is 0.0.
  8415. @item opencl
  8416. If set to 1, specify using OpenCL capabilities, only available if
  8417. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  8418. @end table
  8419. All parameters are optional and default to the equivalent of the
  8420. string '5:5:1.0:5:5:0.0'.
  8421. @subsection Examples
  8422. @itemize
  8423. @item
  8424. Apply strong luma sharpen effect:
  8425. @example
  8426. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  8427. @end example
  8428. @item
  8429. Apply a strong blur of both luma and chroma parameters:
  8430. @example
  8431. unsharp=7:7:-2:7:7:-2
  8432. @end example
  8433. @end itemize
  8434. @section uspp
  8435. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  8436. the image at several (or - in the case of @option{quality} level @code{8} - all)
  8437. shifts and average the results.
  8438. The way this differs from the behavior of spp is that uspp actually encodes &
  8439. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  8440. DCT similar to MJPEG.
  8441. The filter accepts the following options:
  8442. @table @option
  8443. @item quality
  8444. Set quality. This option defines the number of levels for averaging. It accepts
  8445. an integer in the range 0-8. If set to @code{0}, the filter will have no
  8446. effect. A value of @code{8} means the higher quality. For each increment of
  8447. that value the speed drops by a factor of approximately 2. Default value is
  8448. @code{3}.
  8449. @item qp
  8450. Force a constant quantization parameter. If not set, the filter will use the QP
  8451. from the video stream (if available).
  8452. @end table
  8453. @section vectorscope
  8454. Display 2 color component values in the two dimensional graph (which is called
  8455. a vectorscope).
  8456. This filter accepts the following options:
  8457. @table @option
  8458. @item mode, m
  8459. Set vectorscope mode.
  8460. It accepts the following values:
  8461. @table @samp
  8462. @item gray
  8463. Gray values are displayed on graph, higher brightness means more pixels have
  8464. same component color value on location in graph. This is the default mode.
  8465. @item color
  8466. Gray values are displayed on graph. Surrounding pixels values which are not
  8467. present in video frame are drawn in gradient of 2 color components which are
  8468. set by option @code{x} and @code{y}.
  8469. @item color2
  8470. Actual color components values present in video frame are displayed on graph.
  8471. @item color3
  8472. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  8473. on graph increases value of another color component, which is luminance by
  8474. default values of @code{x} and @code{y}.
  8475. @item color4
  8476. Actual colors present in video frame are displayed on graph. If two different
  8477. colors map to same position on graph then color with higher value of component
  8478. not present in graph is picked.
  8479. @end table
  8480. @item x
  8481. Set which color component will be represented on X-axis. Default is @code{1}.
  8482. @item y
  8483. Set which color component will be represented on Y-axis. Default is @code{2}.
  8484. @item intensity, i
  8485. Set intensity, used by modes: gray, color and color3 for increasing brightness
  8486. of color component which represents frequency of (X, Y) location in graph.
  8487. @item envelope, e
  8488. @table @samp
  8489. @item none
  8490. No envelope, this is default.
  8491. @item instant
  8492. Instant envelope, even darkest single pixel will be clearly highlighted.
  8493. @item peak
  8494. Hold maximum and minimum values presented in graph over time. This way you
  8495. can still spot out of range values without constantly looking at vectorscope.
  8496. @item peak+instant
  8497. Peak and instant envelope combined together.
  8498. @end table
  8499. @end table
  8500. @anchor{vidstabdetect}
  8501. @section vidstabdetect
  8502. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  8503. @ref{vidstabtransform} for pass 2.
  8504. This filter generates a file with relative translation and rotation
  8505. transform information about subsequent frames, which is then used by
  8506. the @ref{vidstabtransform} filter.
  8507. To enable compilation of this filter you need to configure FFmpeg with
  8508. @code{--enable-libvidstab}.
  8509. This filter accepts the following options:
  8510. @table @option
  8511. @item result
  8512. Set the path to the file used to write the transforms information.
  8513. Default value is @file{transforms.trf}.
  8514. @item shakiness
  8515. Set how shaky the video is and how quick the camera is. It accepts an
  8516. integer in the range 1-10, a value of 1 means little shakiness, a
  8517. value of 10 means strong shakiness. Default value is 5.
  8518. @item accuracy
  8519. Set the accuracy of the detection process. It must be a value in the
  8520. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  8521. accuracy. Default value is 15.
  8522. @item stepsize
  8523. Set stepsize of the search process. The region around minimum is
  8524. scanned with 1 pixel resolution. Default value is 6.
  8525. @item mincontrast
  8526. Set minimum contrast. Below this value a local measurement field is
  8527. discarded. Must be a floating point value in the range 0-1. Default
  8528. value is 0.3.
  8529. @item tripod
  8530. Set reference frame number for tripod mode.
  8531. If enabled, the motion of the frames is compared to a reference frame
  8532. in the filtered stream, identified by the specified number. The idea
  8533. is to compensate all movements in a more-or-less static scene and keep
  8534. the camera view absolutely still.
  8535. If set to 0, it is disabled. The frames are counted starting from 1.
  8536. @item show
  8537. Show fields and transforms in the resulting frames. It accepts an
  8538. integer in the range 0-2. Default value is 0, which disables any
  8539. visualization.
  8540. @end table
  8541. @subsection Examples
  8542. @itemize
  8543. @item
  8544. Use default values:
  8545. @example
  8546. vidstabdetect
  8547. @end example
  8548. @item
  8549. Analyze strongly shaky movie and put the results in file
  8550. @file{mytransforms.trf}:
  8551. @example
  8552. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  8553. @end example
  8554. @item
  8555. Visualize the result of internal transformations in the resulting
  8556. video:
  8557. @example
  8558. vidstabdetect=show=1
  8559. @end example
  8560. @item
  8561. Analyze a video with medium shakiness using @command{ffmpeg}:
  8562. @example
  8563. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  8564. @end example
  8565. @end itemize
  8566. @anchor{vidstabtransform}
  8567. @section vidstabtransform
  8568. Video stabilization/deshaking: pass 2 of 2,
  8569. see @ref{vidstabdetect} for pass 1.
  8570. Read a file with transform information for each frame and
  8571. apply/compensate them. Together with the @ref{vidstabdetect}
  8572. filter this can be used to deshake videos. See also
  8573. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  8574. the @ref{unsharp} filter, see below.
  8575. To enable compilation of this filter you need to configure FFmpeg with
  8576. @code{--enable-libvidstab}.
  8577. @subsection Options
  8578. @table @option
  8579. @item input
  8580. Set path to the file used to read the transforms. Default value is
  8581. @file{transforms.trf}.
  8582. @item smoothing
  8583. Set the number of frames (value*2 + 1) used for lowpass filtering the
  8584. camera movements. Default value is 10.
  8585. For example a number of 10 means that 21 frames are used (10 in the
  8586. past and 10 in the future) to smoothen the motion in the video. A
  8587. larger value leads to a smoother video, but limits the acceleration of
  8588. the camera (pan/tilt movements). 0 is a special case where a static
  8589. camera is simulated.
  8590. @item optalgo
  8591. Set the camera path optimization algorithm.
  8592. Accepted values are:
  8593. @table @samp
  8594. @item gauss
  8595. gaussian kernel low-pass filter on camera motion (default)
  8596. @item avg
  8597. averaging on transformations
  8598. @end table
  8599. @item maxshift
  8600. Set maximal number of pixels to translate frames. Default value is -1,
  8601. meaning no limit.
  8602. @item maxangle
  8603. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  8604. value is -1, meaning no limit.
  8605. @item crop
  8606. Specify how to deal with borders that may be visible due to movement
  8607. compensation.
  8608. Available values are:
  8609. @table @samp
  8610. @item keep
  8611. keep image information from previous frame (default)
  8612. @item black
  8613. fill the border black
  8614. @end table
  8615. @item invert
  8616. Invert transforms if set to 1. Default value is 0.
  8617. @item relative
  8618. Consider transforms as relative to previous frame if set to 1,
  8619. absolute if set to 0. Default value is 0.
  8620. @item zoom
  8621. Set percentage to zoom. A positive value will result in a zoom-in
  8622. effect, a negative value in a zoom-out effect. Default value is 0 (no
  8623. zoom).
  8624. @item optzoom
  8625. Set optimal zooming to avoid borders.
  8626. Accepted values are:
  8627. @table @samp
  8628. @item 0
  8629. disabled
  8630. @item 1
  8631. optimal static zoom value is determined (only very strong movements
  8632. will lead to visible borders) (default)
  8633. @item 2
  8634. optimal adaptive zoom value is determined (no borders will be
  8635. visible), see @option{zoomspeed}
  8636. @end table
  8637. Note that the value given at zoom is added to the one calculated here.
  8638. @item zoomspeed
  8639. Set percent to zoom maximally each frame (enabled when
  8640. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  8641. 0.25.
  8642. @item interpol
  8643. Specify type of interpolation.
  8644. Available values are:
  8645. @table @samp
  8646. @item no
  8647. no interpolation
  8648. @item linear
  8649. linear only horizontal
  8650. @item bilinear
  8651. linear in both directions (default)
  8652. @item bicubic
  8653. cubic in both directions (slow)
  8654. @end table
  8655. @item tripod
  8656. Enable virtual tripod mode if set to 1, which is equivalent to
  8657. @code{relative=0:smoothing=0}. Default value is 0.
  8658. Use also @code{tripod} option of @ref{vidstabdetect}.
  8659. @item debug
  8660. Increase log verbosity if set to 1. Also the detected global motions
  8661. are written to the temporary file @file{global_motions.trf}. Default
  8662. value is 0.
  8663. @end table
  8664. @subsection Examples
  8665. @itemize
  8666. @item
  8667. Use @command{ffmpeg} for a typical stabilization with default values:
  8668. @example
  8669. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  8670. @end example
  8671. Note the use of the @ref{unsharp} filter which is always recommended.
  8672. @item
  8673. Zoom in a bit more and load transform data from a given file:
  8674. @example
  8675. vidstabtransform=zoom=5:input="mytransforms.trf"
  8676. @end example
  8677. @item
  8678. Smoothen the video even more:
  8679. @example
  8680. vidstabtransform=smoothing=30
  8681. @end example
  8682. @end itemize
  8683. @section vflip
  8684. Flip the input video vertically.
  8685. For example, to vertically flip a video with @command{ffmpeg}:
  8686. @example
  8687. ffmpeg -i in.avi -vf "vflip" out.avi
  8688. @end example
  8689. @anchor{vignette}
  8690. @section vignette
  8691. Make or reverse a natural vignetting effect.
  8692. The filter accepts the following options:
  8693. @table @option
  8694. @item angle, a
  8695. Set lens angle expression as a number of radians.
  8696. The value is clipped in the @code{[0,PI/2]} range.
  8697. Default value: @code{"PI/5"}
  8698. @item x0
  8699. @item y0
  8700. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  8701. by default.
  8702. @item mode
  8703. Set forward/backward mode.
  8704. Available modes are:
  8705. @table @samp
  8706. @item forward
  8707. The larger the distance from the central point, the darker the image becomes.
  8708. @item backward
  8709. The larger the distance from the central point, the brighter the image becomes.
  8710. This can be used to reverse a vignette effect, though there is no automatic
  8711. detection to extract the lens @option{angle} and other settings (yet). It can
  8712. also be used to create a burning effect.
  8713. @end table
  8714. Default value is @samp{forward}.
  8715. @item eval
  8716. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  8717. It accepts the following values:
  8718. @table @samp
  8719. @item init
  8720. Evaluate expressions only once during the filter initialization.
  8721. @item frame
  8722. Evaluate expressions for each incoming frame. This is way slower than the
  8723. @samp{init} mode since it requires all the scalers to be re-computed, but it
  8724. allows advanced dynamic expressions.
  8725. @end table
  8726. Default value is @samp{init}.
  8727. @item dither
  8728. Set dithering to reduce the circular banding effects. Default is @code{1}
  8729. (enabled).
  8730. @item aspect
  8731. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  8732. Setting this value to the SAR of the input will make a rectangular vignetting
  8733. following the dimensions of the video.
  8734. Default is @code{1/1}.
  8735. @end table
  8736. @subsection Expressions
  8737. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  8738. following parameters.
  8739. @table @option
  8740. @item w
  8741. @item h
  8742. input width and height
  8743. @item n
  8744. the number of input frame, starting from 0
  8745. @item pts
  8746. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  8747. @var{TB} units, NAN if undefined
  8748. @item r
  8749. frame rate of the input video, NAN if the input frame rate is unknown
  8750. @item t
  8751. the PTS (Presentation TimeStamp) of the filtered video frame,
  8752. expressed in seconds, NAN if undefined
  8753. @item tb
  8754. time base of the input video
  8755. @end table
  8756. @subsection Examples
  8757. @itemize
  8758. @item
  8759. Apply simple strong vignetting effect:
  8760. @example
  8761. vignette=PI/4
  8762. @end example
  8763. @item
  8764. Make a flickering vignetting:
  8765. @example
  8766. vignette='PI/4+random(1)*PI/50':eval=frame
  8767. @end example
  8768. @end itemize
  8769. @section vstack
  8770. Stack input videos vertically.
  8771. All streams must be of same pixel format and of same width.
  8772. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8773. to create same output.
  8774. The filter accept the following option:
  8775. @table @option
  8776. @item nb_inputs
  8777. Set number of input streams. Default is 2.
  8778. @end table
  8779. @section w3fdif
  8780. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  8781. Deinterlacing Filter").
  8782. Based on the process described by Martin Weston for BBC R&D, and
  8783. implemented based on the de-interlace algorithm written by Jim
  8784. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  8785. uses filter coefficients calculated by BBC R&D.
  8786. There are two sets of filter coefficients, so called "simple":
  8787. and "complex". Which set of filter coefficients is used can
  8788. be set by passing an optional parameter:
  8789. @table @option
  8790. @item filter
  8791. Set the interlacing filter coefficients. Accepts one of the following values:
  8792. @table @samp
  8793. @item simple
  8794. Simple filter coefficient set.
  8795. @item complex
  8796. More-complex filter coefficient set.
  8797. @end table
  8798. Default value is @samp{complex}.
  8799. @item deint
  8800. Specify which frames to deinterlace. Accept one of the following values:
  8801. @table @samp
  8802. @item all
  8803. Deinterlace all frames,
  8804. @item interlaced
  8805. Only deinterlace frames marked as interlaced.
  8806. @end table
  8807. Default value is @samp{all}.
  8808. @end table
  8809. @section waveform
  8810. Video waveform monitor.
  8811. The waveform monitor plots color component intensity. By default luminance
  8812. only. Each column of the waveform corresponds to a column of pixels in the
  8813. source video.
  8814. It accepts the following options:
  8815. @table @option
  8816. @item mode, m
  8817. Can be either @code{row}, or @code{column}. Default is @code{column}.
  8818. In row mode, the graph on the left side represents color component value 0 and
  8819. the right side represents value = 255. In column mode, the top side represents
  8820. color component value = 0 and bottom side represents value = 255.
  8821. @item intensity, i
  8822. Set intensity. Smaller values are useful to find out how many values of the same
  8823. luminance are distributed across input rows/columns.
  8824. Default value is @code{0.04}. Allowed range is [0, 1].
  8825. @item mirror, r
  8826. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  8827. In mirrored mode, higher values will be represented on the left
  8828. side for @code{row} mode and at the top for @code{column} mode. Default is
  8829. @code{1} (mirrored).
  8830. @item display, d
  8831. Set display mode.
  8832. It accepts the following values:
  8833. @table @samp
  8834. @item overlay
  8835. Presents information identical to that in the @code{parade}, except
  8836. that the graphs representing color components are superimposed directly
  8837. over one another.
  8838. This display mode makes it easier to spot relative differences or similarities
  8839. in overlapping areas of the color components that are supposed to be identical,
  8840. such as neutral whites, grays, or blacks.
  8841. @item parade
  8842. Display separate graph for the color components side by side in
  8843. @code{row} mode or one below the other in @code{column} mode.
  8844. Using this display mode makes it easy to spot color casts in the highlights
  8845. and shadows of an image, by comparing the contours of the top and the bottom
  8846. graphs of each waveform. Since whites, grays, and blacks are characterized
  8847. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  8848. should display three waveforms of roughly equal width/height. If not, the
  8849. correction is easy to perform by making level adjustments the three waveforms.
  8850. @end table
  8851. Default is @code{parade}.
  8852. @item components, c
  8853. Set which color components to display. Default is 1, which means only luminance
  8854. or red color component if input is in RGB colorspace. If is set for example to
  8855. 7 it will display all 3 (if) available color components.
  8856. @item envelope, e
  8857. @table @samp
  8858. @item none
  8859. No envelope, this is default.
  8860. @item instant
  8861. Instant envelope, minimum and maximum values presented in graph will be easily
  8862. visible even with small @code{step} value.
  8863. @item peak
  8864. Hold minimum and maximum values presented in graph across time. This way you
  8865. can still spot out of range values without constantly looking at waveforms.
  8866. @item peak+instant
  8867. Peak and instant envelope combined together.
  8868. @end table
  8869. @item filter, f
  8870. @table @samp
  8871. @item lowpass
  8872. No filtering, this is default.
  8873. @item flat
  8874. Luma and chroma combined together.
  8875. @item aflat
  8876. Similar as above, but shows difference between blue and red chroma.
  8877. @item chroma
  8878. Displays only chroma.
  8879. @item achroma
  8880. Similar as above, but shows difference between blue and red chroma.
  8881. @item color
  8882. Displays actual color value on waveform.
  8883. @end table
  8884. @end table
  8885. @section xbr
  8886. Apply the xBR high-quality magnification filter which is designed for pixel
  8887. art. It follows a set of edge-detection rules, see
  8888. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  8889. It accepts the following option:
  8890. @table @option
  8891. @item n
  8892. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  8893. @code{3xBR} and @code{4} for @code{4xBR}.
  8894. Default is @code{3}.
  8895. @end table
  8896. @anchor{yadif}
  8897. @section yadif
  8898. Deinterlace the input video ("yadif" means "yet another deinterlacing
  8899. filter").
  8900. It accepts the following parameters:
  8901. @table @option
  8902. @item mode
  8903. The interlacing mode to adopt. It accepts one of the following values:
  8904. @table @option
  8905. @item 0, send_frame
  8906. Output one frame for each frame.
  8907. @item 1, send_field
  8908. Output one frame for each field.
  8909. @item 2, send_frame_nospatial
  8910. Like @code{send_frame}, but it skips the spatial interlacing check.
  8911. @item 3, send_field_nospatial
  8912. Like @code{send_field}, but it skips the spatial interlacing check.
  8913. @end table
  8914. The default value is @code{send_frame}.
  8915. @item parity
  8916. The picture field parity assumed for the input interlaced video. It accepts one
  8917. of the following values:
  8918. @table @option
  8919. @item 0, tff
  8920. Assume the top field is first.
  8921. @item 1, bff
  8922. Assume the bottom field is first.
  8923. @item -1, auto
  8924. Enable automatic detection of field parity.
  8925. @end table
  8926. The default value is @code{auto}.
  8927. If the interlacing is unknown or the decoder does not export this information,
  8928. top field first will be assumed.
  8929. @item deint
  8930. Specify which frames to deinterlace. Accept one of the following
  8931. values:
  8932. @table @option
  8933. @item 0, all
  8934. Deinterlace all frames.
  8935. @item 1, interlaced
  8936. Only deinterlace frames marked as interlaced.
  8937. @end table
  8938. The default value is @code{all}.
  8939. @end table
  8940. @section zoompan
  8941. Apply Zoom & Pan effect.
  8942. This filter accepts the following options:
  8943. @table @option
  8944. @item zoom, z
  8945. Set the zoom expression. Default is 1.
  8946. @item x
  8947. @item y
  8948. Set the x and y expression. Default is 0.
  8949. @item d
  8950. Set the duration expression in number of frames.
  8951. This sets for how many number of frames effect will last for
  8952. single input image.
  8953. @item s
  8954. Set the output image size, default is 'hd720'.
  8955. @end table
  8956. Each expression can contain the following constants:
  8957. @table @option
  8958. @item in_w, iw
  8959. Input width.
  8960. @item in_h, ih
  8961. Input height.
  8962. @item out_w, ow
  8963. Output width.
  8964. @item out_h, oh
  8965. Output height.
  8966. @item in
  8967. Input frame count.
  8968. @item on
  8969. Output frame count.
  8970. @item x
  8971. @item y
  8972. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  8973. for current input frame.
  8974. @item px
  8975. @item py
  8976. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  8977. not yet such frame (first input frame).
  8978. @item zoom
  8979. Last calculated zoom from 'z' expression for current input frame.
  8980. @item pzoom
  8981. Last calculated zoom of last output frame of previous input frame.
  8982. @item duration
  8983. Number of output frames for current input frame. Calculated from 'd' expression
  8984. for each input frame.
  8985. @item pduration
  8986. number of output frames created for previous input frame
  8987. @item a
  8988. Rational number: input width / input height
  8989. @item sar
  8990. sample aspect ratio
  8991. @item dar
  8992. display aspect ratio
  8993. @end table
  8994. @subsection Examples
  8995. @itemize
  8996. @item
  8997. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  8998. @example
  8999. 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
  9000. @end example
  9001. @item
  9002. Zoom-in up to 1.5 and pan always at center of picture:
  9003. @example
  9004. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9005. @end example
  9006. @end itemize
  9007. @c man end VIDEO FILTERS
  9008. @chapter Video Sources
  9009. @c man begin VIDEO SOURCES
  9010. Below is a description of the currently available video sources.
  9011. @section buffer
  9012. Buffer video frames, and make them available to the filter chain.
  9013. This source is mainly intended for a programmatic use, in particular
  9014. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9015. It accepts the following parameters:
  9016. @table @option
  9017. @item video_size
  9018. Specify the size (width and height) of the buffered video frames. For the
  9019. syntax of this option, check the
  9020. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9021. @item width
  9022. The input video width.
  9023. @item height
  9024. The input video height.
  9025. @item pix_fmt
  9026. A string representing the pixel format of the buffered video frames.
  9027. It may be a number corresponding to a pixel format, or a pixel format
  9028. name.
  9029. @item time_base
  9030. Specify the timebase assumed by the timestamps of the buffered frames.
  9031. @item frame_rate
  9032. Specify the frame rate expected for the video stream.
  9033. @item pixel_aspect, sar
  9034. The sample (pixel) aspect ratio of the input video.
  9035. @item sws_param
  9036. Specify the optional parameters to be used for the scale filter which
  9037. is automatically inserted when an input change is detected in the
  9038. input size or format.
  9039. @end table
  9040. For example:
  9041. @example
  9042. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9043. @end example
  9044. will instruct the source to accept video frames with size 320x240 and
  9045. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9046. square pixels (1:1 sample aspect ratio).
  9047. Since the pixel format with name "yuv410p" corresponds to the number 6
  9048. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9049. this example corresponds to:
  9050. @example
  9051. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9052. @end example
  9053. Alternatively, the options can be specified as a flat string, but this
  9054. syntax is deprecated:
  9055. @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}]
  9056. @section cellauto
  9057. Create a pattern generated by an elementary cellular automaton.
  9058. The initial state of the cellular automaton can be defined through the
  9059. @option{filename}, and @option{pattern} options. If such options are
  9060. not specified an initial state is created randomly.
  9061. At each new frame a new row in the video is filled with the result of
  9062. the cellular automaton next generation. The behavior when the whole
  9063. frame is filled is defined by the @option{scroll} option.
  9064. This source accepts the following options:
  9065. @table @option
  9066. @item filename, f
  9067. Read the initial cellular automaton state, i.e. the starting row, from
  9068. the specified file.
  9069. In the file, each non-whitespace character is considered an alive
  9070. cell, a newline will terminate the row, and further characters in the
  9071. file will be ignored.
  9072. @item pattern, p
  9073. Read the initial cellular automaton state, i.e. the starting row, from
  9074. the specified string.
  9075. Each non-whitespace character in the string is considered an alive
  9076. cell, a newline will terminate the row, and further characters in the
  9077. string will be ignored.
  9078. @item rate, r
  9079. Set the video rate, that is the number of frames generated per second.
  9080. Default is 25.
  9081. @item random_fill_ratio, ratio
  9082. Set the random fill ratio for the initial cellular automaton row. It
  9083. is a floating point number value ranging from 0 to 1, defaults to
  9084. 1/PHI.
  9085. This option is ignored when a file or a pattern is specified.
  9086. @item random_seed, seed
  9087. Set the seed for filling randomly the initial row, must be an integer
  9088. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9089. set to -1, the filter will try to use a good random seed on a best
  9090. effort basis.
  9091. @item rule
  9092. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9093. Default value is 110.
  9094. @item size, s
  9095. Set the size of the output video. For the syntax of this option, check the
  9096. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9097. If @option{filename} or @option{pattern} is specified, the size is set
  9098. by default to the width of the specified initial state row, and the
  9099. height is set to @var{width} * PHI.
  9100. If @option{size} is set, it must contain the width of the specified
  9101. pattern string, and the specified pattern will be centered in the
  9102. larger row.
  9103. If a filename or a pattern string is not specified, the size value
  9104. defaults to "320x518" (used for a randomly generated initial state).
  9105. @item scroll
  9106. If set to 1, scroll the output upward when all the rows in the output
  9107. have been already filled. If set to 0, the new generated row will be
  9108. written over the top row just after the bottom row is filled.
  9109. Defaults to 1.
  9110. @item start_full, full
  9111. If set to 1, completely fill the output with generated rows before
  9112. outputting the first frame.
  9113. This is the default behavior, for disabling set the value to 0.
  9114. @item stitch
  9115. If set to 1, stitch the left and right row edges together.
  9116. This is the default behavior, for disabling set the value to 0.
  9117. @end table
  9118. @subsection Examples
  9119. @itemize
  9120. @item
  9121. Read the initial state from @file{pattern}, and specify an output of
  9122. size 200x400.
  9123. @example
  9124. cellauto=f=pattern:s=200x400
  9125. @end example
  9126. @item
  9127. Generate a random initial row with a width of 200 cells, with a fill
  9128. ratio of 2/3:
  9129. @example
  9130. cellauto=ratio=2/3:s=200x200
  9131. @end example
  9132. @item
  9133. Create a pattern generated by rule 18 starting by a single alive cell
  9134. centered on an initial row with width 100:
  9135. @example
  9136. cellauto=p=@@:s=100x400:full=0:rule=18
  9137. @end example
  9138. @item
  9139. Specify a more elaborated initial pattern:
  9140. @example
  9141. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  9142. @end example
  9143. @end itemize
  9144. @section mandelbrot
  9145. Generate a Mandelbrot set fractal, and progressively zoom towards the
  9146. point specified with @var{start_x} and @var{start_y}.
  9147. This source accepts the following options:
  9148. @table @option
  9149. @item end_pts
  9150. Set the terminal pts value. Default value is 400.
  9151. @item end_scale
  9152. Set the terminal scale value.
  9153. Must be a floating point value. Default value is 0.3.
  9154. @item inner
  9155. Set the inner coloring mode, that is the algorithm used to draw the
  9156. Mandelbrot fractal internal region.
  9157. It shall assume one of the following values:
  9158. @table @option
  9159. @item black
  9160. Set black mode.
  9161. @item convergence
  9162. Show time until convergence.
  9163. @item mincol
  9164. Set color based on point closest to the origin of the iterations.
  9165. @item period
  9166. Set period mode.
  9167. @end table
  9168. Default value is @var{mincol}.
  9169. @item bailout
  9170. Set the bailout value. Default value is 10.0.
  9171. @item maxiter
  9172. Set the maximum of iterations performed by the rendering
  9173. algorithm. Default value is 7189.
  9174. @item outer
  9175. Set outer coloring mode.
  9176. It shall assume one of following values:
  9177. @table @option
  9178. @item iteration_count
  9179. Set iteration cound mode.
  9180. @item normalized_iteration_count
  9181. set normalized iteration count mode.
  9182. @end table
  9183. Default value is @var{normalized_iteration_count}.
  9184. @item rate, r
  9185. Set frame rate, expressed as number of frames per second. Default
  9186. value is "25".
  9187. @item size, s
  9188. Set frame size. For the syntax of this option, check the "Video
  9189. size" section in the ffmpeg-utils manual. Default value is "640x480".
  9190. @item start_scale
  9191. Set the initial scale value. Default value is 3.0.
  9192. @item start_x
  9193. Set the initial x position. Must be a floating point value between
  9194. -100 and 100. Default value is -0.743643887037158704752191506114774.
  9195. @item start_y
  9196. Set the initial y position. Must be a floating point value between
  9197. -100 and 100. Default value is -0.131825904205311970493132056385139.
  9198. @end table
  9199. @section mptestsrc
  9200. Generate various test patterns, as generated by the MPlayer test filter.
  9201. The size of the generated video is fixed, and is 256x256.
  9202. This source is useful in particular for testing encoding features.
  9203. This source accepts the following options:
  9204. @table @option
  9205. @item rate, r
  9206. Specify the frame rate of the sourced video, as the number of frames
  9207. generated per second. It has to be a string in the format
  9208. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9209. number or a valid video frame rate abbreviation. The default value is
  9210. "25".
  9211. @item duration, d
  9212. Set the duration of the sourced video. See
  9213. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9214. for the accepted syntax.
  9215. If not specified, or the expressed duration is negative, the video is
  9216. supposed to be generated forever.
  9217. @item test, t
  9218. Set the number or the name of the test to perform. Supported tests are:
  9219. @table @option
  9220. @item dc_luma
  9221. @item dc_chroma
  9222. @item freq_luma
  9223. @item freq_chroma
  9224. @item amp_luma
  9225. @item amp_chroma
  9226. @item cbp
  9227. @item mv
  9228. @item ring1
  9229. @item ring2
  9230. @item all
  9231. @end table
  9232. Default value is "all", which will cycle through the list of all tests.
  9233. @end table
  9234. Some examples:
  9235. @example
  9236. mptestsrc=t=dc_luma
  9237. @end example
  9238. will generate a "dc_luma" test pattern.
  9239. @section frei0r_src
  9240. Provide a frei0r source.
  9241. To enable compilation of this filter you need to install the frei0r
  9242. header and configure FFmpeg with @code{--enable-frei0r}.
  9243. This source accepts the following parameters:
  9244. @table @option
  9245. @item size
  9246. The size of the video to generate. For the syntax of this option, check the
  9247. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9248. @item framerate
  9249. The framerate of the generated video. It may be a string of the form
  9250. @var{num}/@var{den} or a frame rate abbreviation.
  9251. @item filter_name
  9252. The name to the frei0r source to load. For more information regarding frei0r and
  9253. how to set the parameters, read the @ref{frei0r} section in the video filters
  9254. documentation.
  9255. @item filter_params
  9256. A '|'-separated list of parameters to pass to the frei0r source.
  9257. @end table
  9258. For example, to generate a frei0r partik0l source with size 200x200
  9259. and frame rate 10 which is overlaid on the overlay filter main input:
  9260. @example
  9261. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  9262. @end example
  9263. @section life
  9264. Generate a life pattern.
  9265. This source is based on a generalization of John Conway's life game.
  9266. The sourced input represents a life grid, each pixel represents a cell
  9267. which can be in one of two possible states, alive or dead. Every cell
  9268. interacts with its eight neighbours, which are the cells that are
  9269. horizontally, vertically, or diagonally adjacent.
  9270. At each interaction the grid evolves according to the adopted rule,
  9271. which specifies the number of neighbor alive cells which will make a
  9272. cell stay alive or born. The @option{rule} option allows one to specify
  9273. the rule to adopt.
  9274. This source accepts the following options:
  9275. @table @option
  9276. @item filename, f
  9277. Set the file from which to read the initial grid state. In the file,
  9278. each non-whitespace character is considered an alive cell, and newline
  9279. is used to delimit the end of each row.
  9280. If this option is not specified, the initial grid is generated
  9281. randomly.
  9282. @item rate, r
  9283. Set the video rate, that is the number of frames generated per second.
  9284. Default is 25.
  9285. @item random_fill_ratio, ratio
  9286. Set the random fill ratio for the initial random grid. It is a
  9287. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  9288. It is ignored when a file is specified.
  9289. @item random_seed, seed
  9290. Set the seed for filling the initial random grid, must be an integer
  9291. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9292. set to -1, the filter will try to use a good random seed on a best
  9293. effort basis.
  9294. @item rule
  9295. Set the life rule.
  9296. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  9297. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  9298. @var{NS} specifies the number of alive neighbor cells which make a
  9299. live cell stay alive, and @var{NB} the number of alive neighbor cells
  9300. which make a dead cell to become alive (i.e. to "born").
  9301. "s" and "b" can be used in place of "S" and "B", respectively.
  9302. Alternatively a rule can be specified by an 18-bits integer. The 9
  9303. high order bits are used to encode the next cell state if it is alive
  9304. for each number of neighbor alive cells, the low order bits specify
  9305. the rule for "borning" new cells. Higher order bits encode for an
  9306. higher number of neighbor cells.
  9307. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  9308. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  9309. Default value is "S23/B3", which is the original Conway's game of life
  9310. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  9311. cells, and will born a new cell if there are three alive cells around
  9312. a dead cell.
  9313. @item size, s
  9314. Set the size of the output video. For the syntax of this option, check the
  9315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9316. If @option{filename} is specified, the size is set by default to the
  9317. same size of the input file. If @option{size} is set, it must contain
  9318. the size specified in the input file, and the initial grid defined in
  9319. that file is centered in the larger resulting area.
  9320. If a filename is not specified, the size value defaults to "320x240"
  9321. (used for a randomly generated initial grid).
  9322. @item stitch
  9323. If set to 1, stitch the left and right grid edges together, and the
  9324. top and bottom edges also. Defaults to 1.
  9325. @item mold
  9326. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  9327. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  9328. value from 0 to 255.
  9329. @item life_color
  9330. Set the color of living (or new born) cells.
  9331. @item death_color
  9332. Set the color of dead cells. If @option{mold} is set, this is the first color
  9333. used to represent a dead cell.
  9334. @item mold_color
  9335. Set mold color, for definitely dead and moldy cells.
  9336. For the syntax of these 3 color options, check the "Color" section in the
  9337. ffmpeg-utils manual.
  9338. @end table
  9339. @subsection Examples
  9340. @itemize
  9341. @item
  9342. Read a grid from @file{pattern}, and center it on a grid of size
  9343. 300x300 pixels:
  9344. @example
  9345. life=f=pattern:s=300x300
  9346. @end example
  9347. @item
  9348. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  9349. @example
  9350. life=ratio=2/3:s=200x200
  9351. @end example
  9352. @item
  9353. Specify a custom rule for evolving a randomly generated grid:
  9354. @example
  9355. life=rule=S14/B34
  9356. @end example
  9357. @item
  9358. Full example with slow death effect (mold) using @command{ffplay}:
  9359. @example
  9360. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  9361. @end example
  9362. @end itemize
  9363. @anchor{allrgb}
  9364. @anchor{allyuv}
  9365. @anchor{color}
  9366. @anchor{haldclutsrc}
  9367. @anchor{nullsrc}
  9368. @anchor{rgbtestsrc}
  9369. @anchor{smptebars}
  9370. @anchor{smptehdbars}
  9371. @anchor{testsrc}
  9372. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  9373. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  9374. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  9375. The @code{color} source provides an uniformly colored input.
  9376. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  9377. @ref{haldclut} filter.
  9378. The @code{nullsrc} source returns unprocessed video frames. It is
  9379. mainly useful to be employed in analysis / debugging tools, or as the
  9380. source for filters which ignore the input data.
  9381. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  9382. detecting RGB vs BGR issues. You should see a red, green and blue
  9383. stripe from top to bottom.
  9384. The @code{smptebars} source generates a color bars pattern, based on
  9385. the SMPTE Engineering Guideline EG 1-1990.
  9386. The @code{smptehdbars} source generates a color bars pattern, based on
  9387. the SMPTE RP 219-2002.
  9388. The @code{testsrc} source generates a test video pattern, showing a
  9389. color pattern, a scrolling gradient and a timestamp. This is mainly
  9390. intended for testing purposes.
  9391. The sources accept the following parameters:
  9392. @table @option
  9393. @item color, c
  9394. Specify the color of the source, only available in the @code{color}
  9395. source. For the syntax of this option, check the "Color" section in the
  9396. ffmpeg-utils manual.
  9397. @item level
  9398. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  9399. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  9400. pixels to be used as identity matrix for 3D lookup tables. Each component is
  9401. coded on a @code{1/(N*N)} scale.
  9402. @item size, s
  9403. Specify the size of the sourced video. For the syntax of this option, check the
  9404. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9405. The default value is @code{320x240}.
  9406. This option is not available with the @code{haldclutsrc} filter.
  9407. @item rate, r
  9408. Specify the frame rate of the sourced video, as the number of frames
  9409. generated per second. It has to be a string in the format
  9410. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  9411. number or a valid video frame rate abbreviation. The default value is
  9412. "25".
  9413. @item sar
  9414. Set the sample aspect ratio of the sourced video.
  9415. @item duration, d
  9416. Set the duration of the sourced video. See
  9417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9418. for the accepted syntax.
  9419. If not specified, or the expressed duration is negative, the video is
  9420. supposed to be generated forever.
  9421. @item decimals, n
  9422. Set the number of decimals to show in the timestamp, only available in the
  9423. @code{testsrc} source.
  9424. The displayed timestamp value will correspond to the original
  9425. timestamp value multiplied by the power of 10 of the specified
  9426. value. Default value is 0.
  9427. @end table
  9428. For example the following:
  9429. @example
  9430. testsrc=duration=5.3:size=qcif:rate=10
  9431. @end example
  9432. will generate a video with a duration of 5.3 seconds, with size
  9433. 176x144 and a frame rate of 10 frames per second.
  9434. The following graph description will generate a red source
  9435. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  9436. frames per second.
  9437. @example
  9438. color=c=red@@0.2:s=qcif:r=10
  9439. @end example
  9440. If the input content is to be ignored, @code{nullsrc} can be used. The
  9441. following command generates noise in the luminance plane by employing
  9442. the @code{geq} filter:
  9443. @example
  9444. nullsrc=s=256x256, geq=random(1)*255:128:128
  9445. @end example
  9446. @subsection Commands
  9447. The @code{color} source supports the following commands:
  9448. @table @option
  9449. @item c, color
  9450. Set the color of the created image. Accepts the same syntax of the
  9451. corresponding @option{color} option.
  9452. @end table
  9453. @c man end VIDEO SOURCES
  9454. @chapter Video Sinks
  9455. @c man begin VIDEO SINKS
  9456. Below is a description of the currently available video sinks.
  9457. @section buffersink
  9458. Buffer video frames, and make them available to the end of the filter
  9459. graph.
  9460. This sink is mainly intended for programmatic use, in particular
  9461. through the interface defined in @file{libavfilter/buffersink.h}
  9462. or the options system.
  9463. It accepts a pointer to an AVBufferSinkContext structure, which
  9464. defines the incoming buffers' formats, to be passed as the opaque
  9465. parameter to @code{avfilter_init_filter} for initialization.
  9466. @section nullsink
  9467. Null video sink: do absolutely nothing with the input video. It is
  9468. mainly useful as a template and for use in analysis / debugging
  9469. tools.
  9470. @c man end VIDEO SINKS
  9471. @chapter Multimedia Filters
  9472. @c man begin MULTIMEDIA FILTERS
  9473. Below is a description of the currently available multimedia filters.
  9474. @section aphasemeter
  9475. Convert input audio to a video output, displaying the audio phase.
  9476. The filter accepts the following options:
  9477. @table @option
  9478. @item rate, r
  9479. Set the output frame rate. Default value is @code{25}.
  9480. @item size, s
  9481. Set the video size for the output. For the syntax of this option, check the
  9482. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9483. Default value is @code{800x400}.
  9484. @item rc
  9485. @item gc
  9486. @item bc
  9487. Specify the red, green, blue contrast. Default values are @code{2},
  9488. @code{7} and @code{1}.
  9489. Allowed range is @code{[0, 255]}.
  9490. @item mpc
  9491. Set color which will be used for drawing median phase. If color is
  9492. @code{none} which is default, no median phase value will be drawn.
  9493. @end table
  9494. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  9495. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  9496. The @code{-1} means left and right channels are completely out of phase and
  9497. @code{1} means channels are in phase.
  9498. @section avectorscope
  9499. Convert input audio to a video output, representing the audio vector
  9500. scope.
  9501. The filter is used to measure the difference between channels of stereo
  9502. audio stream. A monoaural signal, consisting of identical left and right
  9503. signal, results in straight vertical line. Any stereo separation is visible
  9504. as a deviation from this line, creating a Lissajous figure.
  9505. If the straight (or deviation from it) but horizontal line appears this
  9506. indicates that the left and right channels are out of phase.
  9507. The filter accepts the following options:
  9508. @table @option
  9509. @item mode, m
  9510. Set the vectorscope mode.
  9511. Available values are:
  9512. @table @samp
  9513. @item lissajous
  9514. Lissajous rotated by 45 degrees.
  9515. @item lissajous_xy
  9516. Same as above but not rotated.
  9517. @item polar
  9518. Shape resembling half of circle.
  9519. @end table
  9520. Default value is @samp{lissajous}.
  9521. @item size, s
  9522. Set the video size for the output. For the syntax of this option, check the
  9523. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9524. Default value is @code{400x400}.
  9525. @item rate, r
  9526. Set the output frame rate. Default value is @code{25}.
  9527. @item rc
  9528. @item gc
  9529. @item bc
  9530. @item ac
  9531. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  9532. @code{160}, @code{80} and @code{255}.
  9533. Allowed range is @code{[0, 255]}.
  9534. @item rf
  9535. @item gf
  9536. @item bf
  9537. @item af
  9538. Specify the red, green, blue and alpha fade. Default values are @code{15},
  9539. @code{10}, @code{5} and @code{5}.
  9540. Allowed range is @code{[0, 255]}.
  9541. @item zoom
  9542. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  9543. @end table
  9544. @subsection Examples
  9545. @itemize
  9546. @item
  9547. Complete example using @command{ffplay}:
  9548. @example
  9549. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  9550. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  9551. @end example
  9552. @end itemize
  9553. @section concat
  9554. Concatenate audio and video streams, joining them together one after the
  9555. other.
  9556. The filter works on segments of synchronized video and audio streams. All
  9557. segments must have the same number of streams of each type, and that will
  9558. also be the number of streams at output.
  9559. The filter accepts the following options:
  9560. @table @option
  9561. @item n
  9562. Set the number of segments. Default is 2.
  9563. @item v
  9564. Set the number of output video streams, that is also the number of video
  9565. streams in each segment. Default is 1.
  9566. @item a
  9567. Set the number of output audio streams, that is also the number of audio
  9568. streams in each segment. Default is 0.
  9569. @item unsafe
  9570. Activate unsafe mode: do not fail if segments have a different format.
  9571. @end table
  9572. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  9573. @var{a} audio outputs.
  9574. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  9575. segment, in the same order as the outputs, then the inputs for the second
  9576. segment, etc.
  9577. Related streams do not always have exactly the same duration, for various
  9578. reasons including codec frame size or sloppy authoring. For that reason,
  9579. related synchronized streams (e.g. a video and its audio track) should be
  9580. concatenated at once. The concat filter will use the duration of the longest
  9581. stream in each segment (except the last one), and if necessary pad shorter
  9582. audio streams with silence.
  9583. For this filter to work correctly, all segments must start at timestamp 0.
  9584. All corresponding streams must have the same parameters in all segments; the
  9585. filtering system will automatically select a common pixel format for video
  9586. streams, and a common sample format, sample rate and channel layout for
  9587. audio streams, but other settings, such as resolution, must be converted
  9588. explicitly by the user.
  9589. Different frame rates are acceptable but will result in variable frame rate
  9590. at output; be sure to configure the output file to handle it.
  9591. @subsection Examples
  9592. @itemize
  9593. @item
  9594. Concatenate an opening, an episode and an ending, all in bilingual version
  9595. (video in stream 0, audio in streams 1 and 2):
  9596. @example
  9597. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  9598. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  9599. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  9600. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  9601. @end example
  9602. @item
  9603. Concatenate two parts, handling audio and video separately, using the
  9604. (a)movie sources, and adjusting the resolution:
  9605. @example
  9606. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  9607. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  9608. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  9609. @end example
  9610. Note that a desync will happen at the stitch if the audio and video streams
  9611. do not have exactly the same duration in the first file.
  9612. @end itemize
  9613. @anchor{ebur128}
  9614. @section ebur128
  9615. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  9616. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  9617. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  9618. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  9619. The filter also has a video output (see the @var{video} option) with a real
  9620. time graph to observe the loudness evolution. The graphic contains the logged
  9621. message mentioned above, so it is not printed anymore when this option is set,
  9622. unless the verbose logging is set. The main graphing area contains the
  9623. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  9624. the momentary loudness (400 milliseconds).
  9625. More information about the Loudness Recommendation EBU R128 on
  9626. @url{http://tech.ebu.ch/loudness}.
  9627. The filter accepts the following options:
  9628. @table @option
  9629. @item video
  9630. Activate the video output. The audio stream is passed unchanged whether this
  9631. option is set or no. The video stream will be the first output stream if
  9632. activated. Default is @code{0}.
  9633. @item size
  9634. Set the video size. This option is for video only. For the syntax of this
  9635. option, check the
  9636. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9637. Default and minimum resolution is @code{640x480}.
  9638. @item meter
  9639. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  9640. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  9641. other integer value between this range is allowed.
  9642. @item metadata
  9643. Set metadata injection. If set to @code{1}, the audio input will be segmented
  9644. into 100ms output frames, each of them containing various loudness information
  9645. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  9646. Default is @code{0}.
  9647. @item framelog
  9648. Force the frame logging level.
  9649. Available values are:
  9650. @table @samp
  9651. @item info
  9652. information logging level
  9653. @item verbose
  9654. verbose logging level
  9655. @end table
  9656. By default, the logging level is set to @var{info}. If the @option{video} or
  9657. the @option{metadata} options are set, it switches to @var{verbose}.
  9658. @item peak
  9659. Set peak mode(s).
  9660. Available modes can be cumulated (the option is a @code{flag} type). Possible
  9661. values are:
  9662. @table @samp
  9663. @item none
  9664. Disable any peak mode (default).
  9665. @item sample
  9666. Enable sample-peak mode.
  9667. Simple peak mode looking for the higher sample value. It logs a message
  9668. for sample-peak (identified by @code{SPK}).
  9669. @item true
  9670. Enable true-peak mode.
  9671. If enabled, the peak lookup is done on an over-sampled version of the input
  9672. stream for better peak accuracy. It logs a message for true-peak.
  9673. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  9674. This mode requires a build with @code{libswresample}.
  9675. @end table
  9676. @end table
  9677. @subsection Examples
  9678. @itemize
  9679. @item
  9680. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  9681. @example
  9682. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  9683. @end example
  9684. @item
  9685. Run an analysis with @command{ffmpeg}:
  9686. @example
  9687. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  9688. @end example
  9689. @end itemize
  9690. @section interleave, ainterleave
  9691. Temporally interleave frames from several inputs.
  9692. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  9693. These filters read frames from several inputs and send the oldest
  9694. queued frame to the output.
  9695. Input streams must have a well defined, monotonically increasing frame
  9696. timestamp values.
  9697. In order to submit one frame to output, these filters need to enqueue
  9698. at least one frame for each input, so they cannot work in case one
  9699. input is not yet terminated and will not receive incoming frames.
  9700. For example consider the case when one input is a @code{select} filter
  9701. which always drop input frames. The @code{interleave} filter will keep
  9702. reading from that input, but it will never be able to send new frames
  9703. to output until the input will send an end-of-stream signal.
  9704. Also, depending on inputs synchronization, the filters will drop
  9705. frames in case one input receives more frames than the other ones, and
  9706. the queue is already filled.
  9707. These filters accept the following options:
  9708. @table @option
  9709. @item nb_inputs, n
  9710. Set the number of different inputs, it is 2 by default.
  9711. @end table
  9712. @subsection Examples
  9713. @itemize
  9714. @item
  9715. Interleave frames belonging to different streams using @command{ffmpeg}:
  9716. @example
  9717. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  9718. @end example
  9719. @item
  9720. Add flickering blur effect:
  9721. @example
  9722. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  9723. @end example
  9724. @end itemize
  9725. @section perms, aperms
  9726. Set read/write permissions for the output frames.
  9727. These filters are mainly aimed at developers to test direct path in the
  9728. following filter in the filtergraph.
  9729. The filters accept the following options:
  9730. @table @option
  9731. @item mode
  9732. Select the permissions mode.
  9733. It accepts the following values:
  9734. @table @samp
  9735. @item none
  9736. Do nothing. This is the default.
  9737. @item ro
  9738. Set all the output frames read-only.
  9739. @item rw
  9740. Set all the output frames directly writable.
  9741. @item toggle
  9742. Make the frame read-only if writable, and writable if read-only.
  9743. @item random
  9744. Set each output frame read-only or writable randomly.
  9745. @end table
  9746. @item seed
  9747. Set the seed for the @var{random} mode, must be an integer included between
  9748. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9749. @code{-1}, the filter will try to use a good random seed on a best effort
  9750. basis.
  9751. @end table
  9752. Note: in case of auto-inserted filter between the permission filter and the
  9753. following one, the permission might not be received as expected in that
  9754. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  9755. perms/aperms filter can avoid this problem.
  9756. @section select, aselect
  9757. Select frames to pass in output.
  9758. This filter accepts the following options:
  9759. @table @option
  9760. @item expr, e
  9761. Set expression, which is evaluated for each input frame.
  9762. If the expression is evaluated to zero, the frame is discarded.
  9763. If the evaluation result is negative or NaN, the frame is sent to the
  9764. first output; otherwise it is sent to the output with index
  9765. @code{ceil(val)-1}, assuming that the input index starts from 0.
  9766. For example a value of @code{1.2} corresponds to the output with index
  9767. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  9768. @item outputs, n
  9769. Set the number of outputs. The output to which to send the selected
  9770. frame is based on the result of the evaluation. Default value is 1.
  9771. @end table
  9772. The expression can contain the following constants:
  9773. @table @option
  9774. @item n
  9775. The (sequential) number of the filtered frame, starting from 0.
  9776. @item selected_n
  9777. The (sequential) number of the selected frame, starting from 0.
  9778. @item prev_selected_n
  9779. The sequential number of the last selected frame. It's NAN if undefined.
  9780. @item TB
  9781. The timebase of the input timestamps.
  9782. @item pts
  9783. The PTS (Presentation TimeStamp) of the filtered video frame,
  9784. expressed in @var{TB} units. It's NAN if undefined.
  9785. @item t
  9786. The PTS of the filtered video frame,
  9787. expressed in seconds. It's NAN if undefined.
  9788. @item prev_pts
  9789. The PTS of the previously filtered video frame. It's NAN if undefined.
  9790. @item prev_selected_pts
  9791. The PTS of the last previously filtered video frame. It's NAN if undefined.
  9792. @item prev_selected_t
  9793. The PTS of the last previously selected video frame. It's NAN if undefined.
  9794. @item start_pts
  9795. The PTS of the first video frame in the video. It's NAN if undefined.
  9796. @item start_t
  9797. The time of the first video frame in the video. It's NAN if undefined.
  9798. @item pict_type @emph{(video only)}
  9799. The type of the filtered frame. It can assume one of the following
  9800. values:
  9801. @table @option
  9802. @item I
  9803. @item P
  9804. @item B
  9805. @item S
  9806. @item SI
  9807. @item SP
  9808. @item BI
  9809. @end table
  9810. @item interlace_type @emph{(video only)}
  9811. The frame interlace type. It can assume one of the following values:
  9812. @table @option
  9813. @item PROGRESSIVE
  9814. The frame is progressive (not interlaced).
  9815. @item TOPFIRST
  9816. The frame is top-field-first.
  9817. @item BOTTOMFIRST
  9818. The frame is bottom-field-first.
  9819. @end table
  9820. @item consumed_sample_n @emph{(audio only)}
  9821. the number of selected samples before the current frame
  9822. @item samples_n @emph{(audio only)}
  9823. the number of samples in the current frame
  9824. @item sample_rate @emph{(audio only)}
  9825. the input sample rate
  9826. @item key
  9827. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  9828. @item pos
  9829. the position in the file of the filtered frame, -1 if the information
  9830. is not available (e.g. for synthetic video)
  9831. @item scene @emph{(video only)}
  9832. value between 0 and 1 to indicate a new scene; a low value reflects a low
  9833. probability for the current frame to introduce a new scene, while a higher
  9834. value means the current frame is more likely to be one (see the example below)
  9835. @end table
  9836. The default value of the select expression is "1".
  9837. @subsection Examples
  9838. @itemize
  9839. @item
  9840. Select all frames in input:
  9841. @example
  9842. select
  9843. @end example
  9844. The example above is the same as:
  9845. @example
  9846. select=1
  9847. @end example
  9848. @item
  9849. Skip all frames:
  9850. @example
  9851. select=0
  9852. @end example
  9853. @item
  9854. Select only I-frames:
  9855. @example
  9856. select='eq(pict_type\,I)'
  9857. @end example
  9858. @item
  9859. Select one frame every 100:
  9860. @example
  9861. select='not(mod(n\,100))'
  9862. @end example
  9863. @item
  9864. Select only frames contained in the 10-20 time interval:
  9865. @example
  9866. select=between(t\,10\,20)
  9867. @end example
  9868. @item
  9869. Select only I frames contained in the 10-20 time interval:
  9870. @example
  9871. select=between(t\,10\,20)*eq(pict_type\,I)
  9872. @end example
  9873. @item
  9874. Select frames with a minimum distance of 10 seconds:
  9875. @example
  9876. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  9877. @end example
  9878. @item
  9879. Use aselect to select only audio frames with samples number > 100:
  9880. @example
  9881. aselect='gt(samples_n\,100)'
  9882. @end example
  9883. @item
  9884. Create a mosaic of the first scenes:
  9885. @example
  9886. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  9887. @end example
  9888. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  9889. choice.
  9890. @item
  9891. Send even and odd frames to separate outputs, and compose them:
  9892. @example
  9893. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  9894. @end example
  9895. @end itemize
  9896. @section sendcmd, asendcmd
  9897. Send commands to filters in the filtergraph.
  9898. These filters read commands to be sent to other filters in the
  9899. filtergraph.
  9900. @code{sendcmd} must be inserted between two video filters,
  9901. @code{asendcmd} must be inserted between two audio filters, but apart
  9902. from that they act the same way.
  9903. The specification of commands can be provided in the filter arguments
  9904. with the @var{commands} option, or in a file specified by the
  9905. @var{filename} option.
  9906. These filters accept the following options:
  9907. @table @option
  9908. @item commands, c
  9909. Set the commands to be read and sent to the other filters.
  9910. @item filename, f
  9911. Set the filename of the commands to be read and sent to the other
  9912. filters.
  9913. @end table
  9914. @subsection Commands syntax
  9915. A commands description consists of a sequence of interval
  9916. specifications, comprising a list of commands to be executed when a
  9917. particular event related to that interval occurs. The occurring event
  9918. is typically the current frame time entering or leaving a given time
  9919. interval.
  9920. An interval is specified by the following syntax:
  9921. @example
  9922. @var{START}[-@var{END}] @var{COMMANDS};
  9923. @end example
  9924. The time interval is specified by the @var{START} and @var{END} times.
  9925. @var{END} is optional and defaults to the maximum time.
  9926. The current frame time is considered within the specified interval if
  9927. it is included in the interval [@var{START}, @var{END}), that is when
  9928. the time is greater or equal to @var{START} and is lesser than
  9929. @var{END}.
  9930. @var{COMMANDS} consists of a sequence of one or more command
  9931. specifications, separated by ",", relating to that interval. The
  9932. syntax of a command specification is given by:
  9933. @example
  9934. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  9935. @end example
  9936. @var{FLAGS} is optional and specifies the type of events relating to
  9937. the time interval which enable sending the specified command, and must
  9938. be a non-null sequence of identifier flags separated by "+" or "|" and
  9939. enclosed between "[" and "]".
  9940. The following flags are recognized:
  9941. @table @option
  9942. @item enter
  9943. The command is sent when the current frame timestamp enters the
  9944. specified interval. In other words, the command is sent when the
  9945. previous frame timestamp was not in the given interval, and the
  9946. current is.
  9947. @item leave
  9948. The command is sent when the current frame timestamp leaves the
  9949. specified interval. In other words, the command is sent when the
  9950. previous frame timestamp was in the given interval, and the
  9951. current is not.
  9952. @end table
  9953. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  9954. assumed.
  9955. @var{TARGET} specifies the target of the command, usually the name of
  9956. the filter class or a specific filter instance name.
  9957. @var{COMMAND} specifies the name of the command for the target filter.
  9958. @var{ARG} is optional and specifies the optional list of argument for
  9959. the given @var{COMMAND}.
  9960. Between one interval specification and another, whitespaces, or
  9961. sequences of characters starting with @code{#} until the end of line,
  9962. are ignored and can be used to annotate comments.
  9963. A simplified BNF description of the commands specification syntax
  9964. follows:
  9965. @example
  9966. @var{COMMAND_FLAG} ::= "enter" | "leave"
  9967. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  9968. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  9969. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  9970. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  9971. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  9972. @end example
  9973. @subsection Examples
  9974. @itemize
  9975. @item
  9976. Specify audio tempo change at second 4:
  9977. @example
  9978. asendcmd=c='4.0 atempo tempo 1.5',atempo
  9979. @end example
  9980. @item
  9981. Specify a list of drawtext and hue commands in a file.
  9982. @example
  9983. # show text in the interval 5-10
  9984. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  9985. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  9986. # desaturate the image in the interval 15-20
  9987. 15.0-20.0 [enter] hue s 0,
  9988. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  9989. [leave] hue s 1,
  9990. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  9991. # apply an exponential saturation fade-out effect, starting from time 25
  9992. 25 [enter] hue s exp(25-t)
  9993. @end example
  9994. A filtergraph allowing to read and process the above command list
  9995. stored in a file @file{test.cmd}, can be specified with:
  9996. @example
  9997. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  9998. @end example
  9999. @end itemize
  10000. @anchor{setpts}
  10001. @section setpts, asetpts
  10002. Change the PTS (presentation timestamp) of the input frames.
  10003. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10004. This filter accepts the following options:
  10005. @table @option
  10006. @item expr
  10007. The expression which is evaluated for each frame to construct its timestamp.
  10008. @end table
  10009. The expression is evaluated through the eval API and can contain the following
  10010. constants:
  10011. @table @option
  10012. @item FRAME_RATE
  10013. frame rate, only defined for constant frame-rate video
  10014. @item PTS
  10015. The presentation timestamp in input
  10016. @item N
  10017. The count of the input frame for video or the number of consumed samples,
  10018. not including the current frame for audio, starting from 0.
  10019. @item NB_CONSUMED_SAMPLES
  10020. The number of consumed samples, not including the current frame (only
  10021. audio)
  10022. @item NB_SAMPLES, S
  10023. The number of samples in the current frame (only audio)
  10024. @item SAMPLE_RATE, SR
  10025. The audio sample rate.
  10026. @item STARTPTS
  10027. The PTS of the first frame.
  10028. @item STARTT
  10029. the time in seconds of the first frame
  10030. @item INTERLACED
  10031. State whether the current frame is interlaced.
  10032. @item T
  10033. the time in seconds of the current frame
  10034. @item POS
  10035. original position in the file of the frame, or undefined if undefined
  10036. for the current frame
  10037. @item PREV_INPTS
  10038. The previous input PTS.
  10039. @item PREV_INT
  10040. previous input time in seconds
  10041. @item PREV_OUTPTS
  10042. The previous output PTS.
  10043. @item PREV_OUTT
  10044. previous output time in seconds
  10045. @item RTCTIME
  10046. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  10047. instead.
  10048. @item RTCSTART
  10049. The wallclock (RTC) time at the start of the movie in microseconds.
  10050. @item TB
  10051. The timebase of the input timestamps.
  10052. @end table
  10053. @subsection Examples
  10054. @itemize
  10055. @item
  10056. Start counting PTS from zero
  10057. @example
  10058. setpts=PTS-STARTPTS
  10059. @end example
  10060. @item
  10061. Apply fast motion effect:
  10062. @example
  10063. setpts=0.5*PTS
  10064. @end example
  10065. @item
  10066. Apply slow motion effect:
  10067. @example
  10068. setpts=2.0*PTS
  10069. @end example
  10070. @item
  10071. Set fixed rate of 25 frames per second:
  10072. @example
  10073. setpts=N/(25*TB)
  10074. @end example
  10075. @item
  10076. Set fixed rate 25 fps with some jitter:
  10077. @example
  10078. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  10079. @end example
  10080. @item
  10081. Apply an offset of 10 seconds to the input PTS:
  10082. @example
  10083. setpts=PTS+10/TB
  10084. @end example
  10085. @item
  10086. Generate timestamps from a "live source" and rebase onto the current timebase:
  10087. @example
  10088. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  10089. @end example
  10090. @item
  10091. Generate timestamps by counting samples:
  10092. @example
  10093. asetpts=N/SR/TB
  10094. @end example
  10095. @end itemize
  10096. @section settb, asettb
  10097. Set the timebase to use for the output frames timestamps.
  10098. It is mainly useful for testing timebase configuration.
  10099. It accepts the following parameters:
  10100. @table @option
  10101. @item expr, tb
  10102. The expression which is evaluated into the output timebase.
  10103. @end table
  10104. The value for @option{tb} is an arithmetic expression representing a
  10105. rational. The expression can contain the constants "AVTB" (the default
  10106. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  10107. audio only). Default value is "intb".
  10108. @subsection Examples
  10109. @itemize
  10110. @item
  10111. Set the timebase to 1/25:
  10112. @example
  10113. settb=expr=1/25
  10114. @end example
  10115. @item
  10116. Set the timebase to 1/10:
  10117. @example
  10118. settb=expr=0.1
  10119. @end example
  10120. @item
  10121. Set the timebase to 1001/1000:
  10122. @example
  10123. settb=1+0.001
  10124. @end example
  10125. @item
  10126. Set the timebase to 2*intb:
  10127. @example
  10128. settb=2*intb
  10129. @end example
  10130. @item
  10131. Set the default timebase value:
  10132. @example
  10133. settb=AVTB
  10134. @end example
  10135. @end itemize
  10136. @section showcqt
  10137. Convert input audio to a video output representing
  10138. frequency spectrum logarithmically (using constant Q transform with
  10139. Brown-Puckette algorithm), with musical tone scale, from E0 to D#10 (10 octaves).
  10140. The filter accepts the following options:
  10141. @table @option
  10142. @item volume
  10143. Specify transform volume (multiplier) expression. The expression can contain
  10144. variables:
  10145. @table @option
  10146. @item frequency, freq, f
  10147. the frequency where transform is evaluated
  10148. @item timeclamp, tc
  10149. value of timeclamp option
  10150. @end table
  10151. and functions:
  10152. @table @option
  10153. @item a_weighting(f)
  10154. A-weighting of equal loudness
  10155. @item b_weighting(f)
  10156. B-weighting of equal loudness
  10157. @item c_weighting(f)
  10158. C-weighting of equal loudness
  10159. @end table
  10160. Default value is @code{16}.
  10161. @item tlength
  10162. Specify transform length expression. The expression can contain variables:
  10163. @table @option
  10164. @item frequency, freq, f
  10165. the frequency where transform is evaluated
  10166. @item timeclamp, tc
  10167. value of timeclamp option
  10168. @end table
  10169. Default value is @code{384/f*tc/(384/f+tc)}.
  10170. @item timeclamp
  10171. Specify the transform timeclamp. At low frequency, there is trade-off between
  10172. accuracy in time domain and frequency domain. If timeclamp is lower,
  10173. event in time domain is represented more accurately (such as fast bass drum),
  10174. otherwise event in frequency domain is represented more accurately
  10175. (such as bass guitar). Acceptable value is [0.1, 1.0]. Default value is @code{0.17}.
  10176. @item coeffclamp
  10177. Specify the transform coeffclamp. If coeffclamp is lower, transform is
  10178. more accurate, otherwise transform is faster. Acceptable value is [0.1, 10.0].
  10179. Default value is @code{1.0}.
  10180. @item gamma
  10181. Specify gamma. Lower gamma makes the spectrum more contrast, higher gamma
  10182. makes the spectrum having more range. Acceptable value is [1.0, 7.0].
  10183. Default value is @code{3.0}.
  10184. @item gamma2
  10185. Specify gamma of bargraph. Acceptable value is [1.0, 7.0].
  10186. Default value is @code{1.0}.
  10187. @item fontfile
  10188. Specify font file for use with freetype. If not specified, use embedded font.
  10189. @item fontcolor
  10190. Specify font color expression. This is arithmetic expression that should return
  10191. integer value 0xRRGGBB. The expression can contain variables:
  10192. @table @option
  10193. @item frequency, freq, f
  10194. the frequency where transform is evaluated
  10195. @item timeclamp, tc
  10196. value of timeclamp option
  10197. @end table
  10198. and functions:
  10199. @table @option
  10200. @item midi(f)
  10201. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  10202. @item r(x), g(x), b(x)
  10203. red, green, and blue value of intensity x
  10204. @end table
  10205. Default value is @code{st(0, (midi(f)-59.5)/12);
  10206. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  10207. r(1-ld(1)) + b(ld(1))}
  10208. @item fullhd
  10209. If set to 1 (the default), the video size is 1920x1080 (full HD),
  10210. if set to 0, the video size is 960x540. Use this option to make CPU usage lower.
  10211. @item fps
  10212. Specify video fps. Default value is @code{25}.
  10213. @item count
  10214. Specify number of transform per frame, so there are fps*count transforms
  10215. per second. Note that audio data rate must be divisible by fps*count.
  10216. Default value is @code{6}.
  10217. @end table
  10218. @subsection Examples
  10219. @itemize
  10220. @item
  10221. Playing audio while showing the spectrum:
  10222. @example
  10223. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  10224. @end example
  10225. @item
  10226. Same as above, but with frame rate 30 fps:
  10227. @example
  10228. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  10229. @end example
  10230. @item
  10231. Playing at 960x540 and lower CPU usage:
  10232. @example
  10233. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fullhd=0:count=3 [out0]'
  10234. @end example
  10235. @item
  10236. A1 and its harmonics: A1, A2, (near)E3, A3:
  10237. @example
  10238. 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),
  10239. asplit[a][out1]; [a] showcqt [out0]'
  10240. @end example
  10241. @item
  10242. Same as above, but with more accuracy in frequency domain (and slower):
  10243. @example
  10244. 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),
  10245. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  10246. @end example
  10247. @item
  10248. B-weighting of equal loudness
  10249. @example
  10250. volume=16*b_weighting(f)
  10251. @end example
  10252. @item
  10253. Lower Q factor
  10254. @example
  10255. tlength=100/f*tc/(100/f+tc)
  10256. @end example
  10257. @item
  10258. Custom fontcolor, C-note is colored green, others are colored blue
  10259. @example
  10260. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))'
  10261. @end example
  10262. @item
  10263. Custom gamma, now spectrum is linear to the amplitude.
  10264. @example
  10265. gamma=2:gamma2=2
  10266. @end example
  10267. @end itemize
  10268. @section showfreqs
  10269. Convert input audio to video output representing the audio power spectrum.
  10270. Audio amplitude is on Y-axis while frequency is on X-axis.
  10271. The filter accepts the following options:
  10272. @table @option
  10273. @item size, s
  10274. Specify size of video. For the syntax of this option, check the
  10275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10276. Default is @code{1024x512}.
  10277. @item mode
  10278. Set display mode.
  10279. This set how each frequency bin will be represented.
  10280. It accepts the following values:
  10281. @table @samp
  10282. @item line
  10283. @item bar
  10284. @item dot
  10285. @end table
  10286. Default is @code{bar}.
  10287. @item ascale
  10288. Set amplitude scale.
  10289. It accepts the following values:
  10290. @table @samp
  10291. @item lin
  10292. Linear scale.
  10293. @item sqrt
  10294. Square root scale.
  10295. @item cbrt
  10296. Cubic root scale.
  10297. @item log
  10298. Logarithmic scale.
  10299. @end table
  10300. Default is @code{log}.
  10301. @item fscale
  10302. Set frequency scale.
  10303. It accepts the following values:
  10304. @table @samp
  10305. @item lin
  10306. Linear scale.
  10307. @item log
  10308. Logarithmic scale.
  10309. @item rlog
  10310. Reverse logarithmic scale.
  10311. @end table
  10312. Default is @code{lin}.
  10313. @item win_size
  10314. Set window size.
  10315. It accepts the following values:
  10316. @table @samp
  10317. @item w16
  10318. @item w32
  10319. @item w64
  10320. @item w128
  10321. @item w256
  10322. @item w512
  10323. @item w1024
  10324. @item w2048
  10325. @item w4096
  10326. @item w8192
  10327. @item w16384
  10328. @item w32768
  10329. @item w65536
  10330. @end table
  10331. Default is @code{w2048}
  10332. @item win_func
  10333. Set windowing function.
  10334. It accepts the following values:
  10335. @table @samp
  10336. @item rect
  10337. @item bartlett
  10338. @item hanning
  10339. @item hamming
  10340. @item blackman
  10341. @item welch
  10342. @item flattop
  10343. @item bharris
  10344. @item bnuttall
  10345. @item bhann
  10346. @item sine
  10347. @item nuttall
  10348. @item lanczos
  10349. @item gauss
  10350. @end table
  10351. Default is @code{hanning}.
  10352. @item overlap
  10353. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  10354. which means optimal overlap for selected window function will be picked.
  10355. @item averaging
  10356. Set time averaging. Setting this to 0 will display current maximal peaks.
  10357. Default is @code{1}, which means time averaging is disabled.
  10358. @item colors
  10359. Specify list of colors separated by space or by '|' which will be used to
  10360. draw channel frequencies. Unrecognized or missing colors will be replaced
  10361. by white color.
  10362. @end table
  10363. @section showspectrum
  10364. Convert input audio to a video output, representing the audio frequency
  10365. spectrum.
  10366. The filter accepts the following options:
  10367. @table @option
  10368. @item size, s
  10369. Specify the video size for the output. For the syntax of this option, check the
  10370. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10371. Default value is @code{640x512}.
  10372. @item slide
  10373. Specify how the spectrum should slide along the window.
  10374. It accepts the following values:
  10375. @table @samp
  10376. @item replace
  10377. the samples start again on the left when they reach the right
  10378. @item scroll
  10379. the samples scroll from right to left
  10380. @item fullframe
  10381. frames are only produced when the samples reach the right
  10382. @end table
  10383. Default value is @code{replace}.
  10384. @item mode
  10385. Specify display mode.
  10386. It accepts the following values:
  10387. @table @samp
  10388. @item combined
  10389. all channels are displayed in the same row
  10390. @item separate
  10391. all channels are displayed in separate rows
  10392. @end table
  10393. Default value is @samp{combined}.
  10394. @item color
  10395. Specify display color mode.
  10396. It accepts the following values:
  10397. @table @samp
  10398. @item channel
  10399. each channel is displayed in a separate color
  10400. @item intensity
  10401. each channel is is displayed using the same color scheme
  10402. @end table
  10403. Default value is @samp{channel}.
  10404. @item scale
  10405. Specify scale used for calculating intensity color values.
  10406. It accepts the following values:
  10407. @table @samp
  10408. @item lin
  10409. linear
  10410. @item sqrt
  10411. square root, default
  10412. @item cbrt
  10413. cubic root
  10414. @item log
  10415. logarithmic
  10416. @end table
  10417. Default value is @samp{sqrt}.
  10418. @item saturation
  10419. Set saturation modifier for displayed colors. Negative values provide
  10420. alternative color scheme. @code{0} is no saturation at all.
  10421. Saturation must be in [-10.0, 10.0] range.
  10422. Default value is @code{1}.
  10423. @item win_func
  10424. Set window function.
  10425. It accepts the following values:
  10426. @table @samp
  10427. @item none
  10428. No samples pre-processing (do not expect this to be faster)
  10429. @item hann
  10430. Hann window
  10431. @item hamming
  10432. Hamming window
  10433. @item blackman
  10434. Blackman window
  10435. @end table
  10436. Default value is @code{hann}.
  10437. @end table
  10438. The usage is very similar to the showwaves filter; see the examples in that
  10439. section.
  10440. @subsection Examples
  10441. @itemize
  10442. @item
  10443. Large window with logarithmic color scaling:
  10444. @example
  10445. showspectrum=s=1280x480:scale=log
  10446. @end example
  10447. @item
  10448. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  10449. @example
  10450. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10451. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  10452. @end example
  10453. @end itemize
  10454. @section showvolume
  10455. Convert input audio volume to a video output.
  10456. The filter accepts the following options:
  10457. @table @option
  10458. @item rate, r
  10459. Set video rate.
  10460. @item b
  10461. Set border width, allowed range is [0, 5]. Default is 1.
  10462. @item w
  10463. Set channel width, allowed range is [40, 1080]. Default is 400.
  10464. @item h
  10465. Set channel height, allowed range is [1, 100]. Default is 20.
  10466. @item f
  10467. Set fade, allowed range is [1, 255]. Default is 20.
  10468. @item c
  10469. Set volume color expression.
  10470. The expression can use the following variables:
  10471. @table @option
  10472. @item VOLUME
  10473. Current max volume of channel in dB.
  10474. @item CHANNEL
  10475. Current channel number, starting from 0.
  10476. @end table
  10477. @item t
  10478. If set, displays channel names. Default is enabled.
  10479. @end table
  10480. @section showwaves
  10481. Convert input audio to a video output, representing the samples waves.
  10482. The filter accepts the following options:
  10483. @table @option
  10484. @item size, s
  10485. Specify the video size for the output. For the syntax of this option, check the
  10486. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10487. Default value is @code{600x240}.
  10488. @item mode
  10489. Set display mode.
  10490. Available values are:
  10491. @table @samp
  10492. @item point
  10493. Draw a point for each sample.
  10494. @item line
  10495. Draw a vertical line for each sample.
  10496. @item p2p
  10497. Draw a point for each sample and a line between them.
  10498. @item cline
  10499. Draw a centered vertical line for each sample.
  10500. @end table
  10501. Default value is @code{point}.
  10502. @item n
  10503. Set the number of samples which are printed on the same column. A
  10504. larger value will decrease the frame rate. Must be a positive
  10505. integer. This option can be set only if the value for @var{rate}
  10506. is not explicitly specified.
  10507. @item rate, r
  10508. Set the (approximate) output frame rate. This is done by setting the
  10509. option @var{n}. Default value is "25".
  10510. @item split_channels
  10511. Set if channels should be drawn separately or overlap. Default value is 0.
  10512. @end table
  10513. @subsection Examples
  10514. @itemize
  10515. @item
  10516. Output the input file audio and the corresponding video representation
  10517. at the same time:
  10518. @example
  10519. amovie=a.mp3,asplit[out0],showwaves[out1]
  10520. @end example
  10521. @item
  10522. Create a synthetic signal and show it with showwaves, forcing a
  10523. frame rate of 30 frames per second:
  10524. @example
  10525. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  10526. @end example
  10527. @end itemize
  10528. @section showwavespic
  10529. Convert input audio to a single video frame, representing the samples waves.
  10530. The filter accepts the following options:
  10531. @table @option
  10532. @item size, s
  10533. Specify the video size for the output. For the syntax of this option, check the
  10534. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10535. Default value is @code{600x240}.
  10536. @item split_channels
  10537. Set if channels should be drawn separately or overlap. Default value is 0.
  10538. @end table
  10539. @subsection Examples
  10540. @itemize
  10541. @item
  10542. Extract a channel split representation of the wave form of a whole audio track
  10543. in a 1024x800 picture using @command{ffmpeg}:
  10544. @example
  10545. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  10546. @end example
  10547. @end itemize
  10548. @section split, asplit
  10549. Split input into several identical outputs.
  10550. @code{asplit} works with audio input, @code{split} with video.
  10551. The filter accepts a single parameter which specifies the number of outputs. If
  10552. unspecified, it defaults to 2.
  10553. @subsection Examples
  10554. @itemize
  10555. @item
  10556. Create two separate outputs from the same input:
  10557. @example
  10558. [in] split [out0][out1]
  10559. @end example
  10560. @item
  10561. To create 3 or more outputs, you need to specify the number of
  10562. outputs, like in:
  10563. @example
  10564. [in] asplit=3 [out0][out1][out2]
  10565. @end example
  10566. @item
  10567. Create two separate outputs from the same input, one cropped and
  10568. one padded:
  10569. @example
  10570. [in] split [splitout1][splitout2];
  10571. [splitout1] crop=100:100:0:0 [cropout];
  10572. [splitout2] pad=200:200:100:100 [padout];
  10573. @end example
  10574. @item
  10575. Create 5 copies of the input audio with @command{ffmpeg}:
  10576. @example
  10577. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  10578. @end example
  10579. @end itemize
  10580. @section zmq, azmq
  10581. Receive commands sent through a libzmq client, and forward them to
  10582. filters in the filtergraph.
  10583. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  10584. must be inserted between two video filters, @code{azmq} between two
  10585. audio filters.
  10586. To enable these filters you need to install the libzmq library and
  10587. headers and configure FFmpeg with @code{--enable-libzmq}.
  10588. For more information about libzmq see:
  10589. @url{http://www.zeromq.org/}
  10590. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  10591. receives messages sent through a network interface defined by the
  10592. @option{bind_address} option.
  10593. The received message must be in the form:
  10594. @example
  10595. @var{TARGET} @var{COMMAND} [@var{ARG}]
  10596. @end example
  10597. @var{TARGET} specifies the target of the command, usually the name of
  10598. the filter class or a specific filter instance name.
  10599. @var{COMMAND} specifies the name of the command for the target filter.
  10600. @var{ARG} is optional and specifies the optional argument list for the
  10601. given @var{COMMAND}.
  10602. Upon reception, the message is processed and the corresponding command
  10603. is injected into the filtergraph. Depending on the result, the filter
  10604. will send a reply to the client, adopting the format:
  10605. @example
  10606. @var{ERROR_CODE} @var{ERROR_REASON}
  10607. @var{MESSAGE}
  10608. @end example
  10609. @var{MESSAGE} is optional.
  10610. @subsection Examples
  10611. Look at @file{tools/zmqsend} for an example of a zmq client which can
  10612. be used to send commands processed by these filters.
  10613. Consider the following filtergraph generated by @command{ffplay}
  10614. @example
  10615. ffplay -dumpgraph 1 -f lavfi "
  10616. color=s=100x100:c=red [l];
  10617. color=s=100x100:c=blue [r];
  10618. nullsrc=s=200x100, zmq [bg];
  10619. [bg][l] overlay [bg+l];
  10620. [bg+l][r] overlay=x=100 "
  10621. @end example
  10622. To change the color of the left side of the video, the following
  10623. command can be used:
  10624. @example
  10625. echo Parsed_color_0 c yellow | tools/zmqsend
  10626. @end example
  10627. To change the right side:
  10628. @example
  10629. echo Parsed_color_1 c pink | tools/zmqsend
  10630. @end example
  10631. @c man end MULTIMEDIA FILTERS
  10632. @chapter Multimedia Sources
  10633. @c man begin MULTIMEDIA SOURCES
  10634. Below is a description of the currently available multimedia sources.
  10635. @section amovie
  10636. This is the same as @ref{movie} source, except it selects an audio
  10637. stream by default.
  10638. @anchor{movie}
  10639. @section movie
  10640. Read audio and/or video stream(s) from a movie container.
  10641. It accepts the following parameters:
  10642. @table @option
  10643. @item filename
  10644. The name of the resource to read (not necessarily a file; it can also be a
  10645. device or a stream accessed through some protocol).
  10646. @item format_name, f
  10647. Specifies the format assumed for the movie to read, and can be either
  10648. the name of a container or an input device. If not specified, the
  10649. format is guessed from @var{movie_name} or by probing.
  10650. @item seek_point, sp
  10651. Specifies the seek point in seconds. The frames will be output
  10652. starting from this seek point. The parameter is evaluated with
  10653. @code{av_strtod}, so the numerical value may be suffixed by an IS
  10654. postfix. The default value is "0".
  10655. @item streams, s
  10656. Specifies the streams to read. Several streams can be specified,
  10657. separated by "+". The source will then have as many outputs, in the
  10658. same order. The syntax is explained in the ``Stream specifiers''
  10659. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  10660. respectively the default (best suited) video and audio stream. Default
  10661. is "dv", or "da" if the filter is called as "amovie".
  10662. @item stream_index, si
  10663. Specifies the index of the video stream to read. If the value is -1,
  10664. the most suitable video stream will be automatically selected. The default
  10665. value is "-1". Deprecated. If the filter is called "amovie", it will select
  10666. audio instead of video.
  10667. @item loop
  10668. Specifies how many times to read the stream in sequence.
  10669. If the value is less than 1, the stream will be read again and again.
  10670. Default value is "1".
  10671. Note that when the movie is looped the source timestamps are not
  10672. changed, so it will generate non monotonically increasing timestamps.
  10673. @end table
  10674. It allows overlaying a second video on top of the main input of
  10675. a filtergraph, as shown in this graph:
  10676. @example
  10677. input -----------> deltapts0 --> overlay --> output
  10678. ^
  10679. |
  10680. movie --> scale--> deltapts1 -------+
  10681. @end example
  10682. @subsection Examples
  10683. @itemize
  10684. @item
  10685. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  10686. on top of the input labelled "in":
  10687. @example
  10688. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  10689. [in] setpts=PTS-STARTPTS [main];
  10690. [main][over] overlay=16:16 [out]
  10691. @end example
  10692. @item
  10693. Read from a video4linux2 device, and overlay it on top of the input
  10694. labelled "in":
  10695. @example
  10696. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  10697. [in] setpts=PTS-STARTPTS [main];
  10698. [main][over] overlay=16:16 [out]
  10699. @end example
  10700. @item
  10701. Read the first video stream and the audio stream with id 0x81 from
  10702. dvd.vob; the video is connected to the pad named "video" and the audio is
  10703. connected to the pad named "audio":
  10704. @example
  10705. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  10706. @end example
  10707. @end itemize
  10708. @c man end MULTIMEDIA SOURCES