]> git.sesse.net Git - ffmpeg/blob - doc/filters.texi
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / doc / filters.texi
1 @chapter Filtergraph description
2 @c man begin FILTERGRAPH DESCRIPTION
3
4 A filtergraph is a directed graph of connected filters. It can contain
5 cycles, and there can be multiple links between a pair of
6 filters. Each link has one input pad on one side connecting it to one
7 filter from which it takes its input, and one output pad on the other
8 side connecting it to the one filter accepting its output.
9
10 Each filter in a filtergraph is an instance of a filter class
11 registered in the application, which defines the features and the
12 number of input and output pads of the filter.
13
14 A filter with no input pads is called a "source", a filter with no
15 output pads is called a "sink".
16
17 @anchor{Filtergraph syntax}
18 @section Filtergraph syntax
19
20 A filtergraph can be represented using a textual representation, which is
21 recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
22 options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
23 @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
24 @file{libavfilter/avfiltergraph.h}.
25
26 A filterchain consists of a sequence of connected filters, each one
27 connected to the previous one in the sequence. A filterchain is
28 represented by a list of ","-separated filter descriptions.
29
30 A filtergraph consists of a sequence of filterchains. A sequence of
31 filterchains is represented by a list of ";"-separated filterchain
32 descriptions.
33
34 A filter is represented by a string of the form:
35 [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
36
37 @var{filter_name} is the name of the filter class of which the
38 described filter is an instance of, and has to be the name of one of
39 the filter classes registered in the program.
40 The name of the filter class is optionally followed by a string
41 "=@var{arguments}".
42
43 @var{arguments} is a string which contains the parameters used to
44 initialize the filter instance, and are described in the filter
45 descriptions below.
46
47 The list of arguments can be quoted using the character "'" as initial
48 and ending mark, and the character '\' for escaping the characters
49 within the quoted text; otherwise the argument string is considered
50 terminated when the next special character (belonging to the set
51 "[]=;,") is encountered.
52
53 The name and arguments of the filter are optionally preceded and
54 followed by a list of link labels.
55 A link label allows to name a link and associate it to a filter output
56 or input pad. The preceding labels @var{in_link_1}
57 ... @var{in_link_N}, are associated to the filter input pads,
58 the following labels @var{out_link_1} ... @var{out_link_M}, are
59 associated to the output pads.
60
61 When two link labels with the same name are found in the
62 filtergraph, a link between the corresponding input and output pad is
63 created.
64
65 If an output pad is not labelled, it is linked by default to the first
66 unlabelled input pad of the next filter in the filterchain.
67 For example in the filterchain:
68 @example
69 nullsrc, split[L1], [L2]overlay, nullsink
70 @end example
71 the split filter instance has two output pads, and the overlay filter
72 instance two input pads. The first output pad of split is labelled
73 "L1", the first input pad of overlay is labelled "L2", and the second
74 output pad of split is linked to the second input pad of overlay,
75 which are both unlabelled.
76
77 In a complete filterchain all the unlabelled filter input and output
78 pads must be connected. A filtergraph is considered valid if all the
79 filter input and output pads of all the filterchains are connected.
80
81 Libavfilter will automatically insert scale filters where format
82 conversion is required. It is possible to specify swscale flags
83 for those automatically inserted scalers by prepending
84 @code{sws_flags=@var{flags};}
85 to the filtergraph description.
86
87 Follows a BNF description for the filtergraph syntax:
88 @example
89 @var{NAME}             ::= sequence of alphanumeric characters and '_'
90 @var{LINKLABEL}        ::= "[" @var{NAME} "]"
91 @var{LINKLABELS}       ::= @var{LINKLABEL} [@var{LINKLABELS}]
92 @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
93 @var{FILTER}           ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
94 @var{FILTERCHAIN}      ::= @var{FILTER} [,@var{FILTERCHAIN}]
95 @var{FILTERGRAPH}      ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
96 @end example
97
98 @c man end FILTERGRAPH DESCRIPTION
99
100 @chapter Audio Filters
101 @c man begin AUDIO FILTERS
102
103 When you configure your FFmpeg build, you can disable any of the
104 existing filters using @code{--disable-filters}.
105 The configure output will show the audio filters included in your
106 build.
107
108 Below is a description of the currently available audio filters.
109
110 @section aconvert
111
112 Convert the input audio format to the specified formats.
113
114 The filter accepts a string of the form:
115 "@var{sample_format}:@var{channel_layout}".
116
117 @var{sample_format} specifies the sample format, and can be a string or the
118 corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
119 suffix for a planar sample format.
120
121 @var{channel_layout} specifies the channel layout, and can be a string
122 or the corresponding number value defined in @file{libavutil/audioconvert.h}.
123
124 The special parameter "auto", signifies that the filter will
125 automatically select the output format depending on the output filter.
126
127 Some examples follow.
128
129 @itemize
130 @item
131 Convert input to float, planar, stereo:
132 @example
133 aconvert=fltp:stereo
134 @end example
135
136 @item
137 Convert input to unsigned 8-bit, automatically select out channel layout:
138 @example
139 aconvert=u8:auto
140 @end example
141 @end itemize
142
143 @section aformat
144
145 Convert the input audio to one of the specified formats. The framework will
146 negotiate the most appropriate format to minimize conversions.
147
148 The filter accepts the following named parameters:
149 @table @option
150
151 @item sample_fmts
152 A comma-separated list of requested sample formats.
153
154 @item sample_rates
155 A comma-separated list of requested sample rates.
156
157 @item channel_layouts
158 A comma-separated list of requested channel layouts.
159
160 @end table
161
162 If a parameter is omitted, all values are allowed.
163
164 For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
165 @example
166 aformat=sample_fmts\=u8\,s16:channel_layouts\=stereo
167 @end example
168
169 @section amerge
170
171 Merge two or more audio streams into a single multi-channel stream.
172
173 The filter accepts the following named options:
174
175 @table @option
176
177 @item inputs
178 Set the number of inputs. Default is 2.
179
180 @end table
181
182 If the channel layouts of the inputs are disjoint, and therefore compatible,
183 the channel layout of the output will be set accordingly and the channels
184 will be reordered as necessary. If the channel layouts of the inputs are not
185 disjoint, the output will have all the channels of the first input then all
186 the channels of the second input, in that order, and the channel layout of
187 the output will be the default value corresponding to the total number of
188 channels.
189
190 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
191 is FC+BL+BR, then the output will be in 5.1, with the channels in the
192 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
193 first input, b1 is the first channel of the second input).
194
195 On the other hand, if both input are in stereo, the output channels will be
196 in the default order: a1, a2, b1, b2, and the channel layout will be
197 arbitrarily set to 4.0, which may or may not be the expected value.
198
199 All inputs must have the same sample rate, and format.
200
201 If inputs do not have the same duration, the output will stop with the
202 shortest.
203
204 Example: merge two mono files into a stereo stream:
205 @example
206 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
207 @end example
208
209 Example: multiple merges:
210 @example
211 ffmpeg -f lavfi -i "
212 amovie=input.mkv:si=0 [a0];
213 amovie=input.mkv:si=1 [a1];
214 amovie=input.mkv:si=2 [a2];
215 amovie=input.mkv:si=3 [a3];
216 amovie=input.mkv:si=4 [a4];
217 amovie=input.mkv:si=5 [a5];
218 [a0][a1][a2][a3][a4][a5] amerge=inputs=6" -c:a pcm_s16le output.mkv
219 @end example
220
221 @section amix
222
223 Mixes multiple audio inputs into a single output.
224
225 For example
226 @example
227 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
228 @end example
229 will mix 3 input audio streams to a single output with the same duration as the
230 first input and a dropout transition time of 3 seconds.
231
232 The filter accepts the following named parameters:
233 @table @option
234
235 @item inputs
236 Number of inputs. If unspecified, it defaults to 2.
237
238 @item duration
239 How to determine the end-of-stream.
240 @table @option
241
242 @item longest
243 Duration of longest input. (default)
244
245 @item shortest
246 Duration of shortest input.
247
248 @item first
249 Duration of first input.
250
251 @end table
252
253 @item dropout_transition
254 Transition time, in seconds, for volume renormalization when an input
255 stream ends. The default value is 2 seconds.
256
257 @end table
258
259 @section anull
260
261 Pass the audio source unchanged to the output.
262
263 @section aresample
264
265 Resample the input audio to the specified sample rate.
266
267 The filter accepts exactly one parameter, the output sample rate. If not
268 specified then the filter will automatically convert between its input
269 and output sample rates.
270
271 For example, to resample the input audio to 44100Hz:
272 @example
273 aresample=44100
274 @end example
275
276 @section asetnsamples
277
278 Set the number of samples per each output audio frame.
279
280 The last output packet may contain a different number of samples, as
281 the filter will flush all the remaining samples when the input audio
282 signal its end.
283
284 The filter accepts parameters as a list of @var{key}=@var{value} pairs,
285 separated by ":".
286
287 @table @option
288
289 @item nb_out_samples, n
290 Set the number of frames per each output audio frame. The number is
291 intended as the number of samples @emph{per each channel}.
292 Default value is 1024.
293
294 @item pad, p
295 If set to 1, the filter will pad the last audio frame with zeroes, so
296 that the last frame will contain the same number of samples as the
297 previous ones. Default value is 1.
298 @end table
299
300 For example, to set the number of per-frame samples to 1234 and
301 disable padding for the last frame, use:
302 @example
303 asetnsamples=n=1234:p=0
304 @end example
305
306 @section ashowinfo
307
308 Show a line containing various information for each input audio frame.
309 The input audio is not modified.
310
311 The shown line contains a sequence of key/value pairs of the form
312 @var{key}:@var{value}.
313
314 A description of each shown parameter follows:
315
316 @table @option
317 @item n
318 sequential number of the input frame, starting from 0
319
320 @item pts
321 presentation TimeStamp of the input frame, expressed as a number of
322 time base units. The time base unit depends on the filter input pad, and
323 is usually 1/@var{sample_rate}.
324
325 @item pts_time
326 presentation TimeStamp of the input frame, expressed as a number of
327 seconds
328
329 @item pos
330 position of the frame in the input stream, -1 if this information in
331 unavailable and/or meaningless (for example in case of synthetic audio)
332
333 @item fmt
334 sample format name
335
336 @item chlayout
337 channel layout description
338
339 @item nb_samples
340 number of samples (per each channel) contained in the filtered frame
341
342 @item rate
343 sample rate for the audio frame
344
345 @item checksum
346 Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
347
348 @item plane_checksum
349 Adler-32 checksum (printed in hexadecimal) for each input frame plane,
350 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3} @var{c4} @var{c5}
351 @var{c6} @var{c7}]"
352 @end table
353
354 @section asplit
355
356 Split input audio into several identical outputs.
357
358 The filter accepts a single parameter which specifies the number of outputs. If
359 unspecified, it defaults to 2.
360
361 For example:
362 @example
363 [in] asplit [out0][out1]
364 @end example
365
366 will create two separate outputs from the same input.
367
368 To create 3 or more outputs, you need to specify the number of
369 outputs, like in:
370 @example
371 [in] asplit=3 [out0][out1][out2]
372 @end example
373
374 @example
375 ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
376 @end example
377 will create 5 copies of the input audio.
378
379
380 @section astreamsync
381
382 Forward two audio streams and control the order the buffers are forwarded.
383
384 The argument to the filter is an expression deciding which stream should be
385 forwarded next: if the result is negative, the first stream is forwarded; if
386 the result is positive or zero, the second stream is forwarded. It can use
387 the following variables:
388
389 @table @var
390 @item b1 b2
391 number of buffers forwarded so far on each stream
392 @item s1 s2
393 number of samples forwarded so far on each stream
394 @item t1 t2
395 current timestamp of each stream
396 @end table
397
398 The default value is @code{t1-t2}, which means to always forward the stream
399 that has a smaller timestamp.
400
401 Example: stress-test @code{amerge} by randomly sending buffers on the wrong
402 input, while avoiding too much of a desynchronization:
403 @example
404 amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
405 [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
406 [a2] [b2] amerge
407 @end example
408
409 @section atempo
410
411 Adjust audio tempo.
412
413 The filter accepts exactly one parameter, the audio tempo. If not
414 specified then the filter will assume nominal 1.0 tempo. Tempo must
415 be in the [0.5, 2.0] range.
416
417 For example, to slow down audio to 80% tempo:
418 @example
419 atempo=0.8
420 @end example
421
422 For example, to speed up audio to 125% tempo:
423 @example
424 atempo=1.25
425 @end example
426
427 @section earwax
428
429 Make audio easier to listen to on headphones.
430
431 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
432 so that when listened to on headphones the stereo image is moved from
433 inside your head (standard for headphones) to outside and in front of
434 the listener (standard for speakers).
435
436 Ported from SoX.
437
438 @section pan
439
440 Mix channels with specific gain levels. The filter accepts the output
441 channel layout followed by a set of channels definitions.
442
443 This filter is also designed to remap efficiently the channels of an audio
444 stream.
445
446 The filter accepts parameters of the form:
447 "@var{l}:@var{outdef}:@var{outdef}:..."
448
449 @table @option
450 @item l
451 output channel layout or number of channels
452
453 @item outdef
454 output channel specification, of the form:
455 "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
456
457 @item out_name
458 output channel to define, either a channel name (FL, FR, etc.) or a channel
459 number (c0, c1, etc.)
460
461 @item gain
462 multiplicative coefficient for the channel, 1 leaving the volume unchanged
463
464 @item in_name
465 input channel to use, see out_name for details; it is not possible to mix
466 named and numbered input channels
467 @end table
468
469 If the `=' in a channel specification is replaced by `<', then the gains for
470 that specification will be renormalized so that the total is 1, thus
471 avoiding clipping noise.
472
473 @subsection Mixing examples
474
475 For example, if you want to down-mix from stereo to mono, but with a bigger
476 factor for the left channel:
477 @example
478 pan=1:c0=0.9*c0+0.1*c1
479 @end example
480
481 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
482 7-channels surround:
483 @example
484 pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
485 @end example
486
487 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
488 that should be preferred (see "-ac" option) unless you have very specific
489 needs.
490
491 @subsection Remapping examples
492
493 The channel remapping will be effective if, and only if:
494
495 @itemize
496 @item gain coefficients are zeroes or ones,
497 @item only one input per channel output,
498 @end itemize
499
500 If all these conditions are satisfied, the filter will notify the user ("Pure
501 channel mapping detected"), and use an optimized and lossless method to do the
502 remapping.
503
504 For example, if you have a 5.1 source and want a stereo audio stream by
505 dropping the extra channels:
506 @example
507 pan="stereo: c0=FL : c1=FR"
508 @end example
509
510 Given the same source, you can also switch front left and front right channels
511 and keep the input channel layout:
512 @example
513 pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
514 @end example
515
516 If the input is a stereo audio stream, you can mute the front left channel (and
517 still keep the stereo channel layout) with:
518 @example
519 pan="stereo:c1=c1"
520 @end example
521
522 Still with a stereo audio stream input, you can copy the right channel in both
523 front left and right:
524 @example
525 pan="stereo: c0=FR : c1=FR"
526 @end example
527
528 @section silencedetect
529
530 Detect silence in an audio stream.
531
532 This filter logs a message when it detects that the input audio volume is less
533 or equal to a noise tolerance value for a duration greater or equal to the
534 minimum detected noise duration.
535
536 The printed times and duration are expressed in seconds.
537
538 @table @option
539 @item duration, d
540 Set silence duration until notification (default is 2 seconds).
541
542 @item noise, n
543 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
544 specified value) or amplitude ratio. Default is -60dB, or 0.001.
545 @end table
546
547 Detect 5 seconds of silence with -50dB noise tolerance:
548 @example
549 silencedetect=n=-50dB:d=5
550 @end example
551
552 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
553 tolerance in @file{silence.mp3}:
554 @example
555 ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
556 @end example
557
558 @section volume
559
560 Adjust the input audio volume.
561
562 The filter accepts exactly one parameter @var{vol}, which expresses
563 how the audio volume will be increased or decreased.
564
565 Output values are clipped to the maximum value.
566
567 If @var{vol} is expressed as a decimal number, the output audio
568 volume is given by the relation:
569 @example
570 @var{output_volume} = @var{vol} * @var{input_volume}
571 @end example
572
573 If @var{vol} is expressed as a decimal number followed by the string
574 "dB", the value represents the requested change in decibels of the
575 input audio power, and the output audio volume is given by the
576 relation:
577 @example
578 @var{output_volume} = 10^(@var{vol}/20) * @var{input_volume}
579 @end example
580
581 Otherwise @var{vol} is considered an expression and its evaluated
582 value is used for computing the output audio volume according to the
583 first relation.
584
585 Default value for @var{vol} is 1.0.
586
587 @subsection Examples
588
589 @itemize
590 @item
591 Half the input audio volume:
592 @example
593 volume=0.5
594 @end example
595
596 The above example is equivalent to:
597 @example
598 volume=1/2
599 @end example
600
601 @item
602 Decrease input audio power by 12 decibels:
603 @example
604 volume=-12dB
605 @end example
606 @end itemize
607
608 @section asyncts
609 Synchronize audio data with timestamps by squeezing/stretching it and/or
610 dropping samples/adding silence when needed.
611
612 The filter accepts the following named parameters:
613 @table @option
614
615 @item compensate
616 Enable stretching/squeezing the data to make it match the timestamps.
617
618 @item min_delta
619 Minimum difference between timestamps and audio data (in seconds) to trigger
620 adding/dropping samples.
621
622 @item max_comp
623 Maximum compensation in samples per second.
624
625 @end table
626
627 @section channelsplit
628 Split each channel in input audio stream into a separate output stream.
629
630 This filter accepts the following named parameters:
631 @table @option
632 @item channel_layout
633 Channel layout of the input stream. Default is "stereo".
634 @end table
635
636 For example, assuming a stereo input MP3 file
637 @example
638 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
639 @end example
640 will create an output Matroska file with two audio streams, one containing only
641 the left channel and the other the right channel.
642
643 To split a 5.1 WAV file into per-channel files
644 @example
645 ffmpeg -i in.wav -filter_complex
646 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
647 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
648 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
649 side_right.wav
650 @end example
651
652 @section channelmap
653 Remap input channels to new locations.
654
655 This filter accepts the following named parameters:
656 @table @option
657 @item channel_layout
658 Channel layout of the output stream.
659
660 @item map
661 Map channels from input to output. The argument is a comma-separated list of
662 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
663 @var{in_channel} form. @var{in_channel} can be either the name of the input
664 channel (e.g. FL for front left) or its index in the input channel layout.
665 @var{out_channel} is the name of the output channel or its index in the output
666 channel layout. If @var{out_channel} is not given then it is implicitly an
667 index, starting with zero and increasing by one for each mapping.
668 @end table
669
670 If no mapping is present, the filter will implicitly map input channels to
671 output channels preserving index.
672
673 For example, assuming a 5.1+downmix input MOV file
674 @example
675 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL\,DR-FR' out.wav
676 @end example
677 will create an output WAV file tagged as stereo from the downmix channels of
678 the input.
679
680 To fix a 5.1 WAV improperly encoded in AAC's native channel order
681 @example
682 ffmpeg -i in.wav -filter 'channelmap=1\,2\,0\,5\,3\,4:channel_layout=5.1' out.wav
683 @end example
684
685 @section join
686 Join multiple input streams into one multi-channel stream.
687
688 The filter accepts the following named parameters:
689 @table @option
690
691 @item inputs
692 Number of input streams. Defaults to 2.
693
694 @item channel_layout
695 Desired output channel layout. Defaults to stereo.
696
697 @item map
698 Map channels from inputs to output. The argument is a comma-separated list of
699 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
700 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
701 can be either the name of the input channel (e.g. FL for front left) or its
702 index in the specified input stream. @var{out_channel} is the name of the output
703 channel.
704 @end table
705
706 The filter will attempt to guess the mappings when those are not specified
707 explicitly. It does so by first trying to find an unused matching input channel
708 and if that fails it picks the first unused input channel.
709
710 E.g. to join 3 inputs (with properly set channel layouts)
711 @example
712 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
713 @end example
714
715 To build a 5.1 output from 6 single-channel streams:
716 @example
717 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
718 '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'
719 out
720 @end example
721
722 @section resample
723 Convert the audio sample format, sample rate and channel layout. This filter is
724 not meant to be used directly.
725
726 @c man end AUDIO FILTERS
727
728 @chapter Audio Sources
729 @c man begin AUDIO SOURCES
730
731 Below is a description of the currently available audio sources.
732
733 @section abuffer
734
735 Buffer audio frames, and make them available to the filter chain.
736
737 This source is mainly intended for a programmatic use, in particular
738 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
739
740 It accepts the following mandatory parameters:
741 @var{sample_rate}:@var{sample_fmt}:@var{channel_layout}
742
743 @table @option
744
745 @item sample_rate
746 The sample rate of the incoming audio buffers.
747
748 @item sample_fmt
749 The sample format of the incoming audio buffers.
750 Either a sample format name or its corresponging integer representation from
751 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
752
753 @item channel_layout
754 The channel layout of the incoming audio buffers.
755 Either a channel layout name from channel_layout_map in
756 @file{libavutil/audioconvert.c} or its corresponding integer representation
757 from the AV_CH_LAYOUT_* macros in @file{libavutil/audioconvert.h}
758
759 @end table
760
761 For example:
762 @example
763 abuffer=44100:s16p:stereo
764 @end example
765
766 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
767 Since the sample format with name "s16p" corresponds to the number
768 6 and the "stereo" channel layout corresponds to the value 0x3, this is
769 equivalent to:
770 @example
771 abuffer=44100:6:0x3
772 @end example
773
774 @section aevalsrc
775
776 Generate an audio signal specified by an expression.
777
778 This source accepts in input one or more expressions (one for each
779 channel), which are evaluated and used to generate a corresponding
780 audio signal.
781
782 It accepts the syntax: @var{exprs}[::@var{options}].
783 @var{exprs} is a list of expressions separated by ":", one for each
784 separate channel. In case the @var{channel_layout} is not
785 specified, the selected channel layout depends on the number of
786 provided expressions.
787
788 @var{options} is an optional sequence of @var{key}=@var{value} pairs,
789 separated by ":".
790
791 The description of the accepted options follows.
792
793 @table @option
794
795 @item channel_layout, c
796 Set the channel layout. The number of channels in the specified layout
797 must be equal to the number of specified expressions.
798
799 @item duration, d
800 Set the minimum duration of the sourced audio. See the function
801 @code{av_parse_time()} for the accepted format.
802 Note that the resulting duration may be greater than the specified
803 duration, as the generated audio is always cut at the end of a
804 complete frame.
805
806 If not specified, or the expressed duration is negative, the audio is
807 supposed to be generated forever.
808
809 @item nb_samples, n
810 Set the number of samples per channel per each output frame,
811 default to 1024.
812
813 @item sample_rate, s
814 Specify the sample rate, default to 44100.
815 @end table
816
817 Each expression in @var{exprs} can contain the following constants:
818
819 @table @option
820 @item n
821 number of the evaluated sample, starting from 0
822
823 @item t
824 time of the evaluated sample expressed in seconds, starting from 0
825
826 @item s
827 sample rate
828
829 @end table
830
831 @subsection Examples
832
833 @itemize
834
835 @item
836 Generate silence:
837 @example
838 aevalsrc=0
839 @end example
840
841 @item
842
843 Generate a sin signal with frequency of 440 Hz, set sample rate to
844 8000 Hz:
845 @example
846 aevalsrc="sin(440*2*PI*t)::s=8000"
847 @end example
848
849 @item
850 Generate a two channels signal, specify the channel layout (Front
851 Center + Back Center) explicitly:
852 @example
853 aevalsrc="sin(420*2*PI*t):cos(430*2*PI*t)::c=FC|BC"
854 @end example
855
856 @item
857 Generate white noise:
858 @example
859 aevalsrc="-2+random(0)"
860 @end example
861
862 @item
863 Generate an amplitude modulated signal:
864 @example
865 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
866 @end example
867
868 @item
869 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
870 @example
871 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)"
872 @end example
873
874 @end itemize
875
876 @section amovie
877
878 Read an audio stream from a movie container.
879
880 It accepts the syntax: @var{movie_name}[:@var{options}] where
881 @var{movie_name} is the name of the resource to read (not necessarily
882 a file but also a device or a stream accessed through some protocol),
883 and @var{options} is an optional sequence of @var{key}=@var{value}
884 pairs, separated by ":".
885
886 The description of the accepted options follows.
887
888 @table @option
889
890 @item format_name, f
891 Specify the format assumed for the movie to read, and can be either
892 the name of a container or an input device. If not specified the
893 format is guessed from @var{movie_name} or by probing.
894
895 @item seek_point, sp
896 Specify the seek point in seconds, the frames will be output
897 starting from this seek point, the parameter is evaluated with
898 @code{av_strtod} so the numerical value may be suffixed by an IS
899 postfix. Default value is "0".
900
901 @item stream_index, si
902 Specify the index of the audio stream to read. If the value is -1,
903 the best suited audio stream will be automatically selected. Default
904 value is "-1".
905
906 @end table
907
908 @section anullsrc
909
910 Null audio source, return unprocessed audio frames. It is mainly useful
911 as a template and to be employed in analysis / debugging tools, or as
912 the source for filters which ignore the input data (for example the sox
913 synth filter).
914
915 It accepts an optional sequence of @var{key}=@var{value} pairs,
916 separated by ":".
917
918 The description of the accepted options follows.
919
920 @table @option
921
922 @item sample_rate, s
923 Specify the sample rate, and defaults to 44100.
924
925 @item channel_layout, cl
926
927 Specify the channel layout, and can be either an integer or a string
928 representing a channel layout. The default value of @var{channel_layout}
929 is "stereo".
930
931 Check the channel_layout_map definition in
932 @file{libavcodec/audioconvert.c} for the mapping between strings and
933 channel layout values.
934
935 @item nb_samples, n
936 Set the number of samples per requested frames.
937
938 @end table
939
940 Follow some examples:
941 @example
942 #  set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
943 anullsrc=r=48000:cl=4
944
945 # same as
946 anullsrc=r=48000:cl=mono
947 @end example
948
949 @section abuffer
950 Buffer audio frames, and make them available to the filter chain.
951
952 This source is not intended to be part of user-supplied graph descriptions but
953 for insertion by calling programs through the interface defined in
954 @file{libavfilter/buffersrc.h}.
955
956 It accepts the following named parameters:
957 @table @option
958
959 @item time_base
960 Timebase which will be used for timestamps of submitted frames. It must be
961 either a floating-point number or in @var{numerator}/@var{denominator} form.
962
963 @item sample_rate
964 Audio sample rate.
965
966 @item sample_fmt
967 Name of the sample format, as returned by @code{av_get_sample_fmt_name()}.
968
969 @item channel_layout
970 Channel layout of the audio data, in the form that can be accepted by
971 @code{av_get_channel_layout()}.
972 @end table
973
974 All the parameters need to be explicitly defined.
975
976 @c man end AUDIO SOURCES
977
978 @chapter Audio Sinks
979 @c man begin AUDIO SINKS
980
981 Below is a description of the currently available audio sinks.
982
983 @section abuffersink
984
985 Buffer audio frames, and make them available to the end of filter chain.
986
987 This sink is mainly intended for programmatic use, in particular
988 through the interface defined in @file{libavfilter/buffersink.h}.
989
990 It requires a pointer to an AVABufferSinkContext structure, which
991 defines the incoming buffers' formats, to be passed as the opaque
992 parameter to @code{avfilter_init_filter} for initialization.
993
994 @section anullsink
995
996 Null audio sink, do absolutely nothing with the input audio. It is
997 mainly useful as a template and to be employed in analysis / debugging
998 tools.
999
1000 @section abuffersink
1001 This sink is intended for programmatic use. Frames that arrive on this sink can
1002 be retrieved by the calling program using the interface defined in
1003 @file{libavfilter/buffersink.h}.
1004
1005 This filter accepts no parameters.
1006
1007 @c man end AUDIO SINKS
1008
1009 @chapter Video Filters
1010 @c man begin VIDEO FILTERS
1011
1012 When you configure your FFmpeg build, you can disable any of the
1013 existing filters using @code{--disable-filters}.
1014 The configure output will show the video filters included in your
1015 build.
1016
1017 Below is a description of the currently available video filters.
1018
1019 @section ass
1020
1021 Draw ASS (Advanced Substation Alpha) subtitles on top of input video
1022 using the libass library.
1023
1024 To enable compilation of this filter you need to configure FFmpeg with
1025 @code{--enable-libass}.
1026
1027 This filter accepts the syntax: @var{ass_filename}[:@var{options}],
1028 where @var{ass_filename} is the filename of the ASS file to read, and
1029 @var{options} is an optional sequence of @var{key}=@var{value} pairs,
1030 separated by ":".
1031
1032 A description of the accepted options follows.
1033
1034 @table @option
1035 @item original_size
1036 Specifies the size of the original video, the video for which the ASS file
1037 was composed. Due to a misdesign in ASS aspect ratio arithmetic, this is
1038 necessary to correctly scale the fonts if the aspect ratio has been changed.
1039 @end table
1040
1041 For example, to render the file @file{sub.ass} on top of the input
1042 video, use the command:
1043 @example
1044 ass=sub.ass
1045 @end example
1046
1047 @section bbox
1048
1049 Compute the bounding box for the non-black pixels in the input frame
1050 luminance plane.
1051
1052 This filter computes the bounding box containing all the pixels with a
1053 luminance value greater than the minimum allowed value.
1054 The parameters describing the bounding box are printed on the filter
1055 log.
1056
1057 @section blackdetect
1058
1059 Detect video intervals that are (almost) completely black. Can be
1060 useful to detect chapter transitions, commercials, or invalid
1061 recordings. Output lines contains the time for the start, end and
1062 duration of the detected black interval expressed in seconds.
1063
1064 In order to display the output lines, you need to set the loglevel at
1065 least to the AV_LOG_INFO value.
1066
1067 This filter accepts a list of options in the form of
1068 @var{key}=@var{value} pairs separated by ":". A description of the
1069 accepted options follows.
1070
1071 @table @option
1072 @item black_min_duration, d
1073 Set the minimum detected black duration expressed in seconds. It must
1074 be a non-negative floating point number.
1075
1076 Default value is 2.0.
1077
1078 @item picture_black_ratio_th, pic_th
1079 Set the threshold for considering a picture "black".
1080 Express the minimum value for the ratio:
1081 @example
1082 @var{nb_black_pixels} / @var{nb_pixels}
1083 @end example
1084
1085 for which a picture is considered black.
1086 Default value is 0.98.
1087
1088 @item pixel_black_th, pix_th
1089 Set the threshold for considering a pixel "black".
1090
1091 The threshold expresses the maximum pixel luminance value for which a
1092 pixel is considered "black". The provided value is scaled according to
1093 the following equation:
1094 @example
1095 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
1096 @end example
1097
1098 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
1099 the input video format, the range is [0-255] for YUV full-range
1100 formats and [16-235] for YUV non full-range formats.
1101
1102 Default value is 0.10.
1103 @end table
1104
1105 The following example sets the maximum pixel threshold to the minimum
1106 value, and detects only black intervals of 2 or more seconds:
1107 @example
1108 blackdetect=d=2:pix_th=0.00
1109 @end example
1110
1111 @section blackframe
1112
1113 Detect frames that are (almost) completely black. Can be useful to
1114 detect chapter transitions or commercials. Output lines consist of
1115 the frame number of the detected frame, the percentage of blackness,
1116 the position in the file if known or -1 and the timestamp in seconds.
1117
1118 In order to display the output lines, you need to set the loglevel at
1119 least to the AV_LOG_INFO value.
1120
1121 The filter accepts the syntax:
1122 @example
1123 blackframe[=@var{amount}:[@var{threshold}]]
1124 @end example
1125
1126 @var{amount} is the percentage of the pixels that have to be below the
1127 threshold, and defaults to 98.
1128
1129 @var{threshold} is the threshold below which a pixel value is
1130 considered black, and defaults to 32.
1131
1132 @section boxblur
1133
1134 Apply boxblur algorithm to the input video.
1135
1136 This filter accepts the parameters:
1137 @var{luma_radius}:@var{luma_power}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
1138
1139 Chroma and alpha parameters are optional, if not specified they default
1140 to the corresponding values set for @var{luma_radius} and
1141 @var{luma_power}.
1142
1143 @var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
1144 the radius in pixels of the box used for blurring the corresponding
1145 input plane. They are expressions, and can contain the following
1146 constants:
1147 @table @option
1148 @item w, h
1149 the input width and height in pixels
1150
1151 @item cw, ch
1152 the input chroma image width and height in pixels
1153
1154 @item hsub, vsub
1155 horizontal and vertical chroma subsample values. For example for the
1156 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
1157 @end table
1158
1159 The radius must be a non-negative number, and must not be greater than
1160 the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
1161 and of @code{min(cw,ch)/2} for the chroma planes.
1162
1163 @var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
1164 how many times the boxblur filter is applied to the corresponding
1165 plane.
1166
1167 Some examples follow:
1168
1169 @itemize
1170
1171 @item
1172 Apply a boxblur filter with luma, chroma, and alpha radius
1173 set to 2:
1174 @example
1175 boxblur=2:1
1176 @end example
1177
1178 @item
1179 Set luma radius to 2, alpha and chroma radius to 0
1180 @example
1181 boxblur=2:1:0:0:0:0
1182 @end example
1183
1184 @item
1185 Set luma and chroma radius to a fraction of the video dimension
1186 @example
1187 boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
1188 @end example
1189
1190 @end itemize
1191
1192 @section colormatrix
1193
1194 The colormatrix filter allows conversion between any of the following color
1195 space: BT.709 (@var{bt709}), BT.601 (@var{bt601}), SMPTE-240M (@var{smpte240m})
1196 and FCC (@var{fcc}).
1197
1198 The syntax of the parameters is @var{source}:@var{destination}:
1199
1200 @example
1201 colormatrix=bt601:smpte240m
1202 @end example
1203
1204 @section copy
1205
1206 Copy the input source unchanged to the output. Mainly useful for
1207 testing purposes.
1208
1209 @section crop
1210
1211 Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}:@var{keep_aspect}
1212
1213 The @var{keep_aspect} parameter is optional, if specified and set to a
1214 non-zero value will force the output display aspect ratio to be the
1215 same of the input, by changing the output sample aspect ratio.
1216
1217 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
1218 expressions containing the following constants:
1219
1220 @table @option
1221 @item x, y
1222 the computed values for @var{x} and @var{y}. They are evaluated for
1223 each new frame.
1224
1225 @item in_w, in_h
1226 the input width and height
1227
1228 @item iw, ih
1229 same as @var{in_w} and @var{in_h}
1230
1231 @item out_w, out_h
1232 the output (cropped) width and height
1233
1234 @item ow, oh
1235 same as @var{out_w} and @var{out_h}
1236
1237 @item a
1238 same as @var{iw} / @var{ih}
1239
1240 @item sar
1241 input sample aspect ratio
1242
1243 @item dar
1244 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
1245
1246 @item hsub, vsub
1247 horizontal and vertical chroma subsample values. For example for the
1248 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
1249
1250 @item n
1251 the number of input frame, starting from 0
1252
1253 @item pos
1254 the position in the file of the input frame, NAN if unknown
1255
1256 @item t
1257 timestamp expressed in seconds, NAN if the input timestamp is unknown
1258
1259 @end table
1260
1261 The @var{out_w} and @var{out_h} parameters specify the expressions for
1262 the width and height of the output (cropped) video. They are
1263 evaluated just at the configuration of the filter.
1264
1265 The default value of @var{out_w} is "in_w", and the default value of
1266 @var{out_h} is "in_h".
1267
1268 The expression for @var{out_w} may depend on the value of @var{out_h},
1269 and the expression for @var{out_h} may depend on @var{out_w}, but they
1270 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
1271 evaluated after @var{out_w} and @var{out_h}.
1272
1273 The @var{x} and @var{y} parameters specify the expressions for the
1274 position of the top-left corner of the output (non-cropped) area. They
1275 are evaluated for each frame. If the evaluated value is not valid, it
1276 is approximated to the nearest valid value.
1277
1278 The default value of @var{x} is "(in_w-out_w)/2", and the default
1279 value for @var{y} is "(in_h-out_h)/2", which set the cropped area at
1280 the center of the input image.
1281
1282 The expression for @var{x} may depend on @var{y}, and the expression
1283 for @var{y} may depend on @var{x}.
1284
1285 Follow some examples:
1286 @example
1287 # crop the central input area with size 100x100
1288 crop=100:100
1289
1290 # crop the central input area with size 2/3 of the input video
1291 "crop=2/3*in_w:2/3*in_h"
1292
1293 # crop the input video central square
1294 crop=in_h
1295
1296 # delimit the rectangle with the top-left corner placed at position
1297 # 100:100 and the right-bottom corner corresponding to the right-bottom
1298 # corner of the input image.
1299 crop=in_w-100:in_h-100:100:100
1300
1301 # crop 10 pixels from the left and right borders, and 20 pixels from
1302 # the top and bottom borders
1303 "crop=in_w-2*10:in_h-2*20"
1304
1305 # keep only the bottom right quarter of the input image
1306 "crop=in_w/2:in_h/2:in_w/2:in_h/2"
1307
1308 # crop height for getting Greek harmony
1309 "crop=in_w:1/PHI*in_w"
1310
1311 # trembling effect
1312 "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)"
1313
1314 # erratic camera effect depending on timestamp
1315 "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)"
1316
1317 # set x depending on the value of y
1318 "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
1319 @end example
1320
1321 @section cropdetect
1322
1323 Auto-detect crop size.
1324
1325 Calculate necessary cropping parameters and prints the recommended
1326 parameters through the logging system. The detected dimensions
1327 correspond to the non-black area of the input video.
1328
1329 It accepts the syntax:
1330 @example
1331 cropdetect[=@var{limit}[:@var{round}[:@var{reset}]]]
1332 @end example
1333
1334 @table @option
1335
1336 @item limit
1337 Threshold, which can be optionally specified from nothing (0) to
1338 everything (255), defaults to 24.
1339
1340 @item round
1341 Value which the width/height should be divisible by, defaults to
1342 16. The offset is automatically adjusted to center the video. Use 2 to
1343 get only even dimensions (needed for 4:2:2 video). 16 is best when
1344 encoding to most video codecs.
1345
1346 @item reset
1347 Counter that determines after how many frames cropdetect will reset
1348 the previously detected largest video area and start over to detect
1349 the current optimal crop area. Defaults to 0.
1350
1351 This can be useful when channel logos distort the video area. 0
1352 indicates never reset and return the largest area encountered during
1353 playback.
1354 @end table
1355
1356 @section delogo
1357
1358 Suppress a TV station logo by a simple interpolation of the surrounding
1359 pixels. Just set a rectangle covering the logo and watch it disappear
1360 (and sometimes something even uglier appear - your mileage may vary).
1361
1362 The filter accepts parameters as a string of the form
1363 "@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
1364 @var{key}=@var{value} pairs, separated by ":".
1365
1366 The description of the accepted parameters follows.
1367
1368 @table @option
1369
1370 @item x, y
1371 Specify the top left corner coordinates of the logo. They must be
1372 specified.
1373
1374 @item w, h
1375 Specify the width and height of the logo to clear. They must be
1376 specified.
1377
1378 @item band, t
1379 Specify the thickness of the fuzzy edge of the rectangle (added to
1380 @var{w} and @var{h}). The default value is 4.
1381
1382 @item show
1383 When set to 1, a green rectangle is drawn on the screen to simplify
1384 finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
1385 @var{band} is set to 4. The default value is 0.
1386
1387 @end table
1388
1389 Some examples follow.
1390
1391 @itemize
1392
1393 @item
1394 Set a rectangle covering the area with top left corner coordinates 0,0
1395 and size 100x77, setting a band of size 10:
1396 @example
1397 delogo=0:0:100:77:10
1398 @end example
1399
1400 @item
1401 As the previous example, but use named options:
1402 @example
1403 delogo=x=0:y=0:w=100:h=77:band=10
1404 @end example
1405
1406 @end itemize
1407
1408 @section deshake
1409
1410 Attempt to fix small changes in horizontal and/or vertical shift. This
1411 filter helps remove camera shake from hand-holding a camera, bumping a
1412 tripod, moving on a vehicle, etc.
1413
1414 The filter accepts parameters as a string of the form
1415 "@var{x}:@var{y}:@var{w}:@var{h}:@var{rx}:@var{ry}:@var{edge}:@var{blocksize}:@var{contrast}:@var{search}:@var{filename}"
1416
1417 A description of the accepted parameters follows.
1418
1419 @table @option
1420
1421 @item x, y, w, h
1422 Specify a rectangular area where to limit the search for motion
1423 vectors.
1424 If desired the search for motion vectors can be limited to a
1425 rectangular area of the frame defined by its top left corner, width
1426 and height. These parameters have the same meaning as the drawbox
1427 filter which can be used to visualise the position of the bounding
1428 box.
1429
1430 This is useful when simultaneous movement of subjects within the frame
1431 might be confused for camera motion by the motion vector search.
1432
1433 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
1434 then the full frame is used. This allows later options to be set
1435 without specifying the bounding box for the motion vector search.
1436
1437 Default - search the whole frame.
1438
1439 @item rx, ry
1440 Specify the maximum extent of movement in x and y directions in the
1441 range 0-64 pixels. Default 16.
1442
1443 @item edge
1444 Specify how to generate pixels to fill blanks at the edge of the
1445 frame. An integer from 0 to 3 as follows:
1446 @table @option
1447 @item 0
1448 Fill zeroes at blank locations
1449 @item 1
1450 Original image at blank locations
1451 @item 2
1452 Extruded edge value at blank locations
1453 @item 3
1454 Mirrored edge at blank locations
1455 @end table
1456
1457 The default setting is mirror edge at blank locations.
1458
1459 @item blocksize
1460 Specify the blocksize to use for motion search. Range 4-128 pixels,
1461 default 8.
1462
1463 @item contrast
1464 Specify the contrast threshold for blocks. Only blocks with more than
1465 the specified contrast (difference between darkest and lightest
1466 pixels) will be considered. Range 1-255, default 125.
1467
1468 @item search
1469 Specify the search strategy 0 = exhaustive search, 1 = less exhaustive
1470 search. Default - exhaustive search.
1471
1472 @item filename
1473 If set then a detailed log of the motion search is written to the
1474 specified file.
1475
1476 @end table
1477
1478 @section drawbox
1479
1480 Draw a colored box on the input image.
1481
1482 It accepts the syntax:
1483 @example
1484 drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
1485 @end example
1486
1487 @table @option
1488
1489 @item x, y
1490 Specify the top left corner coordinates of the box. Default to 0.
1491
1492 @item width, height
1493 Specify the width and height of the box, if 0 they are interpreted as
1494 the input width and height. Default to 0.
1495
1496 @item color
1497 Specify the color of the box to write, it can be the name of a color
1498 (case insensitive match) or a 0xRRGGBB[AA] sequence.
1499 @end table
1500
1501 Follow some examples:
1502 @example
1503 # draw a black box around the edge of the input image
1504 drawbox
1505
1506 # draw a box with color red and an opacity of 50%
1507 drawbox=10:20:200:60:red@@0.5"
1508 @end example
1509
1510 @section drawtext
1511
1512 Draw text string or text from specified file on top of video using the
1513 libfreetype library.
1514
1515 To enable compilation of this filter you need to configure FFmpeg with
1516 @code{--enable-libfreetype}.
1517
1518 The filter also recognizes strftime() sequences in the provided text
1519 and expands them accordingly. Check the documentation of strftime().
1520
1521 The filter accepts parameters as a list of @var{key}=@var{value} pairs,
1522 separated by ":".
1523
1524 The description of the accepted parameters follows.
1525
1526 @table @option
1527
1528 @item box
1529 Used to draw a box around text using background color.
1530 Value should be either 1 (enable) or 0 (disable).
1531 The default value of @var{box} is 0.
1532
1533 @item boxcolor
1534 The color to be used for drawing box around text.
1535 Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
1536 (e.g. "0xff00ff"), possibly followed by an alpha specifier.
1537 The default value of @var{boxcolor} is "white".
1538
1539 @item draw
1540 Set an expression which specifies if the text should be drawn. If the
1541 expression evaluates to 0, the text is not drawn. This is useful for
1542 specifying that the text should be drawn only when specific conditions
1543 are met.
1544
1545 Default value is "1".
1546
1547 See below for the list of accepted constants and functions.
1548
1549 @item fix_bounds
1550 If true, check and fix text coords to avoid clipping.
1551
1552 @item fontcolor
1553 The color to be used for drawing fonts.
1554 Either a string (e.g. "red") or in 0xRRGGBB[AA] format
1555 (e.g. "0xff000033"), possibly followed by an alpha specifier.
1556 The default value of @var{fontcolor} is "black".
1557
1558 @item fontfile
1559 The font file to be used for drawing text. Path must be included.
1560 This parameter is mandatory.
1561
1562 @item fontsize
1563 The font size to be used for drawing text.
1564 The default value of @var{fontsize} is 16.
1565
1566 @item ft_load_flags
1567 Flags to be used for loading the fonts.
1568
1569 The flags map the corresponding flags supported by libfreetype, and are
1570 a combination of the following values:
1571 @table @var
1572 @item default
1573 @item no_scale
1574 @item no_hinting
1575 @item render
1576 @item no_bitmap
1577 @item vertical_layout
1578 @item force_autohint
1579 @item crop_bitmap
1580 @item pedantic
1581 @item ignore_global_advance_width
1582 @item no_recurse
1583 @item ignore_transform
1584 @item monochrome
1585 @item linear_design
1586 @item no_autohint
1587 @item end table
1588 @end table
1589
1590 Default value is "render".
1591
1592 For more information consult the documentation for the FT_LOAD_*
1593 libfreetype flags.
1594
1595 @item shadowcolor
1596 The color to be used for drawing a shadow behind the drawn text.  It
1597 can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
1598 form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
1599 The default value of @var{shadowcolor} is "black".
1600
1601 @item shadowx, shadowy
1602 The x and y offsets for the text shadow position with respect to the
1603 position of the text. They can be either positive or negative
1604 values. Default value for both is "0".
1605
1606 @item tabsize
1607 The size in number of spaces to use for rendering the tab.
1608 Default value is 4.
1609
1610 @item timecode
1611 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
1612 format. It can be used with or without text parameter. @var{timecode_rate}
1613 option must be specified.
1614
1615 @item timecode_rate, rate, r
1616 Set the timecode frame rate (timecode only).
1617
1618 @item text
1619 The text string to be drawn. The text must be a sequence of UTF-8
1620 encoded characters.
1621 This parameter is mandatory if no file is specified with the parameter
1622 @var{textfile}.
1623
1624 @item textfile
1625 A text file containing text to be drawn. The text must be a sequence
1626 of UTF-8 encoded characters.
1627
1628 This parameter is mandatory if no text string is specified with the
1629 parameter @var{text}.
1630
1631 If both @var{text} and @var{textfile} are specified, an error is thrown.
1632
1633 @item x, y
1634 The expressions which specify the offsets where text will be drawn
1635 within the video frame. They are relative to the top/left border of the
1636 output image.
1637
1638 The default value of @var{x} and @var{y} is "0".
1639
1640 See below for the list of accepted constants and functions.
1641 @end table
1642
1643 The parameters for @var{x} and @var{y} are expressions containing the
1644 following constants and functions:
1645
1646 @table @option
1647 @item dar
1648 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
1649
1650 @item hsub, vsub
1651 horizontal and vertical chroma subsample values. For example for the
1652 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
1653
1654 @item line_h, lh
1655 the height of each text line
1656
1657 @item main_h, h, H
1658 the input height
1659
1660 @item main_w, w, W
1661 the input width
1662
1663 @item max_glyph_a, ascent
1664 the maximum distance from the baseline to the highest/upper grid
1665 coordinate used to place a glyph outline point, for all the rendered
1666 glyphs.
1667 It is a positive value, due to the grid's orientation with the Y axis
1668 upwards.
1669
1670 @item max_glyph_d, descent
1671 the maximum distance from the baseline to the lowest grid coordinate
1672 used to place a glyph outline point, for all the rendered glyphs.
1673 This is a negative value, due to the grid's orientation, with the Y axis
1674 upwards.
1675
1676 @item max_glyph_h
1677 maximum glyph height, that is the maximum height for all the glyphs
1678 contained in the rendered text, it is equivalent to @var{ascent} -
1679 @var{descent}.
1680
1681 @item max_glyph_w
1682 maximum glyph width, that is the maximum width for all the glyphs
1683 contained in the rendered text
1684
1685 @item n
1686 the number of input frame, starting from 0
1687
1688 @item rand(min, max)
1689 return a random number included between @var{min} and @var{max}
1690
1691 @item sar
1692 input sample aspect ratio
1693
1694 @item t
1695 timestamp expressed in seconds, NAN if the input timestamp is unknown
1696
1697 @item text_h, th
1698 the height of the rendered text
1699
1700 @item text_w, tw
1701 the width of the rendered text
1702
1703 @item x, y
1704 the x and y offset coordinates where the text is drawn.
1705
1706 These parameters allow the @var{x} and @var{y} expressions to refer
1707 each other, so you can for example specify @code{y=x/dar}.
1708 @end table
1709
1710 If libavfilter was built with @code{--enable-fontconfig}, then
1711 @option{fontfile} can be a fontconfig pattern or omitted.
1712
1713 Some examples follow.
1714
1715 @itemize
1716
1717 @item
1718 Draw "Test Text" with font FreeSerif, using the default values for the
1719 optional parameters.
1720
1721 @example
1722 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
1723 @end example
1724
1725 @item
1726 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
1727 and y=50 (counting from the top-left corner of the screen), text is
1728 yellow with a red box around it. Both the text and the box have an
1729 opacity of 20%.
1730
1731 @example
1732 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
1733           x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
1734 @end example
1735
1736 Note that the double quotes are not necessary if spaces are not used
1737 within the parameter list.
1738
1739 @item
1740 Show the text at the center of the video frame:
1741 @example
1742 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
1743 @end example
1744
1745 @item
1746 Show a text line sliding from right to left in the last row of the video
1747 frame. The file @file{LONG_LINE} is assumed to contain a single line
1748 with no newlines.
1749 @example
1750 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
1751 @end example
1752
1753 @item
1754 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
1755 @example
1756 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
1757 @end example
1758
1759 @item
1760 Draw a single green letter "g", at the center of the input video.
1761 The glyph baseline is placed at half screen height.
1762 @example
1763 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
1764 @end example
1765
1766 @item
1767 Show text for 1 second every 3 seconds:
1768 @example
1769 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\\,3)\\,1):text='blink'"
1770 @end example
1771
1772 @item
1773 Use fontconfig to set the font. Note that the colons need to be escaped.
1774 @example
1775 drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
1776 @end example
1777
1778 @end itemize
1779
1780 For more information about libfreetype, check:
1781 @url{http://www.freetype.org/}.
1782
1783 For more information about fontconfig, check:
1784 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
1785
1786 @section fade
1787
1788 Apply fade-in/out effect to input video.
1789
1790 It accepts the parameters:
1791 @var{type}:@var{start_frame}:@var{nb_frames}[:@var{options}]
1792
1793 @var{type} specifies if the effect type, can be either "in" for
1794 fade-in, or "out" for a fade-out effect.
1795
1796 @var{start_frame} specifies the number of the start frame for starting
1797 to apply the fade effect.
1798
1799 @var{nb_frames} specifies the number of frames for which the fade
1800 effect has to last. At the end of the fade-in effect the output video
1801 will have the same intensity as the input video, at the end of the
1802 fade-out transition the output video will be completely black.
1803
1804 @var{options} is an optional sequence of @var{key}=@var{value} pairs,
1805 separated by ":". The description of the accepted options follows.
1806
1807 @table @option
1808
1809 @item type, t
1810 See @var{type}.
1811
1812 @item start_frame, s
1813 See @var{start_frame}.
1814
1815 @item nb_frames, n
1816 See @var{nb_frames}.
1817
1818 @item alpha
1819 If set to 1, fade only alpha channel, if one exists on the input.
1820 Default value is 0.
1821 @end table
1822
1823 A few usage examples follow, usable too as test scenarios.
1824 @example
1825 # fade in first 30 frames of video
1826 fade=in:0:30
1827
1828 # fade out last 45 frames of a 200-frame video
1829 fade=out:155:45
1830
1831 # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
1832 fade=in:0:25, fade=out:975:25
1833
1834 # make first 5 frames black, then fade in from frame 5-24
1835 fade=in:5:20
1836
1837 # fade in alpha over first 25 frames of video
1838 fade=in:0:25:alpha=1
1839 @end example
1840
1841 @section fieldorder
1842
1843 Transform the field order of the input video.
1844
1845 It accepts one parameter which specifies the required field order that
1846 the input interlaced video will be transformed to. The parameter can
1847 assume one of the following values:
1848
1849 @table @option
1850 @item 0 or bff
1851 output bottom field first
1852 @item 1 or tff
1853 output top field first
1854 @end table
1855
1856 Default value is "tff".
1857
1858 Transformation is achieved by shifting the picture content up or down
1859 by one line, and filling the remaining line with appropriate picture content.
1860 This method is consistent with most broadcast field order converters.
1861
1862 If the input video is not flagged as being interlaced, or it is already
1863 flagged as being of the required output field order then this filter does
1864 not alter the incoming video.
1865
1866 This filter is very useful when converting to or from PAL DV material,
1867 which is bottom field first.
1868
1869 For example:
1870 @example
1871 ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
1872 @end example
1873
1874 @section fifo
1875
1876 Buffer input images and send them when they are requested.
1877
1878 This filter is mainly useful when auto-inserted by the libavfilter
1879 framework.
1880
1881 The filter does not take parameters.
1882
1883 @section format
1884
1885 Convert the input video to one of the specified pixel formats.
1886 Libavfilter will try to pick one that is supported for the input to
1887 the next filter.
1888
1889 The filter accepts a list of pixel format names, separated by ":",
1890 for example "yuv420p:monow:rgb24".
1891
1892 Some examples follow:
1893 @example
1894 # convert the input video to the format "yuv420p"
1895 format=yuv420p
1896
1897 # convert the input video to any of the formats in the list
1898 format=yuv420p:yuv444p:yuv410p
1899 @end example
1900
1901 @section fps
1902
1903 Convert the video to specified constant framerate by duplicating or dropping
1904 frames as necessary.
1905
1906 This filter accepts the following named parameters:
1907 @table @option
1908
1909 @item fps
1910 Desired output framerate.
1911
1912 @end table
1913
1914 @anchor{frei0r}
1915 @section frei0r
1916
1917 Apply a frei0r effect to the input video.
1918
1919 To enable compilation of this filter you need to install the frei0r
1920 header and configure FFmpeg with @code{--enable-frei0r}.
1921
1922 The filter supports the syntax:
1923 @example
1924 @var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
1925 @end example
1926
1927 @var{filter_name} is the name to the frei0r effect to load. If the
1928 environment variable @env{FREI0R_PATH} is defined, the frei0r effect
1929 is searched in each one of the directories specified by the colon
1930 separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r
1931 paths, which are in this order: @file{HOME/.frei0r-1/lib/},
1932 @file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}.
1933
1934 @var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
1935 for the frei0r effect.
1936
1937 A frei0r effect parameter can be a boolean (whose values are specified
1938 with "y" and "n"), a double, a color (specified by the syntax
1939 @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
1940 numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
1941 description), a position (specified by the syntax @var{X}/@var{Y},
1942 @var{X} and @var{Y} being float numbers) and a string.
1943
1944 The number and kind of parameters depend on the loaded effect. If an
1945 effect parameter is not specified the default value is set.
1946
1947 Some examples follow:
1948
1949 @itemize
1950 @item
1951 Apply the distort0r effect, set the first two double parameters:
1952 @example
1953 frei0r=distort0r:0.5:0.01
1954 @end example
1955
1956 @item
1957 Apply the colordistance effect, takes a color as first parameter:
1958 @example
1959 frei0r=colordistance:0.2/0.3/0.4
1960 frei0r=colordistance:violet
1961 frei0r=colordistance:0x112233
1962 @end example
1963
1964 @item
1965 Apply the perspective effect, specify the top left and top right image
1966 positions:
1967 @example
1968 frei0r=perspective:0.2/0.2:0.8/0.2
1969 @end example
1970 @end itemize
1971
1972 For more information see:
1973 @url{http://frei0r.dyne.org}
1974
1975 @section gradfun
1976
1977 Fix the banding artifacts that are sometimes introduced into nearly flat
1978 regions by truncation to 8bit color depth.
1979 Interpolate the gradients that should go where the bands are, and
1980 dither them.
1981
1982 This filter is designed for playback only.  Do not use it prior to
1983 lossy compression, because compression tends to lose the dither and
1984 bring back the bands.
1985
1986 The filter takes two optional parameters, separated by ':':
1987 @var{strength}:@var{radius}
1988
1989 @var{strength} is the maximum amount by which the filter will change
1990 any one pixel. Also the threshold for detecting nearly flat
1991 regions. Acceptable values range from .51 to 255, default value is
1992 1.2, out-of-range values will be clipped to the valid range.
1993
1994 @var{radius} is the neighborhood to fit the gradient to. A larger
1995 radius makes for smoother gradients, but also prevents the filter from
1996 modifying the pixels near detailed regions. Acceptable values are
1997 8-32, default value is 16, out-of-range values will be clipped to the
1998 valid range.
1999
2000 @example
2001 # default parameters
2002 gradfun=1.2:16
2003
2004 # omitting radius
2005 gradfun=1.2
2006 @end example
2007
2008 @section hflip
2009
2010 Flip the input video horizontally.
2011
2012 For example to horizontally flip the input video with @command{ffmpeg}:
2013 @example
2014 ffmpeg -i in.avi -vf "hflip" out.avi
2015 @end example
2016
2017 @section hqdn3d
2018
2019 High precision/quality 3d denoise filter. This filter aims to reduce
2020 image noise producing smooth images and making still images really
2021 still. It should enhance compressibility.
2022
2023 It accepts the following optional parameters:
2024 @var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
2025
2026 @table @option
2027 @item luma_spatial
2028 a non-negative float number which specifies spatial luma strength,
2029 defaults to 4.0
2030
2031 @item chroma_spatial
2032 a non-negative float number which specifies spatial chroma strength,
2033 defaults to 3.0*@var{luma_spatial}/4.0
2034
2035 @item luma_tmp
2036 a float number which specifies luma temporal strength, defaults to
2037 6.0*@var{luma_spatial}/4.0
2038
2039 @item chroma_tmp
2040 a float number which specifies chroma temporal strength, defaults to
2041 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
2042 @end table
2043
2044 @section idet
2045
2046 Interlaceing detect filter. This filter tries to detect if the input is
2047 interlaced or progressive. Top or bottom field first.
2048
2049 @section lut, lutrgb, lutyuv
2050
2051 Compute a look-up table for binding each pixel component input value
2052 to an output value, and apply it to input video.
2053
2054 @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
2055 to an RGB input video.
2056
2057 These filters accept in input a ":"-separated list of options, which
2058 specify the expressions used for computing the lookup table for the
2059 corresponding pixel component values.
2060
2061 The @var{lut} filter requires either YUV or RGB pixel formats in
2062 input, and accepts the options:
2063 @table @option
2064 @item c0
2065 first  pixel component
2066 @item c1
2067 second pixel component
2068 @item c2
2069 third  pixel component
2070 @item c3
2071 fourth pixel component, corresponds to the alpha component
2072 @end table
2073
2074 The exact component associated to each option depends on the format in
2075 input.
2076
2077 The @var{lutrgb} filter requires RGB pixel formats in input, and
2078 accepts the options:
2079 @table @option
2080 @item r
2081 red component
2082 @item g
2083 green component
2084 @item b
2085 blue component
2086 @item a
2087 alpha component
2088 @end table
2089
2090 The @var{lutyuv} filter requires YUV pixel formats in input, and
2091 accepts the options:
2092 @table @option
2093 @item y
2094 Y/luminance component
2095 @item u
2096 U/Cb component
2097 @item v
2098 V/Cr component
2099 @item a
2100 alpha component
2101 @end table
2102
2103 The expressions can contain the following constants and functions:
2104
2105 @table @option
2106 @item w, h
2107 the input width and height
2108
2109 @item val
2110 input value for the pixel component
2111
2112 @item clipval
2113 the input value clipped in the @var{minval}-@var{maxval} range
2114
2115 @item maxval
2116 maximum value for the pixel component
2117
2118 @item minval
2119 minimum value for the pixel component
2120
2121 @item negval
2122 the negated value for the pixel component value clipped in the
2123 @var{minval}-@var{maxval} range , it corresponds to the expression
2124 "maxval-clipval+minval"
2125
2126 @item clip(val)
2127 the computed value in @var{val} clipped in the
2128 @var{minval}-@var{maxval} range
2129
2130 @item gammaval(gamma)
2131 the computed gamma correction value of the pixel component value
2132 clipped in the @var{minval}-@var{maxval} range, corresponds to the
2133 expression
2134 "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
2135
2136 @end table
2137
2138 All expressions default to "val".
2139
2140 Some examples follow:
2141 @example
2142 # negate input video
2143 lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
2144 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
2145
2146 # the above is the same as
2147 lutrgb="r=negval:g=negval:b=negval"
2148 lutyuv="y=negval:u=negval:v=negval"
2149
2150 # negate luminance
2151 lutyuv=y=negval
2152
2153 # remove chroma components, turns the video into a graytone image
2154 lutyuv="u=128:v=128"
2155
2156 # apply a luma burning effect
2157 lutyuv="y=2*val"
2158
2159 # remove green and blue components
2160 lutrgb="g=0:b=0"
2161
2162 # set a constant alpha channel value on input
2163 format=rgba,lutrgb=a="maxval-minval/2"
2164
2165 # correct luminance gamma by a 0.5 factor
2166 lutyuv=y=gammaval(0.5)
2167 @end example
2168
2169 @section mp
2170
2171 Apply an MPlayer filter to the input video.
2172
2173 This filter provides a wrapper around most of the filters of
2174 MPlayer/MEncoder.
2175
2176 This wrapper is considered experimental. Some of the wrapped filters
2177 may not work properly and we may drop support for them, as they will
2178 be implemented natively into FFmpeg. Thus you should avoid
2179 depending on them when writing portable scripts.
2180
2181 The filters accepts the parameters:
2182 @var{filter_name}[:=]@var{filter_params}
2183
2184 @var{filter_name} is the name of a supported MPlayer filter,
2185 @var{filter_params} is a string containing the parameters accepted by
2186 the named filter.
2187
2188 The list of the currently supported filters follows:
2189 @table @var
2190 @item decimate
2191 @item denoise3d
2192 @item detc
2193 @item dint
2194 @item divtc
2195 @item down3dright
2196 @item dsize
2197 @item eq2
2198 @item eq
2199 @item field
2200 @item fil
2201 @item fixpts
2202 @item framestep
2203 @item fspp
2204 @item geq
2205 @item harddup
2206 @item hqdn3d
2207 @item hue
2208 @item il
2209 @item ilpack
2210 @item ivtc
2211 @item kerndeint
2212 @item mcdeint
2213 @item noise
2214 @item ow
2215 @item palette
2216 @item perspective
2217 @item phase
2218 @item pp7
2219 @item pullup
2220 @item qp
2221 @item rectangle
2222 @item rotate
2223 @item sab
2224 @item smartblur
2225 @item softpulldown
2226 @item softskip
2227 @item spp
2228 @item telecine
2229 @item tile
2230 @item tinterlace
2231 @item unsharp
2232 @item uspp
2233 @item yuvcsp
2234 @item yvu9
2235 @end table
2236
2237 The parameter syntax and behavior for the listed filters are the same
2238 of the corresponding MPlayer filters. For detailed instructions check
2239 the "VIDEO FILTERS" section in the MPlayer manual.
2240
2241 Some examples follow:
2242 @example
2243 # adjust gamma, brightness, contrast
2244 mp=eq2=1.0:2:0.5
2245
2246 # tweak hue and saturation
2247 mp=hue=100:-10
2248 @end example
2249
2250 See also mplayer(1), @url{http://www.mplayerhq.hu/}.
2251
2252 @section negate
2253
2254 Negate input video.
2255
2256 This filter accepts an integer in input, if non-zero it negates the
2257 alpha component (if available). The default value in input is 0.
2258
2259 @section noformat
2260
2261 Force libavfilter not to use any of the specified pixel formats for the
2262 input to the next filter.
2263
2264 The filter accepts a list of pixel format names, separated by ":",
2265 for example "yuv420p:monow:rgb24".
2266
2267 Some examples follow:
2268 @example
2269 # force libavfilter to use a format different from "yuv420p" for the
2270 # input to the vflip filter
2271 noformat=yuv420p,vflip
2272
2273 # convert the input video to any of the formats not contained in the list
2274 noformat=yuv420p:yuv444p:yuv410p
2275 @end example
2276
2277 @section null
2278
2279 Pass the video source unchanged to the output.
2280
2281 @section ocv
2282
2283 Apply video transform using libopencv.
2284
2285 To enable this filter install libopencv library and headers and
2286 configure FFmpeg with @code{--enable-libopencv}.
2287
2288 The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
2289
2290 @var{filter_name} is the name of the libopencv filter to apply.
2291
2292 @var{filter_params} specifies the parameters to pass to the libopencv
2293 filter. If not specified the default values are assumed.
2294
2295 Refer to the official libopencv documentation for more precise
2296 information:
2297 @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
2298
2299 Follows the list of supported libopencv filters.
2300
2301 @anchor{dilate}
2302 @subsection dilate
2303
2304 Dilate an image by using a specific structuring element.
2305 This filter corresponds to the libopencv function @code{cvDilate}.
2306
2307 It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
2308
2309 @var{struct_el} represents a structuring element, and has the syntax:
2310 @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
2311
2312 @var{cols} and @var{rows} represent the number of columns and rows of
2313 the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
2314 point, and @var{shape} the shape for the structuring element, and
2315 can be one of the values "rect", "cross", "ellipse", "custom".
2316
2317 If the value for @var{shape} is "custom", it must be followed by a
2318 string of the form "=@var{filename}". The file with name
2319 @var{filename} is assumed to represent a binary image, with each
2320 printable character corresponding to a bright pixel. When a custom
2321 @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
2322 or columns and rows of the read file are assumed instead.
2323
2324 The default value for @var{struct_el} is "3x3+0x0/rect".
2325
2326 @var{nb_iterations} specifies the number of times the transform is
2327 applied to the image, and defaults to 1.
2328
2329 Follow some example:
2330 @example
2331 # use the default values
2332 ocv=dilate
2333
2334 # dilate using a structuring element with a 5x5 cross, iterate two times
2335 ocv=dilate=5x5+2x2/cross:2
2336
2337 # read the shape from the file diamond.shape, iterate two times
2338 # the file diamond.shape may contain a pattern of characters like this:
2339 #   *
2340 #  ***
2341 # *****
2342 #  ***
2343 #   *
2344 # the specified cols and rows are ignored (but not the anchor point coordinates)
2345 ocv=0x0+2x2/custom=diamond.shape:2
2346 @end example
2347
2348 @subsection erode
2349
2350 Erode an image by using a specific structuring element.
2351 This filter corresponds to the libopencv function @code{cvErode}.
2352
2353 The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
2354 with the same syntax and semantics as the @ref{dilate} filter.
2355
2356 @subsection smooth
2357
2358 Smooth the input video.
2359
2360 The filter takes the following parameters:
2361 @var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
2362
2363 @var{type} is the type of smooth filter to apply, and can be one of
2364 the following values: "blur", "blur_no_scale", "median", "gaussian",
2365 "bilateral". The default value is "gaussian".
2366
2367 @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
2368 parameters whose meanings depend on smooth type. @var{param1} and
2369 @var{param2} accept integer positive values or 0, @var{param3} and
2370 @var{param4} accept float values.
2371
2372 The default value for @var{param1} is 3, the default value for the
2373 other parameters is 0.
2374
2375 These parameters correspond to the parameters assigned to the
2376 libopencv function @code{cvSmooth}.
2377
2378 @anchor{overlay}
2379 @section overlay
2380
2381 Overlay one video on top of another.
2382
2383 It takes two inputs and one output, the first input is the "main"
2384 video on which the second input is overlayed.
2385
2386 It accepts the parameters: @var{x}:@var{y}[:@var{options}].
2387
2388 @var{x} is the x coordinate of the overlayed video on the main video,
2389 @var{y} is the y coordinate. @var{x} and @var{y} are expressions containing
2390 the following parameters:
2391
2392 @table @option
2393 @item main_w, main_h
2394 main input width and height
2395
2396 @item W, H
2397 same as @var{main_w} and @var{main_h}
2398
2399 @item overlay_w, overlay_h
2400 overlay input width and height
2401
2402 @item w, h
2403 same as @var{overlay_w} and @var{overlay_h}
2404 @end table
2405
2406 @var{options} is an optional list of @var{key}=@var{value} pairs,
2407 separated by ":".
2408
2409 The description of the accepted options follows.
2410
2411 @table @option
2412 @item rgb
2413 If set to 1, force the filter to accept inputs in the RGB
2414 color space. Default value is 0.
2415 @end table
2416
2417 Be aware that frames are taken from each input video in timestamp
2418 order, hence, if their initial timestamps differ, it is a a good idea
2419 to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
2420 have them begin in the same zero timestamp, as it does the example for
2421 the @var{movie} filter.
2422
2423 Follow some examples:
2424 @example
2425 # draw the overlay at 10 pixels from the bottom right
2426 # corner of the main video.
2427 overlay=main_w-overlay_w-10:main_h-overlay_h-10
2428
2429 # insert a transparent PNG logo in the bottom left corner of the input
2430 ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
2431
2432 # insert 2 different transparent PNG logos (second logo on bottom
2433 # right corner):
2434 ffmpeg -i input -i logo1 -i logo2 -filter_complex
2435 'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
2436
2437 # add a transparent color layer on top of the main video,
2438 # WxH specifies the size of the main input to the overlay filter
2439 color=red@.3:WxH [over]; [in][over] overlay [out]
2440
2441 # play an original video and a filtered version (here with the deshake filter)
2442 # side by side
2443 ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
2444
2445 # the previous example is the same as:
2446 ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
2447 @end example
2448
2449 You can chain together more overlays but the efficiency of such
2450 approach is yet to be tested.
2451
2452 @section pad
2453
2454 Add paddings to the input image, and places the original input at the
2455 given coordinates @var{x}, @var{y}.
2456
2457 It accepts the following parameters:
2458 @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
2459
2460 The parameters @var{width}, @var{height}, @var{x}, and @var{y} are
2461 expressions containing the following constants:
2462
2463 @table @option
2464 @item in_w, in_h
2465 the input video width and height
2466
2467 @item iw, ih
2468 same as @var{in_w} and @var{in_h}
2469
2470 @item out_w, out_h
2471 the output width and height, that is the size of the padded area as
2472 specified by the @var{width} and @var{height} expressions
2473
2474 @item ow, oh
2475 same as @var{out_w} and @var{out_h}
2476
2477 @item x, y
2478 x and y offsets as specified by the @var{x} and @var{y}
2479 expressions, or NAN if not yet specified
2480
2481 @item a
2482 same as @var{iw} / @var{ih}
2483
2484 @item sar
2485 input sample aspect ratio
2486
2487 @item dar
2488 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
2489
2490 @item hsub, vsub
2491 horizontal and vertical chroma subsample values. For example for the
2492 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
2493 @end table
2494
2495 Follows the description of the accepted parameters.
2496
2497 @table @option
2498 @item width, height
2499
2500 Specify the size of the output image with the paddings added. If the
2501 value for @var{width} or @var{height} is 0, the corresponding input size
2502 is used for the output.
2503
2504 The @var{width} expression can reference the value set by the
2505 @var{height} expression, and vice versa.
2506
2507 The default value of @var{width} and @var{height} is 0.
2508
2509 @item x, y
2510
2511 Specify the offsets where to place the input image in the padded area
2512 with respect to the top/left border of the output image.
2513
2514 The @var{x} expression can reference the value set by the @var{y}
2515 expression, and vice versa.
2516
2517 The default value of @var{x} and @var{y} is 0.
2518
2519 @item color
2520
2521 Specify the color of the padded area, it can be the name of a color
2522 (case insensitive match) or a 0xRRGGBB[AA] sequence.
2523
2524 The default value of @var{color} is "black".
2525
2526 @end table
2527
2528 Some examples follow:
2529
2530 @example
2531 # Add paddings with color "violet" to the input video. Output video
2532 # size is 640x480, the top-left corner of the input video is placed at
2533 # column 0, row 40.
2534 pad=640:480:0:40:violet
2535
2536 # pad the input to get an output with dimensions increased bt 3/2,
2537 # and put the input video at the center of the padded area
2538 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
2539
2540 # pad the input to get a squared output with size equal to the maximum
2541 # value between the input width and height, and put the input video at
2542 # the center of the padded area
2543 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
2544
2545 # pad the input to get a final w/h ratio of 16:9
2546 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
2547
2548 # for anamorphic video, in order to set the output display aspect ratio,
2549 # it is necessary to use sar in the expression, according to the relation:
2550 # (ih * X / ih) * sar = output_dar
2551 # X = output_dar / sar
2552 pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
2553
2554 # double output size and put the input video in the bottom-right
2555 # corner of the output padded area
2556 pad="2*iw:2*ih:ow-iw:oh-ih"
2557 @end example
2558
2559 @section pixdesctest
2560
2561 Pixel format descriptor test filter, mainly useful for internal
2562 testing. The output video should be equal to the input video.
2563
2564 For example:
2565 @example
2566 format=monow, pixdesctest
2567 @end example
2568
2569 can be used to test the monowhite pixel format descriptor definition.
2570
2571 @section removelogo
2572
2573 Suppress a TV station logo, using an image file to determine which
2574 pixels comprise the logo. It works by filling in the pixels that
2575 comprise the logo with neighboring pixels.
2576
2577 This filter requires one argument which specifies the filter bitmap
2578 file, which can be any image format supported by libavformat. The
2579 width and height of the image file must match those of the video
2580 stream being processed.
2581
2582 Pixels in the provided bitmap image with a value of zero are not
2583 considered part of the logo, non-zero pixels are considered part of
2584 the logo. If you use white (255) for the logo and black (0) for the
2585 rest, you will be safe. For making the filter bitmap, it is
2586 recommended to take a screen capture of a black frame with the logo
2587 visible, and then using a threshold filter followed by the erode
2588 filter once or twice.
2589
2590 If needed, little splotches can be fixed manually. Remember that if
2591 logo pixels are not covered, the filter quality will be much
2592 reduced. Marking too many pixels as part of the logo does not hurt as
2593 much, but it will increase the amount of blurring needed to cover over
2594 the image and will destroy more information than necessary, and extra
2595 pixels will slow things down on a large logo.
2596
2597 @section scale
2598
2599 Scale the input video to @var{width}:@var{height}[:@var{interl}=@{1|-1@}] and/or convert the image format.
2600
2601 The scale filter forces the output display aspect ratio to be the same
2602 of the input, by changing the output sample aspect ratio.
2603
2604 The parameters @var{width} and @var{height} are expressions containing
2605 the following constants:
2606
2607 @table @option
2608 @item in_w, in_h
2609 the input width and height
2610
2611 @item iw, ih
2612 same as @var{in_w} and @var{in_h}
2613
2614 @item out_w, out_h
2615 the output (cropped) width and height
2616
2617 @item ow, oh
2618 same as @var{out_w} and @var{out_h}
2619
2620 @item a
2621 same as @var{iw} / @var{ih}
2622
2623 @item sar
2624 input sample aspect ratio
2625
2626 @item dar
2627 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
2628
2629 @item hsub, vsub
2630 horizontal and vertical chroma subsample values. For example for the
2631 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
2632 @end table
2633
2634 If the input image format is different from the format requested by
2635 the next filter, the scale filter will convert the input to the
2636 requested format.
2637
2638 If the value for @var{width} or @var{height} is 0, the respective input
2639 size is used for the output.
2640
2641 If the value for @var{width} or @var{height} is -1, the scale filter will
2642 use, for the respective output size, a value that maintains the aspect
2643 ratio of the input image.
2644
2645 The default value of @var{width} and @var{height} is 0.
2646
2647 Valid values for the optional parameter @var{interl} are:
2648
2649 @table @option
2650 @item 1
2651 force interlaced aware scaling
2652
2653 @item -1
2654 select interlaced aware scaling depending on whether the source frames
2655 are flagged as interlaced or not
2656 @end table
2657
2658 Unless @var{interl} is set to one of the above options, interlaced scaling will not be used.
2659
2660 Some examples follow:
2661 @example
2662 # scale the input video to a size of 200x100.
2663 scale=200:100
2664
2665 # scale the input to 2x
2666 scale=2*iw:2*ih
2667 # the above is the same as
2668 scale=2*in_w:2*in_h
2669
2670 # scale the input to 2x with forced interlaced scaling
2671 scale=2*iw:2*ih:interl=1
2672
2673 # scale the input to half size
2674 scale=iw/2:ih/2
2675
2676 # increase the width, and set the height to the same size
2677 scale=3/2*iw:ow
2678
2679 # seek for Greek harmony
2680 scale=iw:1/PHI*iw
2681 scale=ih*PHI:ih
2682
2683 # increase the height, and set the width to 3/2 of the height
2684 scale=3/2*oh:3/5*ih
2685
2686 # increase the size, but make the size a multiple of the chroma
2687 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
2688
2689 # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
2690 scale='min(500\, iw*3/2):-1'
2691 @end example
2692
2693 @section select
2694 Select frames to pass in output.
2695
2696 It accepts in input an expression, which is evaluated for each input
2697 frame. If the expression is evaluated to a non-zero value, the frame
2698 is selected and passed to the output, otherwise it is discarded.
2699
2700 The expression can contain the following constants:
2701
2702 @table @option
2703 @item n
2704 the sequential number of the filtered frame, starting from 0
2705
2706 @item selected_n
2707 the sequential number of the selected frame, starting from 0
2708
2709 @item prev_selected_n
2710 the sequential number of the last selected frame, NAN if undefined
2711
2712 @item TB
2713 timebase of the input timestamps
2714
2715 @item pts
2716 the PTS (Presentation TimeStamp) of the filtered video frame,
2717 expressed in @var{TB} units, NAN if undefined
2718
2719 @item t
2720 the PTS (Presentation TimeStamp) of the filtered video frame,
2721 expressed in seconds, NAN if undefined
2722
2723 @item prev_pts
2724 the PTS of the previously filtered video frame, NAN if undefined
2725
2726 @item prev_selected_pts
2727 the PTS of the last previously filtered video frame, NAN if undefined
2728
2729 @item prev_selected_t
2730 the PTS of the last previously selected video frame, NAN if undefined
2731
2732 @item start_pts
2733 the PTS of the first video frame in the video, NAN if undefined
2734
2735 @item start_t
2736 the time of the first video frame in the video, NAN if undefined
2737
2738 @item pict_type
2739 the type of the filtered frame, can assume one of the following
2740 values:
2741 @table @option
2742 @item I
2743 @item P
2744 @item B
2745 @item S
2746 @item SI
2747 @item SP
2748 @item BI
2749 @end table
2750
2751 @item interlace_type
2752 the frame interlace type, can assume one of the following values:
2753 @table @option
2754 @item PROGRESSIVE
2755 the frame is progressive (not interlaced)
2756 @item TOPFIRST
2757 the frame is top-field-first
2758 @item BOTTOMFIRST
2759 the frame is bottom-field-first
2760 @end table
2761
2762 @item key
2763 1 if the filtered frame is a key-frame, 0 otherwise
2764
2765 @item pos
2766 the position in the file of the filtered frame, -1 if the information
2767 is not available (e.g. for synthetic video)
2768
2769 @item scene
2770 value between 0 and 1 to indicate a new scene; a low value reflects a low
2771 probability for the current frame to introduce a new scene, while a higher
2772 value means the current frame is more likely to be one (see the example below)
2773
2774 @end table
2775
2776 The default value of the select expression is "1".
2777
2778 Some examples follow:
2779
2780 @example
2781 # select all frames in input
2782 select
2783
2784 # the above is the same as:
2785 select=1
2786
2787 # skip all frames:
2788 select=0
2789
2790 # select only I-frames
2791 select='eq(pict_type\,I)'
2792
2793 # select one frame every 100
2794 select='not(mod(n\,100))'
2795
2796 # select only frames contained in the 10-20 time interval
2797 select='gte(t\,10)*lte(t\,20)'
2798
2799 # select only I frames contained in the 10-20 time interval
2800 select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
2801
2802 # select frames with a minimum distance of 10 seconds
2803 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
2804 @end example
2805
2806 Complete example to create a mosaic of the first scenes:
2807
2808 @example
2809 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
2810 @end example
2811
2812 Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
2813 choice.
2814
2815 @section setdar, setsar
2816
2817 The @code{setdar} filter sets the Display Aspect Ratio for the filter
2818 output video.
2819
2820 This is done by changing the specified Sample (aka Pixel) Aspect
2821 Ratio, according to the following equation:
2822 @example
2823 @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
2824 @end example
2825
2826 Keep in mind that the @code{setdar} filter does not modify the pixel
2827 dimensions of the video frame. Also the display aspect ratio set by
2828 this filter may be changed by later filters in the filterchain,
2829 e.g. in case of scaling or if another "setdar" or a "setsar" filter is
2830 applied.
2831
2832 The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
2833 the filter output video.
2834
2835 Note that as a consequence of the application of this filter, the
2836 output display aspect ratio will change according to the equation
2837 above.
2838
2839 Keep in mind that the sample aspect ratio set by the @code{setsar}
2840 filter may be changed by later filters in the filterchain, e.g. if
2841 another "setsar" or a "setdar" filter is applied.
2842
2843 The @code{setdar} and @code{setsar} filters accept a parameter string
2844 which represents the wanted aspect ratio.  The parameter can
2845 be a floating point number string, an expression, or a string of the form
2846 @var{num}:@var{den}, where @var{num} and @var{den} are the numerator
2847 and denominator of the aspect ratio. If the parameter is not
2848 specified, it is assumed the value "0:1".
2849
2850 For example to change the display aspect ratio to 16:9, specify:
2851 @example
2852 setdar=16:9
2853 @end example
2854
2855 The example above is equivalent to:
2856 @example
2857 setdar=1.77777
2858 @end example
2859
2860 To change the sample aspect ratio to 10:11, specify:
2861 @example
2862 setsar=10:11
2863 @end example
2864
2865 @section setfield
2866
2867 Force field for the output video frame.
2868
2869 The @code{setfield} filter marks the interlace type field for the
2870 output frames. It does not change the input frame, but only sets the
2871 corresponding property, which affects how the frame is treated by
2872 following filters (e.g. @code{fieldorder} or @code{yadif}).
2873
2874 It accepts a string parameter, which can assume the following values:
2875 @table @samp
2876 @item auto
2877 Keep the same field property.
2878
2879 @item bff
2880 Mark the frame as bottom-field-first.
2881
2882 @item tff
2883 Mark the frame as top-field-first.
2884
2885 @item prog
2886 Mark the frame as progressive.
2887 @end table
2888
2889 @section setpts
2890
2891 Change the PTS (presentation timestamp) of the input video frames.
2892
2893 Accept in input an expression evaluated through the eval API, which
2894 can contain the following constants:
2895
2896 @table @option
2897 @item PTS
2898 the presentation timestamp in input
2899
2900 @item N
2901 the count of the input frame, starting from 0.
2902
2903 @item STARTPTS
2904 the PTS of the first video frame
2905
2906 @item INTERLACED
2907 tell if the current frame is interlaced
2908
2909 @item POS
2910 original position in the file of the frame, or undefined if undefined
2911 for the current frame
2912
2913 @item PREV_INPTS
2914 previous input PTS
2915
2916 @item PREV_OUTPTS
2917 previous output PTS
2918
2919 @end table
2920
2921 Some examples follow:
2922
2923 @example
2924 # start counting PTS from zero
2925 setpts=PTS-STARTPTS
2926
2927 # fast motion
2928 setpts=0.5*PTS
2929
2930 # slow motion
2931 setpts=2.0*PTS
2932
2933 # fixed rate 25 fps
2934 setpts=N/(25*TB)
2935
2936 # fixed rate 25 fps with some jitter
2937 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
2938 @end example
2939
2940 @section settb
2941
2942 Set the timebase to use for the output frames timestamps.
2943 It is mainly useful for testing timebase configuration.
2944
2945 It accepts in input an arithmetic expression representing a rational.
2946 The expression can contain the constants "AVTB" (the
2947 default timebase), and "intb" (the input timebase).
2948
2949 The default value for the input is "intb".
2950
2951 Follow some examples.
2952
2953 @example
2954 # set the timebase to 1/25
2955 settb=1/25
2956
2957 # set the timebase to 1/10
2958 settb=0.1
2959
2960 #set the timebase to 1001/1000
2961 settb=1+0.001
2962
2963 #set the timebase to 2*intb
2964 settb=2*intb
2965
2966 #set the default timebase value
2967 settb=AVTB
2968 @end example
2969
2970 @section showinfo
2971
2972 Show a line containing various information for each input video frame.
2973 The input video is not modified.
2974
2975 The shown line contains a sequence of key/value pairs of the form
2976 @var{key}:@var{value}.
2977
2978 A description of each shown parameter follows:
2979
2980 @table @option
2981 @item n
2982 sequential number of the input frame, starting from 0
2983
2984 @item pts
2985 Presentation TimeStamp of the input frame, expressed as a number of
2986 time base units. The time base unit depends on the filter input pad.
2987
2988 @item pts_time
2989 Presentation TimeStamp of the input frame, expressed as a number of
2990 seconds
2991
2992 @item pos
2993 position of the frame in the input stream, -1 if this information in
2994 unavailable and/or meaningless (for example in case of synthetic video)
2995
2996 @item fmt
2997 pixel format name
2998
2999 @item sar
3000 sample aspect ratio of the input frame, expressed in the form
3001 @var{num}/@var{den}
3002
3003 @item s
3004 size of the input frame, expressed in the form
3005 @var{width}x@var{height}
3006
3007 @item i
3008 interlaced mode ("P" for "progressive", "T" for top field first, "B"
3009 for bottom field first)
3010
3011 @item iskey
3012 1 if the frame is a key frame, 0 otherwise
3013
3014 @item type
3015 picture type of the input frame ("I" for an I-frame, "P" for a
3016 P-frame, "B" for a B-frame, "?" for unknown type).
3017 Check also the documentation of the @code{AVPictureType} enum and of
3018 the @code{av_get_picture_type_char} function defined in
3019 @file{libavutil/avutil.h}.
3020
3021 @item checksum
3022 Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
3023
3024 @item plane_checksum
3025 Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
3026 expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
3027 @end table
3028
3029 @section slicify
3030
3031 Pass the images of input video on to next video filter as multiple
3032 slices.
3033
3034 @example
3035 ffmpeg -i in.avi -vf "slicify=32" out.avi
3036 @end example
3037
3038 The filter accepts the slice height as parameter. If the parameter is
3039 not specified it will use the default value of 16.
3040
3041 Adding this in the beginning of filter chains should make filtering
3042 faster due to better use of the memory cache.
3043
3044 @section split
3045
3046 Split input video into several identical outputs.
3047
3048 The filter accepts a single parameter which specifies the number of outputs. If
3049 unspecified, it defaults to 2.
3050
3051 For example
3052 @example
3053 ffmpeg -i INPUT -filter_complex split=5 OUTPUT
3054 @end example
3055 will create 5 copies of the input video.
3056
3057 For example:
3058 @example
3059 [in] split [splitout1][splitout2];
3060 [splitout1] crop=100:100:0:0    [cropout];
3061 [splitout2] pad=200:200:100:100 [padout];
3062 @end example
3063
3064 will create two separate outputs from the same input, one cropped and
3065 one padded.
3066
3067 @section super2xsai
3068
3069 Scale the input by 2x and smooth using the Super2xSaI (Scale and
3070 Interpolate) pixel art scaling algorithm.
3071
3072 Useful for enlarging pixel art images without reducing sharpness.
3073
3074 @section swapuv
3075 Swap U & V plane.
3076
3077 @section thumbnail
3078 Select the most representative frame in a given sequence of consecutive frames.
3079
3080 It accepts as argument the frames batch size to analyze (default @var{N}=100);
3081 in a set of @var{N} frames, the filter will pick one of them, and then handle
3082 the next batch of @var{N} frames until the end.
3083
3084 Since the filter keeps track of the whole frames sequence, a bigger @var{N}
3085 value will result in a higher memory usage, so a high value is not recommended.
3086
3087 The following example extract one picture each 50 frames:
3088 @example
3089 thumbnail=50
3090 @end example
3091
3092 Complete example of a thumbnail creation with @command{ffmpeg}:
3093 @example
3094 ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
3095 @end example
3096
3097 @section tile
3098
3099 Tile several successive frames together.
3100
3101 It accepts as argument the tile size (i.e. the number of lines and columns)
3102 in the form "@var{w}x@var{h}".
3103
3104 For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame
3105 nokey}) in a movie:
3106 @example
3107 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
3108 @end example
3109 The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
3110 duplicating each output frame to accomodate the originally detected frame
3111 rate.
3112
3113 @section tinterlace
3114
3115 Perform various types of temporal field interlacing.
3116
3117 Frames are counted starting from 1, so the first input frame is
3118 considered odd.
3119
3120 This filter accepts a single parameter specifying the mode. Available
3121 modes are:
3122
3123 @table @samp
3124 @item merge, 0
3125 Move odd frames into the upper field, even into the lower field,
3126 generating a double height frame at half framerate.
3127
3128 @item drop_odd, 1
3129 Only output even frames, odd frames are dropped, generating a frame with
3130 unchanged height at half framerate.
3131
3132 @item drop_even, 2
3133 Only output odd frames, even frames are dropped, generating a frame with
3134 unchanged height at half framerate.
3135
3136 @item pad, 3
3137 Expand each frame to full height, but pad alternate lines with black,
3138 generating a frame with double height at the same input framerate.
3139
3140 @item interleave_top, 4
3141 Interleave the upper field from odd frames with the lower field from
3142 even frames, generating a frame with unchanged height at half framerate.
3143
3144 @item interleave_bottom, 5
3145 Interleave the lower field from odd frames with the upper field from
3146 even frames, generating a frame with unchanged height at half framerate.
3147
3148 @item interlacex2, 6
3149 Double frame rate with unchanged height. Frames are inserted each
3150 containing the second temporal field from the previous input frame and
3151 the first temporal field from the next input frame. This mode relies on
3152 the top_field_first flag. Useful for interlaced video displays with no
3153 field synchronisation.
3154 @end table
3155
3156 Numeric values are deprecated but are accepted for backward
3157 compatibility reasons.
3158
3159 Default mode is @code{merge}.
3160
3161 @section transpose
3162
3163 Transpose rows with columns in the input video and optionally flip it.
3164
3165 It accepts a parameter representing an integer, which can assume the
3166 values:
3167
3168 @table @samp
3169 @item 0
3170 Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
3171 @example
3172 L.R     L.l
3173 . . ->  . .
3174 l.r     R.r
3175 @end example
3176
3177 @item 1
3178 Rotate by 90 degrees clockwise, that is:
3179 @example
3180 L.R     l.L
3181 . . ->  . .
3182 l.r     r.R
3183 @end example
3184
3185 @item 2
3186 Rotate by 90 degrees counterclockwise, that is:
3187 @example
3188 L.R     R.r
3189 . . ->  . .
3190 l.r     L.l
3191 @end example
3192
3193 @item 3
3194 Rotate by 90 degrees clockwise and vertically flip, that is:
3195 @example
3196 L.R     r.R
3197 . . ->  . .
3198 l.r     l.L
3199 @end example
3200 @end table
3201
3202 @section unsharp
3203
3204 Sharpen or blur the input video.
3205
3206 It accepts the following parameters:
3207 @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
3208
3209 Negative values for the amount will blur the input video, while positive
3210 values will sharpen. All parameters are optional and default to the
3211 equivalent of the string '5:5:1.0:5:5:0.0'.
3212
3213 @table @option
3214
3215 @item luma_msize_x
3216 Set the luma matrix horizontal size. It can be an integer between 3
3217 and 13, default value is 5.
3218
3219 @item luma_msize_y
3220 Set the luma matrix vertical size. It can be an integer between 3
3221 and 13, default value is 5.
3222
3223 @item luma_amount
3224 Set the luma effect strength. It can be a float number between -2.0
3225 and 5.0, default value is 1.0.
3226
3227 @item chroma_msize_x
3228 Set the chroma matrix horizontal size. It can be an integer between 3
3229 and 13, default value is 5.
3230
3231 @item chroma_msize_y
3232 Set the chroma matrix vertical size. It can be an integer between 3
3233 and 13, default value is 5.
3234
3235 @item chroma_amount
3236 Set the chroma effect strength. It can be a float number between -2.0
3237 and 5.0, default value is 0.0.
3238
3239 @end table
3240
3241 @example
3242 # Strong luma sharpen effect parameters
3243 unsharp=7:7:2.5
3244
3245 # Strong blur of both luma and chroma parameters
3246 unsharp=7:7:-2:7:7:-2
3247
3248 # Use the default values with @command{ffmpeg}
3249 ffmpeg -i in.avi -vf "unsharp" out.mp4
3250 @end example
3251
3252 @section vflip
3253
3254 Flip the input video vertically.
3255
3256 @example
3257 ffmpeg -i in.avi -vf "vflip" out.avi
3258 @end example
3259
3260 @section yadif
3261
3262 Deinterlace the input video ("yadif" means "yet another deinterlacing
3263 filter").
3264
3265 It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
3266
3267 @var{mode} specifies the interlacing mode to adopt, accepts one of the
3268 following values:
3269
3270 @table @option
3271 @item 0
3272 output 1 frame for each frame
3273 @item 1
3274 output 1 frame for each field
3275 @item 2
3276 like 0 but skips spatial interlacing check
3277 @item 3
3278 like 1 but skips spatial interlacing check
3279 @end table
3280
3281 Default value is 0.
3282
3283 @var{parity} specifies the picture field parity assumed for the input
3284 interlaced video, accepts one of the following values:
3285
3286 @table @option
3287 @item 0
3288 assume top field first
3289 @item 1
3290 assume bottom field first
3291 @item -1
3292 enable automatic detection
3293 @end table
3294
3295 Default value is -1.
3296 If interlacing is unknown or decoder does not export this information,
3297 top field first will be assumed.
3298
3299 @var{auto} specifies if deinterlacer should trust the interlaced flag
3300 and only deinterlace frames marked as interlaced
3301
3302 @table @option
3303 @item 0
3304 deinterlace all frames
3305 @item 1
3306 only deinterlace frames marked as interlaced
3307 @end table
3308
3309 Default value is 0.
3310
3311 @c man end VIDEO FILTERS
3312
3313 @chapter Video Sources
3314 @c man begin VIDEO SOURCES
3315
3316 Below is a description of the currently available video sources.
3317
3318 @section buffer
3319
3320 Buffer video frames, and make them available to the filter chain.
3321
3322 This source is mainly intended for a programmatic use, in particular
3323 through the interface defined in @file{libavfilter/vsrc_buffer.h}.
3324
3325 It accepts a list of options in the form of @var{key}=@var{value} pairs
3326 separated by ":". A descroption of the accepted options follows.
3327
3328 @table @option
3329
3330 @item video_size
3331 Specify the size (width and height) of the buffered video frames.
3332
3333 @item pix_fmt
3334 A string representing the pixel format of the buffered video frames.
3335 It may be a number corresponding to a pixel format, or a pixel format
3336 name.
3337
3338 @item time_base
3339 Specify the timebase assumed by the timestamps of the buffered frames.
3340
3341 @item time_base
3342 Specify the frame rate expected for the video stream.
3343
3344 @item pixel_aspect
3345 Specify the sample aspect ratio assumed by the video frames.
3346
3347 @item sws_param
3348 Specify the optional parameters to be used for the scale filter which
3349 is automatically inserted when an input change is detected in the
3350 input size or format.
3351 @end table
3352
3353 For example:
3354 @example
3355 buffer=size=320x240:pix_fmt=yuv410p:time_base=1/24:pixel_aspect=1/1
3356 @end example
3357
3358 will instruct the source to accept video frames with size 320x240 and
3359 with format "yuv410p", assuming 1/24 as the timestamps timebase and
3360 square pixels (1:1 sample aspect ratio).
3361 Since the pixel format with name "yuv410p" corresponds to the number 6
3362 (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
3363 this example corresponds to:
3364 @example
3365 buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
3366 @end example
3367
3368 Alternatively, the options can be specified as a flat string, but this
3369 syntax is deprecated:
3370
3371 @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}]
3372
3373 @section cellauto
3374
3375 Create a pattern generated by an elementary cellular automaton.
3376
3377 The initial state of the cellular automaton can be defined through the
3378 @option{filename}, and @option{pattern} options. If such options are
3379 not specified an initial state is created randomly.
3380
3381 At each new frame a new row in the video is filled with the result of
3382 the cellular automaton next generation. The behavior when the whole
3383 frame is filled is defined by the @option{scroll} option.
3384
3385 This source accepts a list of options in the form of
3386 @var{key}=@var{value} pairs separated by ":". A description of the
3387 accepted options follows.
3388
3389 @table @option
3390 @item filename, f
3391 Read the initial cellular automaton state, i.e. the starting row, from
3392 the specified file.
3393 In the file, each non-whitespace character is considered an alive
3394 cell, a newline will terminate the row, and further characters in the
3395 file will be ignored.
3396
3397 @item pattern, p
3398 Read the initial cellular automaton state, i.e. the starting row, from
3399 the specified string.
3400
3401 Each non-whitespace character in the string is considered an alive
3402 cell, a newline will terminate the row, and further characters in the
3403 string will be ignored.
3404
3405 @item rate, r
3406 Set the video rate, that is the number of frames generated per second.
3407 Default is 25.
3408
3409 @item random_fill_ratio, ratio
3410 Set the random fill ratio for the initial cellular automaton row. It
3411 is a floating point number value ranging from 0 to 1, defaults to
3412 1/PHI.
3413
3414 This option is ignored when a file or a pattern is specified.
3415
3416 @item random_seed, seed
3417 Set the seed for filling randomly the initial row, must be an integer
3418 included between 0 and UINT32_MAX. If not specified, or if explicitly
3419 set to -1, the filter will try to use a good random seed on a best
3420 effort basis.
3421
3422 @item rule
3423 Set the cellular automaton rule, it is a number ranging from 0 to 255.
3424 Default value is 110.
3425
3426 @item size, s
3427 Set the size of the output video.
3428
3429 If @option{filename} or @option{pattern} is specified, the size is set
3430 by default to the width of the specified initial state row, and the
3431 height is set to @var{width} * PHI.
3432
3433 If @option{size} is set, it must contain the width of the specified
3434 pattern string, and the specified pattern will be centered in the
3435 larger row.
3436
3437 If a filename or a pattern string is not specified, the size value
3438 defaults to "320x518" (used for a randomly generated initial state).
3439
3440 @item scroll
3441 If set to 1, scroll the output upward when all the rows in the output
3442 have been already filled. If set to 0, the new generated row will be
3443 written over the top row just after the bottom row is filled.
3444 Defaults to 1.
3445
3446 @item start_full, full
3447 If set to 1, completely fill the output with generated rows before
3448 outputting the first frame.
3449 This is the default behavior, for disabling set the value to 0.
3450
3451 @item stitch
3452 If set to 1, stitch the left and right row edges together.
3453 This is the default behavior, for disabling set the value to 0.
3454 @end table
3455
3456 @subsection Examples
3457
3458 @itemize
3459 @item
3460 Read the initial state from @file{pattern}, and specify an output of
3461 size 200x400.
3462 @example
3463 cellauto=f=pattern:s=200x400
3464 @end example
3465
3466 @item
3467 Generate a random initial row with a width of 200 cells, with a fill
3468 ratio of 2/3:
3469 @example
3470 cellauto=ratio=2/3:s=200x200
3471 @end example
3472
3473 @item
3474 Create a pattern generated by rule 18 starting by a single alive cell
3475 centered on an initial row with width 100:
3476 @example
3477 cellauto=p=@@:s=100x400:full=0:rule=18
3478 @end example
3479
3480 @item
3481 Specify a more elaborated initial pattern:
3482 @example
3483 cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
3484 @end example
3485
3486 @end itemize
3487
3488 @section color
3489
3490 Provide an uniformly colored input.
3491
3492 This source accepts list of options in the form of
3493 @var{key}=@var{value} pairs separated by ":".
3494
3495 Alternatively, it accepts a string in the form
3496 @var{color}:@var{size}:@var{rate}, but this syntax is
3497 deprecated.
3498
3499 Follows the description of the accepted parameters.
3500
3501 @table @option
3502
3503 @item color, c
3504 Specify the color of the source. It can be the name of a color (case
3505 insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
3506 alpha specifier. The default value is "black".
3507
3508 @item size, s
3509 Specify the size of the sourced video, it may be a string of the form
3510 @var{width}x@var{height}, or the name of a size abbreviation. The
3511 default value is "320x240".
3512
3513 @item rate, r
3514 Specify the frame rate of the sourced video, as the number of frames
3515 generated per second. It has to be a string in the format
3516 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
3517 number or a valid video frame rate abbreviation. The default value is
3518 "25".
3519
3520 @end table
3521
3522 For example the following graph description will generate a red source
3523 with an opacity of 0.2, with size "qcif" and a frame rate of 10
3524 frames per second, which will be overlayed over the source connected
3525 to the pad with identifier "in".
3526
3527 @example
3528 "color=c=red@@0.2:s=qcif:r=10 [color]; [in][color] overlay [out]"
3529 @end example
3530
3531 @section movie
3532
3533 Read a video stream from a movie container.
3534
3535 It accepts the syntax: @var{movie_name}[:@var{options}] where
3536 @var{movie_name} is the name of the resource to read (not necessarily
3537 a file but also a device or a stream accessed through some protocol),
3538 and @var{options} is an optional sequence of @var{key}=@var{value}
3539 pairs, separated by ":".
3540
3541 The description of the accepted options follows.
3542
3543 @table @option
3544
3545 @item format_name, f
3546 Specifies the format assumed for the movie to read, and can be either
3547 the name of a container or an input device. If not specified the
3548 format is guessed from @var{movie_name} or by probing.
3549
3550 @item seek_point, sp
3551 Specifies the seek point in seconds, the frames will be output
3552 starting from this seek point, the parameter is evaluated with
3553 @code{av_strtod} so the numerical value may be suffixed by an IS
3554 postfix. Default value is "0".
3555
3556 @item stream_index, si
3557 Specifies the index of the video stream to read. If the value is -1,
3558 the best suited video stream will be automatically selected. Default
3559 value is "-1".
3560
3561 @item loop
3562 Specifies how many times to read the video stream in sequence.
3563 If the value is less than 1, the stream will be read again and again.
3564 Default value is "1".
3565
3566 Note that when the movie is looped the source timestamps are not
3567 changed, so it will generate non monotonically increasing timestamps.
3568 @end table
3569
3570 This filter allows to overlay a second video on top of main input of
3571 a filtergraph as shown in this graph:
3572 @example
3573 input -----------> deltapts0 --> overlay --> output
3574                                     ^
3575                                     |
3576 movie --> scale--> deltapts1 -------+
3577 @end example
3578
3579 Some examples follow:
3580 @example
3581 # skip 3.2 seconds from the start of the avi file in.avi, and overlay it
3582 # on top of the input labelled as "in".
3583 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
3584 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
3585
3586 # read from a video4linux2 device, and overlay it on top of the input
3587 # labelled as "in"
3588 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
3589 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
3590
3591 @end example
3592
3593 @section mptestsrc
3594
3595 Generate various test patterns, as generated by the MPlayer test filter.
3596
3597 The size of the generated video is fixed, and is 256x256.
3598 This source is useful in particular for testing encoding features.
3599
3600 This source accepts an optional sequence of @var{key}=@var{value} pairs,
3601 separated by ":". The description of the accepted options follows.
3602
3603 @table @option
3604
3605 @item rate, r
3606 Specify the frame rate of the sourced video, as the number of frames
3607 generated per second. It has to be a string in the format
3608 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
3609 number or a valid video frame rate abbreviation. The default value is
3610 "25".
3611
3612 @item duration, d
3613 Set the video duration of the sourced video. The accepted syntax is:
3614 @example
3615 [-]HH:MM:SS[.m...]
3616 [-]S+[.m...]
3617 @end example
3618 See also the function @code{av_parse_time()}.
3619
3620 If not specified, or the expressed duration is negative, the video is
3621 supposed to be generated forever.
3622
3623 @item test, t
3624
3625 Set the number or the name of the test to perform. Supported tests are:
3626 @table @option
3627 @item dc_luma
3628 @item dc_chroma
3629 @item freq_luma
3630 @item freq_chroma
3631 @item amp_luma
3632 @item amp_chroma
3633 @item cbp
3634 @item mv
3635 @item ring1
3636 @item ring2
3637 @item all
3638 @end table
3639
3640 Default value is "all", which will cycle through the list of all tests.
3641 @end table
3642
3643 For example the following:
3644 @example
3645 testsrc=t=dc_luma
3646 @end example
3647
3648 will generate a "dc_luma" test pattern.
3649
3650 @section frei0r_src
3651
3652 Provide a frei0r source.
3653
3654 To enable compilation of this filter you need to install the frei0r
3655 header and configure FFmpeg with @code{--enable-frei0r}.
3656
3657 The source supports the syntax:
3658 @example
3659 @var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
3660 @end example
3661
3662 @var{size} is the size of the video to generate, may be a string of the
3663 form @var{width}x@var{height} or a frame size abbreviation.
3664 @var{rate} is the rate of the video to generate, may be a string of
3665 the form @var{num}/@var{den} or a frame rate abbreviation.
3666 @var{src_name} is the name to the frei0r source to load. For more
3667 information regarding frei0r and how to set the parameters read the
3668 section @ref{frei0r} in the description of the video filters.
3669
3670 For example, to generate a frei0r partik0l source with size 200x200
3671 and frame rate 10 which is overlayed on the overlay filter main input:
3672 @example
3673 frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
3674 @end example
3675
3676 @section life
3677
3678 Generate a life pattern.
3679
3680 This source is based on a generalization of John Conway's life game.
3681
3682 The sourced input represents a life grid, each pixel represents a cell
3683 which can be in one of two possible states, alive or dead. Every cell
3684 interacts with its eight neighbours, which are the cells that are
3685 horizontally, vertically, or diagonally adjacent.
3686
3687 At each interaction the grid evolves according to the adopted rule,
3688 which specifies the number of neighbor alive cells which will make a
3689 cell stay alive or born. The @option{rule} option allows to specify
3690 the rule to adopt.
3691
3692 This source accepts a list of options in the form of
3693 @var{key}=@var{value} pairs separated by ":". A description of the
3694 accepted options follows.
3695
3696 @table @option
3697 @item filename, f
3698 Set the file from which to read the initial grid state. In the file,
3699 each non-whitespace character is considered an alive cell, and newline
3700 is used to delimit the end of each row.
3701
3702 If this option is not specified, the initial grid is generated
3703 randomly.
3704
3705 @item rate, r
3706 Set the video rate, that is the number of frames generated per second.
3707 Default is 25.
3708
3709 @item random_fill_ratio, ratio
3710 Set the random fill ratio for the initial random grid. It is a
3711 floating point number value ranging from 0 to 1, defaults to 1/PHI.
3712 It is ignored when a file is specified.
3713
3714 @item random_seed, seed
3715 Set the seed for filling the initial random grid, must be an integer
3716 included between 0 and UINT32_MAX. If not specified, or if explicitly
3717 set to -1, the filter will try to use a good random seed on a best
3718 effort basis.
3719
3720 @item rule
3721 Set the life rule.
3722
3723 A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
3724 where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
3725 @var{NS} specifies the number of alive neighbor cells which make a
3726 live cell stay alive, and @var{NB} the number of alive neighbor cells
3727 which make a dead cell to become alive (i.e. to "born").
3728 "s" and "b" can be used in place of "S" and "B", respectively.
3729
3730 Alternatively a rule can be specified by an 18-bits integer. The 9
3731 high order bits are used to encode the next cell state if it is alive
3732 for each number of neighbor alive cells, the low order bits specify
3733 the rule for "borning" new cells. Higher order bits encode for an
3734 higher number of neighbor cells.
3735 For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
3736 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
3737
3738 Default value is "S23/B3", which is the original Conway's game of life
3739 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
3740 cells, and will born a new cell if there are three alive cells around
3741 a dead cell.
3742
3743 @item size, s
3744 Set the size of the output video.
3745
3746 If @option{filename} is specified, the size is set by default to the
3747 same size of the input file. If @option{size} is set, it must contain
3748 the size specified in the input file, and the initial grid defined in
3749 that file is centered in the larger resulting area.
3750
3751 If a filename is not specified, the size value defaults to "320x240"
3752 (used for a randomly generated initial grid).
3753
3754 @item stitch
3755 If set to 1, stitch the left and right grid edges together, and the
3756 top and bottom edges also. Defaults to 1.
3757
3758 @item mold
3759 Set cell mold speed. If set, a dead cell will go from @option{death_color} to
3760 @option{mold_color} with a step of @option{mold}. @option{mold} can have a
3761 value from 0 to 255.
3762
3763 @item life_color
3764 Set the color of living (or new born) cells.
3765
3766 @item death_color
3767 Set the color of dead cells. If @option{mold} is set, this is the first color
3768 used to represent a dead cell.
3769
3770 @item mold_color
3771 Set mold color, for definitely dead and moldy cells.
3772 @end table
3773
3774 @subsection Examples
3775
3776 @itemize
3777 @item
3778 Read a grid from @file{pattern}, and center it on a grid of size
3779 300x300 pixels:
3780 @example
3781 life=f=pattern:s=300x300
3782 @end example
3783
3784 @item
3785 Generate a random grid of size 200x200, with a fill ratio of 2/3:
3786 @example
3787 life=ratio=2/3:s=200x200
3788 @end example
3789
3790 @item
3791 Specify a custom rule for evolving a randomly generated grid:
3792 @example
3793 life=rule=S14/B34
3794 @end example
3795
3796 @item
3797 Full example with slow death effect (mold) using @command{ffplay}:
3798 @example
3799 ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
3800 @end example
3801 @end itemize
3802
3803 @section nullsrc, rgbtestsrc, testsrc
3804
3805 The @code{nullsrc} source returns unprocessed video frames. It is
3806 mainly useful to be employed in analysis / debugging tools, or as the
3807 source for filters which ignore the input data.
3808
3809 The @code{rgbtestsrc} source generates an RGB test pattern useful for
3810 detecting RGB vs BGR issues. You should see a red, green and blue
3811 stripe from top to bottom.
3812
3813 The @code{testsrc} source generates a test video pattern, showing a
3814 color pattern, a scrolling gradient and a timestamp. This is mainly
3815 intended for testing purposes.
3816
3817 These sources accept an optional sequence of @var{key}=@var{value} pairs,
3818 separated by ":". The description of the accepted options follows.
3819
3820 @table @option
3821
3822 @item size, s
3823 Specify the size of the sourced video, it may be a string of the form
3824 @var{width}x@var{height}, or the name of a size abbreviation. The
3825 default value is "320x240".
3826
3827 @item rate, r
3828 Specify the frame rate of the sourced video, as the number of frames
3829 generated per second. It has to be a string in the format
3830 @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
3831 number or a valid video frame rate abbreviation. The default value is
3832 "25".
3833
3834 @item sar
3835 Set the sample aspect ratio of the sourced video.
3836
3837 @item duration, d
3838 Set the video duration of the sourced video. The accepted syntax is:
3839 @example
3840 [-]HH[:MM[:SS[.m...]]]
3841 [-]S+[.m...]
3842 @end example
3843 See also the function @code{av_parse_time()}.
3844
3845 If not specified, or the expressed duration is negative, the video is
3846 supposed to be generated forever.
3847
3848 @item decimals, n
3849 Set the number of decimals to show in the timestamp, only used in the
3850 @code{testsrc} source.
3851
3852 The displayed timestamp value will correspond to the original
3853 timestamp value multiplied by the power of 10 of the specified
3854 value. Default value is 0.
3855 @end table
3856
3857 For example the following:
3858 @example
3859 testsrc=duration=5.3:size=qcif:rate=10
3860 @end example
3861
3862 will generate a video with a duration of 5.3 seconds, with size
3863 176x144 and a frame rate of 10 frames per second.
3864
3865 If the input content is to be ignored, @code{nullsrc} can be used. The
3866 following command generates noise in the luminance plane by employing
3867 the @code{mp=geq} filter:
3868 @example
3869 nullsrc=s=256x256, mp=geq=random(1)*255:128:128
3870 @end example
3871
3872 @c man end VIDEO SOURCES
3873
3874 @chapter Video Sinks
3875 @c man begin VIDEO SINKS
3876
3877 Below is a description of the currently available video sinks.
3878
3879 @section buffersink
3880
3881 Buffer video frames, and make them available to the end of the filter
3882 graph.
3883
3884 This sink is mainly intended for a programmatic use, in particular
3885 through the interface defined in @file{libavfilter/buffersink.h}.
3886
3887 It does not require a string parameter in input, but you need to
3888 specify a pointer to a list of supported pixel formats terminated by
3889 -1 in the opaque parameter provided to @code{avfilter_init_filter}
3890 when initializing this sink.
3891
3892 @section nullsink
3893
3894 Null video sink, do absolutely nothing with the input video. It is
3895 mainly useful as a template and to be employed in analysis / debugging
3896 tools.
3897
3898 @c man end VIDEO SINKS
3899
3900 @chapter Transmedia Filters
3901 @c man begin TRANSMEDIA FILTERS
3902
3903 Below is a description of the currently available transmedia filters.
3904
3905 @section showwaves
3906
3907 Convert input audio to a video output, representing the samples waves.
3908
3909 The filter accepts the following named parameters:
3910 @table @option
3911
3912 @item n
3913 Set the number of samples which are printed on the same column. A
3914 larger value will decrease the frame rate. Must be a positive
3915 integer. This option can be set only if the value for @var{rate}
3916 is not explicitly specified.
3917
3918 @item rate, r
3919 Set the (approximate) output frame rate. This is done by setting the
3920 option @var{n}. Default value is "25".
3921
3922 @item size, s
3923 Specify the video size for the output. Default value is "600x240".
3924 @end table
3925
3926 Some examples follow.
3927 @itemize
3928 @item
3929 Output the input file audio and the corresponding video representation
3930 at the same time:
3931 @example
3932 amovie=a.mp3,asplit[out0],showwaves[out1]
3933 @end example
3934
3935 @item
3936 Create a synthetic signal and show it with showwaves, forcing a
3937 framerate of 30 frames per second:
3938 @example
3939 aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
3940 @end example
3941 @end itemize
3942
3943 @c man end TRANSMEDIA FILTERS