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.

10418 lines
280KB

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