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.

10423 lines
281KB

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