ffmpeg / doc / libavfilter.texi @ 143e3aa0
History | View | Annotate | Download (4.68 KB)
1 | 1f09ab5e | Stefano Sabatini | \input texinfo @c -*- texinfo -*- |
---|---|---|---|
2 | |||
3 | dba755fa | Stefano Sabatini | @settitle Libavfilter Documentation |
4 | 1f09ab5e | Stefano Sabatini | @titlepage |
5 | @sp 7 |
||
6 | dba755fa | Stefano Sabatini | @center @titlefont{Libavfilter Documentation} |
7 | 1f09ab5e | Stefano Sabatini | @sp 3 |
8 | @end titlepage |
||
9 | |||
10 | |||
11 | @chapter Introduction |
||
12 | |||
13 | Libavfilter is the filtering API of FFmpeg. It is the substitute of the |
||
14 | now deprecated 'vhooks' and started as a Google Summer of Code project. |
||
15 | |||
16 | Integrating libavfilter into the main FFmpeg repository is a work in |
||
17 | progress. If you wish to try the unfinished development code of |
||
18 | libavfilter then check it out from the libavfilter repository into |
||
19 | some directory of your choice by: |
||
20 | |||
21 | @example |
||
22 | svn checkout svn://svn.ffmpeg.org/soc/libavfilter |
||
23 | @end example |
||
24 | |||
25 | And then read the README file in the top directory to learn how to |
||
26 | integrate it into ffmpeg and ffplay. |
||
27 | |||
28 | But note that there may still be serious bugs in the code and its API |
||
29 | and ABI should not be considered stable yet! |
||
30 | |||
31 | f6112d7f | Stefano Sabatini | @chapter Tutorial |
32 | |||
33 | 1f09ab5e | Stefano Sabatini | In libavfilter, it is possible for filters to have multiple inputs and |
34 | multiple outputs. |
||
35 | To illustrate the sorts of things that are possible, we can |
||
36 | use a complex filter graph. For example, the following one: |
||
37 | |||
38 | @example |
||
39 | input --> split --> fifo -----------------------> overlay --> output |
||
40 | | ^ |
||
41 | | | |
||
42 | +------> fifo --> crop --> vflip --------+ |
||
43 | @end example |
||
44 | |||
45 | splits the stream in two streams, sends one stream through the crop filter |
||
46 | and the vflip filter before merging it back with the other stream by |
||
47 | overlaying it on top. You can use the following command to achieve this: |
||
48 | |||
49 | @example |
||
50 | ./ffmpeg -i in.avi -s 240x320 -vfilters "[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2] |
||
51 | @end example |
||
52 | |||
53 | where input_video.avi has a vertical resolution of 480 pixels. The |
||
54 | result will be that in output the top half of the video is mirrored |
||
55 | onto the bottom half. |
||
56 | |||
57 | Video filters are loaded using the @var{-vfilters} option passed to |
||
58 | ffmpeg or to ffplay. Filters in the same linear chain are separated by |
||
59 | commas. In our example, @var{split, fifo, overlay} are in one linear |
||
60 | chain, and @var{fifo, crop, vflip} are in another. The points where |
||
61 | the linear chains join are labeled by names enclosed in square |
||
62 | brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic |
||
63 | labels @var{[in]} and @var{[out]} are the points where video is input |
||
64 | and output. |
||
65 | |||
66 | Some filters take in input a list of parameters: they are specified |
||
67 | after the filter name and an equal sign, and are separated each other |
||
68 | by a semicolon. |
||
69 | |||
70 | There exist so-called @var{source filters} that do not have a video |
||
71 | input, and we expect in the future some @var{sink filters} that will |
||
72 | not have video output. |
||
73 | |||
74 | @chapter Available video filters |
||
75 | |||
76 | When you configure your FFmpeg build, you can disable any of the |
||
77 | existing video filters. |
||
78 | The configure output will show the video filters included in your |
||
79 | build. |
||
80 | |||
81 | Below is a description of the currently available video filters. |
||
82 | |||
83 | 190c1669 | Stefano Sabatini | @section crop |
84 | |||
85 | Crop the input video to x:y:width:height. |
||
86 | |||
87 | @example |
||
88 | ./ffmpeg -i in.avi -vfilters "crop=0:0:0:240" out.avi |
||
89 | @end example |
||
90 | |||
91 | ``x'' and ``y'' specify the position of the top-left corner of the |
||
92 | output (non-cropped) area. |
||
93 | |||
94 | The default value of ``x'' and ``y'' is 0. |
||
95 | |||
96 | debfab4a | Stefano Sabatini | The ``width'' and ``height'' parameters specify the width and height |
97 | of the output (non-cropped) area. |
||
98 | 190c1669 | Stefano Sabatini | |
99 | A value of 0 is interpreted as the maximum possible size contained in |
||
100 | the area delimited by the top-left corner at position x:y. |
||
101 | |||
102 | For example the parameters: |
||
103 | |||
104 | @example |
||
105 | "crop=100:100:0:0" |
||
106 | @end example |
||
107 | |||
108 | will delimit the rectangle with the top-left corner placed at position |
||
109 | 100:100 and the right-bottom corner corresponding to the right-bottom |
||
110 | corner of the input image. |
||
111 | |||
112 | 29b5a3aa | Stefano Sabatini | The default value of ``width'' and ``height'' is 0. |
113 | 190c1669 | Stefano Sabatini | |
114 | fcbed3c7 | Stefano Sabatini | @section format |
115 | |||
116 | Convert the input video to one of the specified pixel formats. |
||
117 | 143e3aa0 | Stefano Sabatini | Libavfilter will try to pick one that is supported for the input to |
118 | fcbed3c7 | Stefano Sabatini | the next filter. |
119 | |||
120 | 143e3aa0 | Stefano Sabatini | The filter accepts a list of pixel format names, separated by ``:'', |
121 | for example ``yuv420p:monow:rgb24''. |
||
122 | fcbed3c7 | Stefano Sabatini | |
123 | The following command: |
||
124 | |||
125 | @example |
||
126 | ./ffmpeg -i in.avi -vfilters "format=yuv420p" out.avi |
||
127 | @end example |
||
128 | |||
129 | will convert the input video to the format ``yuv420p''. |
||
130 | |||
131 | @section noformat |
||
132 | |||
133 | 143e3aa0 | Stefano Sabatini | Force libavfilter not to use any of the specified pixel formats for the |
134 | fcbed3c7 | Stefano Sabatini | input to the next filter. |
135 | |||
136 | 143e3aa0 | Stefano Sabatini | The filter accepts a list of pixel format names, separated by ``:'', |
137 | for example ``yuv420p:monow:rgb24''. |
||
138 | fcbed3c7 | Stefano Sabatini | |
139 | The following command: |
||
140 | |||
141 | @example |
||
142 | ./ffmpeg -i in.avi -vfilters "noformat=yuv420p, vflip" out.avi |
||
143 | @end example |
||
144 | |||
145 | 143e3aa0 | Stefano Sabatini | will make libavfilter use a format different from ``yuv420p'' for the |
146 | fcbed3c7 | Stefano Sabatini | input to the vflip filter. |
147 | |||
148 | 415e6d29 | Stefano Sabatini | @section null |
149 | |||
150 | Pass the source unchanged to the output. |
||
151 | |||
152 | c38ae71f | Stefano Sabatini | @section vflip |
153 | |||
154 | Flip the input video vertically. |
||
155 | |||
156 | @example |
||
157 | ./ffmpeg -i in.avi -vfilters "vflip" out.avi |
||
158 | @end example |
||
159 | |||
160 | 1f09ab5e | Stefano Sabatini | @bye |