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.

10343 lines
279KB

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