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.

10944 lines
295KB

  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. @example
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end example
  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
  93. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  94. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  95. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} functions defined in
  96. @file{libavfilter/avfilter.h}.
  97. A filterchain consists of a sequence of connected filters, each one
  98. connected to the previous one in the sequence. A filterchain is
  99. represented by a list of ","-separated filter descriptions.
  100. A filtergraph consists of a sequence of filterchains. A sequence of
  101. filterchains is represented by a list of ";"-separated filterchain
  102. descriptions.
  103. A filter is represented by a string of the form:
  104. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  105. @var{filter_name} is the name of the filter class of which the
  106. described filter is an instance of, and has to be the name of one of
  107. the filter classes registered in the program.
  108. The name of the filter class is optionally followed by a string
  109. "=@var{arguments}".
  110. @var{arguments} is a string which contains the parameters used to
  111. initialize the filter instance. It may have one of two forms:
  112. @itemize
  113. @item
  114. A ':'-separated list of @var{key=value} pairs.
  115. @item
  116. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  117. the option names in the order they are declared. E.g. the @code{fade} filter
  118. declares three options in this order -- @option{type}, @option{start_frame} and
  119. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  120. @var{in} is assigned to the option @option{type}, @var{0} to
  121. @option{start_frame} and @var{30} to @option{nb_frames}.
  122. @item
  123. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  124. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  125. follow the same constraints order of the previous point. The following
  126. @var{key=value} pairs can be set in any preferred order.
  127. @end itemize
  128. If the option value itself is a list of items (e.g. the @code{format} filter
  129. takes a list of pixel formats), the items in the list are usually separated by
  130. '|'.
  131. The list of arguments can be quoted using the character "'" as initial
  132. and ending mark, and the character '\' for escaping the characters
  133. within the quoted text; otherwise the argument string is considered
  134. terminated when the next special character (belonging to the set
  135. "[]=;,") is encountered.
  136. The name and arguments of the filter are optionally preceded and
  137. followed by a list of link labels.
  138. A link label allows one to name a link and associate it to a filter output
  139. or input pad. The preceding labels @var{in_link_1}
  140. ... @var{in_link_N}, are associated to the filter input pads,
  141. the following labels @var{out_link_1} ... @var{out_link_M}, are
  142. associated to the output pads.
  143. When two link labels with the same name are found in the
  144. filtergraph, a link between the corresponding input and output pad is
  145. created.
  146. If an output pad is not labelled, it is linked by default to the first
  147. unlabelled input pad of the next filter in the filterchain.
  148. For example in the filterchain
  149. @example
  150. nullsrc, split[L1], [L2]overlay, nullsink
  151. @end example
  152. the split filter instance has two output pads, and the overlay filter
  153. instance two input pads. The first output pad of split is labelled
  154. "L1", the first input pad of overlay is labelled "L2", and the second
  155. output pad of split is linked to the second input pad of overlay,
  156. which are both unlabelled.
  157. In a complete filterchain all the unlabelled filter input and output
  158. pads must be connected. A filtergraph is considered valid if all the
  159. filter input and output pads of all the filterchains are connected.
  160. Libavfilter will automatically insert @ref{scale} filters where format
  161. conversion is required. It is possible to specify swscale flags
  162. for those automatically inserted scalers by prepending
  163. @code{sws_flags=@var{flags};}
  164. to the filtergraph description.
  165. Here is a BNF description of the filtergraph syntax:
  166. @example
  167. @var{NAME} ::= sequence of alphanumeric characters and '_'
  168. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  169. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  170. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  171. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  172. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  173. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  174. @end example
  175. @section Notes on filtergraph escaping
  176. Filtergraph description composition entails several levels of
  177. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  178. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  179. information about the employed escaping procedure.
  180. A first level escaping affects the content of each filter option
  181. value, which may contain the special character @code{:} used to
  182. separate values, or one of the escaping characters @code{\'}.
  183. A second level escaping affects the whole filter description, which
  184. may contain the escaping characters @code{\'} or the special
  185. characters @code{[],;} used by the filtergraph description.
  186. Finally, when you specify a filtergraph on a shell commandline, you
  187. need to perform a third level escaping for the shell special
  188. characters contained within it.
  189. For example, consider the following string to be embedded in
  190. the @ref{drawtext} filter description @option{text} value:
  191. @example
  192. this is a 'string': may contain one, or more, special characters
  193. @end example
  194. This string contains the @code{'} special escaping character, and the
  195. @code{:} special character, so it needs to be escaped in this way:
  196. @example
  197. text=this is a \'string\'\: may contain one, or more, special characters
  198. @end example
  199. A second level of escaping is required when embedding the filter
  200. description in a filtergraph description, in order to escape all the
  201. filtergraph special characters. Thus the example above becomes:
  202. @example
  203. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  204. @end example
  205. (note that in addition to the @code{\'} escaping special characters,
  206. also @code{,} needs to be escaped).
  207. Finally an additional level of escaping is needed when writing the
  208. filtergraph description in a shell command, which depends on the
  209. escaping rules of the adopted shell. For example, assuming that
  210. @code{\} is special and needs to be escaped with another @code{\}, the
  211. previous string will finally result in:
  212. @example
  213. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  214. @end example
  215. @chapter Timeline editing
  216. Some filters support a generic @option{enable} option. For the filters
  217. supporting timeline editing, this option can be set to an expression which is
  218. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  219. the filter will be enabled, otherwise the frame will be sent unchanged to the
  220. next filter in the filtergraph.
  221. The expression accepts the following values:
  222. @table @samp
  223. @item t
  224. timestamp expressed in seconds, NAN if the input timestamp is unknown
  225. @item n
  226. sequential number of the input frame, starting from 0
  227. @item pos
  228. the position in the file of the input frame, NAN if unknown
  229. @end table
  230. Additionally, these filters support an @option{enable} command that can be used
  231. to re-define the expression.
  232. Like any other filtering option, the @option{enable} option follows the same
  233. rules.
  234. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  235. minutes, and a @ref{curves} filter starting at 3 seconds:
  236. @example
  237. smartblur = enable='between(t,10,3*60)',
  238. curves = enable='gte(t,3)' : preset=cross_process
  239. @end example
  240. @c man end FILTERGRAPH DESCRIPTION
  241. @chapter Audio Filters
  242. @c man begin AUDIO FILTERS
  243. When you configure your FFmpeg build, you can disable any of the
  244. existing filters using @code{--disable-filters}.
  245. The configure output will show the audio filters included in your
  246. build.
  247. Below is a description of the currently available audio filters.
  248. @section aconvert
  249. Convert the input audio format to the specified formats.
  250. @emph{This filter is deprecated. Use @ref{aformat} instead.}
  251. The filter accepts a string of the form:
  252. "@var{sample_format}:@var{channel_layout}".
  253. @var{sample_format} specifies the sample format, and can be a string or the
  254. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  255. suffix for a planar sample format.
  256. @var{channel_layout} specifies the channel layout, and can be a string
  257. or the corresponding number value defined in @file{libavutil/channel_layout.h}.
  258. The special parameter "auto", signifies that the filter will
  259. automatically select the output format depending on the output filter.
  260. @subsection Examples
  261. @itemize
  262. @item
  263. Convert input to float, planar, stereo:
  264. @example
  265. aconvert=fltp:stereo
  266. @end example
  267. @item
  268. Convert input to unsigned 8-bit, automatically select out channel layout:
  269. @example
  270. aconvert=u8:auto
  271. @end example
  272. @end itemize
  273. @section adelay
  274. Delay one or more audio channels.
  275. Samples in delayed channel are filled with silence.
  276. The filter accepts the following option:
  277. @table @option
  278. @item delays
  279. Set list of delays in milliseconds for each channel separated by '|'.
  280. At least one delay greater than 0 should be provided.
  281. Unused delays will be silently ignored. If number of given delays is
  282. smaller than number of channels all remaining channels will not be delayed.
  283. @end table
  284. @subsection Examples
  285. @itemize
  286. @item
  287. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  288. the second channel (and any other channels that may be present) unchanged.
  289. @example
  290. adelay=1500|0|500
  291. @end example
  292. @end itemize
  293. @section aecho
  294. Apply echoing to the input audio.
  295. Echoes are reflected sound and can occur naturally amongst mountains
  296. (and sometimes large buildings) when talking or shouting; digital echo
  297. effects emulate this behaviour and are often used to help fill out the
  298. sound of a single instrument or vocal. The time difference between the
  299. original signal and the reflection is the @code{delay}, and the
  300. loudness of the reflected signal is the @code{decay}.
  301. Multiple echoes can have different delays and decays.
  302. A description of the accepted parameters follows.
  303. @table @option
  304. @item in_gain
  305. Set input gain of reflected signal. Default is @code{0.6}.
  306. @item out_gain
  307. Set output gain of reflected signal. Default is @code{0.3}.
  308. @item delays
  309. Set list of time intervals in milliseconds between original signal and reflections
  310. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  311. Default is @code{1000}.
  312. @item decays
  313. Set list of loudnesses of reflected signals separated by '|'.
  314. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  315. Default is @code{0.5}.
  316. @end table
  317. @subsection Examples
  318. @itemize
  319. @item
  320. Make it sound as if there are twice as many instruments as are actually playing:
  321. @example
  322. aecho=0.8:0.88:60:0.4
  323. @end example
  324. @item
  325. If delay is very short, then it sound like a (metallic) robot playing music:
  326. @example
  327. aecho=0.8:0.88:6:0.4
  328. @end example
  329. @item
  330. A longer delay will sound like an open air concert in the mountains:
  331. @example
  332. aecho=0.8:0.9:1000:0.3
  333. @end example
  334. @item
  335. Same as above but with one more mountain:
  336. @example
  337. aecho=0.8:0.9:1000|1800:0.3|0.25
  338. @end example
  339. @end itemize
  340. @section aeval
  341. Modify an audio signal according to the specified expressions.
  342. This filter accepts one or more expressions (one for each channel),
  343. which are evaluated and used to modify a corresponding audio signal.
  344. It accepts the following parameters:
  345. @table @option
  346. @item exprs
  347. Set the '|'-separated expressions list for each separate channel. If
  348. the number of input channels is greater than the number of
  349. expressions, the last specified expression is used for the remaining
  350. output channels.
  351. @item channel_layout, c
  352. Set output channel layout. If not specified, the channel layout is
  353. specified by the number of expressions. If set to @samp{same}, it will
  354. use by default the same input channel layout.
  355. @end table
  356. Each expression in @var{exprs} can contain the following constants and functions:
  357. @table @option
  358. @item ch
  359. channel number of the current expression
  360. @item n
  361. number of the evaluated sample, starting from 0
  362. @item s
  363. sample rate
  364. @item t
  365. time of the evaluated sample expressed in seconds
  366. @item nb_in_channels
  367. @item nb_out_channels
  368. input and output number of channels
  369. @item val(CH)
  370. the value of input channel with number @var{CH}
  371. @end table
  372. Note: this filter is slow. For faster processing you should use a
  373. dedicated filter.
  374. @subsection Examples
  375. @itemize
  376. @item
  377. Half volume:
  378. @example
  379. aeval=val(ch)/2:c=same
  380. @end example
  381. @item
  382. Invert phase of the second channel:
  383. @example
  384. eval=val(0)|-val(1)
  385. @end example
  386. @end itemize
  387. @section afade
  388. Apply fade-in/out effect to input audio.
  389. A description of the accepted parameters follows.
  390. @table @option
  391. @item type, t
  392. Specify the effect type, can be either @code{in} for fade-in, or
  393. @code{out} for a fade-out effect. Default is @code{in}.
  394. @item start_sample, ss
  395. Specify the number of the start sample for starting to apply the fade
  396. effect. Default is 0.
  397. @item nb_samples, ns
  398. Specify the number of samples for which the fade effect has to last. At
  399. the end of the fade-in effect the output audio will have the same
  400. volume as the input audio, at the end of the fade-out transition
  401. the output audio will be silence. Default is 44100.
  402. @item start_time, st
  403. Specify time for starting to apply the fade effect. Default is 0.
  404. The accepted syntax is:
  405. @example
  406. [-]HH[:MM[:SS[.m...]]]
  407. [-]S+[.m...]
  408. @end example
  409. See also the function @code{av_parse_time()}.
  410. If set this option is used instead of @var{start_sample} one.
  411. @item duration, d
  412. Specify the duration for which the fade effect has to last. Default is 0.
  413. The accepted syntax is:
  414. @example
  415. [-]HH[:MM[:SS[.m...]]]
  416. [-]S+[.m...]
  417. @end example
  418. See also the function @code{av_parse_time()}.
  419. At the end of the fade-in effect the output audio will have the same
  420. volume as the input audio, at the end of the fade-out transition
  421. the output audio will be silence.
  422. If set this option is used instead of @var{nb_samples} one.
  423. @item curve
  424. Set curve for fade transition.
  425. It accepts the following values:
  426. @table @option
  427. @item tri
  428. select triangular, linear slope (default)
  429. @item qsin
  430. select quarter of sine wave
  431. @item hsin
  432. select half of sine wave
  433. @item esin
  434. select exponential sine wave
  435. @item log
  436. select logarithmic
  437. @item par
  438. select inverted parabola
  439. @item qua
  440. select quadratic
  441. @item cub
  442. select cubic
  443. @item squ
  444. select square root
  445. @item cbr
  446. select cubic root
  447. @end table
  448. @end table
  449. @subsection Examples
  450. @itemize
  451. @item
  452. Fade in first 15 seconds of audio:
  453. @example
  454. afade=t=in:ss=0:d=15
  455. @end example
  456. @item
  457. Fade out last 25 seconds of a 900 seconds audio:
  458. @example
  459. afade=t=out:st=875:d=25
  460. @end example
  461. @end itemize
  462. @anchor{aformat}
  463. @section aformat
  464. Set output format constraints for the input audio. The framework will
  465. negotiate the most appropriate format to minimize conversions.
  466. It accepts the following parameters:
  467. @table @option
  468. @item sample_fmts
  469. A '|'-separated list of requested sample formats.
  470. @item sample_rates
  471. A '|'-separated list of requested sample rates.
  472. @item channel_layouts
  473. A '|'-separated list of requested channel layouts.
  474. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  475. for the required syntax.
  476. @end table
  477. If a parameter is omitted, all values are allowed.
  478. Force the output to either unsigned 8-bit or signed 16-bit stereo
  479. @example
  480. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  481. @end example
  482. @section allpass
  483. Apply a two-pole all-pass filter with central frequency (in Hz)
  484. @var{frequency}, and filter-width @var{width}.
  485. An all-pass filter changes the audio's frequency to phase relationship
  486. without changing its frequency to amplitude relationship.
  487. The filter accepts the following options:
  488. @table @option
  489. @item frequency, f
  490. Set frequency in Hz.
  491. @item width_type
  492. Set method to specify band-width of filter.
  493. @table @option
  494. @item h
  495. Hz
  496. @item q
  497. Q-Factor
  498. @item o
  499. octave
  500. @item s
  501. slope
  502. @end table
  503. @item width, w
  504. Specify the band-width of a filter in width_type units.
  505. @end table
  506. @section amerge
  507. Merge two or more audio streams into a single multi-channel stream.
  508. The filter accepts the following options:
  509. @table @option
  510. @item inputs
  511. Set the number of inputs. Default is 2.
  512. @end table
  513. If the channel layouts of the inputs are disjoint, and therefore compatible,
  514. the channel layout of the output will be set accordingly and the channels
  515. will be reordered as necessary. If the channel layouts of the inputs are not
  516. disjoint, the output will have all the channels of the first input then all
  517. the channels of the second input, in that order, and the channel layout of
  518. the output will be the default value corresponding to the total number of
  519. channels.
  520. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  521. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  522. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  523. first input, b1 is the first channel of the second input).
  524. On the other hand, if both input are in stereo, the output channels will be
  525. in the default order: a1, a2, b1, b2, and the channel layout will be
  526. arbitrarily set to 4.0, which may or may not be the expected value.
  527. All inputs must have the same sample rate, and format.
  528. If inputs do not have the same duration, the output will stop with the
  529. shortest.
  530. @subsection Examples
  531. @itemize
  532. @item
  533. Merge two mono files into a stereo stream:
  534. @example
  535. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  536. @end example
  537. @item
  538. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  539. @example
  540. 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
  541. @end example
  542. @end itemize
  543. @section amix
  544. Mixes multiple audio inputs into a single output.
  545. Note that this filter only supports float samples (the @var{amerge}
  546. and @var{pan} audio filters support many formats). If the @var{amix}
  547. input has integer samples then @ref{aresample} will be automatically
  548. inserted to perform the conversion to float samples.
  549. For example
  550. @example
  551. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  552. @end example
  553. will mix 3 input audio streams to a single output with the same duration as the
  554. first input and a dropout transition time of 3 seconds.
  555. It accepts the following parameters:
  556. @table @option
  557. @item inputs
  558. The number of inputs. If unspecified, it defaults to 2.
  559. @item duration
  560. How to determine the end-of-stream.
  561. @table @option
  562. @item longest
  563. The duration of the longest input. (default)
  564. @item shortest
  565. The duration of the shortest input.
  566. @item first
  567. The duration of the first input.
  568. @end table
  569. @item dropout_transition
  570. The transition time, in seconds, for volume renormalization when an input
  571. stream ends. The default value is 2 seconds.
  572. @end table
  573. @section anull
  574. Pass the audio source unchanged to the output.
  575. @section apad
  576. Pad the end of a audio stream with silence, this can be used together with
  577. -shortest to extend audio streams to the same length as the video stream.
  578. @section aphaser
  579. Add a phasing effect to the input audio.
  580. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  581. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  582. A description of the accepted parameters follows.
  583. @table @option
  584. @item in_gain
  585. Set input gain. Default is 0.4.
  586. @item out_gain
  587. Set output gain. Default is 0.74
  588. @item delay
  589. Set delay in milliseconds. Default is 3.0.
  590. @item decay
  591. Set decay. Default is 0.4.
  592. @item speed
  593. Set modulation speed in Hz. Default is 0.5.
  594. @item type
  595. Set modulation type. Default is triangular.
  596. It accepts the following values:
  597. @table @samp
  598. @item triangular, t
  599. @item sinusoidal, s
  600. @end table
  601. @end table
  602. @anchor{aresample}
  603. @section aresample
  604. Resample the input audio to the specified parameters, using the
  605. libswresample library. If none are specified then the filter will
  606. automatically convert between its input and output.
  607. This filter is also able to stretch/squeeze the audio data to make it match
  608. the timestamps or to inject silence / cut out audio to make it match the
  609. timestamps, do a combination of both or do neither.
  610. The filter accepts the syntax
  611. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  612. expresses a sample rate and @var{resampler_options} is a list of
  613. @var{key}=@var{value} pairs, separated by ":". See the
  614. ffmpeg-resampler manual for the complete list of supported options.
  615. @subsection Examples
  616. @itemize
  617. @item
  618. Resample the input audio to 44100Hz:
  619. @example
  620. aresample=44100
  621. @end example
  622. @item
  623. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  624. samples per second compensation:
  625. @example
  626. aresample=async=1000
  627. @end example
  628. @end itemize
  629. @section asetnsamples
  630. Set the number of samples per each output audio frame.
  631. The last output packet may contain a different number of samples, as
  632. the filter will flush all the remaining samples when the input audio
  633. signal its end.
  634. The filter accepts the following options:
  635. @table @option
  636. @item nb_out_samples, n
  637. Set the number of frames per each output audio frame. The number is
  638. intended as the number of samples @emph{per each channel}.
  639. Default value is 1024.
  640. @item pad, p
  641. If set to 1, the filter will pad the last audio frame with zeroes, so
  642. that the last frame will contain the same number of samples as the
  643. previous ones. Default value is 1.
  644. @end table
  645. For example, to set the number of per-frame samples to 1234 and
  646. disable padding for the last frame, use:
  647. @example
  648. asetnsamples=n=1234:p=0
  649. @end example
  650. @section asetrate
  651. Set the sample rate without altering the PCM data.
  652. This will result in a change of speed and pitch.
  653. The filter accepts the following options:
  654. @table @option
  655. @item sample_rate, r
  656. Set the output sample rate. Default is 44100 Hz.
  657. @end table
  658. @section ashowinfo
  659. Show a line containing various information for each input audio frame.
  660. The input audio is not modified.
  661. The shown line contains a sequence of key/value pairs of the form
  662. @var{key}:@var{value}.
  663. It accepts the following parameters:
  664. @table @option
  665. @item n
  666. The (sequential) number of the input frame, starting from 0.
  667. @item pts
  668. The presentation timestamp of the input frame, in time base units; the time base
  669. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  670. @item pts_time
  671. The presentation timestamp of the input frame in seconds.
  672. @item pos
  673. position of the frame in the input stream, -1 if this information in
  674. unavailable and/or meaningless (for example in case of synthetic audio)
  675. @item fmt
  676. The sample format.
  677. @item chlayout
  678. The channel layout.
  679. @item rate
  680. The sample rate for the audio frame.
  681. @item nb_samples
  682. The number of samples (per channel) in the frame.
  683. @item checksum
  684. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  685. audio, the data is treated as if all the planes were concatenated.
  686. @item plane_checksums
  687. A list of Adler-32 checksums for each data plane.
  688. @end table
  689. @section astats
  690. Display time domain statistical information about the audio channels.
  691. Statistics are calculated and displayed for each audio channel and,
  692. where applicable, an overall figure is also given.
  693. It accepts the following option:
  694. @table @option
  695. @item length
  696. Short window length in seconds, used for peak and trough RMS measurement.
  697. Default is @code{0.05} (50 miliseconds). Allowed range is @code{[0.1 - 10]}.
  698. @end table
  699. A description of each shown parameter follows:
  700. @table @option
  701. @item DC offset
  702. Mean amplitude displacement from zero.
  703. @item Min level
  704. Minimal sample level.
  705. @item Max level
  706. Maximal sample level.
  707. @item Peak level dB
  708. @item RMS level dB
  709. Standard peak and RMS level measured in dBFS.
  710. @item RMS peak dB
  711. @item RMS trough dB
  712. Peak and trough values for RMS level measured over a short window.
  713. @item Crest factor
  714. Standard ratio of peak to RMS level (note: not in dB).
  715. @item Flat factor
  716. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  717. (i.e. either @var{Min level} or @var{Max level}).
  718. @item Peak count
  719. Number of occasions (not the number of samples) that the signal attained either
  720. @var{Min level} or @var{Max level}.
  721. @end table
  722. @section astreamsync
  723. Forward two audio streams and control the order the buffers are forwarded.
  724. The filter accepts the following options:
  725. @table @option
  726. @item expr, e
  727. Set the expression deciding which stream should be
  728. forwarded next: if the result is negative, the first stream is forwarded; if
  729. the result is positive or zero, the second stream is forwarded. It can use
  730. the following variables:
  731. @table @var
  732. @item b1 b2
  733. number of buffers forwarded so far on each stream
  734. @item s1 s2
  735. number of samples forwarded so far on each stream
  736. @item t1 t2
  737. current timestamp of each stream
  738. @end table
  739. The default value is @code{t1-t2}, which means to always forward the stream
  740. that has a smaller timestamp.
  741. @end table
  742. @subsection Examples
  743. Stress-test @code{amerge} by randomly sending buffers on the wrong
  744. input, while avoiding too much of a desynchronization:
  745. @example
  746. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  747. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  748. [a2] [b2] amerge
  749. @end example
  750. @section asyncts
  751. Synchronize audio data with timestamps by squeezing/stretching it and/or
  752. dropping samples/adding silence when needed.
  753. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  754. It accepts the following parameters:
  755. @table @option
  756. @item compensate
  757. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  758. by default. When disabled, time gaps are covered with silence.
  759. @item min_delta
  760. The minimum difference between timestamps and audio data (in seconds) to trigger
  761. adding/dropping samples. The default value is 0.1. If you get an imperfect
  762. sync with this filter, try setting this parameter to 0.
  763. @item max_comp
  764. The maximum compensation in samples per second. Only relevant with compensate=1.
  765. The default value is 500.
  766. @item first_pts
  767. Assume that the first PTS should be this value. The time base is 1 / sample
  768. rate. This allows for padding/trimming at the start of the stream. By default,
  769. no assumption is made about the first frame's expected PTS, so no padding or
  770. trimming is done. For example, this could be set to 0 to pad the beginning with
  771. silence if an audio stream starts after the video stream or to trim any samples
  772. with a negative PTS due to encoder delay.
  773. @end table
  774. @section atempo
  775. Adjust audio tempo.
  776. The filter accepts exactly one parameter, the audio tempo. If not
  777. specified then the filter will assume nominal 1.0 tempo. Tempo must
  778. be in the [0.5, 2.0] range.
  779. @subsection Examples
  780. @itemize
  781. @item
  782. Slow down audio to 80% tempo:
  783. @example
  784. atempo=0.8
  785. @end example
  786. @item
  787. To speed up audio to 125% tempo:
  788. @example
  789. atempo=1.25
  790. @end example
  791. @end itemize
  792. @section atrim
  793. Trim the input so that the output contains one continuous subpart of the input.
  794. It accepts the following parameters:
  795. @table @option
  796. @item start
  797. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  798. sample with the timestamp @var{start} will be the first sample in the output.
  799. @item end
  800. Specify time of the first audio sample that will be dropped, i.e. the
  801. audio sample immediately preceding the one with the timestamp @var{end} will be
  802. the last sample in the output.
  803. @item start_pts
  804. Same as @var{start}, except this option sets the start timestamp in samples
  805. instead of seconds.
  806. @item end_pts
  807. Same as @var{end}, except this option sets the end timestamp in samples instead
  808. of seconds.
  809. @item duration
  810. The maximum duration of the output in seconds.
  811. @item start_sample
  812. The number of the first sample that should be output.
  813. @item end_sample
  814. The number of the first sample that should be dropped.
  815. @end table
  816. @option{start}, @option{end}, @option{duration} are expressed as time
  817. duration specifications, check the "Time duration" section in the
  818. ffmpeg-utils manual.
  819. Note that the first two sets of the start/end options and the @option{duration}
  820. option look at the frame timestamp, while the _sample options simply count the
  821. samples that pass through the filter. So start/end_pts and start/end_sample will
  822. give different results when the timestamps are wrong, inexact or do not start at
  823. zero. Also note that this filter does not modify the timestamps. If you wish
  824. to have the output timestamps start at zero, insert the asetpts filter after the
  825. atrim filter.
  826. If multiple start or end options are set, this filter tries to be greedy and
  827. keep all samples that match at least one of the specified constraints. To keep
  828. only the part that matches all the constraints at once, chain multiple atrim
  829. filters.
  830. The defaults are such that all the input is kept. So it is possible to set e.g.
  831. just the end values to keep everything before the specified time.
  832. Examples:
  833. @itemize
  834. @item
  835. Drop everything except the second minute of input:
  836. @example
  837. ffmpeg -i INPUT -af atrim=60:120
  838. @end example
  839. @item
  840. Keep only the first 1000 samples:
  841. @example
  842. ffmpeg -i INPUT -af atrim=end_sample=1000
  843. @end example
  844. @end itemize
  845. @section bandpass
  846. Apply a two-pole Butterworth band-pass filter with central
  847. frequency @var{frequency}, and (3dB-point) band-width width.
  848. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  849. instead of the default: constant 0dB peak gain.
  850. The filter roll off at 6dB per octave (20dB per decade).
  851. The filter accepts the following options:
  852. @table @option
  853. @item frequency, f
  854. Set the filter's central frequency. Default is @code{3000}.
  855. @item csg
  856. Constant skirt gain if set to 1. Defaults to 0.
  857. @item width_type
  858. Set method to specify band-width of filter.
  859. @table @option
  860. @item h
  861. Hz
  862. @item q
  863. Q-Factor
  864. @item o
  865. octave
  866. @item s
  867. slope
  868. @end table
  869. @item width, w
  870. Specify the band-width of a filter in width_type units.
  871. @end table
  872. @section bandreject
  873. Apply a two-pole Butterworth band-reject filter with central
  874. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  875. The filter roll off at 6dB per octave (20dB per decade).
  876. The filter accepts the following options:
  877. @table @option
  878. @item frequency, f
  879. Set the filter's central frequency. Default is @code{3000}.
  880. @item width_type
  881. Set method to specify band-width of filter.
  882. @table @option
  883. @item h
  884. Hz
  885. @item q
  886. Q-Factor
  887. @item o
  888. octave
  889. @item s
  890. slope
  891. @end table
  892. @item width, w
  893. Specify the band-width of a filter in width_type units.
  894. @end table
  895. @section bass
  896. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  897. shelving filter with a response similar to that of a standard
  898. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  899. The filter accepts the following options:
  900. @table @option
  901. @item gain, g
  902. Give the gain at 0 Hz. Its useful range is about -20
  903. (for a large cut) to +20 (for a large boost).
  904. Beware of clipping when using a positive gain.
  905. @item frequency, f
  906. Set the filter's central frequency and so can be used
  907. to extend or reduce the frequency range to be boosted or cut.
  908. The default value is @code{100} Hz.
  909. @item width_type
  910. Set method to specify band-width of filter.
  911. @table @option
  912. @item h
  913. Hz
  914. @item q
  915. Q-Factor
  916. @item o
  917. octave
  918. @item s
  919. slope
  920. @end table
  921. @item width, w
  922. Determine how steep is the filter's shelf transition.
  923. @end table
  924. @section biquad
  925. Apply a biquad IIR filter with the given coefficients.
  926. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  927. are the numerator and denominator coefficients respectively.
  928. @section bs2b
  929. Bauer stereo to binaural transformation, which improves headphone listening of
  930. stereo audio records.
  931. It accepts the following parameters:
  932. @table @option
  933. @item profile
  934. Pre-defined crossfeed level.
  935. @table @option
  936. @item default
  937. Default level (fcut=700, feed=50).
  938. @item cmoy
  939. Chu Moy circuit (fcut=700, feed=60).
  940. @item jmeier
  941. Jan Meier circuit (fcut=650, feed=95).
  942. @end table
  943. @item fcut
  944. Cut frequency (in Hz).
  945. @item feed
  946. Feed level (in Hz).
  947. @end table
  948. @section channelmap
  949. Remap input channels to new locations.
  950. It accepts the following parameters:
  951. @table @option
  952. @item channel_layout
  953. The channel layout of the output stream.
  954. @item map
  955. Map channels from input to output. The argument is a '|'-separated list of
  956. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  957. @var{in_channel} form. @var{in_channel} can be either the name of the input
  958. channel (e.g. FL for front left) or its index in the input channel layout.
  959. @var{out_channel} is the name of the output channel or its index in the output
  960. channel layout. If @var{out_channel} is not given then it is implicitly an
  961. index, starting with zero and increasing by one for each mapping.
  962. @end table
  963. If no mapping is present, the filter will implicitly map input channels to
  964. output channels, preserving indices.
  965. For example, assuming a 5.1+downmix input MOV file,
  966. @example
  967. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  968. @end example
  969. will create an output WAV file tagged as stereo from the downmix channels of
  970. the input.
  971. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  972. @example
  973. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
  974. @end example
  975. @section channelsplit
  976. Split each channel from an input audio stream into a separate output stream.
  977. It accepts the following parameters:
  978. @table @option
  979. @item channel_layout
  980. The channel layout of the input stream. The default is "stereo".
  981. @end table
  982. For example, assuming a stereo input MP3 file,
  983. @example
  984. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  985. @end example
  986. will create an output Matroska file with two audio streams, one containing only
  987. the left channel and the other the right channel.
  988. Split a 5.1 WAV file into per-channel files:
  989. @example
  990. ffmpeg -i in.wav -filter_complex
  991. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  992. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  993. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  994. side_right.wav
  995. @end example
  996. @section compand
  997. Compress or expand the audio's dynamic range.
  998. It accepts the following parameters:
  999. @table @option
  1000. @item attacks
  1001. @item decays
  1002. A list of times in seconds for each channel over which the instantaneous level
  1003. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1004. increase of volume and @var{decays} refers to decrease of volume. For most
  1005. situations, the attack time (response to the audio getting louder) should be
  1006. shorter than the decay time, because the human ear is more sensitive to sudden
  1007. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1008. a typical value for decay is 0.8 seconds.
  1009. @item points
  1010. A list of points for the transfer function, specified in dB relative to the
  1011. maximum possible signal amplitude. Each key points list must be defined using
  1012. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1013. @code{x0/y0 x1/y1 x2/y2 ....}
  1014. The input values must be in strictly increasing order but the transfer function
  1015. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1016. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1017. function are @code{-70/-70|-60/-20}.
  1018. @item soft-knee
  1019. Set the curve radius in dB for all joints. It defaults to 0.01.
  1020. @item gain
  1021. Set the additional gain in dB to be applied at all points on the transfer
  1022. function. This allows for easy adjustment of the overall gain.
  1023. It defaults to 0.
  1024. @item volume
  1025. Set an initial volume, in dB, to be assumed for each channel when filtering
  1026. starts. This permits the user to supply a nominal level initially, so that, for
  1027. example, a very large gain is not applied to initial signal levels before the
  1028. companding has begun to operate. A typical value for audio which is initially
  1029. quiet is -90 dB. It defaults to 0.
  1030. @item delay
  1031. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1032. delayed before being fed to the volume adjuster. Specifying a delay
  1033. approximately equal to the attack/decay times allows the filter to effectively
  1034. operate in predictive rather than reactive mode. It defaults to 0.
  1035. @end table
  1036. @subsection Examples
  1037. @itemize
  1038. @item
  1039. Make music with both quiet and loud passages suitable for listening to in a
  1040. noisy environment:
  1041. @example
  1042. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1043. @end example
  1044. @item
  1045. A noise gate for when the noise is at a lower level than the signal:
  1046. @example
  1047. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1048. @end example
  1049. @item
  1050. Here is another noise gate, this time for when the noise is at a higher level
  1051. than the signal (making it, in some ways, similar to squelch):
  1052. @example
  1053. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1054. @end example
  1055. @end itemize
  1056. @section earwax
  1057. Make audio easier to listen to on headphones.
  1058. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1059. so that when listened to on headphones the stereo image is moved from
  1060. inside your head (standard for headphones) to outside and in front of
  1061. the listener (standard for speakers).
  1062. Ported from SoX.
  1063. @section equalizer
  1064. Apply a two-pole peaking equalisation (EQ) filter. With this
  1065. filter, the signal-level at and around a selected frequency can
  1066. be increased or decreased, whilst (unlike bandpass and bandreject
  1067. filters) that at all other frequencies is unchanged.
  1068. In order to produce complex equalisation curves, this filter can
  1069. be given several times, each with a different central frequency.
  1070. The filter accepts the following options:
  1071. @table @option
  1072. @item frequency, f
  1073. Set the filter's central frequency in Hz.
  1074. @item width_type
  1075. Set method to specify band-width of filter.
  1076. @table @option
  1077. @item h
  1078. Hz
  1079. @item q
  1080. Q-Factor
  1081. @item o
  1082. octave
  1083. @item s
  1084. slope
  1085. @end table
  1086. @item width, w
  1087. Specify the band-width of a filter in width_type units.
  1088. @item gain, g
  1089. Set the required gain or attenuation in dB.
  1090. Beware of clipping when using a positive gain.
  1091. @end table
  1092. @subsection Examples
  1093. @itemize
  1094. @item
  1095. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1096. @example
  1097. equalizer=f=1000:width_type=h:width=200:g=-10
  1098. @end example
  1099. @item
  1100. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1101. @example
  1102. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1103. @end example
  1104. @end itemize
  1105. @section flanger
  1106. Apply a flanging effect to the audio.
  1107. The filter accepts the following options:
  1108. @table @option
  1109. @item delay
  1110. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1111. @item depth
  1112. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1113. @item regen
  1114. Set percentage regeneneration (delayed signal feedback). Range from -95 to 95.
  1115. Default value is 0.
  1116. @item width
  1117. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1118. Default valu is 71.
  1119. @item speed
  1120. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1121. @item shape
  1122. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1123. Default value is @var{sinusoidal}.
  1124. @item phase
  1125. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1126. Default value is 25.
  1127. @item interp
  1128. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1129. Default is @var{linear}.
  1130. @end table
  1131. @section highpass
  1132. Apply a high-pass filter with 3dB point frequency.
  1133. The filter can be either single-pole, or double-pole (the default).
  1134. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1135. The filter accepts the following options:
  1136. @table @option
  1137. @item frequency, f
  1138. Set frequency in Hz. Default is 3000.
  1139. @item poles, p
  1140. Set number of poles. Default is 2.
  1141. @item width_type
  1142. Set method to specify band-width of filter.
  1143. @table @option
  1144. @item h
  1145. Hz
  1146. @item q
  1147. Q-Factor
  1148. @item o
  1149. octave
  1150. @item s
  1151. slope
  1152. @end table
  1153. @item width, w
  1154. Specify the band-width of a filter in width_type units.
  1155. Applies only to double-pole filter.
  1156. The default is 0.707q and gives a Butterworth response.
  1157. @end table
  1158. @section join
  1159. Join multiple input streams into one multi-channel stream.
  1160. It accepts the following parameters:
  1161. @table @option
  1162. @item inputs
  1163. The number of input streams. It defaults to 2.
  1164. @item channel_layout
  1165. The desired output channel layout. It defaults to stereo.
  1166. @item map
  1167. Map channels from inputs to output. The argument is a '|'-separated list of
  1168. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1169. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1170. can be either the name of the input channel (e.g. FL for front left) or its
  1171. index in the specified input stream. @var{out_channel} is the name of the output
  1172. channel.
  1173. @end table
  1174. The filter will attempt to guess the mappings when they are not specified
  1175. explicitly. It does so by first trying to find an unused matching input channel
  1176. and if that fails it picks the first unused input channel.
  1177. Join 3 inputs (with properly set channel layouts):
  1178. @example
  1179. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1180. @end example
  1181. Build a 5.1 output from 6 single-channel streams:
  1182. @example
  1183. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1184. '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'
  1185. out
  1186. @end example
  1187. @section ladspa
  1188. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1189. To enable compilation of this filter you need to configure FFmpeg with
  1190. @code{--enable-ladspa}.
  1191. @table @option
  1192. @item file, f
  1193. Specifies the name of LADSPA plugin library to load. If the environment
  1194. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1195. each one of the directories specified by the colon separated list in
  1196. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1197. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1198. @file{/usr/lib/ladspa/}.
  1199. @item plugin, p
  1200. Specifies the plugin within the library. Some libraries contain only
  1201. one plugin, but others contain many of them. If this is not set filter
  1202. will list all available plugins within the specified library.
  1203. @item controls, c
  1204. Set the '|' separated list of controls which are zero or more floating point
  1205. values that determine the behavior of the loaded plugin (for example delay,
  1206. threshold or gain).
  1207. Controls need to be defined using the following syntax:
  1208. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1209. @var{valuei} is the value set on the @var{i}-th control.
  1210. If @option{controls} is set to @code{help}, all available controls and
  1211. their valid ranges are printed.
  1212. @item sample_rate, s
  1213. Specify the sample rate, default to 44100. Only used if plugin have
  1214. zero inputs.
  1215. @item nb_samples, n
  1216. Set the number of samples per channel per each output frame, default
  1217. is 1024. Only used if plugin have zero inputs.
  1218. @item duration, d
  1219. Set the minimum duration of the sourced audio. See the function
  1220. @code{av_parse_time()} for the accepted format, also check the "Time duration"
  1221. section in the ffmpeg-utils manual.
  1222. Note that the resulting duration may be greater than the specified duration,
  1223. as the generated audio is always cut at the end of a complete frame.
  1224. If not specified, or the expressed duration is negative, the audio is
  1225. supposed to be generated forever.
  1226. Only used if plugin have zero inputs.
  1227. @end table
  1228. @subsection Examples
  1229. @itemize
  1230. @item
  1231. List all available plugins within amp (LADSPA example plugin) library:
  1232. @example
  1233. ladspa=file=amp
  1234. @end example
  1235. @item
  1236. List all available controls and their valid ranges for @code{vcf_notch}
  1237. plugin from @code{VCF} library:
  1238. @example
  1239. ladspa=f=vcf:p=vcf_notch:c=help
  1240. @end example
  1241. @item
  1242. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1243. plugin library:
  1244. @example
  1245. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1246. @end example
  1247. @item
  1248. Add reverberation to the audio using TAP-plugins
  1249. (Tom's Audio Processing plugins):
  1250. @example
  1251. ladspa=file=tap_reverb:tap_reverb
  1252. @end example
  1253. @item
  1254. Generate white noise, with 0.2 amplitude:
  1255. @example
  1256. ladspa=file=cmt:noise_source_white:c=c0=.2
  1257. @end example
  1258. @item
  1259. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1260. @code{C* Audio Plugin Suite} (CAPS) library:
  1261. @example
  1262. ladspa=file=caps:Click:c=c1=20'
  1263. @end example
  1264. @item
  1265. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1266. @example
  1267. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1268. @end example
  1269. @end itemize
  1270. @subsection Commands
  1271. This filter supports the following commands:
  1272. @table @option
  1273. @item cN
  1274. Modify the @var{N}-th control value.
  1275. If the specified value is not valid, it is ignored and prior one is kept.
  1276. @end table
  1277. @section lowpass
  1278. Apply a low-pass filter with 3dB point frequency.
  1279. The filter can be either single-pole or double-pole (the default).
  1280. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1281. The filter accepts the following options:
  1282. @table @option
  1283. @item frequency, f
  1284. Set frequency in Hz. Default is 500.
  1285. @item poles, p
  1286. Set number of poles. Default is 2.
  1287. @item width_type
  1288. Set method to specify band-width of filter.
  1289. @table @option
  1290. @item h
  1291. Hz
  1292. @item q
  1293. Q-Factor
  1294. @item o
  1295. octave
  1296. @item s
  1297. slope
  1298. @end table
  1299. @item width, w
  1300. Specify the band-width of a filter in width_type units.
  1301. Applies only to double-pole filter.
  1302. The default is 0.707q and gives a Butterworth response.
  1303. @end table
  1304. @section pan
  1305. Mix channels with specific gain levels. The filter accepts the output
  1306. channel layout followed by a set of channels definitions.
  1307. This filter is also designed to remap efficiently the channels of an audio
  1308. stream.
  1309. The filter accepts parameters of the form:
  1310. "@var{l}:@var{outdef}:@var{outdef}:..."
  1311. @table @option
  1312. @item l
  1313. output channel layout or number of channels
  1314. @item outdef
  1315. output channel specification, of the form:
  1316. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1317. @item out_name
  1318. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1319. number (c0, c1, etc.)
  1320. @item gain
  1321. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1322. @item in_name
  1323. input channel to use, see out_name for details; it is not possible to mix
  1324. named and numbered input channels
  1325. @end table
  1326. If the `=' in a channel specification is replaced by `<', then the gains for
  1327. that specification will be renormalized so that the total is 1, thus
  1328. avoiding clipping noise.
  1329. @subsection Mixing examples
  1330. For example, if you want to down-mix from stereo to mono, but with a bigger
  1331. factor for the left channel:
  1332. @example
  1333. pan=1:c0=0.9*c0+0.1*c1
  1334. @end example
  1335. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1336. 7-channels surround:
  1337. @example
  1338. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1339. @end example
  1340. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1341. that should be preferred (see "-ac" option) unless you have very specific
  1342. needs.
  1343. @subsection Remapping examples
  1344. The channel remapping will be effective if, and only if:
  1345. @itemize
  1346. @item gain coefficients are zeroes or ones,
  1347. @item only one input per channel output,
  1348. @end itemize
  1349. If all these conditions are satisfied, the filter will notify the user ("Pure
  1350. channel mapping detected"), and use an optimized and lossless method to do the
  1351. remapping.
  1352. For example, if you have a 5.1 source and want a stereo audio stream by
  1353. dropping the extra channels:
  1354. @example
  1355. pan="stereo: c0=FL : c1=FR"
  1356. @end example
  1357. Given the same source, you can also switch front left and front right channels
  1358. and keep the input channel layout:
  1359. @example
  1360. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  1361. @end example
  1362. If the input is a stereo audio stream, you can mute the front left channel (and
  1363. still keep the stereo channel layout) with:
  1364. @example
  1365. pan="stereo:c1=c1"
  1366. @end example
  1367. Still with a stereo audio stream input, you can copy the right channel in both
  1368. front left and right:
  1369. @example
  1370. pan="stereo: c0=FR : c1=FR"
  1371. @end example
  1372. @section replaygain
  1373. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1374. outputs it unchanged.
  1375. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1376. @section resample
  1377. Convert the audio sample format, sample rate and channel layout. It is
  1378. not meant to be used directly.
  1379. @section silencedetect
  1380. Detect silence in an audio stream.
  1381. This filter logs a message when it detects that the input audio volume is less
  1382. or equal to a noise tolerance value for a duration greater or equal to the
  1383. minimum detected noise duration.
  1384. The printed times and duration are expressed in seconds.
  1385. The filter accepts the following options:
  1386. @table @option
  1387. @item duration, d
  1388. Set silence duration until notification (default is 2 seconds).
  1389. @item noise, n
  1390. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1391. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1392. @end table
  1393. @subsection Examples
  1394. @itemize
  1395. @item
  1396. Detect 5 seconds of silence with -50dB noise tolerance:
  1397. @example
  1398. silencedetect=n=-50dB:d=5
  1399. @end example
  1400. @item
  1401. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1402. tolerance in @file{silence.mp3}:
  1403. @example
  1404. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1405. @end example
  1406. @end itemize
  1407. @section treble
  1408. Boost or cut treble (upper) frequencies of the audio using a two-pole
  1409. shelving filter with a response similar to that of a standard
  1410. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item gain, g
  1414. Give the gain at whichever is the lower of ~22 kHz and the
  1415. Nyquist frequency. Its useful range is about -20 (for a large cut)
  1416. to +20 (for a large boost). Beware of clipping when using a positive gain.
  1417. @item frequency, f
  1418. Set the filter's central frequency and so can be used
  1419. to extend or reduce the frequency range to be boosted or cut.
  1420. The default value is @code{3000} Hz.
  1421. @item width_type
  1422. Set method to specify band-width of filter.
  1423. @table @option
  1424. @item h
  1425. Hz
  1426. @item q
  1427. Q-Factor
  1428. @item o
  1429. octave
  1430. @item s
  1431. slope
  1432. @end table
  1433. @item width, w
  1434. Determine how steep is the filter's shelf transition.
  1435. @end table
  1436. @section volume
  1437. Adjust the input audio volume.
  1438. It accepts the following parameters:
  1439. @table @option
  1440. @item volume
  1441. Set audio volume expression.
  1442. Output values are clipped to the maximum value.
  1443. The output audio volume is given by the relation:
  1444. @example
  1445. @var{output_volume} = @var{volume} * @var{input_volume}
  1446. @end example
  1447. The default value for @var{volume} is "1.0".
  1448. @item precision
  1449. This parameter represents the mathematical precision.
  1450. It determines which input sample formats will be allowed, which affects the
  1451. precision of the volume scaling.
  1452. @table @option
  1453. @item fixed
  1454. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  1455. @item float
  1456. 32-bit floating-point; this limits input sample format to FLT. (default)
  1457. @item double
  1458. 64-bit floating-point; this limits input sample format to DBL.
  1459. @end table
  1460. @item replaygain
  1461. Choose the behaviour on encountering ReplayGain side data in input frames.
  1462. @table @option
  1463. @item drop
  1464. Remove ReplayGain side data, ignoring its contents (the default).
  1465. @item ignore
  1466. Ignore ReplayGain side data, but leave it in the frame.
  1467. @item track
  1468. Prefer the track gain, if present.
  1469. @item album
  1470. Prefer the album gain, if present.
  1471. @end table
  1472. @item replaygain_preamp
  1473. Pre-amplification gain in dB to apply to the selected replaygain gain.
  1474. Default value for @var{replaygain_preamp} is 0.0.
  1475. @item eval
  1476. Set when the volume expression is evaluated.
  1477. It accepts the following values:
  1478. @table @samp
  1479. @item once
  1480. only evaluate expression once during the filter initialization, or
  1481. when the @samp{volume} command is sent
  1482. @item frame
  1483. evaluate expression for each incoming frame
  1484. @end table
  1485. Default value is @samp{once}.
  1486. @end table
  1487. The volume expression can contain the following parameters.
  1488. @table @option
  1489. @item n
  1490. frame number (starting at zero)
  1491. @item nb_channels
  1492. number of channels
  1493. @item nb_consumed_samples
  1494. number of samples consumed by the filter
  1495. @item nb_samples
  1496. number of samples in the current frame
  1497. @item pos
  1498. original frame position in the file
  1499. @item pts
  1500. frame PTS
  1501. @item sample_rate
  1502. sample rate
  1503. @item startpts
  1504. PTS at start of stream
  1505. @item startt
  1506. time at start of stream
  1507. @item t
  1508. frame time
  1509. @item tb
  1510. timestamp timebase
  1511. @item volume
  1512. last set volume value
  1513. @end table
  1514. Note that when @option{eval} is set to @samp{once} only the
  1515. @var{sample_rate} and @var{tb} variables are available, all other
  1516. variables will evaluate to NAN.
  1517. @subsection Commands
  1518. This filter supports the following commands:
  1519. @table @option
  1520. @item volume
  1521. Modify the volume expression.
  1522. The command accepts the same syntax of the corresponding option.
  1523. If the specified expression is not valid, it is kept at its current
  1524. value.
  1525. @item replaygain_noclip
  1526. Prevent clipping by limiting the gain applied.
  1527. Default value for @var{replaygain_noclip} is 1.
  1528. @end table
  1529. @subsection Examples
  1530. @itemize
  1531. @item
  1532. Halve the input audio volume:
  1533. @example
  1534. volume=volume=0.5
  1535. volume=volume=1/2
  1536. volume=volume=-6.0206dB
  1537. @end example
  1538. In all the above example the named key for @option{volume} can be
  1539. omitted, for example like in:
  1540. @example
  1541. volume=0.5
  1542. @end example
  1543. @item
  1544. Increase input audio power by 6 decibels using fixed-point precision:
  1545. @example
  1546. volume=volume=6dB:precision=fixed
  1547. @end example
  1548. @item
  1549. Fade volume after time 10 with an annihilation period of 5 seconds:
  1550. @example
  1551. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  1552. @end example
  1553. @end itemize
  1554. @section volumedetect
  1555. Detect the volume of the input video.
  1556. The filter has no parameters. The input is not modified. Statistics about
  1557. the volume will be printed in the log when the input stream end is reached.
  1558. In particular it will show the mean volume (root mean square), maximum
  1559. volume (on a per-sample basis), and the beginning of a histogram of the
  1560. registered volume values (from the maximum value to a cumulated 1/1000 of
  1561. the samples).
  1562. All volumes are in decibels relative to the maximum PCM value.
  1563. @subsection Examples
  1564. Here is an excerpt of the output:
  1565. @example
  1566. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  1567. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  1568. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  1569. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  1570. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  1571. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  1572. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  1573. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  1574. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  1575. @end example
  1576. It means that:
  1577. @itemize
  1578. @item
  1579. The mean square energy is approximately -27 dB, or 10^-2.7.
  1580. @item
  1581. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  1582. @item
  1583. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  1584. @end itemize
  1585. In other words, raising the volume by +4 dB does not cause any clipping,
  1586. raising it by +5 dB causes clipping for 6 samples, etc.
  1587. @c man end AUDIO FILTERS
  1588. @chapter Audio Sources
  1589. @c man begin AUDIO SOURCES
  1590. Below is a description of the currently available audio sources.
  1591. @section abuffer
  1592. Buffer audio frames, and make them available to the filter chain.
  1593. This source is mainly intended for a programmatic use, in particular
  1594. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  1595. It accepts the following parameters:
  1596. @table @option
  1597. @item time_base
  1598. The timebase which will be used for timestamps of submitted frames. It must be
  1599. either a floating-point number or in @var{numerator}/@var{denominator} form.
  1600. @item sample_rate
  1601. The sample rate of the incoming audio buffers.
  1602. @item sample_fmt
  1603. The sample format of the incoming audio buffers.
  1604. Either a sample format name or its corresponging integer representation from
  1605. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  1606. @item channel_layout
  1607. The channel layout of the incoming audio buffers.
  1608. Either a channel layout name from channel_layout_map in
  1609. @file{libavutil/channel_layout.c} or its corresponding integer representation
  1610. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  1611. @item channels
  1612. The number of channels of the incoming audio buffers.
  1613. If both @var{channels} and @var{channel_layout} are specified, then they
  1614. must be consistent.
  1615. @end table
  1616. @subsection Examples
  1617. @example
  1618. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  1619. @end example
  1620. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  1621. Since the sample format with name "s16p" corresponds to the number
  1622. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  1623. equivalent to:
  1624. @example
  1625. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  1626. @end example
  1627. @section aevalsrc
  1628. Generate an audio signal specified by an expression.
  1629. This source accepts in input one or more expressions (one for each
  1630. channel), which are evaluated and used to generate a corresponding
  1631. audio signal.
  1632. This source accepts the following options:
  1633. @table @option
  1634. @item exprs
  1635. Set the '|'-separated expressions list for each separate channel. In case the
  1636. @option{channel_layout} option is not specified, the selected channel layout
  1637. depends on the number of provided expressions. Otherwise the last
  1638. specified expression is applied to the remaining output channels.
  1639. @item channel_layout, c
  1640. Set the channel layout. The number of channels in the specified layout
  1641. must be equal to the number of specified expressions.
  1642. @item duration, d
  1643. Set the minimum duration of the sourced audio. See the function
  1644. @code{av_parse_time()} for the accepted format.
  1645. Note that the resulting duration may be greater than the specified
  1646. duration, as the generated audio is always cut at the end of a
  1647. complete frame.
  1648. If not specified, or the expressed duration is negative, the audio is
  1649. supposed to be generated forever.
  1650. @item nb_samples, n
  1651. Set the number of samples per channel per each output frame,
  1652. default to 1024.
  1653. @item sample_rate, s
  1654. Specify the sample rate, default to 44100.
  1655. @end table
  1656. Each expression in @var{exprs} can contain the following constants:
  1657. @table @option
  1658. @item n
  1659. number of the evaluated sample, starting from 0
  1660. @item t
  1661. time of the evaluated sample expressed in seconds, starting from 0
  1662. @item s
  1663. sample rate
  1664. @end table
  1665. @subsection Examples
  1666. @itemize
  1667. @item
  1668. Generate silence:
  1669. @example
  1670. aevalsrc=0
  1671. @end example
  1672. @item
  1673. Generate a sin signal with frequency of 440 Hz, set sample rate to
  1674. 8000 Hz:
  1675. @example
  1676. aevalsrc="sin(440*2*PI*t):s=8000"
  1677. @end example
  1678. @item
  1679. Generate a two channels signal, specify the channel layout (Front
  1680. Center + Back Center) explicitly:
  1681. @example
  1682. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  1683. @end example
  1684. @item
  1685. Generate white noise:
  1686. @example
  1687. aevalsrc="-2+random(0)"
  1688. @end example
  1689. @item
  1690. Generate an amplitude modulated signal:
  1691. @example
  1692. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  1693. @end example
  1694. @item
  1695. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  1696. @example
  1697. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  1698. @end example
  1699. @end itemize
  1700. @section anullsrc
  1701. The null audio source, return unprocessed audio frames. It is mainly useful
  1702. as a template and to be employed in analysis / debugging tools, or as
  1703. the source for filters which ignore the input data (for example the sox
  1704. synth filter).
  1705. This source accepts the following options:
  1706. @table @option
  1707. @item channel_layout, cl
  1708. Specifies the channel layout, and can be either an integer or a string
  1709. representing a channel layout. The default value of @var{channel_layout}
  1710. is "stereo".
  1711. Check the channel_layout_map definition in
  1712. @file{libavutil/channel_layout.c} for the mapping between strings and
  1713. channel layout values.
  1714. @item sample_rate, r
  1715. Specifies the sample rate, and defaults to 44100.
  1716. @item nb_samples, n
  1717. Set the number of samples per requested frames.
  1718. @end table
  1719. @subsection Examples
  1720. @itemize
  1721. @item
  1722. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  1723. @example
  1724. anullsrc=r=48000:cl=4
  1725. @end example
  1726. @item
  1727. Do the same operation with a more obvious syntax:
  1728. @example
  1729. anullsrc=r=48000:cl=mono
  1730. @end example
  1731. @end itemize
  1732. All the parameters need to be explicitly defined.
  1733. @section flite
  1734. Synthesize a voice utterance using the libflite library.
  1735. To enable compilation of this filter you need to configure FFmpeg with
  1736. @code{--enable-libflite}.
  1737. Note that the flite library is not thread-safe.
  1738. The filter accepts the following options:
  1739. @table @option
  1740. @item list_voices
  1741. If set to 1, list the names of the available voices and exit
  1742. immediately. Default value is 0.
  1743. @item nb_samples, n
  1744. Set the maximum number of samples per frame. Default value is 512.
  1745. @item textfile
  1746. Set the filename containing the text to speak.
  1747. @item text
  1748. Set the text to speak.
  1749. @item voice, v
  1750. Set the voice to use for the speech synthesis. Default value is
  1751. @code{kal}. See also the @var{list_voices} option.
  1752. @end table
  1753. @subsection Examples
  1754. @itemize
  1755. @item
  1756. Read from file @file{speech.txt}, and synthetize the text using the
  1757. standard flite voice:
  1758. @example
  1759. flite=textfile=speech.txt
  1760. @end example
  1761. @item
  1762. Read the specified text selecting the @code{slt} voice:
  1763. @example
  1764. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1765. @end example
  1766. @item
  1767. Input text to ffmpeg:
  1768. @example
  1769. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1770. @end example
  1771. @item
  1772. Make @file{ffplay} speak the specified text, using @code{flite} and
  1773. the @code{lavfi} device:
  1774. @example
  1775. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  1776. @end example
  1777. @end itemize
  1778. For more information about libflite, check:
  1779. @url{http://www.speech.cs.cmu.edu/flite/}
  1780. @section sine
  1781. Generate an audio signal made of a sine wave with amplitude 1/8.
  1782. The audio signal is bit-exact.
  1783. The filter accepts the following options:
  1784. @table @option
  1785. @item frequency, f
  1786. Set the carrier frequency. Default is 440 Hz.
  1787. @item beep_factor, b
  1788. Enable a periodic beep every second with frequency @var{beep_factor} times
  1789. the carrier frequency. Default is 0, meaning the beep is disabled.
  1790. @item sample_rate, r
  1791. Specify the sample rate, default is 44100.
  1792. @item duration, d
  1793. Specify the duration of the generated audio stream.
  1794. @item samples_per_frame
  1795. Set the number of samples per output frame, default is 1024.
  1796. @end table
  1797. @subsection Examples
  1798. @itemize
  1799. @item
  1800. Generate a simple 440 Hz sine wave:
  1801. @example
  1802. sine
  1803. @end example
  1804. @item
  1805. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  1806. @example
  1807. sine=220:4:d=5
  1808. sine=f=220:b=4:d=5
  1809. sine=frequency=220:beep_factor=4:duration=5
  1810. @end example
  1811. @end itemize
  1812. @c man end AUDIO SOURCES
  1813. @chapter Audio Sinks
  1814. @c man begin AUDIO SINKS
  1815. Below is a description of the currently available audio sinks.
  1816. @section abuffersink
  1817. Buffer audio frames, and make them available to the end of filter chain.
  1818. This sink is mainly intended for programmatic use, in particular
  1819. through the interface defined in @file{libavfilter/buffersink.h}
  1820. or the options system.
  1821. It accepts a pointer to an AVABufferSinkContext structure, which
  1822. defines the incoming buffers' formats, to be passed as the opaque
  1823. parameter to @code{avfilter_init_filter} for initialization.
  1824. @section anullsink
  1825. Null audio sink; do absolutely nothing with the input audio. It is
  1826. mainly useful as a template and for use in analysis / debugging
  1827. tools.
  1828. @c man end AUDIO SINKS
  1829. @chapter Video Filters
  1830. @c man begin VIDEO FILTERS
  1831. When you configure your FFmpeg build, you can disable any of the
  1832. existing filters using @code{--disable-filters}.
  1833. The configure output will show the video filters included in your
  1834. build.
  1835. Below is a description of the currently available video filters.
  1836. @section alphaextract
  1837. Extract the alpha component from the input as a grayscale video. This
  1838. is especially useful with the @var{alphamerge} filter.
  1839. @section alphamerge
  1840. Add or replace the alpha component of the primary input with the
  1841. grayscale value of a second input. This is intended for use with
  1842. @var{alphaextract} to allow the transmission or storage of frame
  1843. sequences that have alpha in a format that doesn't support an alpha
  1844. channel.
  1845. For example, to reconstruct full frames from a normal YUV-encoded video
  1846. and a separate video created with @var{alphaextract}, you might use:
  1847. @example
  1848. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  1849. @end example
  1850. Since this filter is designed for reconstruction, it operates on frame
  1851. sequences without considering timestamps, and terminates when either
  1852. input reaches end of stream. This will cause problems if your encoding
  1853. pipeline drops frames. If you're trying to apply an image as an
  1854. overlay to a video stream, consider the @var{overlay} filter instead.
  1855. @section ass
  1856. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  1857. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  1858. Substation Alpha) subtitles files.
  1859. @section bbox
  1860. Compute the bounding box for the non-black pixels in the input frame
  1861. luminance plane.
  1862. This filter computes the bounding box containing all the pixels with a
  1863. luminance value greater than the minimum allowed value.
  1864. The parameters describing the bounding box are printed on the filter
  1865. log.
  1866. The filter accepts the following option:
  1867. @table @option
  1868. @item min_val
  1869. Set the minimal luminance value. Default is @code{16}.
  1870. @end table
  1871. @section blackdetect
  1872. Detect video intervals that are (almost) completely black. Can be
  1873. useful to detect chapter transitions, commercials, or invalid
  1874. recordings. Output lines contains the time for the start, end and
  1875. duration of the detected black interval expressed in seconds.
  1876. In order to display the output lines, you need to set the loglevel at
  1877. least to the AV_LOG_INFO value.
  1878. The filter accepts the following options:
  1879. @table @option
  1880. @item black_min_duration, d
  1881. Set the minimum detected black duration expressed in seconds. It must
  1882. be a non-negative floating point number.
  1883. Default value is 2.0.
  1884. @item picture_black_ratio_th, pic_th
  1885. Set the threshold for considering a picture "black".
  1886. Express the minimum value for the ratio:
  1887. @example
  1888. @var{nb_black_pixels} / @var{nb_pixels}
  1889. @end example
  1890. for which a picture is considered black.
  1891. Default value is 0.98.
  1892. @item pixel_black_th, pix_th
  1893. Set the threshold for considering a pixel "black".
  1894. The threshold expresses the maximum pixel luminance value for which a
  1895. pixel is considered "black". The provided value is scaled according to
  1896. the following equation:
  1897. @example
  1898. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  1899. @end example
  1900. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  1901. the input video format, the range is [0-255] for YUV full-range
  1902. formats and [16-235] for YUV non full-range formats.
  1903. Default value is 0.10.
  1904. @end table
  1905. The following example sets the maximum pixel threshold to the minimum
  1906. value, and detects only black intervals of 2 or more seconds:
  1907. @example
  1908. blackdetect=d=2:pix_th=0.00
  1909. @end example
  1910. @section blackframe
  1911. Detect frames that are (almost) completely black. Can be useful to
  1912. detect chapter transitions or commercials. Output lines consist of
  1913. the frame number of the detected frame, the percentage of blackness,
  1914. the position in the file if known or -1 and the timestamp in seconds.
  1915. In order to display the output lines, you need to set the loglevel at
  1916. least to the AV_LOG_INFO value.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item amount
  1920. The percentage of the pixels that have to be below the threshold; it defaults to
  1921. @code{98}.
  1922. @item threshold, thresh
  1923. The threshold below which a pixel value is considered black; it defaults to
  1924. @code{32}.
  1925. @end table
  1926. @section blend
  1927. Blend two video frames into each other.
  1928. It takes two input streams and outputs one stream, the first input is the
  1929. "top" layer and second input is "bottom" layer.
  1930. Output terminates when shortest input terminates.
  1931. A description of the accepted options follows.
  1932. @table @option
  1933. @item c0_mode
  1934. @item c1_mode
  1935. @item c2_mode
  1936. @item c3_mode
  1937. @item all_mode
  1938. Set blend mode for specific pixel component or all pixel components in case
  1939. of @var{all_mode}. Default value is @code{normal}.
  1940. Available values for component modes are:
  1941. @table @samp
  1942. @item addition
  1943. @item and
  1944. @item average
  1945. @item burn
  1946. @item darken
  1947. @item difference
  1948. @item divide
  1949. @item dodge
  1950. @item exclusion
  1951. @item hardlight
  1952. @item lighten
  1953. @item multiply
  1954. @item negation
  1955. @item normal
  1956. @item or
  1957. @item overlay
  1958. @item phoenix
  1959. @item pinlight
  1960. @item reflect
  1961. @item screen
  1962. @item softlight
  1963. @item subtract
  1964. @item vividlight
  1965. @item xor
  1966. @end table
  1967. @item c0_opacity
  1968. @item c1_opacity
  1969. @item c2_opacity
  1970. @item c3_opacity
  1971. @item all_opacity
  1972. Set blend opacity for specific pixel component or all pixel components in case
  1973. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  1974. @item c0_expr
  1975. @item c1_expr
  1976. @item c2_expr
  1977. @item c3_expr
  1978. @item all_expr
  1979. Set blend expression for specific pixel component or all pixel components in case
  1980. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  1981. The expressions can use the following variables:
  1982. @table @option
  1983. @item N
  1984. The sequential number of the filtered frame, starting from @code{0}.
  1985. @item X
  1986. @item Y
  1987. the coordinates of the current sample
  1988. @item W
  1989. @item H
  1990. the width and height of currently filtered plane
  1991. @item SW
  1992. @item SH
  1993. Width and height scale depending on the currently filtered plane. It is the
  1994. ratio between the corresponding luma plane number of pixels and the current
  1995. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  1996. @code{0.5,0.5} for chroma planes.
  1997. @item T
  1998. Time of the current frame, expressed in seconds.
  1999. @item TOP, A
  2000. Value of pixel component at current location for first video frame (top layer).
  2001. @item BOTTOM, B
  2002. Value of pixel component at current location for second video frame (bottom layer).
  2003. @end table
  2004. @item shortest
  2005. Force termination when the shortest input terminates. Default is @code{0}.
  2006. @item repeatlast
  2007. Continue applying the last bottom frame after the end of the stream. A value of
  2008. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2009. Default is @code{1}.
  2010. @end table
  2011. @subsection Examples
  2012. @itemize
  2013. @item
  2014. Apply transition from bottom layer to top layer in first 10 seconds:
  2015. @example
  2016. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2017. @end example
  2018. @item
  2019. Apply 1x1 checkerboard effect:
  2020. @example
  2021. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2022. @end example
  2023. @item
  2024. Apply uncover left effect:
  2025. @example
  2026. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2027. @end example
  2028. @item
  2029. Apply uncover down effect:
  2030. @example
  2031. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2032. @end example
  2033. @item
  2034. Apply uncover up-left effect:
  2035. @example
  2036. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2037. @end example
  2038. @end itemize
  2039. @section boxblur
  2040. Apply a boxblur algorithm to the input video.
  2041. It accepts the following parameters:
  2042. @table @option
  2043. @item luma_radius, lr
  2044. @item luma_power, lp
  2045. @item chroma_radius, cr
  2046. @item chroma_power, cp
  2047. @item alpha_radius, ar
  2048. @item alpha_power, ap
  2049. @end table
  2050. A description of the accepted options follows.
  2051. @table @option
  2052. @item luma_radius, lr
  2053. @item chroma_radius, cr
  2054. @item alpha_radius, ar
  2055. Set an expression for the box radius in pixels used for blurring the
  2056. corresponding input plane.
  2057. The radius value must be a non-negative number, and must not be
  2058. greater than the value of the expression @code{min(w,h)/2} for the
  2059. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2060. planes.
  2061. Default value for @option{luma_radius} is "2". If not specified,
  2062. @option{chroma_radius} and @option{alpha_radius} default to the
  2063. corresponding value set for @option{luma_radius}.
  2064. The expressions can contain the following constants:
  2065. @table @option
  2066. @item w
  2067. @item h
  2068. The input width and height in pixels.
  2069. @item cw
  2070. @item ch
  2071. The input chroma image width and height in pixels.
  2072. @item hsub
  2073. @item vsub
  2074. The horizontal and vertical chroma subsample values. For example, for the
  2075. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2076. @end table
  2077. @item luma_power, lp
  2078. @item chroma_power, cp
  2079. @item alpha_power, ap
  2080. Specify how many times the boxblur filter is applied to the
  2081. corresponding plane.
  2082. Default value for @option{luma_power} is 2. If not specified,
  2083. @option{chroma_power} and @option{alpha_power} default to the
  2084. corresponding value set for @option{luma_power}.
  2085. A value of 0 will disable the effect.
  2086. @end table
  2087. @subsection Examples
  2088. @itemize
  2089. @item
  2090. Apply a boxblur filter with the luma, chroma, and alpha radii
  2091. set to 2:
  2092. @example
  2093. boxblur=luma_radius=2:luma_power=1
  2094. boxblur=2:1
  2095. @end example
  2096. @item
  2097. Set the luma radius to 2, and alpha and chroma radius to 0:
  2098. @example
  2099. boxblur=2:1:cr=0:ar=0
  2100. @end example
  2101. @item
  2102. Set the luma and chroma radii to a fraction of the video dimension:
  2103. @example
  2104. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2105. @end example
  2106. @end itemize
  2107. @section colorbalance
  2108. Modify intensity of primary colors (red, green and blue) of input frames.
  2109. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2110. regions for the red-cyan, green-magenta or blue-yellow balance.
  2111. A positive adjustment value shifts the balance towards the primary color, a negative
  2112. value towards the complementary color.
  2113. The filter accepts the following options:
  2114. @table @option
  2115. @item rs
  2116. @item gs
  2117. @item bs
  2118. Adjust red, green and blue shadows (darkest pixels).
  2119. @item rm
  2120. @item gm
  2121. @item bm
  2122. Adjust red, green and blue midtones (medium pixels).
  2123. @item rh
  2124. @item gh
  2125. @item bh
  2126. Adjust red, green and blue highlights (brightest pixels).
  2127. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2128. @end table
  2129. @subsection Examples
  2130. @itemize
  2131. @item
  2132. Add red color cast to shadows:
  2133. @example
  2134. colorbalance=rs=.3
  2135. @end example
  2136. @end itemize
  2137. @section colorchannelmixer
  2138. Adjust video input frames by re-mixing color channels.
  2139. This filter modifies a color channel by adding the values associated to
  2140. the other channels of the same pixels. For example if the value to
  2141. modify is red, the output value will be:
  2142. @example
  2143. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  2144. @end example
  2145. The filter accepts the following options:
  2146. @table @option
  2147. @item rr
  2148. @item rg
  2149. @item rb
  2150. @item ra
  2151. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  2152. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  2153. @item gr
  2154. @item gg
  2155. @item gb
  2156. @item ga
  2157. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  2158. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  2159. @item br
  2160. @item bg
  2161. @item bb
  2162. @item ba
  2163. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  2164. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  2165. @item ar
  2166. @item ag
  2167. @item ab
  2168. @item aa
  2169. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  2170. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  2171. Allowed ranges for options are @code{[-2.0, 2.0]}.
  2172. @end table
  2173. @subsection Examples
  2174. @itemize
  2175. @item
  2176. Convert source to grayscale:
  2177. @example
  2178. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  2179. @end example
  2180. @item
  2181. Simulate sepia tones:
  2182. @example
  2183. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  2184. @end example
  2185. @end itemize
  2186. @section colormatrix
  2187. Convert color matrix.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item src
  2191. @item dst
  2192. Specify the source and destination color matrix. Both values must be
  2193. specified.
  2194. The accepted values are:
  2195. @table @samp
  2196. @item bt709
  2197. BT.709
  2198. @item bt601
  2199. BT.601
  2200. @item smpte240m
  2201. SMPTE-240M
  2202. @item fcc
  2203. FCC
  2204. @end table
  2205. @end table
  2206. For example to convert from BT.601 to SMPTE-240M, use the command:
  2207. @example
  2208. colormatrix=bt601:smpte240m
  2209. @end example
  2210. @section copy
  2211. Copy the input source unchanged to the output. This is mainly useful for
  2212. testing purposes.
  2213. @section crop
  2214. Crop the input video to given dimensions.
  2215. It accepts the following parameters:
  2216. @table @option
  2217. @item w, out_w
  2218. The width of the output video. It defaults to @code{iw}.
  2219. This expression is evaluated only once during the filter
  2220. configuration.
  2221. @item h, out_h
  2222. The height of the output video. It defaults to @code{ih}.
  2223. This expression is evaluated only once during the filter
  2224. configuration.
  2225. @item x
  2226. The horizontal position, in the input video, of the left edge of the output
  2227. video. It defaults to @code{(in_w-out_w)/2}.
  2228. This expression is evaluated per-frame.
  2229. @item y
  2230. The vertical position, in the input video, of the top edge of the output video.
  2231. It defaults to @code{(in_h-out_h)/2}.
  2232. This expression is evaluated per-frame.
  2233. @item keep_aspect
  2234. If set to 1 will force the output display aspect ratio
  2235. to be the same of the input, by changing the output sample aspect
  2236. ratio. It defaults to 0.
  2237. @end table
  2238. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  2239. expressions containing the following constants:
  2240. @table @option
  2241. @item x
  2242. @item y
  2243. The computed values for @var{x} and @var{y}. They are evaluated for
  2244. each new frame.
  2245. @item in_w
  2246. @item in_h
  2247. The input width and height.
  2248. @item iw
  2249. @item ih
  2250. These are the same as @var{in_w} and @var{in_h}.
  2251. @item out_w
  2252. @item out_h
  2253. The output (cropped) width and height.
  2254. @item ow
  2255. @item oh
  2256. These are the same as @var{out_w} and @var{out_h}.
  2257. @item a
  2258. same as @var{iw} / @var{ih}
  2259. @item sar
  2260. input sample aspect ratio
  2261. @item dar
  2262. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  2263. @item hsub
  2264. @item vsub
  2265. horizontal and vertical chroma subsample values. For example for the
  2266. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2267. @item n
  2268. The number of the input frame, starting from 0.
  2269. @item pos
  2270. the position in the file of the input frame, NAN if unknown
  2271. @item t
  2272. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  2273. @end table
  2274. The expression for @var{out_w} may depend on the value of @var{out_h},
  2275. and the expression for @var{out_h} may depend on @var{out_w}, but they
  2276. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  2277. evaluated after @var{out_w} and @var{out_h}.
  2278. The @var{x} and @var{y} parameters specify the expressions for the
  2279. position of the top-left corner of the output (non-cropped) area. They
  2280. are evaluated for each frame. If the evaluated value is not valid, it
  2281. is approximated to the nearest valid value.
  2282. The expression for @var{x} may depend on @var{y}, and the expression
  2283. for @var{y} may depend on @var{x}.
  2284. @subsection Examples
  2285. @itemize
  2286. @item
  2287. Crop area with size 100x100 at position (12,34).
  2288. @example
  2289. crop=100:100:12:34
  2290. @end example
  2291. Using named options, the example above becomes:
  2292. @example
  2293. crop=w=100:h=100:x=12:y=34
  2294. @end example
  2295. @item
  2296. Crop the central input area with size 100x100:
  2297. @example
  2298. crop=100:100
  2299. @end example
  2300. @item
  2301. Crop the central input area with size 2/3 of the input video:
  2302. @example
  2303. crop=2/3*in_w:2/3*in_h
  2304. @end example
  2305. @item
  2306. Crop the input video central square:
  2307. @example
  2308. crop=out_w=in_h
  2309. crop=in_h
  2310. @end example
  2311. @item
  2312. Delimit the rectangle with the top-left corner placed at position
  2313. 100:100 and the right-bottom corner corresponding to the right-bottom
  2314. corner of the input image.
  2315. @example
  2316. crop=in_w-100:in_h-100:100:100
  2317. @end example
  2318. @item
  2319. Crop 10 pixels from the left and right borders, and 20 pixels from
  2320. the top and bottom borders
  2321. @example
  2322. crop=in_w-2*10:in_h-2*20
  2323. @end example
  2324. @item
  2325. Keep only the bottom right quarter of the input image:
  2326. @example
  2327. crop=in_w/2:in_h/2:in_w/2:in_h/2
  2328. @end example
  2329. @item
  2330. Crop height for getting Greek harmony:
  2331. @example
  2332. crop=in_w:1/PHI*in_w
  2333. @end example
  2334. @item
  2335. Appply trembling effect:
  2336. @example
  2337. 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)
  2338. @end example
  2339. @item
  2340. Apply erratic camera effect depending on timestamp:
  2341. @example
  2342. 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)"
  2343. @end example
  2344. @item
  2345. Set x depending on the value of y:
  2346. @example
  2347. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  2348. @end example
  2349. @end itemize
  2350. @section cropdetect
  2351. Auto-detect the crop size.
  2352. It calculates the necessary cropping parameters and prints the
  2353. recommended parameters via the logging system. The detected dimensions
  2354. correspond to the non-black area of the input video.
  2355. It accepts the following parameters:
  2356. @table @option
  2357. @item limit
  2358. Set higher black value threshold, which can be optionally specified
  2359. from nothing (0) to everything (255). An intensity value greater
  2360. to the set value is considered non-black. It defaults to 24.
  2361. @item round
  2362. The value which the width/height should be divisible by. It defaults to
  2363. 16. The offset is automatically adjusted to center the video. Use 2 to
  2364. get only even dimensions (needed for 4:2:2 video). 16 is best when
  2365. encoding to most video codecs.
  2366. @item reset_count, reset
  2367. Set the counter that determines after how many frames cropdetect will
  2368. reset the previously detected largest video area and start over to
  2369. detect the current optimal crop area. Default value is 0.
  2370. This can be useful when channel logos distort the video area. 0
  2371. indicates 'never reset', and returns the largest area encountered during
  2372. playback.
  2373. @end table
  2374. @anchor{curves}
  2375. @section curves
  2376. Apply color adjustments using curves.
  2377. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  2378. component (red, green and blue) has its values defined by @var{N} key points
  2379. tied from each other using a smooth curve. The x-axis represents the pixel
  2380. values from the input frame, and the y-axis the new pixel values to be set for
  2381. the output frame.
  2382. By default, a component curve is defined by the two points @var{(0;0)} and
  2383. @var{(1;1)}. This creates a straight line where each original pixel value is
  2384. "adjusted" to its own value, which means no change to the image.
  2385. The filter allows you to redefine these two points and add some more. A new
  2386. curve (using a natural cubic spline interpolation) will be define to pass
  2387. smoothly through all these new coordinates. The new defined points needs to be
  2388. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  2389. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  2390. the vector spaces, the values will be clipped accordingly.
  2391. If there is no key point defined in @code{x=0}, the filter will automatically
  2392. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  2393. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  2394. The filter accepts the following options:
  2395. @table @option
  2396. @item preset
  2397. Select one of the available color presets. This option can be used in addition
  2398. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  2399. options takes priority on the preset values.
  2400. Available presets are:
  2401. @table @samp
  2402. @item none
  2403. @item color_negative
  2404. @item cross_process
  2405. @item darker
  2406. @item increase_contrast
  2407. @item lighter
  2408. @item linear_contrast
  2409. @item medium_contrast
  2410. @item negative
  2411. @item strong_contrast
  2412. @item vintage
  2413. @end table
  2414. Default is @code{none}.
  2415. @item master, m
  2416. Set the master key points. These points will define a second pass mapping. It
  2417. is sometimes called a "luminance" or "value" mapping. It can be used with
  2418. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  2419. post-processing LUT.
  2420. @item red, r
  2421. Set the key points for the red component.
  2422. @item green, g
  2423. Set the key points for the green component.
  2424. @item blue, b
  2425. Set the key points for the blue component.
  2426. @item all
  2427. Set the key points for all components (not including master).
  2428. Can be used in addition to the other key points component
  2429. options. In this case, the unset component(s) will fallback on this
  2430. @option{all} setting.
  2431. @item psfile
  2432. Specify a Photoshop curves file (@code{.asv}) to import the settings from.
  2433. @end table
  2434. To avoid some filtergraph syntax conflicts, each key points list need to be
  2435. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  2436. @subsection Examples
  2437. @itemize
  2438. @item
  2439. Increase slightly the middle level of blue:
  2440. @example
  2441. curves=blue='0.5/0.58'
  2442. @end example
  2443. @item
  2444. Vintage effect:
  2445. @example
  2446. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  2447. @end example
  2448. Here we obtain the following coordinates for each components:
  2449. @table @var
  2450. @item red
  2451. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  2452. @item green
  2453. @code{(0;0) (0.50;0.48) (1;1)}
  2454. @item blue
  2455. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  2456. @end table
  2457. @item
  2458. The previous example can also be achieved with the associated built-in preset:
  2459. @example
  2460. curves=preset=vintage
  2461. @end example
  2462. @item
  2463. Or simply:
  2464. @example
  2465. curves=vintage
  2466. @end example
  2467. @item
  2468. Use a Photoshop preset and redefine the points of the green component:
  2469. @example
  2470. curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
  2471. @end example
  2472. @end itemize
  2473. @section dctdnoiz
  2474. Denoise frames using 2D DCT (frequency domain filtering).
  2475. This filter is not designed for real time and can be extremely slow.
  2476. The filter accepts the following options:
  2477. @table @option
  2478. @item sigma, s
  2479. Set the noise sigma constant.
  2480. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  2481. coefficient (absolute value) below this threshold with be dropped.
  2482. If you need a more advanced filtering, see @option{expr}.
  2483. Default is @code{0}.
  2484. @item overlap
  2485. Set number overlapping pixels for each block. Each block is of size
  2486. @code{16x16}. Since the filter can be slow, you may want to reduce this value,
  2487. at the cost of a less effective filter and the risk of various artefacts.
  2488. If the overlapping value doesn't allow to process the whole input width or
  2489. height, a warning will be displayed and according borders won't be denoised.
  2490. Default value is @code{15}.
  2491. @item expr, e
  2492. Set the coefficient factor expression.
  2493. For each coefficient of a DCT block, this expression will be evaluated as a
  2494. multiplier value for the coefficient.
  2495. If this is option is set, the @option{sigma} option will be ignored.
  2496. The absolute value of the coefficient can be accessed through the @var{c}
  2497. variable.
  2498. @end table
  2499. @subsection Examples
  2500. Apply a denoise with a @option{sigma} of @code{4.5}:
  2501. @example
  2502. dctdnoiz=4.5
  2503. @end example
  2504. The same operation can be achieved using the expression system:
  2505. @example
  2506. dctdnoiz=e='gte(c, 4.5*3)'
  2507. @end example
  2508. @anchor{decimate}
  2509. @section decimate
  2510. Drop duplicated frames at regular intervals.
  2511. The filter accepts the following options:
  2512. @table @option
  2513. @item cycle
  2514. Set the number of frames from which one will be dropped. Setting this to
  2515. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  2516. Default is @code{5}.
  2517. @item dupthresh
  2518. Set the threshold for duplicate detection. If the difference metric for a frame
  2519. is less than or equal to this value, then it is declared as duplicate. Default
  2520. is @code{1.1}
  2521. @item scthresh
  2522. Set scene change threshold. Default is @code{15}.
  2523. @item blockx
  2524. @item blocky
  2525. Set the size of the x and y-axis blocks used during metric calculations.
  2526. Larger blocks give better noise suppression, but also give worse detection of
  2527. small movements. Must be a power of two. Default is @code{32}.
  2528. @item ppsrc
  2529. Mark main input as a pre-processed input and activate clean source input
  2530. stream. This allows the input to be pre-processed with various filters to help
  2531. the metrics calculation while keeping the frame selection lossless. When set to
  2532. @code{1}, the first stream is for the pre-processed input, and the second
  2533. stream is the clean source from where the kept frames are chosen. Default is
  2534. @code{0}.
  2535. @item chroma
  2536. Set whether or not chroma is considered in the metric calculations. Default is
  2537. @code{1}.
  2538. @end table
  2539. @section dejudder
  2540. Remove judder produced by partially interlaced telecined content.
  2541. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  2542. source was partially telecined content then the output of @code{pullup,dejudder}
  2543. will have a variable frame rate. May change the recorded frame rate of the
  2544. container. Aside from that change, this filter will not affect constant frame
  2545. rate video.
  2546. The option available in this filter is:
  2547. @table @option
  2548. @item cycle
  2549. Specify the length of the window over which the judder repeats.
  2550. Accepts any integer greater than 1. Useful values are:
  2551. @table @samp
  2552. @item 4
  2553. If the original was telecined from 24 to 30 fps (Film to NTSC).
  2554. @item 5
  2555. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  2556. @item 20
  2557. If a mixture of the two.
  2558. @end table
  2559. The default is @samp{4}.
  2560. @end table
  2561. @section delogo
  2562. Suppress a TV station logo by a simple interpolation of the surrounding
  2563. pixels. Just set a rectangle covering the logo and watch it disappear
  2564. (and sometimes something even uglier appear - your mileage may vary).
  2565. It accepts the following parameters:
  2566. @table @option
  2567. @item x
  2568. @item y
  2569. Specify the top left corner coordinates of the logo. They must be
  2570. specified.
  2571. @item w
  2572. @item h
  2573. Specify the width and height of the logo to clear. They must be
  2574. specified.
  2575. @item band, t
  2576. Specify the thickness of the fuzzy edge of the rectangle (added to
  2577. @var{w} and @var{h}). The default value is 4.
  2578. @item show
  2579. When set to 1, a green rectangle is drawn on the screen to simplify
  2580. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  2581. The default value is 0.
  2582. The rectangle is drawn on the outermost pixels which will be (partly)
  2583. replaced with interpolated values. The values of the next pixels
  2584. immediately outside this rectangle in each direction will be used to
  2585. compute the interpolated pixel values inside the rectangle.
  2586. @end table
  2587. @subsection Examples
  2588. @itemize
  2589. @item
  2590. Set a rectangle covering the area with top left corner coordinates 0,0
  2591. and size 100x77, and a band of size 10:
  2592. @example
  2593. delogo=x=0:y=0:w=100:h=77:band=10
  2594. @end example
  2595. @end itemize
  2596. @section deshake
  2597. Attempt to fix small changes in horizontal and/or vertical shift. This
  2598. filter helps remove camera shake from hand-holding a camera, bumping a
  2599. tripod, moving on a vehicle, etc.
  2600. The filter accepts the following options:
  2601. @table @option
  2602. @item x
  2603. @item y
  2604. @item w
  2605. @item h
  2606. Specify a rectangular area where to limit the search for motion
  2607. vectors.
  2608. If desired the search for motion vectors can be limited to a
  2609. rectangular area of the frame defined by its top left corner, width
  2610. and height. These parameters have the same meaning as the drawbox
  2611. filter which can be used to visualise the position of the bounding
  2612. box.
  2613. This is useful when simultaneous movement of subjects within the frame
  2614. might be confused for camera motion by the motion vector search.
  2615. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  2616. then the full frame is used. This allows later options to be set
  2617. without specifying the bounding box for the motion vector search.
  2618. Default - search the whole frame.
  2619. @item rx
  2620. @item ry
  2621. Specify the maximum extent of movement in x and y directions in the
  2622. range 0-64 pixels. Default 16.
  2623. @item edge
  2624. Specify how to generate pixels to fill blanks at the edge of the
  2625. frame. Available values are:
  2626. @table @samp
  2627. @item blank, 0
  2628. Fill zeroes at blank locations
  2629. @item original, 1
  2630. Original image at blank locations
  2631. @item clamp, 2
  2632. Extruded edge value at blank locations
  2633. @item mirror, 3
  2634. Mirrored edge at blank locations
  2635. @end table
  2636. Default value is @samp{mirror}.
  2637. @item blocksize
  2638. Specify the blocksize to use for motion search. Range 4-128 pixels,
  2639. default 8.
  2640. @item contrast
  2641. Specify the contrast threshold for blocks. Only blocks with more than
  2642. the specified contrast (difference between darkest and lightest
  2643. pixels) will be considered. Range 1-255, default 125.
  2644. @item search
  2645. Specify the search strategy. Available values are:
  2646. @table @samp
  2647. @item exhaustive, 0
  2648. Set exhaustive search
  2649. @item less, 1
  2650. Set less exhaustive search.
  2651. @end table
  2652. Default value is @samp{exhaustive}.
  2653. @item filename
  2654. If set then a detailed log of the motion search is written to the
  2655. specified file.
  2656. @item opencl
  2657. If set to 1, specify using OpenCL capabilities, only available if
  2658. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  2659. @end table
  2660. @section drawbox
  2661. Draw a colored box on the input image.
  2662. It accepts the following parameters:
  2663. @table @option
  2664. @item x
  2665. @item y
  2666. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  2667. @item width, w
  2668. @item height, h
  2669. The expressions which specify the width and height of the box; if 0 they are interpreted as
  2670. the input width and height. It defaults to 0.
  2671. @item color, c
  2672. Specify the color of the box to write. For the general syntax of this option,
  2673. check the "Color" section in the ffmpeg-utils manual. If the special
  2674. value @code{invert} is used, the box edge color is the same as the
  2675. video with inverted luma.
  2676. @item thickness, t
  2677. The expression which sets the thickness of the box edge. Default value is @code{3}.
  2678. See below for the list of accepted constants.
  2679. @end table
  2680. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2681. following constants:
  2682. @table @option
  2683. @item dar
  2684. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2685. @item hsub
  2686. @item vsub
  2687. horizontal and vertical chroma subsample values. For example for the
  2688. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2689. @item in_h, ih
  2690. @item in_w, iw
  2691. The input width and height.
  2692. @item sar
  2693. The input sample aspect ratio.
  2694. @item x
  2695. @item y
  2696. The x and y offset coordinates where the box is drawn.
  2697. @item w
  2698. @item h
  2699. The width and height of the drawn box.
  2700. @item t
  2701. The thickness of the drawn box.
  2702. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2703. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2704. @end table
  2705. @subsection Examples
  2706. @itemize
  2707. @item
  2708. Draw a black box around the edge of the input image:
  2709. @example
  2710. drawbox
  2711. @end example
  2712. @item
  2713. Draw a box with color red and an opacity of 50%:
  2714. @example
  2715. drawbox=10:20:200:60:red@@0.5
  2716. @end example
  2717. The previous example can be specified as:
  2718. @example
  2719. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2720. @end example
  2721. @item
  2722. Fill the box with pink color:
  2723. @example
  2724. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2725. @end example
  2726. @item
  2727. Draw a 2-pixel red 2.40:1 mask:
  2728. @example
  2729. 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
  2730. @end example
  2731. @end itemize
  2732. @section drawgrid
  2733. Draw a grid on the input image.
  2734. It accepts the following parameters:
  2735. @table @option
  2736. @item x
  2737. @item y
  2738. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  2739. @item width, w
  2740. @item height, h
  2741. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  2742. input width and height, respectively, minus @code{thickness}, so image gets
  2743. framed. Default to 0.
  2744. @item color, c
  2745. Specify the color of the grid. For the general syntax of this option,
  2746. check the "Color" section in the ffmpeg-utils manual. If the special
  2747. value @code{invert} is used, the grid color is the same as the
  2748. video with inverted luma.
  2749. @item thickness, t
  2750. The expression which sets the thickness of the grid line. Default value is @code{1}.
  2751. See below for the list of accepted constants.
  2752. @end table
  2753. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2754. following constants:
  2755. @table @option
  2756. @item dar
  2757. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2758. @item hsub
  2759. @item vsub
  2760. horizontal and vertical chroma subsample values. For example for the
  2761. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2762. @item in_h, ih
  2763. @item in_w, iw
  2764. The input grid cell width and height.
  2765. @item sar
  2766. The input sample aspect ratio.
  2767. @item x
  2768. @item y
  2769. The x and y coordinates of some point of grid intersection (meant to configure offset).
  2770. @item w
  2771. @item h
  2772. The width and height of the drawn cell.
  2773. @item t
  2774. The thickness of the drawn cell.
  2775. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2776. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2777. @end table
  2778. @subsection Examples
  2779. @itemize
  2780. @item
  2781. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  2782. @example
  2783. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  2784. @end example
  2785. @item
  2786. Draw a white 3x3 grid with an opacity of 50%:
  2787. @example
  2788. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  2789. @end example
  2790. @end itemize
  2791. @anchor{drawtext}
  2792. @section drawtext
  2793. Draw a text string or text from a specified file on top of a video, using the
  2794. libfreetype library.
  2795. To enable compilation of this filter, you need to configure FFmpeg with
  2796. @code{--enable-libfreetype}.
  2797. To enable default font fallback and the @var{font} option you need to
  2798. configure FFmpeg with @code{--enable-libfontconfig}.
  2799. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  2800. @code{--enable-libfribidi}.
  2801. @subsection Syntax
  2802. It accepts the following parameters:
  2803. @table @option
  2804. @item box
  2805. Used to draw a box around text using the background color.
  2806. The value must be either 1 (enable) or 0 (disable).
  2807. The default value of @var{box} is 0.
  2808. @item boxcolor
  2809. The color to be used for drawing box around text. For the syntax of this
  2810. option, check the "Color" section in the ffmpeg-utils manual.
  2811. The default value of @var{boxcolor} is "white".
  2812. @item borderw
  2813. Set the width of the border to be drawn around the text using @var{bordercolor}.
  2814. The default value of @var{borderw} is 0.
  2815. @item bordercolor
  2816. Set the color to be used for drawing border around text. For the syntax of this
  2817. option, check the "Color" section in the ffmpeg-utils manual.
  2818. The default value of @var{bordercolor} is "black".
  2819. @item expansion
  2820. Select how the @var{text} is expanded. Can be either @code{none},
  2821. @code{strftime} (deprecated) or
  2822. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2823. below for details.
  2824. @item fix_bounds
  2825. If true, check and fix text coords to avoid clipping.
  2826. @item fontcolor
  2827. The color to be used for drawing fonts. For the syntax of this option, check
  2828. the "Color" section in the ffmpeg-utils manual.
  2829. The default value of @var{fontcolor} is "black".
  2830. @item fontcolor_expr
  2831. String which is expanded the same way as @var{text} to obtain dynamic
  2832. @var{fontcolor} value. By default this option has empty value and is not
  2833. processed. When this option is set, it overrides @var{fontcolor} option.
  2834. @item font
  2835. The font family to be used for drawing text. By default Sans.
  2836. @item fontfile
  2837. The font file to be used for drawing text. The path must be included.
  2838. This parameter is mandatory if the fontconfig support is disabled.
  2839. @item fontsize
  2840. The font size to be used for drawing text.
  2841. The default value of @var{fontsize} is 16.
  2842. @item text_shaping
  2843. If set to 1, attempt to shape the text (for example, reverse the order of
  2844. right-to-left text and join Arabic characters) before drawing it.
  2845. Otherwise, just draw the text exactly as given.
  2846. By default 1 (if supported).
  2847. @item ft_load_flags
  2848. The flags to be used for loading the fonts.
  2849. The flags map the corresponding flags supported by libfreetype, and are
  2850. a combination of the following values:
  2851. @table @var
  2852. @item default
  2853. @item no_scale
  2854. @item no_hinting
  2855. @item render
  2856. @item no_bitmap
  2857. @item vertical_layout
  2858. @item force_autohint
  2859. @item crop_bitmap
  2860. @item pedantic
  2861. @item ignore_global_advance_width
  2862. @item no_recurse
  2863. @item ignore_transform
  2864. @item monochrome
  2865. @item linear_design
  2866. @item no_autohint
  2867. @end table
  2868. Default value is "default".
  2869. For more information consult the documentation for the FT_LOAD_*
  2870. libfreetype flags.
  2871. @item shadowcolor
  2872. The color to be used for drawing a shadow behind the drawn text. For the
  2873. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  2874. The default value of @var{shadowcolor} is "black".
  2875. @item shadowx
  2876. @item shadowy
  2877. The x and y offsets for the text shadow position with respect to the
  2878. position of the text. They can be either positive or negative
  2879. values. The default value for both is "0".
  2880. @item start_number
  2881. The starting frame number for the n/frame_num variable. The default value
  2882. is "0".
  2883. @item tabsize
  2884. The size in number of spaces to use for rendering the tab.
  2885. Default value is 4.
  2886. @item timecode
  2887. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  2888. format. It can be used with or without text parameter. @var{timecode_rate}
  2889. option must be specified.
  2890. @item timecode_rate, rate, r
  2891. Set the timecode frame rate (timecode only).
  2892. @item text
  2893. The text string to be drawn. The text must be a sequence of UTF-8
  2894. encoded characters.
  2895. This parameter is mandatory if no file is specified with the parameter
  2896. @var{textfile}.
  2897. @item textfile
  2898. A text file containing text to be drawn. The text must be a sequence
  2899. of UTF-8 encoded characters.
  2900. This parameter is mandatory if no text string is specified with the
  2901. parameter @var{text}.
  2902. If both @var{text} and @var{textfile} are specified, an error is thrown.
  2903. @item reload
  2904. If set to 1, the @var{textfile} will be reloaded before each frame.
  2905. Be sure to update it atomically, or it may be read partially, or even fail.
  2906. @item x
  2907. @item y
  2908. The expressions which specify the offsets where text will be drawn
  2909. within the video frame. They are relative to the top/left border of the
  2910. output image.
  2911. The default value of @var{x} and @var{y} is "0".
  2912. See below for the list of accepted constants and functions.
  2913. @end table
  2914. The parameters for @var{x} and @var{y} are expressions containing the
  2915. following constants and functions:
  2916. @table @option
  2917. @item dar
  2918. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  2919. @item hsub
  2920. @item vsub
  2921. horizontal and vertical chroma subsample values. For example for the
  2922. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2923. @item line_h, lh
  2924. the height of each text line
  2925. @item main_h, h, H
  2926. the input height
  2927. @item main_w, w, W
  2928. the input width
  2929. @item max_glyph_a, ascent
  2930. the maximum distance from the baseline to the highest/upper grid
  2931. coordinate used to place a glyph outline point, for all the rendered
  2932. glyphs.
  2933. It is a positive value, due to the grid's orientation with the Y axis
  2934. upwards.
  2935. @item max_glyph_d, descent
  2936. the maximum distance from the baseline to the lowest grid coordinate
  2937. used to place a glyph outline point, for all the rendered glyphs.
  2938. This is a negative value, due to the grid's orientation, with the Y axis
  2939. upwards.
  2940. @item max_glyph_h
  2941. maximum glyph height, that is the maximum height for all the glyphs
  2942. contained in the rendered text, it is equivalent to @var{ascent} -
  2943. @var{descent}.
  2944. @item max_glyph_w
  2945. maximum glyph width, that is the maximum width for all the glyphs
  2946. contained in the rendered text
  2947. @item n
  2948. the number of input frame, starting from 0
  2949. @item rand(min, max)
  2950. return a random number included between @var{min} and @var{max}
  2951. @item sar
  2952. The input sample aspect ratio.
  2953. @item t
  2954. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2955. @item text_h, th
  2956. the height of the rendered text
  2957. @item text_w, tw
  2958. the width of the rendered text
  2959. @item x
  2960. @item y
  2961. the x and y offset coordinates where the text is drawn.
  2962. These parameters allow the @var{x} and @var{y} expressions to refer
  2963. each other, so you can for example specify @code{y=x/dar}.
  2964. @end table
  2965. @anchor{drawtext_expansion}
  2966. @subsection Text expansion
  2967. If @option{expansion} is set to @code{strftime},
  2968. the filter recognizes strftime() sequences in the provided text and
  2969. expands them accordingly. Check the documentation of strftime(). This
  2970. feature is deprecated.
  2971. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  2972. If @option{expansion} is set to @code{normal} (which is the default),
  2973. the following expansion mechanism is used.
  2974. The backslash character '\', followed by any character, always expands to
  2975. the second character.
  2976. Sequence of the form @code{%@{...@}} are expanded. The text between the
  2977. braces is a function name, possibly followed by arguments separated by ':'.
  2978. If the arguments contain special characters or delimiters (':' or '@}'),
  2979. they should be escaped.
  2980. Note that they probably must also be escaped as the value for the
  2981. @option{text} option in the filter argument string and as the filter
  2982. argument in the filtergraph description, and possibly also for the shell,
  2983. that makes up to four levels of escaping; using a text file avoids these
  2984. problems.
  2985. The following functions are available:
  2986. @table @command
  2987. @item expr, e
  2988. The expression evaluation result.
  2989. It must take one argument specifying the expression to be evaluated,
  2990. which accepts the same constants and functions as the @var{x} and
  2991. @var{y} values. Note that not all constants should be used, for
  2992. example the text size is not known when evaluating the expression, so
  2993. the constants @var{text_w} and @var{text_h} will have an undefined
  2994. value.
  2995. @item expr_int_format, eif
  2996. Evaluate the expression's value and output as formatted integer.
  2997. First argument is expression to be evaluated, same as for @var{expr} function.
  2998. Second argument specifies output format. Allowed values are 'x', 'X', 'd' and
  2999. 'u', they are treated exactly as in printf function.
  3000. Third parameter is optional and sets the number of positions taken by output.
  3001. Effectively this allows to add padding with zeros from the left.
  3002. @item gmtime
  3003. The time at which the filter is running, expressed in UTC.
  3004. It can accept an argument: a strftime() format string.
  3005. @item localtime
  3006. The time at which the filter is running, expressed in the local time zone.
  3007. It can accept an argument: a strftime() format string.
  3008. @item metadata
  3009. Frame metadata. It must take one argument specifying metadata key.
  3010. @item n, frame_num
  3011. The frame number, starting from 0.
  3012. @item pict_type
  3013. A 1 character description of the current picture type.
  3014. @item pts
  3015. The timestamp of the current frame.
  3016. It can take up to two arguments.
  3017. The first argument is the format of the timestamp; it defaults to @code{flt}
  3018. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  3019. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  3020. The second argument is an offset added to the timestamp.
  3021. @end table
  3022. @subsection Examples
  3023. @itemize
  3024. @item
  3025. Draw "Test Text" with font FreeSerif, using the default values for the
  3026. optional parameters.
  3027. @example
  3028. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  3029. @end example
  3030. @item
  3031. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  3032. and y=50 (counting from the top-left corner of the screen), text is
  3033. yellow with a red box around it. Both the text and the box have an
  3034. opacity of 20%.
  3035. @example
  3036. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  3037. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  3038. @end example
  3039. Note that the double quotes are not necessary if spaces are not used
  3040. within the parameter list.
  3041. @item
  3042. Show the text at the center of the video frame:
  3043. @example
  3044. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  3045. @end example
  3046. @item
  3047. Show a text line sliding from right to left in the last row of the video
  3048. frame. The file @file{LONG_LINE} is assumed to contain a single line
  3049. with no newlines.
  3050. @example
  3051. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  3052. @end example
  3053. @item
  3054. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  3055. @example
  3056. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  3057. @end example
  3058. @item
  3059. Draw a single green letter "g", at the center of the input video.
  3060. The glyph baseline is placed at half screen height.
  3061. @example
  3062. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  3063. @end example
  3064. @item
  3065. Show text for 1 second every 3 seconds:
  3066. @example
  3067. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  3068. @end example
  3069. @item
  3070. Use fontconfig to set the font. Note that the colons need to be escaped.
  3071. @example
  3072. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  3073. @end example
  3074. @item
  3075. Print the date of a real-time encoding (see strftime(3)):
  3076. @example
  3077. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  3078. @end example
  3079. @item
  3080. Shwo text fading in and out (appearing/disappearing):
  3081. @example
  3082. #!/bin/sh
  3083. DS=1.0 # display start
  3084. DE=10.0 # display end
  3085. FID=1.5 # fade in duration
  3086. FOD=5 # fade out duration
  3087. 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 @}"
  3088. @end example
  3089. @end itemize
  3090. For more information about libfreetype, check:
  3091. @url{http://www.freetype.org/}.
  3092. For more information about fontconfig, check:
  3093. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  3094. For more information about libfribidi, check:
  3095. @url{http://fribidi.org/}.
  3096. @section edgedetect
  3097. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  3098. The filter accepts the following options:
  3099. @table @option
  3100. @item low
  3101. @item high
  3102. Set low and high threshold values used by the Canny thresholding
  3103. algorithm.
  3104. The high threshold selects the "strong" edge pixels, which are then
  3105. connected through 8-connectivity with the "weak" edge pixels selected
  3106. by the low threshold.
  3107. @var{low} and @var{high} threshold values must be chosen in the range
  3108. [0,1], and @var{low} should be lesser or equal to @var{high}.
  3109. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  3110. is @code{50/255}.
  3111. @item mode
  3112. Define the drawing mode.
  3113. @table @samp
  3114. @item wires
  3115. Draw white/gray wires on black background.
  3116. @item colormix
  3117. Mix the colors to create a paint/cartoon effect.
  3118. @end table
  3119. Default value is @var{wires}.
  3120. @end table
  3121. @subsection Examples
  3122. @itemize
  3123. @item
  3124. Standard edge detection with custom values for the hysteresis thresholding:
  3125. @example
  3126. edgedetect=low=0.1:high=0.4
  3127. @end example
  3128. @item
  3129. Painting effect without thresholding:
  3130. @example
  3131. edgedetect=mode=colormix:high=0
  3132. @end example
  3133. @end itemize
  3134. @section extractplanes
  3135. Extract color channel components from input video stream into
  3136. separate grayscale video streams.
  3137. The filter accepts the following option:
  3138. @table @option
  3139. @item planes
  3140. Set plane(s) to extract.
  3141. Available values for planes are:
  3142. @table @samp
  3143. @item y
  3144. @item u
  3145. @item v
  3146. @item a
  3147. @item r
  3148. @item g
  3149. @item b
  3150. @end table
  3151. Choosing planes not available in the input will result in an error.
  3152. That means you cannot select @code{r}, @code{g}, @code{b} planes
  3153. with @code{y}, @code{u}, @code{v} planes at same time.
  3154. @end table
  3155. @subsection Examples
  3156. @itemize
  3157. @item
  3158. Extract luma, u and v color channel component from input video frame
  3159. into 3 grayscale outputs:
  3160. @example
  3161. 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
  3162. @end example
  3163. @end itemize
  3164. @section elbg
  3165. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  3166. For each input image, the filter will compute the optimal mapping from
  3167. the input to the output given the codebook length, that is the number
  3168. of distinct output colors.
  3169. This filter accepts the following options.
  3170. @table @option
  3171. @item codebook_length, l
  3172. Set codebook length. The value must be a positive integer, and
  3173. represents the number of distinct output colors. Default value is 256.
  3174. @item nb_steps, n
  3175. Set the maximum number of iterations to apply for computing the optimal
  3176. mapping. The higher the value the better the result and the higher the
  3177. computation time. Default value is 1.
  3178. @item seed, s
  3179. Set a random seed, must be an integer included between 0 and
  3180. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  3181. will try to use a good random seed on a best effort basis.
  3182. @end table
  3183. @section fade
  3184. Apply a fade-in/out effect to the input video.
  3185. It accepts the following parameters:
  3186. @table @option
  3187. @item type, t
  3188. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  3189. effect.
  3190. Default is @code{in}.
  3191. @item start_frame, s
  3192. Specify the number of the frame to start applying the fade
  3193. effect at. Default is 0.
  3194. @item nb_frames, n
  3195. The number of frames that the fade effect lasts. At the end of the
  3196. fade-in effect, the output video will have the same intensity as the input video.
  3197. At the end of the fade-out transition, the output video will be filled with the
  3198. selected @option{color}.
  3199. Default is 25.
  3200. @item alpha
  3201. If set to 1, fade only alpha channel, if one exists on the input.
  3202. Default value is 0.
  3203. @item start_time, st
  3204. Specify the timestamp (in seconds) of the frame to start to apply the fade
  3205. effect. If both start_frame and start_time are specified, the fade will start at
  3206. whichever comes last. Default is 0.
  3207. @item duration, d
  3208. The number of seconds for which the fade effect has to last. At the end of the
  3209. fade-in effect the output video will have the same intensity as the input video,
  3210. at the end of the fade-out transition the output video will be filled with the
  3211. selected @option{color}.
  3212. If both duration and nb_frames are specified, duration is used. Default is 0.
  3213. @item color, c
  3214. Specify the color of the fade. Default is "black".
  3215. @end table
  3216. @subsection Examples
  3217. @itemize
  3218. @item
  3219. Fade in the first 30 frames of video:
  3220. @example
  3221. fade=in:0:30
  3222. @end example
  3223. The command above is equivalent to:
  3224. @example
  3225. fade=t=in:s=0:n=30
  3226. @end example
  3227. @item
  3228. Fade out the last 45 frames of a 200-frame video:
  3229. @example
  3230. fade=out:155:45
  3231. fade=type=out:start_frame=155:nb_frames=45
  3232. @end example
  3233. @item
  3234. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  3235. @example
  3236. fade=in:0:25, fade=out:975:25
  3237. @end example
  3238. @item
  3239. Make the first 5 frames yellow, then fade in from frame 5-24:
  3240. @example
  3241. fade=in:5:20:color=yellow
  3242. @end example
  3243. @item
  3244. Fade in alpha over first 25 frames of video:
  3245. @example
  3246. fade=in:0:25:alpha=1
  3247. @end example
  3248. @item
  3249. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  3250. @example
  3251. fade=t=in:st=5.5:d=0.5
  3252. @end example
  3253. @end itemize
  3254. @section field
  3255. Extract a single field from an interlaced image using stride
  3256. arithmetic to avoid wasting CPU time. The output frames are marked as
  3257. non-interlaced.
  3258. The filter accepts the following options:
  3259. @table @option
  3260. @item type
  3261. Specify whether to extract the top (if the value is @code{0} or
  3262. @code{top}) or the bottom field (if the value is @code{1} or
  3263. @code{bottom}).
  3264. @end table
  3265. @section fieldmatch
  3266. Field matching filter for inverse telecine. It is meant to reconstruct the
  3267. progressive frames from a telecined stream. The filter does not drop duplicated
  3268. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  3269. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  3270. The separation of the field matching and the decimation is notably motivated by
  3271. the possibility of inserting a de-interlacing filter fallback between the two.
  3272. If the source has mixed telecined and real interlaced content,
  3273. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  3274. But these remaining combed frames will be marked as interlaced, and thus can be
  3275. de-interlaced by a later filter such as @ref{yadif} before decimation.
  3276. In addition to the various configuration options, @code{fieldmatch} can take an
  3277. optional second stream, activated through the @option{ppsrc} option. If
  3278. enabled, the frames reconstruction will be based on the fields and frames from
  3279. this second stream. This allows the first input to be pre-processed in order to
  3280. help the various algorithms of the filter, while keeping the output lossless
  3281. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  3282. or brightness/contrast adjustments can help.
  3283. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  3284. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  3285. which @code{fieldmatch} is based on. While the semantic and usage are very
  3286. close, some behaviour and options names can differ.
  3287. The filter accepts the following options:
  3288. @table @option
  3289. @item order
  3290. Specify the assumed field order of the input stream. Available values are:
  3291. @table @samp
  3292. @item auto
  3293. Auto detect parity (use FFmpeg's internal parity value).
  3294. @item bff
  3295. Assume bottom field first.
  3296. @item tff
  3297. Assume top field first.
  3298. @end table
  3299. Note that it is sometimes recommended not to trust the parity announced by the
  3300. stream.
  3301. Default value is @var{auto}.
  3302. @item mode
  3303. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  3304. sense that it won't risk creating jerkiness due to duplicate frames when
  3305. possible, but if there are bad edits or blended fields it will end up
  3306. outputting combed frames when a good match might actually exist. On the other
  3307. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  3308. but will almost always find a good frame if there is one. The other values are
  3309. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  3310. jerkiness and creating duplicate frames versus finding good matches in sections
  3311. with bad edits, orphaned fields, blended fields, etc.
  3312. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  3313. Available values are:
  3314. @table @samp
  3315. @item pc
  3316. 2-way matching (p/c)
  3317. @item pc_n
  3318. 2-way matching, and trying 3rd match if still combed (p/c + n)
  3319. @item pc_u
  3320. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  3321. @item pc_n_ub
  3322. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  3323. still combed (p/c + n + u/b)
  3324. @item pcn
  3325. 3-way matching (p/c/n)
  3326. @item pcn_ub
  3327. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  3328. detected as combed (p/c/n + u/b)
  3329. @end table
  3330. The parenthesis at the end indicate the matches that would be used for that
  3331. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  3332. @var{top}).
  3333. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  3334. the slowest.
  3335. Default value is @var{pc_n}.
  3336. @item ppsrc
  3337. Mark the main input stream as a pre-processed input, and enable the secondary
  3338. input stream as the clean source to pick the fields from. See the filter
  3339. introduction for more details. It is similar to the @option{clip2} feature from
  3340. VFM/TFM.
  3341. Default value is @code{0} (disabled).
  3342. @item field
  3343. Set the field to match from. It is recommended to set this to the same value as
  3344. @option{order} unless you experience matching failures with that setting. In
  3345. certain circumstances changing the field that is used to match from can have a
  3346. large impact on matching performance. Available values are:
  3347. @table @samp
  3348. @item auto
  3349. Automatic (same value as @option{order}).
  3350. @item bottom
  3351. Match from the bottom field.
  3352. @item top
  3353. Match from the top field.
  3354. @end table
  3355. Default value is @var{auto}.
  3356. @item mchroma
  3357. Set whether or not chroma is included during the match comparisons. In most
  3358. cases it is recommended to leave this enabled. You should set this to @code{0}
  3359. only if your clip has bad chroma problems such as heavy rainbowing or other
  3360. artifacts. Setting this to @code{0} could also be used to speed things up at
  3361. the cost of some accuracy.
  3362. Default value is @code{1}.
  3363. @item y0
  3364. @item y1
  3365. These define an exclusion band which excludes the lines between @option{y0} and
  3366. @option{y1} from being included in the field matching decision. An exclusion
  3367. band can be used to ignore subtitles, a logo, or other things that may
  3368. interfere with the matching. @option{y0} sets the starting scan line and
  3369. @option{y1} sets the ending line; all lines in between @option{y0} and
  3370. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  3371. @option{y0} and @option{y1} to the same value will disable the feature.
  3372. @option{y0} and @option{y1} defaults to @code{0}.
  3373. @item scthresh
  3374. Set the scene change detection threshold as a percentage of maximum change on
  3375. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  3376. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  3377. @option{scthresh} is @code{[0.0, 100.0]}.
  3378. Default value is @code{12.0}.
  3379. @item combmatch
  3380. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  3381. account the combed scores of matches when deciding what match to use as the
  3382. final match. Available values are:
  3383. @table @samp
  3384. @item none
  3385. No final matching based on combed scores.
  3386. @item sc
  3387. Combed scores are only used when a scene change is detected.
  3388. @item full
  3389. Use combed scores all the time.
  3390. @end table
  3391. Default is @var{sc}.
  3392. @item combdbg
  3393. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  3394. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  3395. Available values are:
  3396. @table @samp
  3397. @item none
  3398. No forced calculation.
  3399. @item pcn
  3400. Force p/c/n calculations.
  3401. @item pcnub
  3402. Force p/c/n/u/b calculations.
  3403. @end table
  3404. Default value is @var{none}.
  3405. @item cthresh
  3406. This is the area combing threshold used for combed frame detection. This
  3407. essentially controls how "strong" or "visible" combing must be to be detected.
  3408. Larger values mean combing must be more visible and smaller values mean combing
  3409. can be less visible or strong and still be detected. Valid settings are from
  3410. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  3411. be detected as combed). This is basically a pixel difference value. A good
  3412. range is @code{[8, 12]}.
  3413. Default value is @code{9}.
  3414. @item chroma
  3415. Sets whether or not chroma is considered in the combed frame decision. Only
  3416. disable this if your source has chroma problems (rainbowing, etc.) that are
  3417. causing problems for the combed frame detection with chroma enabled. Actually,
  3418. using @option{chroma}=@var{0} is usually more reliable, except for the case
  3419. where there is chroma only combing in the source.
  3420. Default value is @code{0}.
  3421. @item blockx
  3422. @item blocky
  3423. Respectively set the x-axis and y-axis size of the window used during combed
  3424. frame detection. This has to do with the size of the area in which
  3425. @option{combpel} pixels are required to be detected as combed for a frame to be
  3426. declared combed. See the @option{combpel} parameter description for more info.
  3427. Possible values are any number that is a power of 2 starting at 4 and going up
  3428. to 512.
  3429. Default value is @code{16}.
  3430. @item combpel
  3431. The number of combed pixels inside any of the @option{blocky} by
  3432. @option{blockx} size blocks on the frame for the frame to be detected as
  3433. combed. While @option{cthresh} controls how "visible" the combing must be, this
  3434. setting controls "how much" combing there must be in any localized area (a
  3435. window defined by the @option{blockx} and @option{blocky} settings) on the
  3436. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  3437. which point no frames will ever be detected as combed). This setting is known
  3438. as @option{MI} in TFM/VFM vocabulary.
  3439. Default value is @code{80}.
  3440. @end table
  3441. @anchor{p/c/n/u/b meaning}
  3442. @subsection p/c/n/u/b meaning
  3443. @subsubsection p/c/n
  3444. We assume the following telecined stream:
  3445. @example
  3446. Top fields: 1 2 2 3 4
  3447. Bottom fields: 1 2 3 4 4
  3448. @end example
  3449. The numbers correspond to the progressive frame the fields relate to. Here, the
  3450. first two frames are progressive, the 3rd and 4th are combed, and so on.
  3451. When @code{fieldmatch} is configured to run a matching from bottom
  3452. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  3453. @example
  3454. Input stream:
  3455. T 1 2 2 3 4
  3456. B 1 2 3 4 4 <-- matching reference
  3457. Matches: c c n n c
  3458. Output stream:
  3459. T 1 2 3 4 4
  3460. B 1 2 3 4 4
  3461. @end example
  3462. As a result of the field matching, we can see that some frames get duplicated.
  3463. To perform a complete inverse telecine, you need to rely on a decimation filter
  3464. after this operation. See for instance the @ref{decimate} filter.
  3465. The same operation now matching from top fields (@option{field}=@var{top})
  3466. looks like this:
  3467. @example
  3468. Input stream:
  3469. T 1 2 2 3 4 <-- matching reference
  3470. B 1 2 3 4 4
  3471. Matches: c c p p c
  3472. Output stream:
  3473. T 1 2 2 3 4
  3474. B 1 2 2 3 4
  3475. @end example
  3476. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  3477. basically, they refer to the frame and field of the opposite parity:
  3478. @itemize
  3479. @item @var{p} matches the field of the opposite parity in the previous frame
  3480. @item @var{c} matches the field of the opposite parity in the current frame
  3481. @item @var{n} matches the field of the opposite parity in the next frame
  3482. @end itemize
  3483. @subsubsection u/b
  3484. The @var{u} and @var{b} matching are a bit special in the sense that they match
  3485. from the opposite parity flag. In the following examples, we assume that we are
  3486. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  3487. 'x' is placed above and below each matched fields.
  3488. With bottom matching (@option{field}=@var{bottom}):
  3489. @example
  3490. Match: c p n b u
  3491. x x x x x
  3492. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3493. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3494. x x x x x
  3495. Output frames:
  3496. 2 1 2 2 2
  3497. 2 2 2 1 3
  3498. @end example
  3499. With top matching (@option{field}=@var{top}):
  3500. @example
  3501. Match: c p n b u
  3502. x x x x x
  3503. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3504. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3505. x x x x x
  3506. Output frames:
  3507. 2 2 2 1 2
  3508. 2 1 3 2 2
  3509. @end example
  3510. @subsection Examples
  3511. Simple IVTC of a top field first telecined stream:
  3512. @example
  3513. fieldmatch=order=tff:combmatch=none, decimate
  3514. @end example
  3515. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  3516. @example
  3517. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  3518. @end example
  3519. @section fieldorder
  3520. Transform the field order of the input video.
  3521. It accepts the following parameters:
  3522. @table @option
  3523. @item order
  3524. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  3525. for bottom field first.
  3526. @end table
  3527. The default value is @samp{tff}.
  3528. The transformation is done by shifting the picture content up or down
  3529. by one line, and filling the remaining line with appropriate picture content.
  3530. This method is consistent with most broadcast field order converters.
  3531. If the input video is not flagged as being interlaced, or it is already
  3532. flagged as being of the required output field order, then this filter does
  3533. not alter the incoming video.
  3534. It is very useful when converting to or from PAL DV material,
  3535. which is bottom field first.
  3536. For example:
  3537. @example
  3538. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  3539. @end example
  3540. @section fifo
  3541. Buffer input images and send them when they are requested.
  3542. It is mainly useful when auto-inserted by the libavfilter
  3543. framework.
  3544. It does not take parameters.
  3545. @anchor{format}
  3546. @section format
  3547. Convert the input video to one of the specified pixel formats.
  3548. Libavfilter will try to pick one that is suitable as input to
  3549. the next filter.
  3550. It accepts the following parameters:
  3551. @table @option
  3552. @item pix_fmts
  3553. A '|'-separated list of pixel format names, such as
  3554. "pix_fmts=yuv420p|monow|rgb24".
  3555. @end table
  3556. @subsection Examples
  3557. @itemize
  3558. @item
  3559. Convert the input video to the @var{yuv420p} format
  3560. @example
  3561. format=pix_fmts=yuv420p
  3562. @end example
  3563. Convert the input video to any of the formats in the list
  3564. @example
  3565. format=pix_fmts=yuv420p|yuv444p|yuv410p
  3566. @end example
  3567. @end itemize
  3568. @anchor{fps}
  3569. @section fps
  3570. Convert the video to specified constant frame rate by duplicating or dropping
  3571. frames as necessary.
  3572. It accepts the following parameters:
  3573. @table @option
  3574. @item fps
  3575. The desired output frame rate. The default is @code{25}.
  3576. @item round
  3577. Rounding method.
  3578. Possible values are:
  3579. @table @option
  3580. @item zero
  3581. zero round towards 0
  3582. @item inf
  3583. round away from 0
  3584. @item down
  3585. round towards -infinity
  3586. @item up
  3587. round towards +infinity
  3588. @item near
  3589. round to nearest
  3590. @end table
  3591. The default is @code{near}.
  3592. @item start_time
  3593. Assume the first PTS should be the given value, in seconds. This allows for
  3594. padding/trimming at the start of stream. By default, no assumption is made
  3595. about the first frame's expected PTS, so no padding or trimming is done.
  3596. For example, this could be set to 0 to pad the beginning with duplicates of
  3597. the first frame if a video stream starts after the audio stream or to trim any
  3598. frames with a negative PTS.
  3599. @end table
  3600. Alternatively, the options can be specified as a flat string:
  3601. @var{fps}[:@var{round}].
  3602. See also the @ref{setpts} filter.
  3603. @subsection Examples
  3604. @itemize
  3605. @item
  3606. A typical usage in order to set the fps to 25:
  3607. @example
  3608. fps=fps=25
  3609. @end example
  3610. @item
  3611. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  3612. @example
  3613. fps=fps=film:round=near
  3614. @end example
  3615. @end itemize
  3616. @section framepack
  3617. Pack two different video streams into a stereoscopic video, setting proper
  3618. metadata on supported codecs. The two views should have the same size and
  3619. framerate and processing will stop when the shorter video ends. Please note
  3620. that you may conveniently adjust view properties with the @ref{scale} and
  3621. @ref{fps} filters.
  3622. It accepts the following parameters:
  3623. @table @option
  3624. @item format
  3625. The desired packing format. Supported values are:
  3626. @table @option
  3627. @item sbs
  3628. The views are next to each other (default).
  3629. @item tab
  3630. The views are on top of each other.
  3631. @item lines
  3632. The views are packed by line.
  3633. @item columns
  3634. The views are packed by column.
  3635. @item frameseq
  3636. The views are temporally interleaved.
  3637. @end table
  3638. @end table
  3639. Some examples:
  3640. @example
  3641. # Convert left and right views into a frame-sequential video
  3642. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  3643. # Convert views into a side-by-side video with the same output resolution as the input
  3644. 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
  3645. @end example
  3646. @section framestep
  3647. Select one frame every N-th frame.
  3648. This filter accepts the following option:
  3649. @table @option
  3650. @item step
  3651. Select frame after every @code{step} frames.
  3652. Allowed values are positive integers higher than 0. Default value is @code{1}.
  3653. @end table
  3654. @anchor{frei0r}
  3655. @section frei0r
  3656. Apply a frei0r effect to the input video.
  3657. To enable the compilation of this filter, you need to install the frei0r
  3658. header and configure FFmpeg with @code{--enable-frei0r}.
  3659. It accepts the following parameters:
  3660. @table @option
  3661. @item filter_name
  3662. The name of the frei0r effect to load. If the environment variable
  3663. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  3664. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  3665. Otherwise, the standard frei0r paths are searched, in this order:
  3666. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  3667. @file{/usr/lib/frei0r-1/}.
  3668. @item filter_params
  3669. A '|'-separated list of parameters to pass to the frei0r effect.
  3670. @end table
  3671. A frei0r effect parameter can be a boolean (its value is either
  3672. "y" or "n"), a double, a color (specified as
  3673. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  3674. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  3675. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  3676. @var{X} and @var{Y} are floating point numbers) and/or a string.
  3677. The number and types of parameters depend on the loaded effect. If an
  3678. effect parameter is not specified, the default value is set.
  3679. @subsection Examples
  3680. @itemize
  3681. @item
  3682. Apply the distort0r effect, setting the first two double parameters:
  3683. @example
  3684. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  3685. @end example
  3686. @item
  3687. Apply the colordistance effect, taking a color as the first parameter:
  3688. @example
  3689. frei0r=colordistance:0.2/0.3/0.4
  3690. frei0r=colordistance:violet
  3691. frei0r=colordistance:0x112233
  3692. @end example
  3693. @item
  3694. Apply the perspective effect, specifying the top left and top right image
  3695. positions:
  3696. @example
  3697. frei0r=perspective:0.2/0.2|0.8/0.2
  3698. @end example
  3699. @end itemize
  3700. For more information, see
  3701. @url{http://frei0r.dyne.org}
  3702. @section geq
  3703. The filter accepts the following options:
  3704. @table @option
  3705. @item lum_expr, lum
  3706. Set the luminance expression.
  3707. @item cb_expr, cb
  3708. Set the chrominance blue expression.
  3709. @item cr_expr, cr
  3710. Set the chrominance red expression.
  3711. @item alpha_expr, a
  3712. Set the alpha expression.
  3713. @item red_expr, r
  3714. Set the red expression.
  3715. @item green_expr, g
  3716. Set the green expression.
  3717. @item blue_expr, b
  3718. Set the blue expression.
  3719. @end table
  3720. The colorspace is selected according to the specified options. If one
  3721. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  3722. options is specified, the filter will automatically select a YCbCr
  3723. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  3724. @option{blue_expr} options is specified, it will select an RGB
  3725. colorspace.
  3726. If one of the chrominance expression is not defined, it falls back on the other
  3727. one. If no alpha expression is specified it will evaluate to opaque value.
  3728. If none of chrominance expressions are specified, they will evaluate
  3729. to the luminance expression.
  3730. The expressions can use the following variables and functions:
  3731. @table @option
  3732. @item N
  3733. The sequential number of the filtered frame, starting from @code{0}.
  3734. @item X
  3735. @item Y
  3736. The coordinates of the current sample.
  3737. @item W
  3738. @item H
  3739. The width and height of the image.
  3740. @item SW
  3741. @item SH
  3742. Width and height scale depending on the currently filtered plane. It is the
  3743. ratio between the corresponding luma plane number of pixels and the current
  3744. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3745. @code{0.5,0.5} for chroma planes.
  3746. @item T
  3747. Time of the current frame, expressed in seconds.
  3748. @item p(x, y)
  3749. Return the value of the pixel at location (@var{x},@var{y}) of the current
  3750. plane.
  3751. @item lum(x, y)
  3752. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  3753. plane.
  3754. @item cb(x, y)
  3755. Return the value of the pixel at location (@var{x},@var{y}) of the
  3756. blue-difference chroma plane. Return 0 if there is no such plane.
  3757. @item cr(x, y)
  3758. Return the value of the pixel at location (@var{x},@var{y}) of the
  3759. red-difference chroma plane. Return 0 if there is no such plane.
  3760. @item r(x, y)
  3761. @item g(x, y)
  3762. @item b(x, y)
  3763. Return the value of the pixel at location (@var{x},@var{y}) of the
  3764. red/green/blue component. Return 0 if there is no such component.
  3765. @item alpha(x, y)
  3766. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  3767. plane. Return 0 if there is no such plane.
  3768. @end table
  3769. For functions, if @var{x} and @var{y} are outside the area, the value will be
  3770. automatically clipped to the closer edge.
  3771. @subsection Examples
  3772. @itemize
  3773. @item
  3774. Flip the image horizontally:
  3775. @example
  3776. geq=p(W-X\,Y)
  3777. @end example
  3778. @item
  3779. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  3780. wavelength of 100 pixels:
  3781. @example
  3782. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  3783. @end example
  3784. @item
  3785. Generate a fancy enigmatic moving light:
  3786. @example
  3787. 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
  3788. @end example
  3789. @item
  3790. Generate a quick emboss effect:
  3791. @example
  3792. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  3793. @end example
  3794. @item
  3795. Modify RGB components depending on pixel position:
  3796. @example
  3797. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  3798. @end example
  3799. @end itemize
  3800. @section gradfun
  3801. Fix the banding artifacts that are sometimes introduced into nearly flat
  3802. regions by truncation to 8bit color depth.
  3803. Interpolate the gradients that should go where the bands are, and
  3804. dither them.
  3805. It is designed for playback only. Do not use it prior to
  3806. lossy compression, because compression tends to lose the dither and
  3807. bring back the bands.
  3808. It accepts the following parameters:
  3809. @table @option
  3810. @item strength
  3811. The maximum amount by which the filter will change any one pixel. This is also
  3812. the threshold for detecting nearly flat regions. Acceptable values range from
  3813. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  3814. valid range.
  3815. @item radius
  3816. The neighborhood to fit the gradient to. A larger radius makes for smoother
  3817. gradients, but also prevents the filter from modifying the pixels near detailed
  3818. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  3819. values will be clipped to the valid range.
  3820. @end table
  3821. Alternatively, the options can be specified as a flat string:
  3822. @var{strength}[:@var{radius}]
  3823. @subsection Examples
  3824. @itemize
  3825. @item
  3826. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  3827. @example
  3828. gradfun=3.5:8
  3829. @end example
  3830. @item
  3831. Specify radius, omitting the strength (which will fall-back to the default
  3832. value):
  3833. @example
  3834. gradfun=radius=8
  3835. @end example
  3836. @end itemize
  3837. @anchor{haldclut}
  3838. @section haldclut
  3839. Apply a Hald CLUT to a video stream.
  3840. First input is the video stream to process, and second one is the Hald CLUT.
  3841. The Hald CLUT input can be a simple picture or a complete video stream.
  3842. The filter accepts the following options:
  3843. @table @option
  3844. @item shortest
  3845. Force termination when the shortest input terminates. Default is @code{0}.
  3846. @item repeatlast
  3847. Continue applying the last CLUT after the end of the stream. A value of
  3848. @code{0} disable the filter after the last frame of the CLUT is reached.
  3849. Default is @code{1}.
  3850. @end table
  3851. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  3852. filters share the same internals).
  3853. More information about the Hald CLUT can be found on Eskil Steenberg's website
  3854. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  3855. @subsection Workflow examples
  3856. @subsubsection Hald CLUT video stream
  3857. Generate an identity Hald CLUT stream altered with various effects:
  3858. @example
  3859. 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
  3860. @end example
  3861. Note: make sure you use a lossless codec.
  3862. Then use it with @code{haldclut} to apply it on some random stream:
  3863. @example
  3864. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  3865. @end example
  3866. The Hald CLUT will be applied to the 10 first seconds (duration of
  3867. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  3868. to the remaining frames of the @code{mandelbrot} stream.
  3869. @subsubsection Hald CLUT with preview
  3870. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  3871. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  3872. biggest possible square starting at the top left of the picture. The remaining
  3873. padding pixels (bottom or right) will be ignored. This area can be used to add
  3874. a preview of the Hald CLUT.
  3875. Typically, the following generated Hald CLUT will be supported by the
  3876. @code{haldclut} filter:
  3877. @example
  3878. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  3879. pad=iw+320 [padded_clut];
  3880. smptebars=s=320x256, split [a][b];
  3881. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  3882. [main][b] overlay=W-320" -frames:v 1 clut.png
  3883. @end example
  3884. It contains the original and a preview of the effect of the CLUT: SMPTE color
  3885. bars are displayed on the right-top, and below the same color bars processed by
  3886. the color changes.
  3887. Then, the effect of this Hald CLUT can be visualized with:
  3888. @example
  3889. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  3890. @end example
  3891. @section hflip
  3892. Flip the input video horizontally.
  3893. For example, to horizontally flip the input video with @command{ffmpeg}:
  3894. @example
  3895. ffmpeg -i in.avi -vf "hflip" out.avi
  3896. @end example
  3897. @section histeq
  3898. This filter applies a global color histogram equalization on a
  3899. per-frame basis.
  3900. It can be used to correct video that has a compressed range of pixel
  3901. intensities. The filter redistributes the pixel intensities to
  3902. equalize their distribution across the intensity range. It may be
  3903. viewed as an "automatically adjusting contrast filter". This filter is
  3904. useful only for correcting degraded or poorly captured source
  3905. video.
  3906. The filter accepts the following options:
  3907. @table @option
  3908. @item strength
  3909. Determine the amount of equalization to be applied. As the strength
  3910. is reduced, the distribution of pixel intensities more-and-more
  3911. approaches that of the input frame. The value must be a float number
  3912. in the range [0,1] and defaults to 0.200.
  3913. @item intensity
  3914. Set the maximum intensity that can generated and scale the output
  3915. values appropriately. The strength should be set as desired and then
  3916. the intensity can be limited if needed to avoid washing-out. The value
  3917. must be a float number in the range [0,1] and defaults to 0.210.
  3918. @item antibanding
  3919. Set the antibanding level. If enabled the filter will randomly vary
  3920. the luminance of output pixels by a small amount to avoid banding of
  3921. the histogram. Possible values are @code{none}, @code{weak} or
  3922. @code{strong}. It defaults to @code{none}.
  3923. @end table
  3924. @section histogram
  3925. Compute and draw a color distribution histogram for the input video.
  3926. The computed histogram is a representation of the color component
  3927. distribution in an image.
  3928. The filter accepts the following options:
  3929. @table @option
  3930. @item mode
  3931. Set histogram mode.
  3932. It accepts the following values:
  3933. @table @samp
  3934. @item levels
  3935. Standard histogram that displays the color components distribution in an
  3936. image. Displays color graph for each color component. Shows distribution of
  3937. the Y, U, V, A or R, G, B components, depending on input format, in the
  3938. current frame. Below each graph a color component scale meter is shown.
  3939. @item color
  3940. Displays chroma values (U/V color placement) in a two dimensional
  3941. graph (which is called a vectorscope). The brighter a pixel in the
  3942. vectorscope, the more pixels of the input frame correspond to that pixel
  3943. (i.e., more pixels have this chroma value). The V component is displayed on
  3944. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  3945. side being V = 255. The U component is displayed on the vertical (Y) axis,
  3946. with the top representing U = 0 and the bottom representing U = 255.
  3947. The position of a white pixel in the graph corresponds to the chroma value of
  3948. a pixel of the input clip. The graph can therefore be used to read the hue
  3949. (color flavor) and the saturation (the dominance of the hue in the color). As
  3950. the hue of a color changes, it moves around the square. At the center of the
  3951. square the saturation is zero, which means that the corresponding pixel has no
  3952. color. If the amount of a specific color is increased (while leaving the other
  3953. colors unchanged) the saturation increases, and the indicator moves towards
  3954. the edge of the square.
  3955. @item color2
  3956. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  3957. are displayed.
  3958. @item waveform
  3959. Per row/column color component graph. In row mode, the graph on the left side
  3960. represents color component value 0 and the right side represents value = 255.
  3961. In column mode, the top side represents color component value = 0 and bottom
  3962. side represents value = 255.
  3963. @end table
  3964. Default value is @code{levels}.
  3965. @item level_height
  3966. Set height of level in @code{levels}. Default value is @code{200}.
  3967. Allowed range is [50, 2048].
  3968. @item scale_height
  3969. Set height of color scale in @code{levels}. Default value is @code{12}.
  3970. Allowed range is [0, 40].
  3971. @item step
  3972. Set step for @code{waveform} mode. Smaller values are useful to find out how
  3973. many values of the same luminance are distributed across input rows/columns.
  3974. Default value is @code{10}. Allowed range is [1, 255].
  3975. @item waveform_mode
  3976. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  3977. Default is @code{row}.
  3978. @item waveform_mirror
  3979. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  3980. means mirrored. In mirrored mode, higher values will be represented on the left
  3981. side for @code{row} mode and at the top for @code{column} mode. Default is
  3982. @code{0} (unmirrored).
  3983. @item display_mode
  3984. Set display mode for @code{waveform} and @code{levels}.
  3985. It accepts the following values:
  3986. @table @samp
  3987. @item parade
  3988. Display separate graph for the color components side by side in
  3989. @code{row} waveform mode or one below the other in @code{column} waveform mode
  3990. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  3991. per color component graphs are placed below each other.
  3992. Using this display mode in @code{waveform} histogram mode makes it easy to
  3993. spot color casts in the highlights and shadows of an image, by comparing the
  3994. contours of the top and the bottom graphs of each waveform. Since whites,
  3995. grays, and blacks are characterized by exactly equal amounts of red, green,
  3996. and blue, neutral areas of the picture should display three waveforms of
  3997. roughly equal width/height. If not, the correction is easy to perform by
  3998. making level adjustments the three waveforms.
  3999. @item overlay
  4000. Presents information identical to that in the @code{parade}, except
  4001. that the graphs representing color components are superimposed directly
  4002. over one another.
  4003. This display mode in @code{waveform} histogram mode makes it easier to spot
  4004. relative differences or similarities in overlapping areas of the color
  4005. components that are supposed to be identical, such as neutral whites, grays,
  4006. or blacks.
  4007. @end table
  4008. Default is @code{parade}.
  4009. @item levels_mode
  4010. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  4011. Default is @code{linear}.
  4012. @end table
  4013. @subsection Examples
  4014. @itemize
  4015. @item
  4016. Calculate and draw histogram:
  4017. @example
  4018. ffplay -i input -vf histogram
  4019. @end example
  4020. @end itemize
  4021. @anchor{hqdn3d}
  4022. @section hqdn3d
  4023. This is a high precision/quality 3d denoise filter. It aims to reduce
  4024. image noise, producing smooth images and making still images really
  4025. still. It should enhance compressibility.
  4026. It accepts the following optional parameters:
  4027. @table @option
  4028. @item luma_spatial
  4029. A non-negative floating point number which specifies spatial luma strength.
  4030. It defaults to 4.0.
  4031. @item chroma_spatial
  4032. A non-negative floating point number which specifies spatial chroma strength.
  4033. It defaults to 3.0*@var{luma_spatial}/4.0.
  4034. @item luma_tmp
  4035. A floating point number which specifies luma temporal strength. It defaults to
  4036. 6.0*@var{luma_spatial}/4.0.
  4037. @item chroma_tmp
  4038. A floating point number which specifies chroma temporal strength. It defaults to
  4039. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  4040. @end table
  4041. @section hqx
  4042. Apply a high-quality magnification filter designed for pixel art. This filter
  4043. was originally created by Maxim Stepin.
  4044. It accepts the following option:
  4045. @table @option
  4046. @item n
  4047. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  4048. @code{hq3x} and @code{4} for @code{hq4x}.
  4049. Default is @code{3}.
  4050. @end table
  4051. @section hue
  4052. Modify the hue and/or the saturation of the input.
  4053. It accepts the following parameters:
  4054. @table @option
  4055. @item h
  4056. Specify the hue angle as a number of degrees. It accepts an expression,
  4057. and defaults to "0".
  4058. @item s
  4059. Specify the saturation in the [-10,10] range. It accepts an expression and
  4060. defaults to "1".
  4061. @item H
  4062. Specify the hue angle as a number of radians. It accepts an
  4063. expression, and defaults to "0".
  4064. @item b
  4065. Specify the brightness in the [-10,10] range. It accepts an expression and
  4066. defaults to "0".
  4067. @end table
  4068. @option{h} and @option{H} are mutually exclusive, and can't be
  4069. specified at the same time.
  4070. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  4071. expressions containing the following constants:
  4072. @table @option
  4073. @item n
  4074. frame count of the input frame starting from 0
  4075. @item pts
  4076. presentation timestamp of the input frame expressed in time base units
  4077. @item r
  4078. frame rate of the input video, NAN if the input frame rate is unknown
  4079. @item t
  4080. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4081. @item tb
  4082. time base of the input video
  4083. @end table
  4084. @subsection Examples
  4085. @itemize
  4086. @item
  4087. Set the hue to 90 degrees and the saturation to 1.0:
  4088. @example
  4089. hue=h=90:s=1
  4090. @end example
  4091. @item
  4092. Same command but expressing the hue in radians:
  4093. @example
  4094. hue=H=PI/2:s=1
  4095. @end example
  4096. @item
  4097. Rotate hue and make the saturation swing between 0
  4098. and 2 over a period of 1 second:
  4099. @example
  4100. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  4101. @end example
  4102. @item
  4103. Apply a 3 seconds saturation fade-in effect starting at 0:
  4104. @example
  4105. hue="s=min(t/3\,1)"
  4106. @end example
  4107. The general fade-in expression can be written as:
  4108. @example
  4109. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  4110. @end example
  4111. @item
  4112. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  4113. @example
  4114. hue="s=max(0\, min(1\, (8-t)/3))"
  4115. @end example
  4116. The general fade-out expression can be written as:
  4117. @example
  4118. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  4119. @end example
  4120. @end itemize
  4121. @subsection Commands
  4122. This filter supports the following commands:
  4123. @table @option
  4124. @item b
  4125. @item s
  4126. @item h
  4127. @item H
  4128. Modify the hue and/or the saturation and/or brightness of the input video.
  4129. The command accepts the same syntax of the corresponding option.
  4130. If the specified expression is not valid, it is kept at its current
  4131. value.
  4132. @end table
  4133. @section idet
  4134. Detect video interlacing type.
  4135. This filter tries to detect if the input is interlaced or progressive,
  4136. top or bottom field first.
  4137. The filter accepts the following options:
  4138. @table @option
  4139. @item intl_thres
  4140. Set interlacing threshold.
  4141. @item prog_thres
  4142. Set progressive threshold.
  4143. @end table
  4144. @section il
  4145. Deinterleave or interleave fields.
  4146. This filter allows one to process interlaced images fields without
  4147. deinterlacing them. Deinterleaving splits the input frame into 2
  4148. fields (so called half pictures). Odd lines are moved to the top
  4149. half of the output image, even lines to the bottom half.
  4150. You can process (filter) them independently and then re-interleave them.
  4151. The filter accepts the following options:
  4152. @table @option
  4153. @item luma_mode, l
  4154. @item chroma_mode, c
  4155. @item alpha_mode, a
  4156. Available values for @var{luma_mode}, @var{chroma_mode} and
  4157. @var{alpha_mode} are:
  4158. @table @samp
  4159. @item none
  4160. Do nothing.
  4161. @item deinterleave, d
  4162. Deinterleave fields, placing one above the other.
  4163. @item interleave, i
  4164. Interleave fields. Reverse the effect of deinterleaving.
  4165. @end table
  4166. Default value is @code{none}.
  4167. @item luma_swap, ls
  4168. @item chroma_swap, cs
  4169. @item alpha_swap, as
  4170. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  4171. @end table
  4172. @section interlace
  4173. Simple interlacing filter from progressive contents. This interleaves upper (or
  4174. lower) lines from odd frames with lower (or upper) lines from even frames,
  4175. halving the frame rate and preserving image height.
  4176. @example
  4177. Original Original New Frame
  4178. Frame 'j' Frame 'j+1' (tff)
  4179. ========== =========== ==================
  4180. Line 0 --------------------> Frame 'j' Line 0
  4181. Line 1 Line 1 ----> Frame 'j+1' Line 1
  4182. Line 2 ---------------------> Frame 'j' Line 2
  4183. Line 3 Line 3 ----> Frame 'j+1' Line 3
  4184. ... ... ...
  4185. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  4186. @end example
  4187. It accepts the following optional parameters:
  4188. @table @option
  4189. @item scan
  4190. This determines whether the interlaced frame is taken from the even
  4191. (tff - default) or odd (bff) lines of the progressive frame.
  4192. @item lowpass
  4193. Enable (default) or disable the vertical lowpass filter to avoid twitter
  4194. interlacing and reduce moire patterns.
  4195. @end table
  4196. @section kerndeint
  4197. Deinterlace input video by applying Donald Graft's adaptive kernel
  4198. deinterling. Work on interlaced parts of a video to produce
  4199. progressive frames.
  4200. The description of the accepted parameters follows.
  4201. @table @option
  4202. @item thresh
  4203. Set the threshold which affects the filter's tolerance when
  4204. determining if a pixel line must be processed. It must be an integer
  4205. in the range [0,255] and defaults to 10. A value of 0 will result in
  4206. applying the process on every pixels.
  4207. @item map
  4208. Paint pixels exceeding the threshold value to white if set to 1.
  4209. Default is 0.
  4210. @item order
  4211. Set the fields order. Swap fields if set to 1, leave fields alone if
  4212. 0. Default is 0.
  4213. @item sharp
  4214. Enable additional sharpening if set to 1. Default is 0.
  4215. @item twoway
  4216. Enable twoway sharpening if set to 1. Default is 0.
  4217. @end table
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Apply default values:
  4222. @example
  4223. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  4224. @end example
  4225. @item
  4226. Enable additional sharpening:
  4227. @example
  4228. kerndeint=sharp=1
  4229. @end example
  4230. @item
  4231. Paint processed pixels in white:
  4232. @example
  4233. kerndeint=map=1
  4234. @end example
  4235. @end itemize
  4236. @anchor{lut3d}
  4237. @section lut3d
  4238. Apply a 3D LUT to an input video.
  4239. The filter accepts the following options:
  4240. @table @option
  4241. @item file
  4242. Set the 3D LUT file name.
  4243. Currently supported formats:
  4244. @table @samp
  4245. @item 3dl
  4246. AfterEffects
  4247. @item cube
  4248. Iridas
  4249. @item dat
  4250. DaVinci
  4251. @item m3d
  4252. Pandora
  4253. @end table
  4254. @item interp
  4255. Select interpolation mode.
  4256. Available values are:
  4257. @table @samp
  4258. @item nearest
  4259. Use values from the nearest defined point.
  4260. @item trilinear
  4261. Interpolate values using the 8 points defining a cube.
  4262. @item tetrahedral
  4263. Interpolate values using a tetrahedron.
  4264. @end table
  4265. @end table
  4266. @section lut, lutrgb, lutyuv
  4267. Compute a look-up table for binding each pixel component input value
  4268. to an output value, and apply it to the input video.
  4269. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  4270. to an RGB input video.
  4271. These filters accept the following parameters:
  4272. @table @option
  4273. @item c0
  4274. set first pixel component expression
  4275. @item c1
  4276. set second pixel component expression
  4277. @item c2
  4278. set third pixel component expression
  4279. @item c3
  4280. set fourth pixel component expression, corresponds to the alpha component
  4281. @item r
  4282. set red component expression
  4283. @item g
  4284. set green component expression
  4285. @item b
  4286. set blue component expression
  4287. @item a
  4288. alpha component expression
  4289. @item y
  4290. set Y/luminance component expression
  4291. @item u
  4292. set U/Cb component expression
  4293. @item v
  4294. set V/Cr component expression
  4295. @end table
  4296. Each of them specifies the expression to use for computing the lookup table for
  4297. the corresponding pixel component values.
  4298. The exact component associated to each of the @var{c*} options depends on the
  4299. format in input.
  4300. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  4301. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  4302. The expressions can contain the following constants and functions:
  4303. @table @option
  4304. @item w
  4305. @item h
  4306. The input width and height.
  4307. @item val
  4308. The input value for the pixel component.
  4309. @item clipval
  4310. The input value, clipped to the @var{minval}-@var{maxval} range.
  4311. @item maxval
  4312. The maximum value for the pixel component.
  4313. @item minval
  4314. The minimum value for the pixel component.
  4315. @item negval
  4316. The negated value for the pixel component value, clipped to the
  4317. @var{minval}-@var{maxval} range; it corresponds to the expression
  4318. "maxval-clipval+minval".
  4319. @item clip(val)
  4320. The computed value in @var{val}, clipped to the
  4321. @var{minval}-@var{maxval} range.
  4322. @item gammaval(gamma)
  4323. The computed gamma correction value of the pixel component value,
  4324. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  4325. expression
  4326. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  4327. @end table
  4328. All expressions default to "val".
  4329. @subsection Examples
  4330. @itemize
  4331. @item
  4332. Negate input video:
  4333. @example
  4334. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  4335. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  4336. @end example
  4337. The above is the same as:
  4338. @example
  4339. lutrgb="r=negval:g=negval:b=negval"
  4340. lutyuv="y=negval:u=negval:v=negval"
  4341. @end example
  4342. @item
  4343. Negate luminance:
  4344. @example
  4345. lutyuv=y=negval
  4346. @end example
  4347. @item
  4348. Remove chroma components, turning the video into a graytone image:
  4349. @example
  4350. lutyuv="u=128:v=128"
  4351. @end example
  4352. @item
  4353. Apply a luma burning effect:
  4354. @example
  4355. lutyuv="y=2*val"
  4356. @end example
  4357. @item
  4358. Remove green and blue components:
  4359. @example
  4360. lutrgb="g=0:b=0"
  4361. @end example
  4362. @item
  4363. Set a constant alpha channel value on input:
  4364. @example
  4365. format=rgba,lutrgb=a="maxval-minval/2"
  4366. @end example
  4367. @item
  4368. Correct luminance gamma by a factor of 0.5:
  4369. @example
  4370. lutyuv=y=gammaval(0.5)
  4371. @end example
  4372. @item
  4373. Discard least significant bits of luma:
  4374. @example
  4375. lutyuv=y='bitand(val, 128+64+32)'
  4376. @end example
  4377. @end itemize
  4378. @section mergeplanes
  4379. Merge color channel components from several video streams.
  4380. The filter accepts up to 4 input streams, and merge selected input
  4381. planes to the output video.
  4382. This filter accepts the following options:
  4383. @table @option
  4384. @item mapping
  4385. Set input to output plane mapping. Default is @code{0}.
  4386. The mappings is specified as a bitmap. It should be specified as a
  4387. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  4388. mapping for the first plane of the output stream. 'A' sets the number of
  4389. the input stream to use (from 0 to 3), and 'a' the plane number of the
  4390. corresponding input to use (from 0 to 3). The rest of the mappings is
  4391. similar, 'Bb' describes the mapping for the output stream second
  4392. plane, 'Cc' describes the mapping for the output stream third plane and
  4393. 'Dd' describes the mapping for the output stream fourth plane.
  4394. @item format
  4395. Set output pixel format. Default is @code{yuva444p}.
  4396. @end table
  4397. @subsection Examples
  4398. @itemize
  4399. @item
  4400. Merge three gray video streams of same width and height into single video stream:
  4401. @example
  4402. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  4403. @end example
  4404. @item
  4405. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  4406. @example
  4407. [a0][a1]mergeplanes=0x00010210:yuva444p
  4408. @end example
  4409. @item
  4410. Swap Y and A plane in yuva444p stream:
  4411. @example
  4412. format=yuva444p,mergeplanes=0x03010200:yuva444p
  4413. @end example
  4414. @item
  4415. Swap U and V plane in yuv420p stream:
  4416. @example
  4417. format=yuv420p,mergeplanes=0x000201:yuv420p
  4418. @end example
  4419. @item
  4420. Cast a rgb24 clip to yuv444p:
  4421. @example
  4422. format=rgb24,mergeplanes=0x000102:yuv444p
  4423. @end example
  4424. @end itemize
  4425. @section mcdeint
  4426. Apply motion-compensation deinterlacing.
  4427. It needs one field per frame as input and must thus be used together
  4428. with yadif=1/3 or equivalent.
  4429. This filter accepts the following options:
  4430. @table @option
  4431. @item mode
  4432. Set the deinterlacing mode.
  4433. It accepts one of the following values:
  4434. @table @samp
  4435. @item fast
  4436. @item medium
  4437. @item slow
  4438. use iterative motion estimation
  4439. @item extra_slow
  4440. like @samp{slow}, but use multiple reference frames.
  4441. @end table
  4442. Default value is @samp{fast}.
  4443. @item parity
  4444. Set the picture field parity assumed for the input video. It must be
  4445. one of the following values:
  4446. @table @samp
  4447. @item 0, tff
  4448. assume top field first
  4449. @item 1, bff
  4450. assume bottom field first
  4451. @end table
  4452. Default value is @samp{bff}.
  4453. @item qp
  4454. Set per-block quantization parameter (QP) used by the internal
  4455. encoder.
  4456. Higher values should result in a smoother motion vector field but less
  4457. optimal individual vectors. Default value is 1.
  4458. @end table
  4459. @section mp
  4460. Apply an MPlayer filter to the input video.
  4461. This filter provides a wrapper around some of the filters of
  4462. MPlayer/MEncoder.
  4463. This wrapper is considered experimental. Some of the wrapped filters
  4464. may not work properly and we may drop support for them, as they will
  4465. be implemented natively into FFmpeg. Thus you should avoid
  4466. depending on them when writing portable scripts.
  4467. The filter accepts the parameters:
  4468. @var{filter_name}[:=]@var{filter_params}
  4469. @var{filter_name} is the name of a supported MPlayer filter,
  4470. @var{filter_params} is a string containing the parameters accepted by
  4471. the named filter.
  4472. The list of the currently supported filters follows:
  4473. @table @var
  4474. @item eq2
  4475. @item eq
  4476. @item fspp
  4477. @item ilpack
  4478. @item pp7
  4479. @item softpulldown
  4480. @item uspp
  4481. @end table
  4482. The parameter syntax and behavior for the listed filters are the same
  4483. of the corresponding MPlayer filters. For detailed instructions check
  4484. the "VIDEO FILTERS" section in the MPlayer manual.
  4485. @subsection Examples
  4486. @itemize
  4487. @item
  4488. Adjust gamma, brightness, contrast:
  4489. @example
  4490. mp=eq2=1.0:2:0.5
  4491. @end example
  4492. @end itemize
  4493. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  4494. @section mpdecimate
  4495. Drop frames that do not differ greatly from the previous frame in
  4496. order to reduce frame rate.
  4497. The main use of this filter is for very-low-bitrate encoding
  4498. (e.g. streaming over dialup modem), but it could in theory be used for
  4499. fixing movies that were inverse-telecined incorrectly.
  4500. A description of the accepted options follows.
  4501. @table @option
  4502. @item max
  4503. Set the maximum number of consecutive frames which can be dropped (if
  4504. positive), or the minimum interval between dropped frames (if
  4505. negative). If the value is 0, the frame is dropped unregarding the
  4506. number of previous sequentially dropped frames.
  4507. Default value is 0.
  4508. @item hi
  4509. @item lo
  4510. @item frac
  4511. Set the dropping threshold values.
  4512. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  4513. represent actual pixel value differences, so a threshold of 64
  4514. corresponds to 1 unit of difference for each pixel, or the same spread
  4515. out differently over the block.
  4516. A frame is a candidate for dropping if no 8x8 blocks differ by more
  4517. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  4518. meaning the whole image) differ by more than a threshold of @option{lo}.
  4519. Default value for @option{hi} is 64*12, default value for @option{lo} is
  4520. 64*5, and default value for @option{frac} is 0.33.
  4521. @end table
  4522. @section negate
  4523. Negate input video.
  4524. It accepts an integer in input; if non-zero it negates the
  4525. alpha component (if available). The default value in input is 0.
  4526. @section noformat
  4527. Force libavfilter not to use any of the specified pixel formats for the
  4528. input to the next filter.
  4529. It accepts the following parameters:
  4530. @table @option
  4531. @item pix_fmts
  4532. A '|'-separated list of pixel format names, such as
  4533. apix_fmts=yuv420p|monow|rgb24".
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Force libavfilter to use a format different from @var{yuv420p} for the
  4539. input to the vflip filter:
  4540. @example
  4541. noformat=pix_fmts=yuv420p,vflip
  4542. @end example
  4543. @item
  4544. Convert the input video to any of the formats not contained in the list:
  4545. @example
  4546. noformat=yuv420p|yuv444p|yuv410p
  4547. @end example
  4548. @end itemize
  4549. @section noise
  4550. Add noise on video input frame.
  4551. The filter accepts the following options:
  4552. @table @option
  4553. @item all_seed
  4554. @item c0_seed
  4555. @item c1_seed
  4556. @item c2_seed
  4557. @item c3_seed
  4558. Set noise seed for specific pixel component or all pixel components in case
  4559. of @var{all_seed}. Default value is @code{123457}.
  4560. @item all_strength, alls
  4561. @item c0_strength, c0s
  4562. @item c1_strength, c1s
  4563. @item c2_strength, c2s
  4564. @item c3_strength, c3s
  4565. Set noise strength for specific pixel component or all pixel components in case
  4566. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  4567. @item all_flags, allf
  4568. @item c0_flags, c0f
  4569. @item c1_flags, c1f
  4570. @item c2_flags, c2f
  4571. @item c3_flags, c3f
  4572. Set pixel component flags or set flags for all components if @var{all_flags}.
  4573. Available values for component flags are:
  4574. @table @samp
  4575. @item a
  4576. averaged temporal noise (smoother)
  4577. @item p
  4578. mix random noise with a (semi)regular pattern
  4579. @item t
  4580. temporal noise (noise pattern changes between frames)
  4581. @item u
  4582. uniform noise (gaussian otherwise)
  4583. @end table
  4584. @end table
  4585. @subsection Examples
  4586. Add temporal and uniform noise to input video:
  4587. @example
  4588. noise=alls=20:allf=t+u
  4589. @end example
  4590. @section null
  4591. Pass the video source unchanged to the output.
  4592. @section ocv
  4593. Apply a video transform using libopencv.
  4594. To enable this filter, install the libopencv library and headers and
  4595. configure FFmpeg with @code{--enable-libopencv}.
  4596. It accepts the following parameters:
  4597. @table @option
  4598. @item filter_name
  4599. The name of the libopencv filter to apply.
  4600. @item filter_params
  4601. The parameters to pass to the libopencv filter. If not specified, the default
  4602. values are assumed.
  4603. @end table
  4604. Refer to the official libopencv documentation for more precise
  4605. information:
  4606. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  4607. Several libopencv filters are supported; see the following subsections.
  4608. @anchor{dilate}
  4609. @subsection dilate
  4610. Dilate an image by using a specific structuring element.
  4611. It corresponds to the libopencv function @code{cvDilate}.
  4612. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  4613. @var{struct_el} represents a structuring element, and has the syntax:
  4614. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  4615. @var{cols} and @var{rows} represent the number of columns and rows of
  4616. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  4617. point, and @var{shape} the shape for the structuring element. @var{shape}
  4618. must be "rect", "cross", "ellipse", or "custom".
  4619. If the value for @var{shape} is "custom", it must be followed by a
  4620. string of the form "=@var{filename}". The file with name
  4621. @var{filename} is assumed to represent a binary image, with each
  4622. printable character corresponding to a bright pixel. When a custom
  4623. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  4624. or columns and rows of the read file are assumed instead.
  4625. The default value for @var{struct_el} is "3x3+0x0/rect".
  4626. @var{nb_iterations} specifies the number of times the transform is
  4627. applied to the image, and defaults to 1.
  4628. Some examples:
  4629. @example
  4630. # Use the default values
  4631. ocv=dilate
  4632. # Dilate using a structuring element with a 5x5 cross, iterating two times
  4633. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  4634. # Read the shape from the file diamond.shape, iterating two times.
  4635. # The file diamond.shape may contain a pattern of characters like this
  4636. # *
  4637. # ***
  4638. # *****
  4639. # ***
  4640. # *
  4641. # The specified columns and rows are ignored
  4642. # but the anchor point coordinates are not
  4643. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  4644. @end example
  4645. @subsection erode
  4646. Erode an image by using a specific structuring element.
  4647. It corresponds to the libopencv function @code{cvErode}.
  4648. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  4649. with the same syntax and semantics as the @ref{dilate} filter.
  4650. @subsection smooth
  4651. Smooth the input video.
  4652. The filter takes the following parameters:
  4653. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  4654. @var{type} is the type of smooth filter to apply, and must be one of
  4655. the following values: "blur", "blur_no_scale", "median", "gaussian",
  4656. or "bilateral". The default value is "gaussian".
  4657. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  4658. depend on the smooth type. @var{param1} and
  4659. @var{param2} accept integer positive values or 0. @var{param3} and
  4660. @var{param4} accept floating point values.
  4661. The default value for @var{param1} is 3. The default value for the
  4662. other parameters is 0.
  4663. These parameters correspond to the parameters assigned to the
  4664. libopencv function @code{cvSmooth}.
  4665. @anchor{overlay}
  4666. @section overlay
  4667. Overlay one video on top of another.
  4668. It takes two inputs and has one output. The first input is the "main"
  4669. video on which the second input is overlayed.
  4670. It accepts the following parameters:
  4671. A description of the accepted options follows.
  4672. @table @option
  4673. @item x
  4674. @item y
  4675. Set the expression for the x and y coordinates of the overlayed video
  4676. on the main video. Default value is "0" for both expressions. In case
  4677. the expression is invalid, it is set to a huge value (meaning that the
  4678. overlay will not be displayed within the output visible area).
  4679. @item eof_action
  4680. The action to take when EOF is encountered on the secondary input; it accepts
  4681. one of the following values:
  4682. @table @option
  4683. @item repeat
  4684. Repeat the last frame (the default).
  4685. @item endall
  4686. End both streams.
  4687. @item pass
  4688. Pass the main input through.
  4689. @end table
  4690. @item eval
  4691. Set when the expressions for @option{x}, and @option{y} are evaluated.
  4692. It accepts the following values:
  4693. @table @samp
  4694. @item init
  4695. only evaluate expressions once during the filter initialization or
  4696. when a command is processed
  4697. @item frame
  4698. evaluate expressions for each incoming frame
  4699. @end table
  4700. Default value is @samp{frame}.
  4701. @item shortest
  4702. If set to 1, force the output to terminate when the shortest input
  4703. terminates. Default value is 0.
  4704. @item format
  4705. Set the format for the output video.
  4706. It accepts the following values:
  4707. @table @samp
  4708. @item yuv420
  4709. force YUV420 output
  4710. @item yuv422
  4711. force YUV422 output
  4712. @item yuv444
  4713. force YUV444 output
  4714. @item rgb
  4715. force RGB output
  4716. @end table
  4717. Default value is @samp{yuv420}.
  4718. @item rgb @emph{(deprecated)}
  4719. If set to 1, force the filter to accept inputs in the RGB
  4720. color space. Default value is 0. This option is deprecated, use
  4721. @option{format} instead.
  4722. @item repeatlast
  4723. If set to 1, force the filter to draw the last overlay frame over the
  4724. main input until the end of the stream. A value of 0 disables this
  4725. behavior. Default value is 1.
  4726. @end table
  4727. The @option{x}, and @option{y} expressions can contain the following
  4728. parameters.
  4729. @table @option
  4730. @item main_w, W
  4731. @item main_h, H
  4732. The main input width and height.
  4733. @item overlay_w, w
  4734. @item overlay_h, h
  4735. The overlay input width and height.
  4736. @item x
  4737. @item y
  4738. The computed values for @var{x} and @var{y}. They are evaluated for
  4739. each new frame.
  4740. @item hsub
  4741. @item vsub
  4742. horizontal and vertical chroma subsample values of the output
  4743. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  4744. @var{vsub} is 1.
  4745. @item n
  4746. the number of input frame, starting from 0
  4747. @item pos
  4748. the position in the file of the input frame, NAN if unknown
  4749. @item t
  4750. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  4751. @end table
  4752. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  4753. when evaluation is done @emph{per frame}, and will evaluate to NAN
  4754. when @option{eval} is set to @samp{init}.
  4755. Be aware that frames are taken from each input video in timestamp
  4756. order, hence, if their initial timestamps differ, it is a good idea
  4757. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  4758. have them begin in the same zero timestamp, as the example for
  4759. the @var{movie} filter does.
  4760. You can chain together more overlays but you should test the
  4761. efficiency of such approach.
  4762. @subsection Commands
  4763. This filter supports the following commands:
  4764. @table @option
  4765. @item x
  4766. @item y
  4767. Modify the x and y of the overlay input.
  4768. The command accepts the same syntax of the corresponding option.
  4769. If the specified expression is not valid, it is kept at its current
  4770. value.
  4771. @end table
  4772. @subsection Examples
  4773. @itemize
  4774. @item
  4775. Draw the overlay at 10 pixels from the bottom right corner of the main
  4776. video:
  4777. @example
  4778. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  4779. @end example
  4780. Using named options the example above becomes:
  4781. @example
  4782. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  4783. @end example
  4784. @item
  4785. Insert a transparent PNG logo in the bottom left corner of the input,
  4786. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  4787. @example
  4788. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  4789. @end example
  4790. @item
  4791. Insert 2 different transparent PNG logos (second logo on bottom
  4792. right corner) using the @command{ffmpeg} tool:
  4793. @example
  4794. 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
  4795. @end example
  4796. @item
  4797. Add a transparent color layer on top of the main video; @code{WxH}
  4798. must specify the size of the main input to the overlay filter:
  4799. @example
  4800. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  4801. @end example
  4802. @item
  4803. Play an original video and a filtered version (here with the deshake
  4804. filter) side by side using the @command{ffplay} tool:
  4805. @example
  4806. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  4807. @end example
  4808. The above command is the same as:
  4809. @example
  4810. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  4811. @end example
  4812. @item
  4813. Make a sliding overlay appearing from the left to the right top part of the
  4814. screen starting since time 2:
  4815. @example
  4816. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  4817. @end example
  4818. @item
  4819. Compose output by putting two input videos side to side:
  4820. @example
  4821. ffmpeg -i left.avi -i right.avi -filter_complex "
  4822. nullsrc=size=200x100 [background];
  4823. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  4824. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  4825. [background][left] overlay=shortest=1 [background+left];
  4826. [background+left][right] overlay=shortest=1:x=100 [left+right]
  4827. "
  4828. @end example
  4829. @item
  4830. Mask 10-20 seconds of a video by applying the delogo filter to a section
  4831. @example
  4832. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  4833. -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]'
  4834. masked.avi
  4835. @end example
  4836. @item
  4837. Chain several overlays in cascade:
  4838. @example
  4839. nullsrc=s=200x200 [bg];
  4840. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  4841. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  4842. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  4843. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  4844. [in3] null, [mid2] overlay=100:100 [out0]
  4845. @end example
  4846. @end itemize
  4847. @section owdenoise
  4848. Apply Overcomplete Wavelet denoiser.
  4849. The filter accepts the following options:
  4850. @table @option
  4851. @item depth
  4852. Set depth.
  4853. Larger depth values will denoise lower frequency components more, but
  4854. slow down filtering.
  4855. Must be an int in the range 8-16, default is @code{8}.
  4856. @item luma_strength, ls
  4857. Set luma strength.
  4858. Must be a double value in the range 0-1000, default is @code{1.0}.
  4859. @item chroma_strength, cs
  4860. Set chroma strength.
  4861. Must be a double value in the range 0-1000, default is @code{1.0}.
  4862. @end table
  4863. @section pad
  4864. Add paddings to the input image, and place the original input at the
  4865. provided @var{x}, @var{y} coordinates.
  4866. It accepts the following parameters:
  4867. @table @option
  4868. @item width, w
  4869. @item height, h
  4870. Specify an expression for the size of the output image with the
  4871. paddings added. If the value for @var{width} or @var{height} is 0, the
  4872. corresponding input size is used for the output.
  4873. The @var{width} expression can reference the value set by the
  4874. @var{height} expression, and vice versa.
  4875. The default value of @var{width} and @var{height} is 0.
  4876. @item x
  4877. @item y
  4878. Specify the offsets to place the input image at within the padded area,
  4879. with respect to the top/left border of the output image.
  4880. The @var{x} expression can reference the value set by the @var{y}
  4881. expression, and vice versa.
  4882. The default value of @var{x} and @var{y} is 0.
  4883. @item color
  4884. Specify the color of the padded area. For the syntax of this option,
  4885. check the "Color" section in the ffmpeg-utils manual.
  4886. The default value of @var{color} is "black".
  4887. @end table
  4888. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  4889. options are expressions containing the following constants:
  4890. @table @option
  4891. @item in_w
  4892. @item in_h
  4893. The input video width and height.
  4894. @item iw
  4895. @item ih
  4896. These are the same as @var{in_w} and @var{in_h}.
  4897. @item out_w
  4898. @item out_h
  4899. The output width and height (the size of the padded area), as
  4900. specified by the @var{width} and @var{height} expressions.
  4901. @item ow
  4902. @item oh
  4903. These are the same as @var{out_w} and @var{out_h}.
  4904. @item x
  4905. @item y
  4906. The x and y offsets as specified by the @var{x} and @var{y}
  4907. expressions, or NAN if not yet specified.
  4908. @item a
  4909. same as @var{iw} / @var{ih}
  4910. @item sar
  4911. input sample aspect ratio
  4912. @item dar
  4913. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4914. @item hsub
  4915. @item vsub
  4916. The horizontal and vertical chroma subsample values. For example for the
  4917. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4918. @end table
  4919. @subsection Examples
  4920. @itemize
  4921. @item
  4922. Add paddings with the color "violet" to the input video. The output video
  4923. size is 640x480, and the top-left corner of the input video is placed at
  4924. column 0, row 40
  4925. @example
  4926. pad=640:480:0:40:violet
  4927. @end example
  4928. The example above is equivalent to the following command:
  4929. @example
  4930. pad=width=640:height=480:x=0:y=40:color=violet
  4931. @end example
  4932. @item
  4933. Pad the input to get an output with dimensions increased by 3/2,
  4934. and put the input video at the center of the padded area:
  4935. @example
  4936. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  4937. @end example
  4938. @item
  4939. Pad the input to get a squared output with size equal to the maximum
  4940. value between the input width and height, and put the input video at
  4941. the center of the padded area:
  4942. @example
  4943. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  4944. @end example
  4945. @item
  4946. Pad the input to get a final w/h ratio of 16:9:
  4947. @example
  4948. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  4949. @end example
  4950. @item
  4951. In case of anamorphic video, in order to set the output display aspect
  4952. correctly, it is necessary to use @var{sar} in the expression,
  4953. according to the relation:
  4954. @example
  4955. (ih * X / ih) * sar = output_dar
  4956. X = output_dar / sar
  4957. @end example
  4958. Thus the previous example needs to be modified to:
  4959. @example
  4960. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  4961. @end example
  4962. @item
  4963. Double the output size and put the input video in the bottom-right
  4964. corner of the output padded area:
  4965. @example
  4966. pad="2*iw:2*ih:ow-iw:oh-ih"
  4967. @end example
  4968. @end itemize
  4969. @section perspective
  4970. Correct perspective of video not recorded perpendicular to the screen.
  4971. A description of the accepted parameters follows.
  4972. @table @option
  4973. @item x0
  4974. @item y0
  4975. @item x1
  4976. @item y1
  4977. @item x2
  4978. @item y2
  4979. @item x3
  4980. @item y3
  4981. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  4982. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  4983. The expressions can use the following variables:
  4984. @table @option
  4985. @item W
  4986. @item H
  4987. the width and height of video frame.
  4988. @end table
  4989. @item interpolation
  4990. Set interpolation for perspective correction.
  4991. It accepts the following values:
  4992. @table @samp
  4993. @item linear
  4994. @item cubic
  4995. @end table
  4996. Default value is @samp{linear}.
  4997. @end table
  4998. @section phase
  4999. Delay interlaced video by one field time so that the field order changes.
  5000. The intended use is to fix PAL movies that have been captured with the
  5001. opposite field order to the film-to-video transfer.
  5002. A description of the accepted parameters follows.
  5003. @table @option
  5004. @item mode
  5005. Set phase mode.
  5006. It accepts the following values:
  5007. @table @samp
  5008. @item t
  5009. Capture field order top-first, transfer bottom-first.
  5010. Filter will delay the bottom field.
  5011. @item b
  5012. Capture field order bottom-first, transfer top-first.
  5013. Filter will delay the top field.
  5014. @item p
  5015. Capture and transfer with the same field order. This mode only exists
  5016. for the documentation of the other options to refer to, but if you
  5017. actually select it, the filter will faithfully do nothing.
  5018. @item a
  5019. Capture field order determined automatically by field flags, transfer
  5020. opposite.
  5021. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  5022. basis using field flags. If no field information is available,
  5023. then this works just like @samp{u}.
  5024. @item u
  5025. Capture unknown or varying, transfer opposite.
  5026. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  5027. analyzing the images and selecting the alternative that produces best
  5028. match between the fields.
  5029. @item T
  5030. Capture top-first, transfer unknown or varying.
  5031. Filter selects among @samp{t} and @samp{p} using image analysis.
  5032. @item B
  5033. Capture bottom-first, transfer unknown or varying.
  5034. Filter selects among @samp{b} and @samp{p} using image analysis.
  5035. @item A
  5036. Capture determined by field flags, transfer unknown or varying.
  5037. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  5038. image analysis. If no field information is available, then this works just
  5039. like @samp{U}. This is the default mode.
  5040. @item U
  5041. Both capture and transfer unknown or varying.
  5042. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  5043. @end table
  5044. @end table
  5045. @section pixdesctest
  5046. Pixel format descriptor test filter, mainly useful for internal
  5047. testing. The output video should be equal to the input video.
  5048. For example:
  5049. @example
  5050. format=monow, pixdesctest
  5051. @end example
  5052. can be used to test the monowhite pixel format descriptor definition.
  5053. @section pp
  5054. Enable the specified chain of postprocessing subfilters using libpostproc. This
  5055. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  5056. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  5057. Each subfilter and some options have a short and a long name that can be used
  5058. interchangeably, i.e. dr/dering are the same.
  5059. The filters accept the following options:
  5060. @table @option
  5061. @item subfilters
  5062. Set postprocessing subfilters string.
  5063. @end table
  5064. All subfilters share common options to determine their scope:
  5065. @table @option
  5066. @item a/autoq
  5067. Honor the quality commands for this subfilter.
  5068. @item c/chrom
  5069. Do chrominance filtering, too (default).
  5070. @item y/nochrom
  5071. Do luminance filtering only (no chrominance).
  5072. @item n/noluma
  5073. Do chrominance filtering only (no luminance).
  5074. @end table
  5075. These options can be appended after the subfilter name, separated by a '|'.
  5076. Available subfilters are:
  5077. @table @option
  5078. @item hb/hdeblock[|difference[|flatness]]
  5079. Horizontal deblocking filter
  5080. @table @option
  5081. @item difference
  5082. Difference factor where higher values mean more deblocking (default: @code{32}).
  5083. @item flatness
  5084. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5085. @end table
  5086. @item vb/vdeblock[|difference[|flatness]]
  5087. Vertical deblocking filter
  5088. @table @option
  5089. @item difference
  5090. Difference factor where higher values mean more deblocking (default: @code{32}).
  5091. @item flatness
  5092. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5093. @end table
  5094. @item ha/hadeblock[|difference[|flatness]]
  5095. Accurate horizontal deblocking filter
  5096. @table @option
  5097. @item difference
  5098. Difference factor where higher values mean more deblocking (default: @code{32}).
  5099. @item flatness
  5100. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5101. @end table
  5102. @item va/vadeblock[|difference[|flatness]]
  5103. Accurate vertical deblocking filter
  5104. @table @option
  5105. @item difference
  5106. Difference factor where higher values mean more deblocking (default: @code{32}).
  5107. @item flatness
  5108. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5109. @end table
  5110. @end table
  5111. The horizontal and vertical deblocking filters share the difference and
  5112. flatness values so you cannot set different horizontal and vertical
  5113. thresholds.
  5114. @table @option
  5115. @item h1/x1hdeblock
  5116. Experimental horizontal deblocking filter
  5117. @item v1/x1vdeblock
  5118. Experimental vertical deblocking filter
  5119. @item dr/dering
  5120. Deringing filter
  5121. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  5122. @table @option
  5123. @item threshold1
  5124. larger -> stronger filtering
  5125. @item threshold2
  5126. larger -> stronger filtering
  5127. @item threshold3
  5128. larger -> stronger filtering
  5129. @end table
  5130. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  5131. @table @option
  5132. @item f/fullyrange
  5133. Stretch luminance to @code{0-255}.
  5134. @end table
  5135. @item lb/linblenddeint
  5136. Linear blend deinterlacing filter that deinterlaces the given block by
  5137. filtering all lines with a @code{(1 2 1)} filter.
  5138. @item li/linipoldeint
  5139. Linear interpolating deinterlacing filter that deinterlaces the given block by
  5140. linearly interpolating every second line.
  5141. @item ci/cubicipoldeint
  5142. Cubic interpolating deinterlacing filter deinterlaces the given block by
  5143. cubically interpolating every second line.
  5144. @item md/mediandeint
  5145. Median deinterlacing filter that deinterlaces the given block by applying a
  5146. median filter to every second line.
  5147. @item fd/ffmpegdeint
  5148. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  5149. second line with a @code{(-1 4 2 4 -1)} filter.
  5150. @item l5/lowpass5
  5151. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  5152. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  5153. @item fq/forceQuant[|quantizer]
  5154. Overrides the quantizer table from the input with the constant quantizer you
  5155. specify.
  5156. @table @option
  5157. @item quantizer
  5158. Quantizer to use
  5159. @end table
  5160. @item de/default
  5161. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  5162. @item fa/fast
  5163. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  5164. @item ac
  5165. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  5166. @end table
  5167. @subsection Examples
  5168. @itemize
  5169. @item
  5170. Apply horizontal and vertical deblocking, deringing and automatic
  5171. brightness/contrast:
  5172. @example
  5173. pp=hb/vb/dr/al
  5174. @end example
  5175. @item
  5176. Apply default filters without brightness/contrast correction:
  5177. @example
  5178. pp=de/-al
  5179. @end example
  5180. @item
  5181. Apply default filters and temporal denoiser:
  5182. @example
  5183. pp=default/tmpnoise|1|2|3
  5184. @end example
  5185. @item
  5186. Apply deblocking on luminance only, and switch vertical deblocking on or off
  5187. automatically depending on available CPU time:
  5188. @example
  5189. pp=hb|y/vb|a
  5190. @end example
  5191. @end itemize
  5192. @section psnr
  5193. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  5194. Ratio) between two input videos.
  5195. This filter takes in input two input videos, the first input is
  5196. considered the "main" source and is passed unchanged to the
  5197. output. The second input is used as a "reference" video for computing
  5198. the PSNR.
  5199. Both video inputs must have the same resolution and pixel format for
  5200. this filter to work correctly. Also it assumes that both inputs
  5201. have the same number of frames, which are compared one by one.
  5202. The obtained average PSNR is printed through the logging system.
  5203. The filter stores the accumulated MSE (mean squared error) of each
  5204. frame, and at the end of the processing it is averaged across all frames
  5205. equally, and the following formula is applied to obtain the PSNR:
  5206. @example
  5207. PSNR = 10*log10(MAX^2/MSE)
  5208. @end example
  5209. Where MAX is the average of the maximum values of each component of the
  5210. image.
  5211. The description of the accepted parameters follows.
  5212. @table @option
  5213. @item stats_file, f
  5214. If specified the filter will use the named file to save the PSNR of
  5215. each individual frame.
  5216. @end table
  5217. The file printed if @var{stats_file} is selected, contains a sequence of
  5218. key/value pairs of the form @var{key}:@var{value} for each compared
  5219. couple of frames.
  5220. A description of each shown parameter follows:
  5221. @table @option
  5222. @item n
  5223. sequential number of the input frame, starting from 1
  5224. @item mse_avg
  5225. Mean Square Error pixel-by-pixel average difference of the compared
  5226. frames, averaged over all the image components.
  5227. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  5228. Mean Square Error pixel-by-pixel average difference of the compared
  5229. frames for the component specified by the suffix.
  5230. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  5231. Peak Signal to Noise ratio of the compared frames for the component
  5232. specified by the suffix.
  5233. @end table
  5234. For example:
  5235. @example
  5236. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  5237. [main][ref] psnr="stats_file=stats.log" [out]
  5238. @end example
  5239. On this example the input file being processed is compared with the
  5240. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  5241. is stored in @file{stats.log}.
  5242. @anchor{pullup}
  5243. @section pullup
  5244. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  5245. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  5246. content.
  5247. The pullup filter is designed to take advantage of future context in making
  5248. its decisions. This filter is stateless in the sense that it does not lock
  5249. onto a pattern to follow, but it instead looks forward to the following
  5250. fields in order to identify matches and rebuild progressive frames.
  5251. To produce content with an even framerate, insert the fps filter after
  5252. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  5253. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  5254. The filter accepts the following options:
  5255. @table @option
  5256. @item jl
  5257. @item jr
  5258. @item jt
  5259. @item jb
  5260. These options set the amount of "junk" to ignore at the left, right, top, and
  5261. bottom of the image, respectively. Left and right are in units of 8 pixels,
  5262. while top and bottom are in units of 2 lines.
  5263. The default is 8 pixels on each side.
  5264. @item sb
  5265. Set the strict breaks. Setting this option to 1 will reduce the chances of
  5266. filter generating an occasional mismatched frame, but it may also cause an
  5267. excessive number of frames to be dropped during high motion sequences.
  5268. Conversely, setting it to -1 will make filter match fields more easily.
  5269. This may help processing of video where there is slight blurring between
  5270. the fields, but may also cause there to be interlaced frames in the output.
  5271. Default value is @code{0}.
  5272. @item mp
  5273. Set the metric plane to use. It accepts the following values:
  5274. @table @samp
  5275. @item l
  5276. Use luma plane.
  5277. @item u
  5278. Use chroma blue plane.
  5279. @item v
  5280. Use chroma red plane.
  5281. @end table
  5282. This option may be set to use chroma plane instead of the default luma plane
  5283. for doing filter's computations. This may improve accuracy on very clean
  5284. source material, but more likely will decrease accuracy, especially if there
  5285. is chroma noise (rainbow effect) or any grayscale video.
  5286. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  5287. load and make pullup usable in realtime on slow machines.
  5288. @end table
  5289. For best results (without duplicated frames in the output file) it is
  5290. necessary to change the output frame rate. For example, to inverse
  5291. telecine NTSC input:
  5292. @example
  5293. ffmpeg -i input -vf pullup -r 24000/1001 ...
  5294. @end example
  5295. @section removelogo
  5296. Suppress a TV station logo, using an image file to determine which
  5297. pixels comprise the logo. It works by filling in the pixels that
  5298. comprise the logo with neighboring pixels.
  5299. The filter accepts the following options:
  5300. @table @option
  5301. @item filename, f
  5302. Set the filter bitmap file, which can be any image format supported by
  5303. libavformat. The width and height of the image file must match those of the
  5304. video stream being processed.
  5305. @end table
  5306. Pixels in the provided bitmap image with a value of zero are not
  5307. considered part of the logo, non-zero pixels are considered part of
  5308. the logo. If you use white (255) for the logo and black (0) for the
  5309. rest, you will be safe. For making the filter bitmap, it is
  5310. recommended to take a screen capture of a black frame with the logo
  5311. visible, and then using a threshold filter followed by the erode
  5312. filter once or twice.
  5313. If needed, little splotches can be fixed manually. Remember that if
  5314. logo pixels are not covered, the filter quality will be much
  5315. reduced. Marking too many pixels as part of the logo does not hurt as
  5316. much, but it will increase the amount of blurring needed to cover over
  5317. the image and will destroy more information than necessary, and extra
  5318. pixels will slow things down on a large logo.
  5319. @section rotate
  5320. Rotate video by an arbitrary angle expressed in radians.
  5321. The filter accepts the following options:
  5322. A description of the optional parameters follows.
  5323. @table @option
  5324. @item angle, a
  5325. Set an expression for the angle by which to rotate the input video
  5326. clockwise, expressed as a number of radians. A negative value will
  5327. result in a counter-clockwise rotation. By default it is set to "0".
  5328. This expression is evaluated for each frame.
  5329. @item out_w, ow
  5330. Set the output width expression, default value is "iw".
  5331. This expression is evaluated just once during configuration.
  5332. @item out_h, oh
  5333. Set the output height expression, default value is "ih".
  5334. This expression is evaluated just once during configuration.
  5335. @item bilinear
  5336. Enable bilinear interpolation if set to 1, a value of 0 disables
  5337. it. Default value is 1.
  5338. @item fillcolor, c
  5339. Set the color used to fill the output area not covered by the rotated
  5340. image. For the generalsyntax of this option, check the "Color" section in the
  5341. ffmpeg-utils manual. If the special value "none" is selected then no
  5342. background is printed (useful for example if the background is never shown).
  5343. Default value is "black".
  5344. @end table
  5345. The expressions for the angle and the output size can contain the
  5346. following constants and functions:
  5347. @table @option
  5348. @item n
  5349. sequential number of the input frame, starting from 0. It is always NAN
  5350. before the first frame is filtered.
  5351. @item t
  5352. time in seconds of the input frame, it is set to 0 when the filter is
  5353. configured. It is always NAN before the first frame is filtered.
  5354. @item hsub
  5355. @item vsub
  5356. horizontal and vertical chroma subsample values. For example for the
  5357. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5358. @item in_w, iw
  5359. @item in_h, ih
  5360. the input video width and height
  5361. @item out_w, ow
  5362. @item out_h, oh
  5363. the output width and height, that is the size of the padded area as
  5364. specified by the @var{width} and @var{height} expressions
  5365. @item rotw(a)
  5366. @item roth(a)
  5367. the minimal width/height required for completely containing the input
  5368. video rotated by @var{a} radians.
  5369. These are only available when computing the @option{out_w} and
  5370. @option{out_h} expressions.
  5371. @end table
  5372. @subsection Examples
  5373. @itemize
  5374. @item
  5375. Rotate the input by PI/6 radians clockwise:
  5376. @example
  5377. rotate=PI/6
  5378. @end example
  5379. @item
  5380. Rotate the input by PI/6 radians counter-clockwise:
  5381. @example
  5382. rotate=-PI/6
  5383. @end example
  5384. @item
  5385. Rotate the input by 45 degrees clockwise:
  5386. @example
  5387. rotate=45*PI/180
  5388. @end example
  5389. @item
  5390. Apply a constant rotation with period T, starting from an angle of PI/3:
  5391. @example
  5392. rotate=PI/3+2*PI*t/T
  5393. @end example
  5394. @item
  5395. Make the input video rotation oscillating with a period of T
  5396. seconds and an amplitude of A radians:
  5397. @example
  5398. rotate=A*sin(2*PI/T*t)
  5399. @end example
  5400. @item
  5401. Rotate the video, output size is chosen so that the whole rotating
  5402. input video is always completely contained in the output:
  5403. @example
  5404. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  5405. @end example
  5406. @item
  5407. Rotate the video, reduce the output size so that no background is ever
  5408. shown:
  5409. @example
  5410. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  5411. @end example
  5412. @end itemize
  5413. @subsection Commands
  5414. The filter supports the following commands:
  5415. @table @option
  5416. @item a, angle
  5417. Set the angle expression.
  5418. The command accepts the same syntax of the corresponding option.
  5419. If the specified expression is not valid, it is kept at its current
  5420. value.
  5421. @end table
  5422. @section sab
  5423. Apply Shape Adaptive Blur.
  5424. The filter accepts the following options:
  5425. @table @option
  5426. @item luma_radius, lr
  5427. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  5428. value is 1.0. A greater value will result in a more blurred image, and
  5429. in slower processing.
  5430. @item luma_pre_filter_radius, lpfr
  5431. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  5432. value is 1.0.
  5433. @item luma_strength, ls
  5434. Set luma maximum difference between pixels to still be considered, must
  5435. be a value in the 0.1-100.0 range, default value is 1.0.
  5436. @item chroma_radius, cr
  5437. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  5438. greater value will result in a more blurred image, and in slower
  5439. processing.
  5440. @item chroma_pre_filter_radius, cpfr
  5441. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  5442. @item chroma_strength, cs
  5443. Set chroma maximum difference between pixels to still be considered,
  5444. must be a value in the 0.1-100.0 range.
  5445. @end table
  5446. Each chroma option value, if not explicitly specified, is set to the
  5447. corresponding luma option value.
  5448. @anchor{scale}
  5449. @section scale
  5450. Scale (resize) the input video, using the libswscale library.
  5451. The scale filter forces the output display aspect ratio to be the same
  5452. of the input, by changing the output sample aspect ratio.
  5453. If the input image format is different from the format requested by
  5454. the next filter, the scale filter will convert the input to the
  5455. requested format.
  5456. @subsection Options
  5457. The filter accepts the following options, or any of the options
  5458. supported by the libswscale scaler.
  5459. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  5460. the complete list of scaler options.
  5461. @table @option
  5462. @item width, w
  5463. @item height, h
  5464. Set the output video dimension expression. Default value is the input
  5465. dimension.
  5466. If the value is 0, the input width is used for the output.
  5467. If one of the values is -1, the scale filter will use a value that
  5468. maintains the aspect ratio of the input image, calculated from the
  5469. other specified dimension. If both of them are -1, the input size is
  5470. used
  5471. If one of the values is -n with n > 1, the scale filter will also use a value
  5472. that maintains the aspect ratio of the input image, calculated from the other
  5473. specified dimension. After that it will, however, make sure that the calculated
  5474. dimension is divisible by n and adjust the value if necessary.
  5475. See below for the list of accepted constants for use in the dimension
  5476. expression.
  5477. @item interl
  5478. Set the interlacing mode. It accepts the following values:
  5479. @table @samp
  5480. @item 1
  5481. Force interlaced aware scaling.
  5482. @item 0
  5483. Do not apply interlaced scaling.
  5484. @item -1
  5485. Select interlaced aware scaling depending on whether the source frames
  5486. are flagged as interlaced or not.
  5487. @end table
  5488. Default value is @samp{0}.
  5489. @item flags
  5490. Set libswscale scaling flags. See
  5491. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  5492. complete list of values. If not explicitly specified the filter applies
  5493. the default flags.
  5494. @item size, s
  5495. Set the video size. For the syntax of this option, check the "Video size"
  5496. section in the ffmpeg-utils manual.
  5497. @item in_color_matrix
  5498. @item out_color_matrix
  5499. Set in/output YCbCr color space type.
  5500. This allows the autodetected value to be overridden as well as allows forcing
  5501. a specific value used for the output and encoder.
  5502. If not specified, the color space type depends on the pixel format.
  5503. Possible values:
  5504. @table @samp
  5505. @item auto
  5506. Choose automatically.
  5507. @item bt709
  5508. Format conforming to International Telecommunication Union (ITU)
  5509. Recommendation BT.709.
  5510. @item fcc
  5511. Set color space conforming to the United States Federal Communications
  5512. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  5513. @item bt601
  5514. Set color space conforming to:
  5515. @itemize
  5516. @item
  5517. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  5518. @item
  5519. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  5520. @item
  5521. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  5522. @end itemize
  5523. @item smpte240m
  5524. Set color space conforming to SMPTE ST 240:1999.
  5525. @end table
  5526. @item in_range
  5527. @item out_range
  5528. Set in/output YCbCr sample range.
  5529. This allows the autodetected value to be overridden as well as allows forcing
  5530. a specific value used for the output and encoder. If not specified, the
  5531. range depends on the pixel format. Possible values:
  5532. @table @samp
  5533. @item auto
  5534. Choose automatically.
  5535. @item jpeg/full/pc
  5536. Set full range (0-255 in case of 8-bit luma).
  5537. @item mpeg/tv
  5538. Set "MPEG" range (16-235 in case of 8-bit luma).
  5539. @end table
  5540. @item force_original_aspect_ratio
  5541. Enable decreasing or increasing output video width or height if necessary to
  5542. keep the original aspect ratio. Possible values:
  5543. @table @samp
  5544. @item disable
  5545. Scale the video as specified and disable this feature.
  5546. @item decrease
  5547. The output video dimensions will automatically be decreased if needed.
  5548. @item increase
  5549. The output video dimensions will automatically be increased if needed.
  5550. @end table
  5551. One useful instance of this option is that when you know a specific device's
  5552. maximum allowed resolution, you can use this to limit the output video to
  5553. that, while retaining the aspect ratio. For example, device A allows
  5554. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  5555. decrease) and specifying 1280x720 to the command line makes the output
  5556. 1280x533.
  5557. Please note that this is a different thing than specifying -1 for @option{w}
  5558. or @option{h}, you still need to specify the output resolution for this option
  5559. to work.
  5560. @end table
  5561. The values of the @option{w} and @option{h} options are expressions
  5562. containing the following constants:
  5563. @table @var
  5564. @item in_w
  5565. @item in_h
  5566. The input width and height
  5567. @item iw
  5568. @item ih
  5569. These are the same as @var{in_w} and @var{in_h}.
  5570. @item out_w
  5571. @item out_h
  5572. The output (scaled) width and height
  5573. @item ow
  5574. @item oh
  5575. These are the same as @var{out_w} and @var{out_h}
  5576. @item a
  5577. The same as @var{iw} / @var{ih}
  5578. @item sar
  5579. input sample aspect ratio
  5580. @item dar
  5581. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  5582. @item hsub
  5583. @item vsub
  5584. horizontal and vertical input chroma subsample values. For example for the
  5585. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5586. @item ohsub
  5587. @item ovsub
  5588. horizontal and vertical output chroma subsample values. For example for the
  5589. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5590. @end table
  5591. @subsection Examples
  5592. @itemize
  5593. @item
  5594. Scale the input video to a size of 200x100
  5595. @example
  5596. scale=w=200:h=100
  5597. @end example
  5598. This is equivalent to:
  5599. @example
  5600. scale=200:100
  5601. @end example
  5602. or:
  5603. @example
  5604. scale=200x100
  5605. @end example
  5606. @item
  5607. Specify a size abbreviation for the output size:
  5608. @example
  5609. scale=qcif
  5610. @end example
  5611. which can also be written as:
  5612. @example
  5613. scale=size=qcif
  5614. @end example
  5615. @item
  5616. Scale the input to 2x:
  5617. @example
  5618. scale=w=2*iw:h=2*ih
  5619. @end example
  5620. @item
  5621. The above is the same as:
  5622. @example
  5623. scale=2*in_w:2*in_h
  5624. @end example
  5625. @item
  5626. Scale the input to 2x with forced interlaced scaling:
  5627. @example
  5628. scale=2*iw:2*ih:interl=1
  5629. @end example
  5630. @item
  5631. Scale the input to half size:
  5632. @example
  5633. scale=w=iw/2:h=ih/2
  5634. @end example
  5635. @item
  5636. Increase the width, and set the height to the same size:
  5637. @example
  5638. scale=3/2*iw:ow
  5639. @end example
  5640. @item
  5641. Seek Greek harmony:
  5642. @example
  5643. scale=iw:1/PHI*iw
  5644. scale=ih*PHI:ih
  5645. @end example
  5646. @item
  5647. Increase the height, and set the width to 3/2 of the height:
  5648. @example
  5649. scale=w=3/2*oh:h=3/5*ih
  5650. @end example
  5651. @item
  5652. Increase the size, making the size a multiple of the chroma
  5653. subsample values:
  5654. @example
  5655. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  5656. @end example
  5657. @item
  5658. Increase the width to a maximum of 500 pixels,
  5659. keeping the same aspect ratio as the input:
  5660. @example
  5661. scale=w='min(500\, iw*3/2):h=-1'
  5662. @end example
  5663. @end itemize
  5664. @section separatefields
  5665. The @code{separatefields} takes a frame-based video input and splits
  5666. each frame into its components fields, producing a new half height clip
  5667. with twice the frame rate and twice the frame count.
  5668. This filter use field-dominance information in frame to decide which
  5669. of each pair of fields to place first in the output.
  5670. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  5671. @section setdar, setsar
  5672. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  5673. output video.
  5674. This is done by changing the specified Sample (aka Pixel) Aspect
  5675. Ratio, according to the following equation:
  5676. @example
  5677. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  5678. @end example
  5679. Keep in mind that the @code{setdar} filter does not modify the pixel
  5680. dimensions of the video frame. Also, the display aspect ratio set by
  5681. this filter may be changed by later filters in the filterchain,
  5682. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  5683. applied.
  5684. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  5685. the filter output video.
  5686. Note that as a consequence of the application of this filter, the
  5687. output display aspect ratio will change according to the equation
  5688. above.
  5689. Keep in mind that the sample aspect ratio set by the @code{setsar}
  5690. filter may be changed by later filters in the filterchain, e.g. if
  5691. another "setsar" or a "setdar" filter is applied.
  5692. It accepts the following parameters:
  5693. @table @option
  5694. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  5695. Set the aspect ratio used by the filter.
  5696. The parameter can be a floating point number string, an expression, or
  5697. a string of the form @var{num}:@var{den}, where @var{num} and
  5698. @var{den} are the numerator and denominator of the aspect ratio. If
  5699. the parameter is not specified, it is assumed the value "0".
  5700. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  5701. should be escaped.
  5702. @item max
  5703. Set the maximum integer value to use for expressing numerator and
  5704. denominator when reducing the expressed aspect ratio to a rational.
  5705. Default value is @code{100}.
  5706. @end table
  5707. The parameter @var{sar} is an expression containing
  5708. the following constants:
  5709. @table @option
  5710. @item E, PI, PHI
  5711. These are approximated values for the mathematical constants e
  5712. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  5713. @item w, h
  5714. The input width and height.
  5715. @item a
  5716. These are the same as @var{w} / @var{h}.
  5717. @item sar
  5718. The input sample aspect ratio.
  5719. @item dar
  5720. The input display aspect ratio. It is the same as
  5721. (@var{w} / @var{h}) * @var{sar}.
  5722. @item hsub, vsub
  5723. Horizontal and vertical chroma subsample values. For example, for the
  5724. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. To change the display aspect ratio to 16:9, specify one of the following:
  5730. @example
  5731. setdar=dar=1.77777
  5732. setdar=dar=16/9
  5733. setdar=dar=1.77777
  5734. @end example
  5735. @item
  5736. To change the sample aspect ratio to 10:11, specify:
  5737. @example
  5738. setsar=sar=10/11
  5739. @end example
  5740. @item
  5741. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  5742. 1000 in the aspect ratio reduction, use the command:
  5743. @example
  5744. setdar=ratio=16/9:max=1000
  5745. @end example
  5746. @end itemize
  5747. @anchor{setfield}
  5748. @section setfield
  5749. Force field for the output video frame.
  5750. The @code{setfield} filter marks the interlace type field for the
  5751. output frames. It does not change the input frame, but only sets the
  5752. corresponding property, which affects how the frame is treated by
  5753. following filters (e.g. @code{fieldorder} or @code{yadif}).
  5754. The filter accepts the following options:
  5755. @table @option
  5756. @item mode
  5757. Available values are:
  5758. @table @samp
  5759. @item auto
  5760. Keep the same field property.
  5761. @item bff
  5762. Mark the frame as bottom-field-first.
  5763. @item tff
  5764. Mark the frame as top-field-first.
  5765. @item prog
  5766. Mark the frame as progressive.
  5767. @end table
  5768. @end table
  5769. @section showinfo
  5770. Show a line containing various information for each input video frame.
  5771. The input video is not modified.
  5772. The shown line contains a sequence of key/value pairs of the form
  5773. @var{key}:@var{value}.
  5774. It accepts the following parameters:
  5775. @table @option
  5776. @item n
  5777. The (sequential) number of the input frame, starting from 0.
  5778. @item pts
  5779. The Presentation TimeStamp of the input frame, expressed as a number of
  5780. time base units. The time base unit depends on the filter input pad.
  5781. @item pts_time
  5782. The Presentation TimeStamp of the input frame, expressed as a number of
  5783. seconds.
  5784. @item pos
  5785. The position of the frame in the input stream, or -1 if this information is
  5786. unavailable and/or meaningless (for example in case of synthetic video).
  5787. @item fmt
  5788. The pixel format name.
  5789. @item sar
  5790. The sample aspect ratio of the input frame, expressed in the form
  5791. @var{num}/@var{den}.
  5792. @item s
  5793. The size of the input frame. For the syntax of this option, check the "Video size"
  5794. section in the ffmpeg-utils manual.
  5795. @item i
  5796. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  5797. for bottom field first).
  5798. @item iskey
  5799. This is 1 if the frame is a key frame, 0 otherwise.
  5800. @item type
  5801. The picture type of the input frame ("I" for an I-frame, "P" for a
  5802. P-frame, "B" for a B-frame, or "?" for an unknown type).
  5803. Also refer to the documentation of the @code{AVPictureType} enum and of
  5804. the @code{av_get_picture_type_char} function defined in
  5805. @file{libavutil/avutil.h}.
  5806. @item checksum
  5807. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  5808. @item plane_checksum
  5809. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  5810. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  5811. @end table
  5812. @section shuffleplanes
  5813. Reorder and/or duplicate video planes.
  5814. It accepts the following parameters:
  5815. @table @option
  5816. @item map0
  5817. The index of the input plane to be used as the first output plane.
  5818. @item map1
  5819. The index of the input plane to be used as the second output plane.
  5820. @item map2
  5821. The index of the input plane to be used as the third output plane.
  5822. @item map3
  5823. The index of the input plane to be used as the fourth output plane.
  5824. @end table
  5825. The first plane has the index 0. The default is to keep the input unchanged.
  5826. Swap the second and third planes of the input:
  5827. @example
  5828. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  5829. @end example
  5830. @section signalstats
  5831. Evaluate various visual metrics that assist in determining issues associated
  5832. with the digitization of analog video media.
  5833. By default the filter will log these metadata values:
  5834. @table @option
  5835. @item YMIN
  5836. Display the minimal Y value contained within the input frame. Expressed in
  5837. range of [0-255].
  5838. @item YLOW
  5839. Display the Y value at the 10% percentile within the input frame. Expressed in
  5840. range of [0-255].
  5841. @item YAVG
  5842. Display the average Y value within the input frame. Expressed in range of
  5843. [0-255].
  5844. @item YHIGH
  5845. Display the Y value at the 90% percentile within the input frame. Expressed in
  5846. range of [0-255].
  5847. @item YMAX
  5848. Display the maximum Y value contained within the input frame. Expressed in
  5849. range of [0-255].
  5850. @item UMIN
  5851. Display the minimal U value contained within the input frame. Expressed in
  5852. range of [0-255].
  5853. @item ULOW
  5854. Display the U value at the 10% percentile within the input frame. Expressed in
  5855. range of [0-255].
  5856. @item UAVG
  5857. Display the average U value within the input frame. Expressed in range of
  5858. [0-255].
  5859. @item UHIGH
  5860. Display the U value at the 90% percentile within the input frame. Expressed in
  5861. range of [0-255].
  5862. @item UMAX
  5863. Display the maximum U value contained within the input frame. Expressed in
  5864. range of [0-255].
  5865. @item VMIN
  5866. Display the minimal V value contained within the input frame. Expressed in
  5867. range of [0-255].
  5868. @item VLOW
  5869. Display the V value at the 10% percentile within the input frame. Expressed in
  5870. range of [0-255].
  5871. @item VAVG
  5872. Display the average V value within the input frame. Expressed in range of
  5873. [0-255].
  5874. @item VHIGH
  5875. Display the V value at the 90% percentile within the input frame. Expressed in
  5876. range of [0-255].
  5877. @item VMAX
  5878. Display the maximum V value contained within the input frame. Expressed in
  5879. range of [0-255].
  5880. @item SATMIN
  5881. Display the minimal saturation value contained within the input frame.
  5882. Expressed in range of [0-~181.02].
  5883. @item SATLOW
  5884. Display the saturation value at the 10% percentile within the input frame.
  5885. Expressed in range of [0-~181.02].
  5886. @item SATAVG
  5887. Display the average saturation value within the input frame. Expressed in range
  5888. of [0-~181.02].
  5889. @item SATHIGH
  5890. Display the saturation value at the 90% percentile within the input frame.
  5891. Expressed in range of [0-~181.02].
  5892. @item SATMAX
  5893. Display the maximum saturation value contained within the input frame.
  5894. Expressed in range of [0-~181.02].
  5895. @item HUEMED
  5896. Display the median value for hue within the input frame. Expressed in range of
  5897. [0-360].
  5898. @item HUEAVG
  5899. Display the average value for hue within the input frame. Expressed in range of
  5900. [0-360].
  5901. @item YDIF
  5902. Display the average of sample value difference between all values of the Y
  5903. plane in the current frame and corresponding values of the previous input frame.
  5904. Expressed in range of [0-255].
  5905. @item UDIF
  5906. Display the average of sample value difference between all values of the U
  5907. plane in the current frame and corresponding values of the previous input frame.
  5908. Expressed in range of [0-255].
  5909. @item VDIF
  5910. Display the average of sample value difference between all values of the V
  5911. plane in the current frame and corresponding values of the previous input frame.
  5912. Expressed in range of [0-255].
  5913. @end table
  5914. The filter accepts the following options:
  5915. @table @option
  5916. @item stat
  5917. @item out
  5918. @option{stat} specify an additional form of image analysis.
  5919. @option{out} output video with the specified type of pixel highlighted.
  5920. Both options accept the following values:
  5921. @table @samp
  5922. @item tout
  5923. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  5924. unlike the neighboring pixels of the same field. Examples of temporal outliers
  5925. include the results of video dropouts, head clogs, or tape tracking issues.
  5926. @item vrep
  5927. Identify @var{vertical line repetition}. Vertical line repetition includes
  5928. similar rows of pixels within a frame. In born-digital video vertical line
  5929. repetition is common, but this pattern is uncommon in video digitized from an
  5930. analog source. When it occurs in video that results from the digitization of an
  5931. analog source it can indicate concealment from a dropout compensator.
  5932. @item brng
  5933. Identify pixels that fall outside of legal broadcast range.
  5934. @end table
  5935. @item color, c
  5936. Set the highlight color for the @option{out} option. The default color is
  5937. yellow.
  5938. @end table
  5939. @subsection Examples
  5940. @itemize
  5941. @item
  5942. Output data of various video metrics:
  5943. @example
  5944. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  5945. @end example
  5946. @item
  5947. Output specific data about the minimum and maximum values of the Y plane per frame:
  5948. @example
  5949. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  5950. @end example
  5951. @item
  5952. Playback video while highlighting pixels that are outside of broadcast range in red.
  5953. @example
  5954. ffplay example.mov -vf signalstats="out=brng:color=red"
  5955. @end example
  5956. @item
  5957. Playback video with signalstats metadata drawn over the frame.
  5958. @example
  5959. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  5960. @end example
  5961. The contents of signalstat_drawtext.txt used in the command are:
  5962. @example
  5963. time %@{pts:hms@}
  5964. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  5965. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  5966. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  5967. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  5968. @end example
  5969. @end itemize
  5970. @anchor{smartblur}
  5971. @section smartblur
  5972. Blur the input video without impacting the outlines.
  5973. It accepts the following options:
  5974. @table @option
  5975. @item luma_radius, lr
  5976. Set the luma radius. The option value must be a float number in
  5977. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5978. used to blur the image (slower if larger). Default value is 1.0.
  5979. @item luma_strength, ls
  5980. Set the luma strength. The option value must be a float number
  5981. in the range [-1.0,1.0] that configures the blurring. A value included
  5982. in [0.0,1.0] will blur the image whereas a value included in
  5983. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5984. @item luma_threshold, lt
  5985. Set the luma threshold used as a coefficient to determine
  5986. whether a pixel should be blurred or not. The option value must be an
  5987. integer in the range [-30,30]. A value of 0 will filter all the image,
  5988. a value included in [0,30] will filter flat areas and a value included
  5989. in [-30,0] will filter edges. Default value is 0.
  5990. @item chroma_radius, cr
  5991. Set the chroma radius. The option value must be a float number in
  5992. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5993. used to blur the image (slower if larger). Default value is 1.0.
  5994. @item chroma_strength, cs
  5995. Set the chroma strength. The option value must be a float number
  5996. in the range [-1.0,1.0] that configures the blurring. A value included
  5997. in [0.0,1.0] will blur the image whereas a value included in
  5998. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5999. @item chroma_threshold, ct
  6000. Set the chroma threshold used as a coefficient to determine
  6001. whether a pixel should be blurred or not. The option value must be an
  6002. integer in the range [-30,30]. A value of 0 will filter all the image,
  6003. a value included in [0,30] will filter flat areas and a value included
  6004. in [-30,0] will filter edges. Default value is 0.
  6005. @end table
  6006. If a chroma option is not explicitly set, the corresponding luma value
  6007. is set.
  6008. @section stereo3d
  6009. Convert between different stereoscopic image formats.
  6010. The filters accept the following options:
  6011. @table @option
  6012. @item in
  6013. Set stereoscopic image format of input.
  6014. Available values for input image formats are:
  6015. @table @samp
  6016. @item sbsl
  6017. side by side parallel (left eye left, right eye right)
  6018. @item sbsr
  6019. side by side crosseye (right eye left, left eye right)
  6020. @item sbs2l
  6021. side by side parallel with half width resolution
  6022. (left eye left, right eye right)
  6023. @item sbs2r
  6024. side by side crosseye with half width resolution
  6025. (right eye left, left eye right)
  6026. @item abl
  6027. above-below (left eye above, right eye below)
  6028. @item abr
  6029. above-below (right eye above, left eye below)
  6030. @item ab2l
  6031. above-below with half height resolution
  6032. (left eye above, right eye below)
  6033. @item ab2r
  6034. above-below with half height resolution
  6035. (right eye above, left eye below)
  6036. @item al
  6037. alternating frames (left eye first, right eye second)
  6038. @item ar
  6039. alternating frames (right eye first, left eye second)
  6040. Default value is @samp{sbsl}.
  6041. @end table
  6042. @item out
  6043. Set stereoscopic image format of output.
  6044. Available values for output image formats are all the input formats as well as:
  6045. @table @samp
  6046. @item arbg
  6047. anaglyph red/blue gray
  6048. (red filter on left eye, blue filter on right eye)
  6049. @item argg
  6050. anaglyph red/green gray
  6051. (red filter on left eye, green filter on right eye)
  6052. @item arcg
  6053. anaglyph red/cyan gray
  6054. (red filter on left eye, cyan filter on right eye)
  6055. @item arch
  6056. anaglyph red/cyan half colored
  6057. (red filter on left eye, cyan filter on right eye)
  6058. @item arcc
  6059. anaglyph red/cyan color
  6060. (red filter on left eye, cyan filter on right eye)
  6061. @item arcd
  6062. anaglyph red/cyan color optimized with the least squares projection of dubois
  6063. (red filter on left eye, cyan filter on right eye)
  6064. @item agmg
  6065. anaglyph green/magenta gray
  6066. (green filter on left eye, magenta filter on right eye)
  6067. @item agmh
  6068. anaglyph green/magenta half colored
  6069. (green filter on left eye, magenta filter on right eye)
  6070. @item agmc
  6071. anaglyph green/magenta colored
  6072. (green filter on left eye, magenta filter on right eye)
  6073. @item agmd
  6074. anaglyph green/magenta color optimized with the least squares projection of dubois
  6075. (green filter on left eye, magenta filter on right eye)
  6076. @item aybg
  6077. anaglyph yellow/blue gray
  6078. (yellow filter on left eye, blue filter on right eye)
  6079. @item aybh
  6080. anaglyph yellow/blue half colored
  6081. (yellow filter on left eye, blue filter on right eye)
  6082. @item aybc
  6083. anaglyph yellow/blue colored
  6084. (yellow filter on left eye, blue filter on right eye)
  6085. @item aybd
  6086. anaglyph yellow/blue color optimized with the least squares projection of dubois
  6087. (yellow filter on left eye, blue filter on right eye)
  6088. @item irl
  6089. interleaved rows (left eye has top row, right eye starts on next row)
  6090. @item irr
  6091. interleaved rows (right eye has top row, left eye starts on next row)
  6092. @item ml
  6093. mono output (left eye only)
  6094. @item mr
  6095. mono output (right eye only)
  6096. @end table
  6097. Default value is @samp{arcd}.
  6098. @end table
  6099. @subsection Examples
  6100. @itemize
  6101. @item
  6102. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  6103. @example
  6104. stereo3d=sbsl:aybd
  6105. @end example
  6106. @item
  6107. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  6108. @example
  6109. stereo3d=abl:sbsr
  6110. @end example
  6111. @end itemize
  6112. @section spp
  6113. Apply a simple postprocessing filter that compresses and decompresses the image
  6114. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  6115. and average the results.
  6116. The filter accepts the following options:
  6117. @table @option
  6118. @item quality
  6119. Set quality. This option defines the number of levels for averaging. It accepts
  6120. an integer in the range 0-6. If set to @code{0}, the filter will have no
  6121. effect. A value of @code{6} means the higher quality. For each increment of
  6122. that value the speed drops by a factor of approximately 2. Default value is
  6123. @code{3}.
  6124. @item qp
  6125. Force a constant quantization parameter. If not set, the filter will use the QP
  6126. from the video stream (if available).
  6127. @item mode
  6128. Set thresholding mode. Available modes are:
  6129. @table @samp
  6130. @item hard
  6131. Set hard thresholding (default).
  6132. @item soft
  6133. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6134. @end table
  6135. @item use_bframe_qp
  6136. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6137. option may cause flicker since the B-Frames have often larger QP. Default is
  6138. @code{0} (not enabled).
  6139. @end table
  6140. @anchor{subtitles}
  6141. @section subtitles
  6142. Draw subtitles on top of input video using the libass library.
  6143. To enable compilation of this filter you need to configure FFmpeg with
  6144. @code{--enable-libass}. This filter also requires a build with libavcodec and
  6145. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  6146. Alpha) subtitles format.
  6147. The filter accepts the following options:
  6148. @table @option
  6149. @item filename, f
  6150. Set the filename of the subtitle file to read. It must be specified.
  6151. @item original_size
  6152. Specify the size of the original video, the video for which the ASS file
  6153. was composed. For the syntax of this option, check the "Video size" section in
  6154. the ffmpeg-utils manual. Due to a misdesign in ASS aspect ratio arithmetic,
  6155. this is necessary to correctly scale the fonts if the aspect ratio has been
  6156. changed.
  6157. @item charenc
  6158. Set subtitles input character encoding. @code{subtitles} filter only. Only
  6159. useful if not UTF-8.
  6160. @item stream_index, si
  6161. Set subtitles stream index. @code{subtitles} filter only.
  6162. @end table
  6163. If the first key is not specified, it is assumed that the first value
  6164. specifies the @option{filename}.
  6165. For example, to render the file @file{sub.srt} on top of the input
  6166. video, use the command:
  6167. @example
  6168. subtitles=sub.srt
  6169. @end example
  6170. which is equivalent to:
  6171. @example
  6172. subtitles=filename=sub.srt
  6173. @end example
  6174. To render the default subtitles stream from file @file{video.mkv}, use:
  6175. @example
  6176. subtitles=video.mkv
  6177. @end example
  6178. To render the second subtitles stream from that file, use:
  6179. @example
  6180. subtitles=video.mkv:si=1
  6181. @end example
  6182. @section super2xsai
  6183. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  6184. Interpolate) pixel art scaling algorithm.
  6185. Useful for enlarging pixel art images without reducing sharpness.
  6186. @section swapuv
  6187. Swap U & V plane.
  6188. @section telecine
  6189. Apply telecine process to the video.
  6190. This filter accepts the following options:
  6191. @table @option
  6192. @item first_field
  6193. @table @samp
  6194. @item top, t
  6195. top field first
  6196. @item bottom, b
  6197. bottom field first
  6198. The default value is @code{top}.
  6199. @end table
  6200. @item pattern
  6201. A string of numbers representing the pulldown pattern you wish to apply.
  6202. The default value is @code{23}.
  6203. @end table
  6204. @example
  6205. Some typical patterns:
  6206. NTSC output (30i):
  6207. 27.5p: 32222
  6208. 24p: 23 (classic)
  6209. 24p: 2332 (preferred)
  6210. 20p: 33
  6211. 18p: 334
  6212. 16p: 3444
  6213. PAL output (25i):
  6214. 27.5p: 12222
  6215. 24p: 222222222223 ("Euro pulldown")
  6216. 16.67p: 33
  6217. 16p: 33333334
  6218. @end example
  6219. @section thumbnail
  6220. Select the most representative frame in a given sequence of consecutive frames.
  6221. The filter accepts the following options:
  6222. @table @option
  6223. @item n
  6224. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  6225. will pick one of them, and then handle the next batch of @var{n} frames until
  6226. the end. Default is @code{100}.
  6227. @end table
  6228. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  6229. value will result in a higher memory usage, so a high value is not recommended.
  6230. @subsection Examples
  6231. @itemize
  6232. @item
  6233. Extract one picture each 50 frames:
  6234. @example
  6235. thumbnail=50
  6236. @end example
  6237. @item
  6238. Complete example of a thumbnail creation with @command{ffmpeg}:
  6239. @example
  6240. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  6241. @end example
  6242. @end itemize
  6243. @section tile
  6244. Tile several successive frames together.
  6245. The filter accepts the following options:
  6246. @table @option
  6247. @item layout
  6248. Set the grid size (i.e. the number of lines and columns). For the syntax of
  6249. this option, check the "Video size" section in the ffmpeg-utils manual.
  6250. @item nb_frames
  6251. Set the maximum number of frames to render in the given area. It must be less
  6252. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  6253. the area will be used.
  6254. @item margin
  6255. Set the outer border margin in pixels.
  6256. @item padding
  6257. Set the inner border thickness (i.e. the number of pixels between frames). For
  6258. more advanced padding options (such as having different values for the edges),
  6259. refer to the pad video filter.
  6260. @item color
  6261. Specify the color of the unused areaFor the syntax of this option, check the
  6262. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  6263. is "black".
  6264. @end table
  6265. @subsection Examples
  6266. @itemize
  6267. @item
  6268. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  6269. @example
  6270. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  6271. @end example
  6272. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  6273. duplicating each output frame to accommodate the originally detected frame
  6274. rate.
  6275. @item
  6276. Display @code{5} pictures in an area of @code{3x2} frames,
  6277. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  6278. mixed flat and named options:
  6279. @example
  6280. tile=3x2:nb_frames=5:padding=7:margin=2
  6281. @end example
  6282. @end itemize
  6283. @section tinterlace
  6284. Perform various types of temporal field interlacing.
  6285. Frames are counted starting from 1, so the first input frame is
  6286. considered odd.
  6287. The filter accepts the following options:
  6288. @table @option
  6289. @item mode
  6290. Specify the mode of the interlacing. This option can also be specified
  6291. as a value alone. See below for a list of values for this option.
  6292. Available values are:
  6293. @table @samp
  6294. @item merge, 0
  6295. Move odd frames into the upper field, even into the lower field,
  6296. generating a double height frame at half frame rate.
  6297. @item drop_odd, 1
  6298. Only output even frames, odd frames are dropped, generating a frame with
  6299. unchanged height at half frame rate.
  6300. @item drop_even, 2
  6301. Only output odd frames, even frames are dropped, generating a frame with
  6302. unchanged height at half frame rate.
  6303. @item pad, 3
  6304. Expand each frame to full height, but pad alternate lines with black,
  6305. generating a frame with double height at the same input frame rate.
  6306. @item interleave_top, 4
  6307. Interleave the upper field from odd frames with the lower field from
  6308. even frames, generating a frame with unchanged height at half frame rate.
  6309. @item interleave_bottom, 5
  6310. Interleave the lower field from odd frames with the upper field from
  6311. even frames, generating a frame with unchanged height at half frame rate.
  6312. @item interlacex2, 6
  6313. Double frame rate with unchanged height. Frames are inserted each
  6314. containing the second temporal field from the previous input frame and
  6315. the first temporal field from the next input frame. This mode relies on
  6316. the top_field_first flag. Useful for interlaced video displays with no
  6317. field synchronisation.
  6318. @end table
  6319. Numeric values are deprecated but are accepted for backward
  6320. compatibility reasons.
  6321. Default mode is @code{merge}.
  6322. @item flags
  6323. Specify flags influencing the filter process.
  6324. Available value for @var{flags} is:
  6325. @table @option
  6326. @item low_pass_filter, vlfp
  6327. Enable vertical low-pass filtering in the filter.
  6328. Vertical low-pass filtering is required when creating an interlaced
  6329. destination from a progressive source which contains high-frequency
  6330. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  6331. patterning.
  6332. Vertical low-pass filtering can only be enabled for @option{mode}
  6333. @var{interleave_top} and @var{interleave_bottom}.
  6334. @end table
  6335. @end table
  6336. @section transpose
  6337. Transpose rows with columns in the input video and optionally flip it.
  6338. It accepts the following parameters:
  6339. @table @option
  6340. @item dir
  6341. Specify the transposition direction.
  6342. Can assume the following values:
  6343. @table @samp
  6344. @item 0, 4, cclock_flip
  6345. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  6346. @example
  6347. L.R L.l
  6348. . . -> . .
  6349. l.r R.r
  6350. @end example
  6351. @item 1, 5, clock
  6352. Rotate by 90 degrees clockwise, that is:
  6353. @example
  6354. L.R l.L
  6355. . . -> . .
  6356. l.r r.R
  6357. @end example
  6358. @item 2, 6, cclock
  6359. Rotate by 90 degrees counterclockwise, that is:
  6360. @example
  6361. L.R R.r
  6362. . . -> . .
  6363. l.r L.l
  6364. @end example
  6365. @item 3, 7, clock_flip
  6366. Rotate by 90 degrees clockwise and vertically flip, that is:
  6367. @example
  6368. L.R r.R
  6369. . . -> . .
  6370. l.r l.L
  6371. @end example
  6372. @end table
  6373. For values between 4-7, the transposition is only done if the input
  6374. video geometry is portrait and not landscape. These values are
  6375. deprecated, the @code{passthrough} option should be used instead.
  6376. Numerical values are deprecated, and should be dropped in favor of
  6377. symbolic constants.
  6378. @item passthrough
  6379. Do not apply the transposition if the input geometry matches the one
  6380. specified by the specified value. It accepts the following values:
  6381. @table @samp
  6382. @item none
  6383. Always apply transposition.
  6384. @item portrait
  6385. Preserve portrait geometry (when @var{height} >= @var{width}).
  6386. @item landscape
  6387. Preserve landscape geometry (when @var{width} >= @var{height}).
  6388. @end table
  6389. Default value is @code{none}.
  6390. @end table
  6391. For example to rotate by 90 degrees clockwise and preserve portrait
  6392. layout:
  6393. @example
  6394. transpose=dir=1:passthrough=portrait
  6395. @end example
  6396. The command above can also be specified as:
  6397. @example
  6398. transpose=1:portrait
  6399. @end example
  6400. @section trim
  6401. Trim the input so that the output contains one continuous subpart of the input.
  6402. It accepts the following parameters:
  6403. @table @option
  6404. @item start
  6405. Specify the time of the start of the kept section, i.e. the frame with the
  6406. timestamp @var{start} will be the first frame in the output.
  6407. @item end
  6408. Specify the time of the first frame that will be dropped, i.e. the frame
  6409. immediately preceding the one with the timestamp @var{end} will be the last
  6410. frame in the output.
  6411. @item start_pts
  6412. This is the same as @var{start}, except this option sets the start timestamp
  6413. in timebase units instead of seconds.
  6414. @item end_pts
  6415. This is the same as @var{end}, except this option sets the end timestamp
  6416. in timebase units instead of seconds.
  6417. @item duration
  6418. The maximum duration of the output in seconds.
  6419. @item start_frame
  6420. The number of the first frame that should be passed to the output.
  6421. @item end_frame
  6422. The number of the first frame that should be dropped.
  6423. @end table
  6424. @option{start}, @option{end}, @option{duration} are expressed as time
  6425. duration specifications, check the "Time duration" section in the
  6426. ffmpeg-utils manual.
  6427. Note that the first two sets of the start/end options and the @option{duration}
  6428. option look at the frame timestamp, while the _frame variants simply count the
  6429. frames that pass through the filter. Also note that this filter does not modify
  6430. the timestamps. If you wish for the output timestamps to start at zero, insert a
  6431. setpts filter after the trim filter.
  6432. If multiple start or end options are set, this filter tries to be greedy and
  6433. keep all the frames that match at least one of the specified constraints. To keep
  6434. only the part that matches all the constraints at once, chain multiple trim
  6435. filters.
  6436. The defaults are such that all the input is kept. So it is possible to set e.g.
  6437. just the end values to keep everything before the specified time.
  6438. Examples:
  6439. @itemize
  6440. @item
  6441. Drop everything except the second minute of input:
  6442. @example
  6443. ffmpeg -i INPUT -vf trim=60:120
  6444. @end example
  6445. @item
  6446. Keep only the first second:
  6447. @example
  6448. ffmpeg -i INPUT -vf trim=duration=1
  6449. @end example
  6450. @end itemize
  6451. @section unsharp
  6452. Sharpen or blur the input video.
  6453. It accepts the following parameters:
  6454. @table @option
  6455. @item luma_msize_x, lx
  6456. Set the luma matrix horizontal size. It must be an odd integer between
  6457. 3 and 63. The default value is 5.
  6458. @item luma_msize_y, ly
  6459. Set the luma matrix vertical size. It must be an odd integer between 3
  6460. and 63. The default value is 5.
  6461. @item luma_amount, la
  6462. Set the luma effect strength. It must be a floating point number, reasonable
  6463. values lay between -1.5 and 1.5.
  6464. Negative values will blur the input video, while positive values will
  6465. sharpen it, a value of zero will disable the effect.
  6466. Default value is 1.0.
  6467. @item chroma_msize_x, cx
  6468. Set the chroma matrix horizontal size. It must be an odd integer
  6469. between 3 and 63. The default value is 5.
  6470. @item chroma_msize_y, cy
  6471. Set the chroma matrix vertical size. It must be an odd integer
  6472. between 3 and 63. The default value is 5.
  6473. @item chroma_amount, ca
  6474. Set the chroma effect strength. It must be a floating point number, reasonable
  6475. values lay between -1.5 and 1.5.
  6476. Negative values will blur the input video, while positive values will
  6477. sharpen it, a value of zero will disable the effect.
  6478. Default value is 0.0.
  6479. @item opencl
  6480. If set to 1, specify using OpenCL capabilities, only available if
  6481. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  6482. @end table
  6483. All parameters are optional and default to the equivalent of the
  6484. string '5:5:1.0:5:5:0.0'.
  6485. @subsection Examples
  6486. @itemize
  6487. @item
  6488. Apply strong luma sharpen effect:
  6489. @example
  6490. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  6491. @end example
  6492. @item
  6493. Apply a strong blur of both luma and chroma parameters:
  6494. @example
  6495. unsharp=7:7:-2:7:7:-2
  6496. @end example
  6497. @end itemize
  6498. @anchor{vidstabdetect}
  6499. @section vidstabdetect
  6500. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  6501. @ref{vidstabtransform} for pass 2.
  6502. This filter generates a file with relative translation and rotation
  6503. transform information about subsequent frames, which is then used by
  6504. the @ref{vidstabtransform} filter.
  6505. To enable compilation of this filter you need to configure FFmpeg with
  6506. @code{--enable-libvidstab}.
  6507. This filter accepts the following options:
  6508. @table @option
  6509. @item result
  6510. Set the path to the file used to write the transforms information.
  6511. Default value is @file{transforms.trf}.
  6512. @item shakiness
  6513. Set how shaky the video is and how quick the camera is. It accepts an
  6514. integer in the range 1-10, a value of 1 means little shakiness, a
  6515. value of 10 means strong shakiness. Default value is 5.
  6516. @item accuracy
  6517. Set the accuracy of the detection process. It must be a value in the
  6518. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  6519. accuracy. Default value is 15.
  6520. @item stepsize
  6521. Set stepsize of the search process. The region around minimum is
  6522. scanned with 1 pixel resolution. Default value is 6.
  6523. @item mincontrast
  6524. Set minimum contrast. Below this value a local measurement field is
  6525. discarded. Must be a floating point value in the range 0-1. Default
  6526. value is 0.3.
  6527. @item tripod
  6528. Set reference frame number for tripod mode.
  6529. If enabled, the motion of the frames is compared to a reference frame
  6530. in the filtered stream, identified by the specified number. The idea
  6531. is to compensate all movements in a more-or-less static scene and keep
  6532. the camera view absolutely still.
  6533. If set to 0, it is disabled. The frames are counted starting from 1.
  6534. @item show
  6535. Show fields and transforms in the resulting frames. It accepts an
  6536. integer in the range 0-2. Default value is 0, which disables any
  6537. visualization.
  6538. @end table
  6539. @subsection Examples
  6540. @itemize
  6541. @item
  6542. Use default values:
  6543. @example
  6544. vidstabdetect
  6545. @end example
  6546. @item
  6547. Analyze strongly shaky movie and put the results in file
  6548. @file{mytransforms.trf}:
  6549. @example
  6550. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  6551. @end example
  6552. @item
  6553. Visualize the result of internal transformations in the resulting
  6554. video:
  6555. @example
  6556. vidstabdetect=show=1
  6557. @end example
  6558. @item
  6559. Analyze a video with medium shakiness using @command{ffmpeg}:
  6560. @example
  6561. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  6562. @end example
  6563. @end itemize
  6564. @anchor{vidstabtransform}
  6565. @section vidstabtransform
  6566. Video stabilization/deshaking: pass 2 of 2,
  6567. see @ref{vidstabdetect} for pass 1.
  6568. Read a file with transform information for each frame and
  6569. apply/compensate them. Together with the @ref{vidstabdetect}
  6570. filter this can be used to deshake videos. See also
  6571. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  6572. the unsharp filter, see below.
  6573. To enable compilation of this filter you need to configure FFmpeg with
  6574. @code{--enable-libvidstab}.
  6575. @subsection Options
  6576. @table @option
  6577. @item input
  6578. Set path to the file used to read the transforms. Default value is
  6579. @file{transforms.trf}).
  6580. @item smoothing
  6581. Set the number of frames (value*2 + 1) used for lowpass filtering the
  6582. camera movements. Default value is 10.
  6583. For example a number of 10 means that 21 frames are used (10 in the
  6584. past and 10 in the future) to smoothen the motion in the video. A
  6585. larger values leads to a smoother video, but limits the acceleration
  6586. of the camera (pan/tilt movements). 0 is a special case where a
  6587. static camera is simulated.
  6588. @item optalgo
  6589. Set the camera path optimization algorithm.
  6590. Accepted values are:
  6591. @table @samp
  6592. @item gauss
  6593. gaussian kernel low-pass filter on camera motion (default)
  6594. @item avg
  6595. averaging on transformations
  6596. @end table
  6597. @item maxshift
  6598. Set maximal number of pixels to translate frames. Default value is -1,
  6599. meaning no limit.
  6600. @item maxangle
  6601. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  6602. value is -1, meaning no limit.
  6603. @item crop
  6604. Specify how to deal with borders that may be visible due to movement
  6605. compensation.
  6606. Available values are:
  6607. @table @samp
  6608. @item keep
  6609. keep image information from previous frame (default)
  6610. @item black
  6611. fill the border black
  6612. @end table
  6613. @item invert
  6614. Invert transforms if set to 1. Default value is 0.
  6615. @item relative
  6616. Consider transforms as relative to previsou frame if set to 1,
  6617. absolute if set to 0. Default value is 0.
  6618. @item zoom
  6619. Set percentage to zoom. A positive value will result in a zoom-in
  6620. effect, a negative value in a zoom-out effect. Default value is 0 (no
  6621. zoom).
  6622. @item optzoom
  6623. Set optimal zooming to avoid borders.
  6624. Accepted values are:
  6625. @table @samp
  6626. @item 0
  6627. disabled
  6628. @item 1
  6629. optimal static zoom value is determined (only very strong movements
  6630. will lead to visible borders) (default)
  6631. @item 2
  6632. optimal adaptive zoom value is determined (no borders will be
  6633. visible), see @option{zoomspeed}
  6634. @end table
  6635. Note that the value given at zoom is added to the one calculated here.
  6636. @item zoomspeed
  6637. Set percent to zoom maximally each frame (enabled when
  6638. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  6639. 0.25.
  6640. @item interpol
  6641. Specify type of interpolation.
  6642. Available values are:
  6643. @table @samp
  6644. @item no
  6645. no interpolation
  6646. @item linear
  6647. linear only horizontal
  6648. @item bilinear
  6649. linear in both directions (default)
  6650. @item bicubic
  6651. cubic in both directions (slow)
  6652. @end table
  6653. @item tripod
  6654. Enable virtual tripod mode if set to 1, which is equivalent to
  6655. @code{relative=0:smoothing=0}. Default value is 0.
  6656. Use also @code{tripod} option of @ref{vidstabdetect}.
  6657. @item debug
  6658. Increase log verbosity if set to 1. Also the detected global motions
  6659. are written to the temporary file @file{global_motions.trf}. Default
  6660. value is 0.
  6661. @end table
  6662. @subsection Examples
  6663. @itemize
  6664. @item
  6665. Use @command{ffmpeg} for a typical stabilization with default values:
  6666. @example
  6667. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  6668. @end example
  6669. Note the use of the unsharp filter which is always recommended.
  6670. @item
  6671. Zoom in a bit more and load transform data from a given file:
  6672. @example
  6673. vidstabtransform=zoom=5:input="mytransforms.trf"
  6674. @end example
  6675. @item
  6676. Smoothen the video even more:
  6677. @example
  6678. vidstabtransform=smoothing=30
  6679. @end example
  6680. @end itemize
  6681. @section vflip
  6682. Flip the input video vertically.
  6683. For example, to vertically flip a video with @command{ffmpeg}:
  6684. @example
  6685. ffmpeg -i in.avi -vf "vflip" out.avi
  6686. @end example
  6687. @section vignette
  6688. Make or reverse a natural vignetting effect.
  6689. The filter accepts the following options:
  6690. @table @option
  6691. @item angle, a
  6692. Set lens angle expression as a number of radians.
  6693. The value is clipped in the @code{[0,PI/2]} range.
  6694. Default value: @code{"PI/5"}
  6695. @item x0
  6696. @item y0
  6697. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  6698. by default.
  6699. @item mode
  6700. Set forward/backward mode.
  6701. Available modes are:
  6702. @table @samp
  6703. @item forward
  6704. The larger the distance from the central point, the darker the image becomes.
  6705. @item backward
  6706. The larger the distance from the central point, the brighter the image becomes.
  6707. This can be used to reverse a vignette effect, though there is no automatic
  6708. detection to extract the lens @option{angle} and other settings (yet). It can
  6709. also be used to create a burning effect.
  6710. @end table
  6711. Default value is @samp{forward}.
  6712. @item eval
  6713. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  6714. It accepts the following values:
  6715. @table @samp
  6716. @item init
  6717. Evaluate expressions only once during the filter initialization.
  6718. @item frame
  6719. Evaluate expressions for each incoming frame. This is way slower than the
  6720. @samp{init} mode since it requires all the scalers to be re-computed, but it
  6721. allows advanced dynamic expressions.
  6722. @end table
  6723. Default value is @samp{init}.
  6724. @item dither
  6725. Set dithering to reduce the circular banding effects. Default is @code{1}
  6726. (enabled).
  6727. @item aspect
  6728. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  6729. Setting this value to the SAR of the input will make a rectangular vignetting
  6730. following the dimensions of the video.
  6731. Default is @code{1/1}.
  6732. @end table
  6733. @subsection Expressions
  6734. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  6735. following parameters.
  6736. @table @option
  6737. @item w
  6738. @item h
  6739. input width and height
  6740. @item n
  6741. the number of input frame, starting from 0
  6742. @item pts
  6743. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  6744. @var{TB} units, NAN if undefined
  6745. @item r
  6746. frame rate of the input video, NAN if the input frame rate is unknown
  6747. @item t
  6748. the PTS (Presentation TimeStamp) of the filtered video frame,
  6749. expressed in seconds, NAN if undefined
  6750. @item tb
  6751. time base of the input video
  6752. @end table
  6753. @subsection Examples
  6754. @itemize
  6755. @item
  6756. Apply simple strong vignetting effect:
  6757. @example
  6758. vignette=PI/4
  6759. @end example
  6760. @item
  6761. Make a flickering vignetting:
  6762. @example
  6763. vignette='PI/4+random(1)*PI/50':eval=frame
  6764. @end example
  6765. @end itemize
  6766. @section w3fdif
  6767. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  6768. Deinterlacing Filter").
  6769. Based on the process described by Martin Weston for BBC R&D, and
  6770. implemented based on the de-interlace algorithm written by Jim
  6771. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  6772. uses filter coefficients calculated by BBC R&D.
  6773. There are two sets of filter coefficients, so called "simple":
  6774. and "complex". Which set of filter coefficients is used can
  6775. be set by passing an optional parameter:
  6776. @table @option
  6777. @item filter
  6778. Set the interlacing filter coefficients. Accepts one of the following values:
  6779. @table @samp
  6780. @item simple
  6781. Simple filter coefficient set.
  6782. @item complex
  6783. More-complex filter coefficient set.
  6784. @end table
  6785. Default value is @samp{complex}.
  6786. @item deint
  6787. Specify which frames to deinterlace. Accept one of the following values:
  6788. @table @samp
  6789. @item all
  6790. Deinterlace all frames,
  6791. @item interlaced
  6792. Only deinterlace frames marked as interlaced.
  6793. @end table
  6794. Default value is @samp{all}.
  6795. @end table
  6796. @anchor{yadif}
  6797. @section yadif
  6798. Deinterlace the input video ("yadif" means "yet another deinterlacing
  6799. filter").
  6800. It accepts the following parameters:
  6801. @table @option
  6802. @item mode
  6803. The interlacing mode to adopt. It accepts one of the following values:
  6804. @table @option
  6805. @item 0, send_frame
  6806. Output one frame for each frame.
  6807. @item 1, send_field
  6808. Output one frame for each field.
  6809. @item 2, send_frame_nospatial
  6810. Like @code{send_frame}, but it skips the spatial interlacing check.
  6811. @item 3, send_field_nospatial
  6812. Like @code{send_field}, but it skips the spatial interlacing check.
  6813. @end table
  6814. The default value is @code{send_frame}.
  6815. @item parity
  6816. The picture field parity assumed for the input interlaced video. It accepts one
  6817. of the following values:
  6818. @table @option
  6819. @item 0, tff
  6820. Assume the top field is first.
  6821. @item 1, bff
  6822. Assume the bottom field is first.
  6823. @item -1, auto
  6824. Enable automatic detection of field parity.
  6825. @end table
  6826. The default value is @code{auto}.
  6827. If the interlacing is unknown or the decoder does not export this information,
  6828. top field first will be assumed.
  6829. @item deint
  6830. Specify which frames to deinterlace. Accept one of the following
  6831. values:
  6832. @table @option
  6833. @item 0, all
  6834. Deinterlace all frames.
  6835. @item 1, interlaced
  6836. Only deinterlace frames marked as interlaced.
  6837. @end table
  6838. The default value is @code{all}.
  6839. @end table
  6840. @section zoompan
  6841. Apply Zoom & Pan effect.
  6842. This filter accepts the following options:
  6843. @table @option
  6844. @item zoom, z
  6845. Set the zoom expression. Default is 1.
  6846. @item x
  6847. @item y
  6848. Set the x and y expression. Default is 0.
  6849. @item d
  6850. Set the duration expression in number of frames.
  6851. This sets for how many number of frames effect will last for
  6852. single input image.
  6853. @item s
  6854. Set the output image size, default is 'hd720'.
  6855. @end table
  6856. Each expression can contain the following constants:
  6857. @table @option
  6858. @item in_w, iw
  6859. Input width.
  6860. @item in_h, ih
  6861. Input height.
  6862. @item out_w, ow
  6863. Output width.
  6864. @item out_h, oh
  6865. Output height.
  6866. @item in
  6867. Input frame count.
  6868. @item on
  6869. Output frame count.
  6870. @item x
  6871. @item y
  6872. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  6873. for current input frame.
  6874. @item px
  6875. @item py
  6876. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  6877. not yet such frame (first input frame).
  6878. @item zoom
  6879. Last calculated zoom from 'z' expression for current input frame.
  6880. @item pzoom
  6881. Last calculated zoom of last output frame of previous input frame.
  6882. @item duration
  6883. Number of output frames for current input frame. Calculated from 'd' expression
  6884. for each input frame.
  6885. @item pduration
  6886. number of output frames created for previous input frame
  6887. @item a
  6888. Rational number: input width / input height
  6889. @item sar
  6890. sample aspect ratio
  6891. @item dar
  6892. display aspect ratio
  6893. @end table
  6894. @subsection Examples
  6895. @itemize
  6896. @item
  6897. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  6898. @example
  6899. 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
  6900. @end example
  6901. @end itemize
  6902. @c man end VIDEO FILTERS
  6903. @chapter Video Sources
  6904. @c man begin VIDEO SOURCES
  6905. Below is a description of the currently available video sources.
  6906. @section buffer
  6907. Buffer video frames, and make them available to the filter chain.
  6908. This source is mainly intended for a programmatic use, in particular
  6909. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  6910. It accepts the following parameters:
  6911. @table @option
  6912. @item video_size
  6913. Specify the size (width and height) of the buffered video frames. For the
  6914. syntax of this option, check the "Video size" section in the ffmpeg-utils
  6915. manual.
  6916. @item width
  6917. The input video width.
  6918. @item height
  6919. The input video height.
  6920. @item pix_fmt
  6921. A string representing the pixel format of the buffered video frames.
  6922. It may be a number corresponding to a pixel format, or a pixel format
  6923. name.
  6924. @item time_base
  6925. Specify the timebase assumed by the timestamps of the buffered frames.
  6926. @item frame_rate
  6927. Specify the frame rate expected for the video stream.
  6928. @item pixel_aspect, sar
  6929. The sample (pixel) aspect ratio of the input video.
  6930. @item sws_param
  6931. Specify the optional parameters to be used for the scale filter which
  6932. is automatically inserted when an input change is detected in the
  6933. input size or format.
  6934. @end table
  6935. For example:
  6936. @example
  6937. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  6938. @end example
  6939. will instruct the source to accept video frames with size 320x240 and
  6940. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  6941. square pixels (1:1 sample aspect ratio).
  6942. Since the pixel format with name "yuv410p" corresponds to the number 6
  6943. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  6944. this example corresponds to:
  6945. @example
  6946. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  6947. @end example
  6948. Alternatively, the options can be specified as a flat string, but this
  6949. syntax is deprecated:
  6950. @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}]
  6951. @section cellauto
  6952. Create a pattern generated by an elementary cellular automaton.
  6953. The initial state of the cellular automaton can be defined through the
  6954. @option{filename}, and @option{pattern} options. If such options are
  6955. not specified an initial state is created randomly.
  6956. At each new frame a new row in the video is filled with the result of
  6957. the cellular automaton next generation. The behavior when the whole
  6958. frame is filled is defined by the @option{scroll} option.
  6959. This source accepts the following options:
  6960. @table @option
  6961. @item filename, f
  6962. Read the initial cellular automaton state, i.e. the starting row, from
  6963. the specified file.
  6964. In the file, each non-whitespace character is considered an alive
  6965. cell, a newline will terminate the row, and further characters in the
  6966. file will be ignored.
  6967. @item pattern, p
  6968. Read the initial cellular automaton state, i.e. the starting row, from
  6969. the specified string.
  6970. Each non-whitespace character in the string is considered an alive
  6971. cell, a newline will terminate the row, and further characters in the
  6972. string will be ignored.
  6973. @item rate, r
  6974. Set the video rate, that is the number of frames generated per second.
  6975. Default is 25.
  6976. @item random_fill_ratio, ratio
  6977. Set the random fill ratio for the initial cellular automaton row. It
  6978. is a floating point number value ranging from 0 to 1, defaults to
  6979. 1/PHI.
  6980. This option is ignored when a file or a pattern is specified.
  6981. @item random_seed, seed
  6982. Set the seed for filling randomly the initial row, must be an integer
  6983. included between 0 and UINT32_MAX. If not specified, or if explicitly
  6984. set to -1, the filter will try to use a good random seed on a best
  6985. effort basis.
  6986. @item rule
  6987. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  6988. Default value is 110.
  6989. @item size, s
  6990. Set the size of the output video. For the syntax of this option, check
  6991. the "Video size" section in the ffmpeg-utils manual.
  6992. If @option{filename} or @option{pattern} is specified, the size is set
  6993. by default to the width of the specified initial state row, and the
  6994. height is set to @var{width} * PHI.
  6995. If @option{size} is set, it must contain the width of the specified
  6996. pattern string, and the specified pattern will be centered in the
  6997. larger row.
  6998. If a filename or a pattern string is not specified, the size value
  6999. defaults to "320x518" (used for a randomly generated initial state).
  7000. @item scroll
  7001. If set to 1, scroll the output upward when all the rows in the output
  7002. have been already filled. If set to 0, the new generated row will be
  7003. written over the top row just after the bottom row is filled.
  7004. Defaults to 1.
  7005. @item start_full, full
  7006. If set to 1, completely fill the output with generated rows before
  7007. outputting the first frame.
  7008. This is the default behavior, for disabling set the value to 0.
  7009. @item stitch
  7010. If set to 1, stitch the left and right row edges together.
  7011. This is the default behavior, for disabling set the value to 0.
  7012. @end table
  7013. @subsection Examples
  7014. @itemize
  7015. @item
  7016. Read the initial state from @file{pattern}, and specify an output of
  7017. size 200x400.
  7018. @example
  7019. cellauto=f=pattern:s=200x400
  7020. @end example
  7021. @item
  7022. Generate a random initial row with a width of 200 cells, with a fill
  7023. ratio of 2/3:
  7024. @example
  7025. cellauto=ratio=2/3:s=200x200
  7026. @end example
  7027. @item
  7028. Create a pattern generated by rule 18 starting by a single alive cell
  7029. centered on an initial row with width 100:
  7030. @example
  7031. cellauto=p=@@:s=100x400:full=0:rule=18
  7032. @end example
  7033. @item
  7034. Specify a more elaborated initial pattern:
  7035. @example
  7036. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  7037. @end example
  7038. @end itemize
  7039. @section mandelbrot
  7040. Generate a Mandelbrot set fractal, and progressively zoom towards the
  7041. point specified with @var{start_x} and @var{start_y}.
  7042. This source accepts the following options:
  7043. @table @option
  7044. @item end_pts
  7045. Set the terminal pts value. Default value is 400.
  7046. @item end_scale
  7047. Set the terminal scale value.
  7048. Must be a floating point value. Default value is 0.3.
  7049. @item inner
  7050. Set the inner coloring mode, that is the algorithm used to draw the
  7051. Mandelbrot fractal internal region.
  7052. It shall assume one of the following values:
  7053. @table @option
  7054. @item black
  7055. Set black mode.
  7056. @item convergence
  7057. Show time until convergence.
  7058. @item mincol
  7059. Set color based on point closest to the origin of the iterations.
  7060. @item period
  7061. Set period mode.
  7062. @end table
  7063. Default value is @var{mincol}.
  7064. @item bailout
  7065. Set the bailout value. Default value is 10.0.
  7066. @item maxiter
  7067. Set the maximum of iterations performed by the rendering
  7068. algorithm. Default value is 7189.
  7069. @item outer
  7070. Set outer coloring mode.
  7071. It shall assume one of following values:
  7072. @table @option
  7073. @item iteration_count
  7074. Set iteration cound mode.
  7075. @item normalized_iteration_count
  7076. set normalized iteration count mode.
  7077. @end table
  7078. Default value is @var{normalized_iteration_count}.
  7079. @item rate, r
  7080. Set frame rate, expressed as number of frames per second. Default
  7081. value is "25".
  7082. @item size, s
  7083. Set frame size. For the syntax of this option, check the "Video
  7084. size" section in the ffmpeg-utils manual. Default value is "640x480".
  7085. @item start_scale
  7086. Set the initial scale value. Default value is 3.0.
  7087. @item start_x
  7088. Set the initial x position. Must be a floating point value between
  7089. -100 and 100. Default value is -0.743643887037158704752191506114774.
  7090. @item start_y
  7091. Set the initial y position. Must be a floating point value between
  7092. -100 and 100. Default value is -0.131825904205311970493132056385139.
  7093. @end table
  7094. @section mptestsrc
  7095. Generate various test patterns, as generated by the MPlayer test filter.
  7096. The size of the generated video is fixed, and is 256x256.
  7097. This source is useful in particular for testing encoding features.
  7098. This source accepts the following options:
  7099. @table @option
  7100. @item rate, r
  7101. Specify the frame rate of the sourced video, as the number of frames
  7102. generated per second. It has to be a string in the format
  7103. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  7104. number or a valid video frame rate abbreviation. The default value is
  7105. "25".
  7106. @item duration, d
  7107. Set the video duration of the sourced video. The accepted syntax is:
  7108. @example
  7109. [-]HH:MM:SS[.m...]
  7110. [-]S+[.m...]
  7111. @end example
  7112. See also the function @code{av_parse_time()}.
  7113. If not specified, or the expressed duration is negative, the video is
  7114. supposed to be generated forever.
  7115. @item test, t
  7116. Set the number or the name of the test to perform. Supported tests are:
  7117. @table @option
  7118. @item dc_luma
  7119. @item dc_chroma
  7120. @item freq_luma
  7121. @item freq_chroma
  7122. @item amp_luma
  7123. @item amp_chroma
  7124. @item cbp
  7125. @item mv
  7126. @item ring1
  7127. @item ring2
  7128. @item all
  7129. @end table
  7130. Default value is "all", which will cycle through the list of all tests.
  7131. @end table
  7132. Some examples:
  7133. @example
  7134. testsrc=t=dc_luma
  7135. @end example
  7136. will generate a "dc_luma" test pattern.
  7137. @section frei0r_src
  7138. Provide a frei0r source.
  7139. To enable compilation of this filter you need to install the frei0r
  7140. header and configure FFmpeg with @code{--enable-frei0r}.
  7141. This source accepts the following parameters:
  7142. @table @option
  7143. @item size
  7144. The size of the video to generate. For the syntax of this option, check the
  7145. "Video size" section in the ffmpeg-utils manual.
  7146. @item framerate
  7147. The framerate of the generated video. It may be a string of the form
  7148. @var{num}/@var{den} or a frame rate abbreviation.
  7149. @item filter_name
  7150. The name to the frei0r source to load. For more information regarding frei0r and
  7151. how to set the parameters, read the @ref{frei0r} section in the video filters
  7152. documentation.
  7153. @item filter_params
  7154. A '|'-separated list of parameters to pass to the frei0r source.
  7155. @end table
  7156. For example, to generate a frei0r partik0l source with size 200x200
  7157. and frame rate 10 which is overlayed on the overlay filter main input:
  7158. @example
  7159. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  7160. @end example
  7161. @section life
  7162. Generate a life pattern.
  7163. This source is based on a generalization of John Conway's life game.
  7164. The sourced input represents a life grid, each pixel represents a cell
  7165. which can be in one of two possible states, alive or dead. Every cell
  7166. interacts with its eight neighbours, which are the cells that are
  7167. horizontally, vertically, or diagonally adjacent.
  7168. At each interaction the grid evolves according to the adopted rule,
  7169. which specifies the number of neighbor alive cells which will make a
  7170. cell stay alive or born. The @option{rule} option allows one to specify
  7171. the rule to adopt.
  7172. This source accepts the following options:
  7173. @table @option
  7174. @item filename, f
  7175. Set the file from which to read the initial grid state. In the file,
  7176. each non-whitespace character is considered an alive cell, and newline
  7177. is used to delimit the end of each row.
  7178. If this option is not specified, the initial grid is generated
  7179. randomly.
  7180. @item rate, r
  7181. Set the video rate, that is the number of frames generated per second.
  7182. Default is 25.
  7183. @item random_fill_ratio, ratio
  7184. Set the random fill ratio for the initial random grid. It is a
  7185. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  7186. It is ignored when a file is specified.
  7187. @item random_seed, seed
  7188. Set the seed for filling the initial random grid, must be an integer
  7189. included between 0 and UINT32_MAX. If not specified, or if explicitly
  7190. set to -1, the filter will try to use a good random seed on a best
  7191. effort basis.
  7192. @item rule
  7193. Set the life rule.
  7194. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  7195. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  7196. @var{NS} specifies the number of alive neighbor cells which make a
  7197. live cell stay alive, and @var{NB} the number of alive neighbor cells
  7198. which make a dead cell to become alive (i.e. to "born").
  7199. "s" and "b" can be used in place of "S" and "B", respectively.
  7200. Alternatively a rule can be specified by an 18-bits integer. The 9
  7201. high order bits are used to encode the next cell state if it is alive
  7202. for each number of neighbor alive cells, the low order bits specify
  7203. the rule for "borning" new cells. Higher order bits encode for an
  7204. higher number of neighbor cells.
  7205. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  7206. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  7207. Default value is "S23/B3", which is the original Conway's game of life
  7208. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  7209. cells, and will born a new cell if there are three alive cells around
  7210. a dead cell.
  7211. @item size, s
  7212. Set the size of the output video. For the syntax of this option, check the
  7213. "Video size" section in the ffmpeg-utils manual.
  7214. If @option{filename} is specified, the size is set by default to the
  7215. same size of the input file. If @option{size} is set, it must contain
  7216. the size specified in the input file, and the initial grid defined in
  7217. that file is centered in the larger resulting area.
  7218. If a filename is not specified, the size value defaults to "320x240"
  7219. (used for a randomly generated initial grid).
  7220. @item stitch
  7221. If set to 1, stitch the left and right grid edges together, and the
  7222. top and bottom edges also. Defaults to 1.
  7223. @item mold
  7224. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  7225. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  7226. value from 0 to 255.
  7227. @item life_color
  7228. Set the color of living (or new born) cells.
  7229. @item death_color
  7230. Set the color of dead cells. If @option{mold} is set, this is the first color
  7231. used to represent a dead cell.
  7232. @item mold_color
  7233. Set mold color, for definitely dead and moldy cells.
  7234. For the syntax of these 3 color options, check the "Color" section in the
  7235. ffmpeg-utils manual.
  7236. @end table
  7237. @subsection Examples
  7238. @itemize
  7239. @item
  7240. Read a grid from @file{pattern}, and center it on a grid of size
  7241. 300x300 pixels:
  7242. @example
  7243. life=f=pattern:s=300x300
  7244. @end example
  7245. @item
  7246. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  7247. @example
  7248. life=ratio=2/3:s=200x200
  7249. @end example
  7250. @item
  7251. Specify a custom rule for evolving a randomly generated grid:
  7252. @example
  7253. life=rule=S14/B34
  7254. @end example
  7255. @item
  7256. Full example with slow death effect (mold) using @command{ffplay}:
  7257. @example
  7258. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  7259. @end example
  7260. @end itemize
  7261. @anchor{color}
  7262. @anchor{haldclutsrc}
  7263. @anchor{nullsrc}
  7264. @anchor{rgbtestsrc}
  7265. @anchor{smptebars}
  7266. @anchor{smptehdbars}
  7267. @anchor{testsrc}
  7268. @section color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  7269. The @code{color} source provides an uniformly colored input.
  7270. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  7271. @ref{haldclut} filter.
  7272. The @code{nullsrc} source returns unprocessed video frames. It is
  7273. mainly useful to be employed in analysis / debugging tools, or as the
  7274. source for filters which ignore the input data.
  7275. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  7276. detecting RGB vs BGR issues. You should see a red, green and blue
  7277. stripe from top to bottom.
  7278. The @code{smptebars} source generates a color bars pattern, based on
  7279. the SMPTE Engineering Guideline EG 1-1990.
  7280. The @code{smptehdbars} source generates a color bars pattern, based on
  7281. the SMPTE RP 219-2002.
  7282. The @code{testsrc} source generates a test video pattern, showing a
  7283. color pattern, a scrolling gradient and a timestamp. This is mainly
  7284. intended for testing purposes.
  7285. The sources accept the following parameters:
  7286. @table @option
  7287. @item color, c
  7288. Specify the color of the source, only available in the @code{color}
  7289. source. For the syntax of this option, check the "Color" section in the
  7290. ffmpeg-utils manual.
  7291. @item level
  7292. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  7293. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  7294. pixels to be used as identity matrix for 3D lookup tables. Each component is
  7295. coded on a @code{1/(N*N)} scale.
  7296. @item size, s
  7297. Specify the size of the sourced video. For the syntax of this option, check the
  7298. "Video size" section in the ffmpeg-utils manual. The default value is
  7299. "320x240".
  7300. This option is not available with the @code{haldclutsrc} filter.
  7301. @item rate, r
  7302. Specify the frame rate of the sourced video, as the number of frames
  7303. generated per second. It has to be a string in the format
  7304. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  7305. number or a valid video frame rate abbreviation. The default value is
  7306. "25".
  7307. @item sar
  7308. Set the sample aspect ratio of the sourced video.
  7309. @item duration, d
  7310. Set the video duration of the sourced video. The accepted syntax is:
  7311. @example
  7312. [-]HH[:MM[:SS[.m...]]]
  7313. [-]S+[.m...]
  7314. @end example
  7315. Also see the the @code{av_parse_time()} function.
  7316. If not specified, or the expressed duration is negative, the video is
  7317. supposed to be generated forever.
  7318. @item decimals, n
  7319. Set the number of decimals to show in the timestamp, only available in the
  7320. @code{testsrc} source.
  7321. The displayed timestamp value will correspond to the original
  7322. timestamp value multiplied by the power of 10 of the specified
  7323. value. Default value is 0.
  7324. @end table
  7325. For example the following:
  7326. @example
  7327. testsrc=duration=5.3:size=qcif:rate=10
  7328. @end example
  7329. will generate a video with a duration of 5.3 seconds, with size
  7330. 176x144 and a frame rate of 10 frames per second.
  7331. The following graph description will generate a red source
  7332. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  7333. frames per second.
  7334. @example
  7335. color=c=red@@0.2:s=qcif:r=10
  7336. @end example
  7337. If the input content is to be ignored, @code{nullsrc} can be used. The
  7338. following command generates noise in the luminance plane by employing
  7339. the @code{geq} filter:
  7340. @example
  7341. nullsrc=s=256x256, geq=random(1)*255:128:128
  7342. @end example
  7343. @subsection Commands
  7344. The @code{color} source supports the following commands:
  7345. @table @option
  7346. @item c, color
  7347. Set the color of the created image. Accepts the same syntax of the
  7348. corresponding @option{color} option.
  7349. @end table
  7350. @c man end VIDEO SOURCES
  7351. @chapter Video Sinks
  7352. @c man begin VIDEO SINKS
  7353. Below is a description of the currently available video sinks.
  7354. @section buffersink
  7355. Buffer video frames, and make them available to the end of the filter
  7356. graph.
  7357. This sink is mainly intended for programmatic use, in particular
  7358. through the interface defined in @file{libavfilter/buffersink.h}
  7359. or the options system.
  7360. It accepts a pointer to an AVBufferSinkContext structure, which
  7361. defines the incoming buffers' formats, to be passed as the opaque
  7362. parameter to @code{avfilter_init_filter} for initialization.
  7363. @section nullsink
  7364. Null video sink: do absolutely nothing with the input video. It is
  7365. mainly useful as a template and for use in analysis / debugging
  7366. tools.
  7367. @c man end VIDEO SINKS
  7368. @chapter Multimedia Filters
  7369. @c man begin MULTIMEDIA FILTERS
  7370. Below is a description of the currently available multimedia filters.
  7371. @section avectorscope
  7372. Convert input audio to a video output, representing the audio vector
  7373. scope.
  7374. The filter is used to measure the difference between channels of stereo
  7375. audio stream. A monoaural signal, consisting of identical left and right
  7376. signal, results in straight vertical line. Any stereo separation is visible
  7377. as a deviation from this line, creating a Lissajous figure.
  7378. If the straight (or deviation from it) but horizontal line appears this
  7379. indicates that the left and right channels are out of phase.
  7380. The filter accepts the following options:
  7381. @table @option
  7382. @item mode, m
  7383. Set the vectorscope mode.
  7384. Available values are:
  7385. @table @samp
  7386. @item lissajous
  7387. Lissajous rotated by 45 degrees.
  7388. @item lissajous_xy
  7389. Same as above but not rotated.
  7390. @end table
  7391. Default value is @samp{lissajous}.
  7392. @item size, s
  7393. Set the video size for the output. For the syntax of this option, check the "Video size"
  7394. section in the ffmpeg-utils manual. Default value is @code{400x400}.
  7395. @item rate, r
  7396. Set the output frame rate. Default value is @code{25}.
  7397. @item rc
  7398. @item gc
  7399. @item bc
  7400. Specify the red, green and blue contrast. Default values are @code{40}, @code{160} and @code{80}.
  7401. Allowed range is @code{[0, 255]}.
  7402. @item rf
  7403. @item gf
  7404. @item bf
  7405. Specify the red, green and blue fade. Default values are @code{15}, @code{10} and @code{5}.
  7406. Allowed range is @code{[0, 255]}.
  7407. @item zoom
  7408. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  7409. @end table
  7410. @subsection Examples
  7411. @itemize
  7412. @item
  7413. Complete example using @command{ffplay}:
  7414. @example
  7415. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  7416. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  7417. @end example
  7418. @end itemize
  7419. @section concat
  7420. Concatenate audio and video streams, joining them together one after the
  7421. other.
  7422. The filter works on segments of synchronized video and audio streams. All
  7423. segments must have the same number of streams of each type, and that will
  7424. also be the number of streams at output.
  7425. The filter accepts the following options:
  7426. @table @option
  7427. @item n
  7428. Set the number of segments. Default is 2.
  7429. @item v
  7430. Set the number of output video streams, that is also the number of video
  7431. streams in each segment. Default is 1.
  7432. @item a
  7433. Set the number of output audio streams, that is also the number of audio
  7434. streams in each segment. Default is 0.
  7435. @item unsafe
  7436. Activate unsafe mode: do not fail if segments have a different format.
  7437. @end table
  7438. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  7439. @var{a} audio outputs.
  7440. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  7441. segment, in the same order as the outputs, then the inputs for the second
  7442. segment, etc.
  7443. Related streams do not always have exactly the same duration, for various
  7444. reasons including codec frame size or sloppy authoring. For that reason,
  7445. related synchronized streams (e.g. a video and its audio track) should be
  7446. concatenated at once. The concat filter will use the duration of the longest
  7447. stream in each segment (except the last one), and if necessary pad shorter
  7448. audio streams with silence.
  7449. For this filter to work correctly, all segments must start at timestamp 0.
  7450. All corresponding streams must have the same parameters in all segments; the
  7451. filtering system will automatically select a common pixel format for video
  7452. streams, and a common sample format, sample rate and channel layout for
  7453. audio streams, but other settings, such as resolution, must be converted
  7454. explicitly by the user.
  7455. Different frame rates are acceptable but will result in variable frame rate
  7456. at output; be sure to configure the output file to handle it.
  7457. @subsection Examples
  7458. @itemize
  7459. @item
  7460. Concatenate an opening, an episode and an ending, all in bilingual version
  7461. (video in stream 0, audio in streams 1 and 2):
  7462. @example
  7463. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  7464. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  7465. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  7466. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  7467. @end example
  7468. @item
  7469. Concatenate two parts, handling audio and video separately, using the
  7470. (a)movie sources, and adjusting the resolution:
  7471. @example
  7472. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  7473. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  7474. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  7475. @end example
  7476. Note that a desync will happen at the stitch if the audio and video streams
  7477. do not have exactly the same duration in the first file.
  7478. @end itemize
  7479. @section ebur128
  7480. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  7481. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  7482. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  7483. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  7484. The filter also has a video output (see the @var{video} option) with a real
  7485. time graph to observe the loudness evolution. The graphic contains the logged
  7486. message mentioned above, so it is not printed anymore when this option is set,
  7487. unless the verbose logging is set. The main graphing area contains the
  7488. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  7489. the momentary loudness (400 milliseconds).
  7490. More information about the Loudness Recommendation EBU R128 on
  7491. @url{http://tech.ebu.ch/loudness}.
  7492. The filter accepts the following options:
  7493. @table @option
  7494. @item video
  7495. Activate the video output. The audio stream is passed unchanged whether this
  7496. option is set or no. The video stream will be the first output stream if
  7497. activated. Default is @code{0}.
  7498. @item size
  7499. Set the video size. This option is for video only. For the syntax of this
  7500. option, check the "Video size" section in the ffmpeg-utils manual. Default
  7501. and minimum resolution is @code{640x480}.
  7502. @item meter
  7503. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  7504. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  7505. other integer value between this range is allowed.
  7506. @item metadata
  7507. Set metadata injection. If set to @code{1}, the audio input will be segmented
  7508. into 100ms output frames, each of them containing various loudness information
  7509. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  7510. Default is @code{0}.
  7511. @item framelog
  7512. Force the frame logging level.
  7513. Available values are:
  7514. @table @samp
  7515. @item info
  7516. information logging level
  7517. @item verbose
  7518. verbose logging level
  7519. @end table
  7520. By default, the logging level is set to @var{info}. If the @option{video} or
  7521. the @option{metadata} options are set, it switches to @var{verbose}.
  7522. @item peak
  7523. Set peak mode(s).
  7524. Available modes can be cumulated (the option is a @code{flag} type). Possible
  7525. values are:
  7526. @table @samp
  7527. @item none
  7528. Disable any peak mode (default).
  7529. @item sample
  7530. Enable sample-peak mode.
  7531. Simple peak mode looking for the higher sample value. It logs a message
  7532. for sample-peak (identified by @code{SPK}).
  7533. @item true
  7534. Enable true-peak mode.
  7535. If enabled, the peak lookup is done on an over-sampled version of the input
  7536. stream for better peak accuracy. It logs a message for true-peak.
  7537. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  7538. This mode requires a build with @code{libswresample}.
  7539. @end table
  7540. @end table
  7541. @subsection Examples
  7542. @itemize
  7543. @item
  7544. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  7545. @example
  7546. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  7547. @end example
  7548. @item
  7549. Run an analysis with @command{ffmpeg}:
  7550. @example
  7551. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  7552. @end example
  7553. @end itemize
  7554. @section interleave, ainterleave
  7555. Temporally interleave frames from several inputs.
  7556. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  7557. These filters read frames from several inputs and send the oldest
  7558. queued frame to the output.
  7559. Input streams must have a well defined, monotonically increasing frame
  7560. timestamp values.
  7561. In order to submit one frame to output, these filters need to enqueue
  7562. at least one frame for each input, so they cannot work in case one
  7563. input is not yet terminated and will not receive incoming frames.
  7564. For example consider the case when one input is a @code{select} filter
  7565. which always drop input frames. The @code{interleave} filter will keep
  7566. reading from that input, but it will never be able to send new frames
  7567. to output until the input will send an end-of-stream signal.
  7568. Also, depending on inputs synchronization, the filters will drop
  7569. frames in case one input receives more frames than the other ones, and
  7570. the queue is already filled.
  7571. These filters accept the following options:
  7572. @table @option
  7573. @item nb_inputs, n
  7574. Set the number of different inputs, it is 2 by default.
  7575. @end table
  7576. @subsection Examples
  7577. @itemize
  7578. @item
  7579. Interleave frames belonging to different streams using @command{ffmpeg}:
  7580. @example
  7581. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  7582. @end example
  7583. @item
  7584. Add flickering blur effect:
  7585. @example
  7586. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  7587. @end example
  7588. @end itemize
  7589. @section perms, aperms
  7590. Set read/write permissions for the output frames.
  7591. These filters are mainly aimed at developers to test direct path in the
  7592. following filter in the filtergraph.
  7593. The filters accept the following options:
  7594. @table @option
  7595. @item mode
  7596. Select the permissions mode.
  7597. It accepts the following values:
  7598. @table @samp
  7599. @item none
  7600. Do nothing. This is the default.
  7601. @item ro
  7602. Set all the output frames read-only.
  7603. @item rw
  7604. Set all the output frames directly writable.
  7605. @item toggle
  7606. Make the frame read-only if writable, and writable if read-only.
  7607. @item random
  7608. Set each output frame read-only or writable randomly.
  7609. @end table
  7610. @item seed
  7611. Set the seed for the @var{random} mode, must be an integer included between
  7612. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7613. @code{-1}, the filter will try to use a good random seed on a best effort
  7614. basis.
  7615. @end table
  7616. Note: in case of auto-inserted filter between the permission filter and the
  7617. following one, the permission might not be received as expected in that
  7618. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  7619. perms/aperms filter can avoid this problem.
  7620. @section select, aselect
  7621. Select frames to pass in output.
  7622. This filter accepts the following options:
  7623. @table @option
  7624. @item expr, e
  7625. Set expression, which is evaluated for each input frame.
  7626. If the expression is evaluated to zero, the frame is discarded.
  7627. If the evaluation result is negative or NaN, the frame is sent to the
  7628. first output; otherwise it is sent to the output with index
  7629. @code{ceil(val)-1}, assuming that the input index starts from 0.
  7630. For example a value of @code{1.2} corresponds to the output with index
  7631. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  7632. @item outputs, n
  7633. Set the number of outputs. The output to which to send the selected
  7634. frame is based on the result of the evaluation. Default value is 1.
  7635. @end table
  7636. The expression can contain the following constants:
  7637. @table @option
  7638. @item n
  7639. The (sequential) number of the filtered frame, starting from 0.
  7640. @item selected_n
  7641. The (sequential) number of the selected frame, starting from 0.
  7642. @item prev_selected_n
  7643. The sequential number of the last selected frame. It's NAN if undefined.
  7644. @item TB
  7645. The timebase of the input timestamps.
  7646. @item pts
  7647. The PTS (Presentation TimeStamp) of the filtered video frame,
  7648. expressed in @var{TB} units. It's NAN if undefined.
  7649. @item t
  7650. The PTS of the filtered video frame,
  7651. expressed in seconds. It's NAN if undefined.
  7652. @item prev_pts
  7653. The PTS of the previously filtered video frame. It's NAN if undefined.
  7654. @item prev_selected_pts
  7655. The PTS of the last previously filtered video frame. It's NAN if undefined.
  7656. @item prev_selected_t
  7657. The PTS of the last previously selected video frame. It's NAN if undefined.
  7658. @item start_pts
  7659. The PTS of the first video frame in the video. It's NAN if undefined.
  7660. @item start_t
  7661. The time of the first video frame in the video. It's NAN if undefined.
  7662. @item pict_type @emph{(video only)}
  7663. The type of the filtered frame. It can assume one of the following
  7664. values:
  7665. @table @option
  7666. @item I
  7667. @item P
  7668. @item B
  7669. @item S
  7670. @item SI
  7671. @item SP
  7672. @item BI
  7673. @end table
  7674. @item interlace_type @emph{(video only)}
  7675. The frame interlace type. It can assume one of the following values:
  7676. @table @option
  7677. @item PROGRESSIVE
  7678. The frame is progressive (not interlaced).
  7679. @item TOPFIRST
  7680. The frame is top-field-first.
  7681. @item BOTTOMFIRST
  7682. The frame is bottom-field-first.
  7683. @end table
  7684. @item consumed_sample_n @emph{(audio only)}
  7685. the number of selected samples before the current frame
  7686. @item samples_n @emph{(audio only)}
  7687. the number of samples in the current frame
  7688. @item sample_rate @emph{(audio only)}
  7689. the input sample rate
  7690. @item key
  7691. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  7692. @item pos
  7693. the position in the file of the filtered frame, -1 if the information
  7694. is not available (e.g. for synthetic video)
  7695. @item scene @emph{(video only)}
  7696. value between 0 and 1 to indicate a new scene; a low value reflects a low
  7697. probability for the current frame to introduce a new scene, while a higher
  7698. value means the current frame is more likely to be one (see the example below)
  7699. @end table
  7700. The default value of the select expression is "1".
  7701. @subsection Examples
  7702. @itemize
  7703. @item
  7704. Select all frames in input:
  7705. @example
  7706. select
  7707. @end example
  7708. The example above is the same as:
  7709. @example
  7710. select=1
  7711. @end example
  7712. @item
  7713. Skip all frames:
  7714. @example
  7715. select=0
  7716. @end example
  7717. @item
  7718. Select only I-frames:
  7719. @example
  7720. select='eq(pict_type\,I)'
  7721. @end example
  7722. @item
  7723. Select one frame every 100:
  7724. @example
  7725. select='not(mod(n\,100))'
  7726. @end example
  7727. @item
  7728. Select only frames contained in the 10-20 time interval:
  7729. @example
  7730. select=between(t\,10\,20)
  7731. @end example
  7732. @item
  7733. Select only I frames contained in the 10-20 time interval:
  7734. @example
  7735. select=between(t\,10\,20)*eq(pict_type\,I)
  7736. @end example
  7737. @item
  7738. Select frames with a minimum distance of 10 seconds:
  7739. @example
  7740. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  7741. @end example
  7742. @item
  7743. Use aselect to select only audio frames with samples number > 100:
  7744. @example
  7745. aselect='gt(samples_n\,100)'
  7746. @end example
  7747. @item
  7748. Create a mosaic of the first scenes:
  7749. @example
  7750. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  7751. @end example
  7752. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  7753. choice.
  7754. @item
  7755. Send even and odd frames to separate outputs, and compose them:
  7756. @example
  7757. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  7758. @end example
  7759. @end itemize
  7760. @section sendcmd, asendcmd
  7761. Send commands to filters in the filtergraph.
  7762. These filters read commands to be sent to other filters in the
  7763. filtergraph.
  7764. @code{sendcmd} must be inserted between two video filters,
  7765. @code{asendcmd} must be inserted between two audio filters, but apart
  7766. from that they act the same way.
  7767. The specification of commands can be provided in the filter arguments
  7768. with the @var{commands} option, or in a file specified by the
  7769. @var{filename} option.
  7770. These filters accept the following options:
  7771. @table @option
  7772. @item commands, c
  7773. Set the commands to be read and sent to the other filters.
  7774. @item filename, f
  7775. Set the filename of the commands to be read and sent to the other
  7776. filters.
  7777. @end table
  7778. @subsection Commands syntax
  7779. A commands description consists of a sequence of interval
  7780. specifications, comprising a list of commands to be executed when a
  7781. particular event related to that interval occurs. The occurring event
  7782. is typically the current frame time entering or leaving a given time
  7783. interval.
  7784. An interval is specified by the following syntax:
  7785. @example
  7786. @var{START}[-@var{END}] @var{COMMANDS};
  7787. @end example
  7788. The time interval is specified by the @var{START} and @var{END} times.
  7789. @var{END} is optional and defaults to the maximum time.
  7790. The current frame time is considered within the specified interval if
  7791. it is included in the interval [@var{START}, @var{END}), that is when
  7792. the time is greater or equal to @var{START} and is lesser than
  7793. @var{END}.
  7794. @var{COMMANDS} consists of a sequence of one or more command
  7795. specifications, separated by ",", relating to that interval. The
  7796. syntax of a command specification is given by:
  7797. @example
  7798. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  7799. @end example
  7800. @var{FLAGS} is optional and specifies the type of events relating to
  7801. the time interval which enable sending the specified command, and must
  7802. be a non-null sequence of identifier flags separated by "+" or "|" and
  7803. enclosed between "[" and "]".
  7804. The following flags are recognized:
  7805. @table @option
  7806. @item enter
  7807. The command is sent when the current frame timestamp enters the
  7808. specified interval. In other words, the command is sent when the
  7809. previous frame timestamp was not in the given interval, and the
  7810. current is.
  7811. @item leave
  7812. The command is sent when the current frame timestamp leaves the
  7813. specified interval. In other words, the command is sent when the
  7814. previous frame timestamp was in the given interval, and the
  7815. current is not.
  7816. @end table
  7817. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  7818. assumed.
  7819. @var{TARGET} specifies the target of the command, usually the name of
  7820. the filter class or a specific filter instance name.
  7821. @var{COMMAND} specifies the name of the command for the target filter.
  7822. @var{ARG} is optional and specifies the optional list of argument for
  7823. the given @var{COMMAND}.
  7824. Between one interval specification and another, whitespaces, or
  7825. sequences of characters starting with @code{#} until the end of line,
  7826. are ignored and can be used to annotate comments.
  7827. A simplified BNF description of the commands specification syntax
  7828. follows:
  7829. @example
  7830. @var{COMMAND_FLAG} ::= "enter" | "leave"
  7831. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  7832. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  7833. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  7834. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  7835. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  7836. @end example
  7837. @subsection Examples
  7838. @itemize
  7839. @item
  7840. Specify audio tempo change at second 4:
  7841. @example
  7842. asendcmd=c='4.0 atempo tempo 1.5',atempo
  7843. @end example
  7844. @item
  7845. Specify a list of drawtext and hue commands in a file.
  7846. @example
  7847. # show text in the interval 5-10
  7848. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  7849. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  7850. # desaturate the image in the interval 15-20
  7851. 15.0-20.0 [enter] hue s 0,
  7852. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  7853. [leave] hue s 1,
  7854. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  7855. # apply an exponential saturation fade-out effect, starting from time 25
  7856. 25 [enter] hue s exp(25-t)
  7857. @end example
  7858. A filtergraph allowing to read and process the above command list
  7859. stored in a file @file{test.cmd}, can be specified with:
  7860. @example
  7861. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  7862. @end example
  7863. @end itemize
  7864. @anchor{setpts}
  7865. @section setpts, asetpts
  7866. Change the PTS (presentation timestamp) of the input frames.
  7867. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  7868. This filter accepts the following options:
  7869. @table @option
  7870. @item expr
  7871. The expression which is evaluated for each frame to construct its timestamp.
  7872. @end table
  7873. The expression is evaluated through the eval API and can contain the following
  7874. constants:
  7875. @table @option
  7876. @item FRAME_RATE
  7877. frame rate, only defined for constant frame-rate video
  7878. @item PTS
  7879. The presentation timestamp in input
  7880. @item N
  7881. The count of the input frame for video or the number of consumed samples,
  7882. not including the current frame for audio, starting from 0.
  7883. @item NB_CONSUMED_SAMPLES
  7884. The number of consumed samples, not including the current frame (only
  7885. audio)
  7886. @item NB_SAMPLES, S
  7887. The number of samples in the current frame (only audio)
  7888. @item SAMPLE_RATE, SR
  7889. The audio sample rate.
  7890. @item STARTPTS
  7891. The PTS of the first frame.
  7892. @item STARTT
  7893. the time in seconds of the first frame
  7894. @item INTERLACED
  7895. State whether the current frame is interlaced.
  7896. @item T
  7897. the time in seconds of the current frame
  7898. @item POS
  7899. original position in the file of the frame, or undefined if undefined
  7900. for the current frame
  7901. @item PREV_INPTS
  7902. The previous input PTS.
  7903. @item PREV_INT
  7904. previous input time in seconds
  7905. @item PREV_OUTPTS
  7906. The previous output PTS.
  7907. @item PREV_OUTT
  7908. previous output time in seconds
  7909. @item RTCTIME
  7910. The wallclock (RTC) time in microseconds.. This is deprecated, use time(0)
  7911. instead.
  7912. @item RTCSTART
  7913. The wallclock (RTC) time at the start of the movie in microseconds.
  7914. @item TB
  7915. The timebase of the input timestamps.
  7916. @end table
  7917. @subsection Examples
  7918. @itemize
  7919. @item
  7920. Start counting PTS from zero
  7921. @example
  7922. setpts=PTS-STARTPTS
  7923. @end example
  7924. @item
  7925. Apply fast motion effect:
  7926. @example
  7927. setpts=0.5*PTS
  7928. @end example
  7929. @item
  7930. Apply slow motion effect:
  7931. @example
  7932. setpts=2.0*PTS
  7933. @end example
  7934. @item
  7935. Set fixed rate of 25 frames per second:
  7936. @example
  7937. setpts=N/(25*TB)
  7938. @end example
  7939. @item
  7940. Set fixed rate 25 fps with some jitter:
  7941. @example
  7942. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  7943. @end example
  7944. @item
  7945. Apply an offset of 10 seconds to the input PTS:
  7946. @example
  7947. setpts=PTS+10/TB
  7948. @end example
  7949. @item
  7950. Generate timestamps from a "live source" and rebase onto the current timebase:
  7951. @example
  7952. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  7953. @end example
  7954. @item
  7955. Generate timestamps by counting samples:
  7956. @example
  7957. asetpts=N/SR/TB
  7958. @end example
  7959. @end itemize
  7960. @section settb, asettb
  7961. Set the timebase to use for the output frames timestamps.
  7962. It is mainly useful for testing timebase configuration.
  7963. It accepts the following parameters:
  7964. @table @option
  7965. @item expr, tb
  7966. The expression which is evaluated into the output timebase.
  7967. @end table
  7968. The value for @option{tb} is an arithmetic expression representing a
  7969. rational. The expression can contain the constants "AVTB" (the default
  7970. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  7971. audio only). Default value is "intb".
  7972. @subsection Examples
  7973. @itemize
  7974. @item
  7975. Set the timebase to 1/25:
  7976. @example
  7977. settb=expr=1/25
  7978. @end example
  7979. @item
  7980. Set the timebase to 1/10:
  7981. @example
  7982. settb=expr=0.1
  7983. @end example
  7984. @item
  7985. Set the timebase to 1001/1000:
  7986. @example
  7987. settb=1+0.001
  7988. @end example
  7989. @item
  7990. Set the timebase to 2*intb:
  7991. @example
  7992. settb=2*intb
  7993. @end example
  7994. @item
  7995. Set the default timebase value:
  7996. @example
  7997. settb=AVTB
  7998. @end example
  7999. @end itemize
  8000. @section showcqt
  8001. Convert input audio to a video output representing
  8002. frequency spectrum logarithmically (using constant Q transform with
  8003. Brown-Puckette algorithm), with musical tone scale, from E0 to D#10 (10 octaves).
  8004. The filter accepts the following options:
  8005. @table @option
  8006. @item volume
  8007. Specify the transform volume (multiplier). Acceptable value is [1.0, 100.0].
  8008. Default value is @code{16.0}.
  8009. @item timeclamp
  8010. Specify the transform timeclamp. At low frequency, there is trade-off between
  8011. accuracy in time domain and frequency domain. If timeclamp is lower,
  8012. event in time domain is represented more accurately (such as fast bass drum),
  8013. otherwise event in frequency domain is represented more accurately
  8014. (such as bass guitar). Acceptable value is [0.1, 1.0]. Default value is @code{0.17}.
  8015. @item coeffclamp
  8016. Specify the transform coeffclamp. If coeffclamp is lower, transform is
  8017. more accurate, otherwise transform is faster. Acceptable value is [0.1, 10.0].
  8018. Default value is @code{1.0}.
  8019. @item gamma
  8020. Specify gamma. Lower gamma makes the spectrum more contrast, higher gamma
  8021. makes the spectrum having more range. Acceptable value is [1.0, 7.0].
  8022. Default value is @code{3.0}.
  8023. @item fontfile
  8024. Specify font file for use with freetype. If not specified, use embedded font.
  8025. @item fullhd
  8026. If set to 1 (the default), the video size is 1920x1080 (full HD),
  8027. if set to 0, the video size is 960x540. Use this option to make CPU usage lower.
  8028. @item fps
  8029. Specify video fps. Default value is @code{25}.
  8030. @item count
  8031. Specify number of transform per frame, so there are fps*count transforms
  8032. per second. Note that audio data rate must be divisible by fps*count.
  8033. Default value is @code{6}.
  8034. @end table
  8035. @subsection Examples
  8036. @itemize
  8037. @item
  8038. Playing audio while showing the spectrum:
  8039. @example
  8040. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  8041. @end example
  8042. @item
  8043. Same as above, but with frame rate 30 fps:
  8044. @example
  8045. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  8046. @end example
  8047. @item
  8048. Playing at 960x540 and lower CPU usage:
  8049. @example
  8050. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fullhd=0:count=3 [out0]'
  8051. @end example
  8052. @item
  8053. A1 and its harmonics: A1, A2, (near)E3, A3:
  8054. @example
  8055. 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),
  8056. asplit[a][out1]; [a] showcqt [out0]'
  8057. @end example
  8058. @item
  8059. Same as above, but with more accuracy in frequency domain (and slower):
  8060. @example
  8061. 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),
  8062. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  8063. @end example
  8064. @end itemize
  8065. @section showspectrum
  8066. Convert input audio to a video output, representing the audio frequency
  8067. spectrum.
  8068. The filter accepts the following options:
  8069. @table @option
  8070. @item size, s
  8071. Specify the video size for the output. For the syntax of this option, check
  8072. the "Video size" section in the ffmpeg-utils manual. Default value is
  8073. @code{640x512}.
  8074. @item slide
  8075. Specify if the spectrum should slide along the window. Default value is
  8076. @code{0}.
  8077. @item mode
  8078. Specify display mode.
  8079. It accepts the following values:
  8080. @table @samp
  8081. @item combined
  8082. all channels are displayed in the same row
  8083. @item separate
  8084. all channels are displayed in separate rows
  8085. @end table
  8086. Default value is @samp{combined}.
  8087. @item color
  8088. Specify display color mode.
  8089. It accepts the following values:
  8090. @table @samp
  8091. @item channel
  8092. each channel is displayed in a separate color
  8093. @item intensity
  8094. each channel is is displayed using the same color scheme
  8095. @end table
  8096. Default value is @samp{channel}.
  8097. @item scale
  8098. Specify scale used for calculating intensity color values.
  8099. It accepts the following values:
  8100. @table @samp
  8101. @item lin
  8102. linear
  8103. @item sqrt
  8104. square root, default
  8105. @item cbrt
  8106. cubic root
  8107. @item log
  8108. logarithmic
  8109. @end table
  8110. Default value is @samp{sqrt}.
  8111. @item saturation
  8112. Set saturation modifier for displayed colors. Negative values provide
  8113. alternative color scheme. @code{0} is no saturation at all.
  8114. Saturation must be in [-10.0, 10.0] range.
  8115. Default value is @code{1}.
  8116. @item win_func
  8117. Set window function.
  8118. It accepts the following values:
  8119. @table @samp
  8120. @item none
  8121. No samples pre-processing (do not expect this to be faster)
  8122. @item hann
  8123. Hann window
  8124. @item hamming
  8125. Hamming window
  8126. @item blackman
  8127. Blackman window
  8128. @end table
  8129. Default value is @code{hann}.
  8130. @end table
  8131. The usage is very similar to the showwaves filter; see the examples in that
  8132. section.
  8133. @subsection Examples
  8134. @itemize
  8135. @item
  8136. Large window with logarithmic color scaling:
  8137. @example
  8138. showspectrum=s=1280x480:scale=log
  8139. @end example
  8140. @item
  8141. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  8142. @example
  8143. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  8144. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  8145. @end example
  8146. @end itemize
  8147. @section showwaves
  8148. Convert input audio to a video output, representing the samples waves.
  8149. The filter accepts the following options:
  8150. @table @option
  8151. @item size, s
  8152. Specify the video size for the output. For the syntax of this option, check
  8153. the "Video size" section in the ffmpeg-utils manual. Default value
  8154. is "600x240".
  8155. @item mode
  8156. Set display mode.
  8157. Available values are:
  8158. @table @samp
  8159. @item point
  8160. Draw a point for each sample.
  8161. @item line
  8162. Draw a vertical line for each sample.
  8163. @end table
  8164. Default value is @code{point}.
  8165. @item n
  8166. Set the number of samples which are printed on the same column. A
  8167. larger value will decrease the frame rate. Must be a positive
  8168. integer. This option can be set only if the value for @var{rate}
  8169. is not explicitly specified.
  8170. @item rate, r
  8171. Set the (approximate) output frame rate. This is done by setting the
  8172. option @var{n}. Default value is "25".
  8173. @end table
  8174. @subsection Examples
  8175. @itemize
  8176. @item
  8177. Output the input file audio and the corresponding video representation
  8178. at the same time:
  8179. @example
  8180. amovie=a.mp3,asplit[out0],showwaves[out1]
  8181. @end example
  8182. @item
  8183. Create a synthetic signal and show it with showwaves, forcing a
  8184. frame rate of 30 frames per second:
  8185. @example
  8186. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  8187. @end example
  8188. @end itemize
  8189. @section split, asplit
  8190. Split input into several identical outputs.
  8191. @code{asplit} works with audio input, @code{split} with video.
  8192. The filter accepts a single parameter which specifies the number of outputs. If
  8193. unspecified, it defaults to 2.
  8194. @subsection Examples
  8195. @itemize
  8196. @item
  8197. Create two separate outputs from the same input:
  8198. @example
  8199. [in] split [out0][out1]
  8200. @end example
  8201. @item
  8202. To create 3 or more outputs, you need to specify the number of
  8203. outputs, like in:
  8204. @example
  8205. [in] asplit=3 [out0][out1][out2]
  8206. @end example
  8207. @item
  8208. Create two separate outputs from the same input, one cropped and
  8209. one padded:
  8210. @example
  8211. [in] split [splitout1][splitout2];
  8212. [splitout1] crop=100:100:0:0 [cropout];
  8213. [splitout2] pad=200:200:100:100 [padout];
  8214. @end example
  8215. @item
  8216. Create 5 copies of the input audio with @command{ffmpeg}:
  8217. @example
  8218. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  8219. @end example
  8220. @end itemize
  8221. @section zmq, azmq
  8222. Receive commands sent through a libzmq client, and forward them to
  8223. filters in the filtergraph.
  8224. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  8225. must be inserted between two video filters, @code{azmq} between two
  8226. audio filters.
  8227. To enable these filters you need to install the libzmq library and
  8228. headers and configure FFmpeg with @code{--enable-libzmq}.
  8229. For more information about libzmq see:
  8230. @url{http://www.zeromq.org/}
  8231. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  8232. receives messages sent through a network interface defined by the
  8233. @option{bind_address} option.
  8234. The received message must be in the form:
  8235. @example
  8236. @var{TARGET} @var{COMMAND} [@var{ARG}]
  8237. @end example
  8238. @var{TARGET} specifies the target of the command, usually the name of
  8239. the filter class or a specific filter instance name.
  8240. @var{COMMAND} specifies the name of the command for the target filter.
  8241. @var{ARG} is optional and specifies the optional argument list for the
  8242. given @var{COMMAND}.
  8243. Upon reception, the message is processed and the corresponding command
  8244. is injected into the filtergraph. Depending on the result, the filter
  8245. will send a reply to the client, adopting the format:
  8246. @example
  8247. @var{ERROR_CODE} @var{ERROR_REASON}
  8248. @var{MESSAGE}
  8249. @end example
  8250. @var{MESSAGE} is optional.
  8251. @subsection Examples
  8252. Look at @file{tools/zmqsend} for an example of a zmq client which can
  8253. be used to send commands processed by these filters.
  8254. Consider the following filtergraph generated by @command{ffplay}
  8255. @example
  8256. ffplay -dumpgraph 1 -f lavfi "
  8257. color=s=100x100:c=red [l];
  8258. color=s=100x100:c=blue [r];
  8259. nullsrc=s=200x100, zmq [bg];
  8260. [bg][l] overlay [bg+l];
  8261. [bg+l][r] overlay=x=100 "
  8262. @end example
  8263. To change the color of the left side of the video, the following
  8264. command can be used:
  8265. @example
  8266. echo Parsed_color_0 c yellow | tools/zmqsend
  8267. @end example
  8268. To change the right side:
  8269. @example
  8270. echo Parsed_color_1 c pink | tools/zmqsend
  8271. @end example
  8272. @c man end MULTIMEDIA FILTERS
  8273. @chapter Multimedia Sources
  8274. @c man begin MULTIMEDIA SOURCES
  8275. Below is a description of the currently available multimedia sources.
  8276. @section amovie
  8277. This is the same as @ref{movie} source, except it selects an audio
  8278. stream by default.
  8279. @anchor{movie}
  8280. @section movie
  8281. Read audio and/or video stream(s) from a movie container.
  8282. It accepts the following parameters:
  8283. @table @option
  8284. @item filename
  8285. The name of the resource to read (not necessarily a file; it can also be a
  8286. device or a stream accessed through some protocol).
  8287. @item format_name, f
  8288. Specifies the format assumed for the movie to read, and can be either
  8289. the name of a container or an input device. If not specified, the
  8290. format is guessed from @var{movie_name} or by probing.
  8291. @item seek_point, sp
  8292. Specifies the seek point in seconds. The frames will be output
  8293. starting from this seek point. The parameter is evaluated with
  8294. @code{av_strtod}, so the numerical value may be suffixed by an IS
  8295. postfix. The default value is "0".
  8296. @item streams, s
  8297. Specifies the streams to read. Several streams can be specified,
  8298. separated by "+". The source will then have as many outputs, in the
  8299. same order. The syntax is explained in the ``Stream specifiers''
  8300. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  8301. respectively the default (best suited) video and audio stream. Default
  8302. is "dv", or "da" if the filter is called as "amovie".
  8303. @item stream_index, si
  8304. Specifies the index of the video stream to read. If the value is -1,
  8305. the most suitable video stream will be automatically selected. The default
  8306. value is "-1". Deprecated. If the filter is called "amovie", it will select
  8307. audio instead of video.
  8308. @item loop
  8309. Specifies how many times to read the stream in sequence.
  8310. If the value is less than 1, the stream will be read again and again.
  8311. Default value is "1".
  8312. Note that when the movie is looped the source timestamps are not
  8313. changed, so it will generate non monotonically increasing timestamps.
  8314. @end table
  8315. It allows overlaying a second video on top of the main input of
  8316. a filtergraph, as shown in this graph:
  8317. @example
  8318. input -----------> deltapts0 --> overlay --> output
  8319. ^
  8320. |
  8321. movie --> scale--> deltapts1 -------+
  8322. @end example
  8323. @subsection Examples
  8324. @itemize
  8325. @item
  8326. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  8327. on top of the input labelled "in":
  8328. @example
  8329. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  8330. [in] setpts=PTS-STARTPTS [main];
  8331. [main][over] overlay=16:16 [out]
  8332. @end example
  8333. @item
  8334. Read from a video4linux2 device, and overlay it on top of the input
  8335. labelled "in":
  8336. @example
  8337. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  8338. [in] setpts=PTS-STARTPTS [main];
  8339. [main][over] overlay=16:16 [out]
  8340. @end example
  8341. @item
  8342. Read the first video stream and the audio stream with id 0x81 from
  8343. dvd.vob; the video is connected to the pad named "video" and the audio is
  8344. connected to the pad named "audio":
  8345. @example
  8346. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  8347. @end example
  8348. @end itemize
  8349. @c man end MULTIMEDIA SOURCES