Statistics
| Branch: | Revision:

ffmpeg / doc / ffmpeg-doc.texi @ 17a21f3c

History | View | Annotate | Download (52.1 KB)

1 9181577c Fabrice Bellard
\input texinfo @c -*- texinfo -*-
2
3
@settitle FFmpeg Documentation
4
@titlepage
5
@sp 7
6
@center @titlefont{FFmpeg Documentation}
7
@sp 3
8
@end titlepage
9
10
11
@chapter Introduction
12
13
FFmpeg is a very fast video and audio converter. It can also grab from
14
a live audio/video source.
15 115329f1 Diego Biurrun
16 9181577c Fabrice Bellard
The command line interface is designed to be intuitive, in the sense
17 4c5f7207 Diego Biurrun
that FFmpeg tries to figure out all parameters that can possibly be
18
derived automatically. You usually only have to specify the target
19
bitrate you want.
20 9181577c Fabrice Bellard
21
FFmpeg can also convert from any sample rate to any other, and resize
22
video on the fly with a high quality polyphase filter.
23
24
@chapter Quick Start
25
26 e99c4e10 Fabrice Bellard
@c man begin EXAMPLES
27 9181577c Fabrice Bellard
@section Video and Audio grabbing
28
29 e99c4e10 Fabrice Bellard
FFmpeg can use a video4linux compatible video source and any Open Sound
30
System audio source:
31
32 9181577c Fabrice Bellard
@example
33 115329f1 Diego Biurrun
ffmpeg /tmp/out.mpg
34 9181577c Fabrice Bellard
@end example
35
36 e99c4e10 Fabrice Bellard
Note that you must activate the right video source and channel before
37 4c5f7207 Diego Biurrun
launching FFmpeg with any TV viewer such as xawtv
38
(@url{http://bytesex.org/xawtv/}) by Gerd Knorr. You also
39
have to set the audio recording levels correctly with a
40 e99c4e10 Fabrice Bellard
standard mixer.
41 9181577c Fabrice Bellard
42 6bf40f39 Philip Gladstone
@section Video and Audio file format conversion
43 9181577c Fabrice Bellard
44 4c5f7207 Diego Biurrun
* FFmpeg can use any supported file format and protocol as input:
45 9181577c Fabrice Bellard
46
Examples:
47
48 4c5f7207 Diego Biurrun
* You can use YUV files as input:
49 9181577c Fabrice Bellard
50
@example
51 115329f1 Diego Biurrun
ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
52 9181577c Fabrice Bellard
@end example
53
54 115329f1 Diego Biurrun
It will use the files:
55 9181577c Fabrice Bellard
@example
56 e99c4e10 Fabrice Bellard
/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
57
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
58 9181577c Fabrice Bellard
@end example
59
60 e99c4e10 Fabrice Bellard
The Y files use twice the resolution of the U and V files. They are
61
raw files, without header. They can be generated by all decent video
62
decoders. You must specify the size of the image with the @option{-s} option
63 4c5f7207 Diego Biurrun
if FFmpeg cannot guess it.
64 9181577c Fabrice Bellard
65 4c5f7207 Diego Biurrun
* You can input from a raw YUV420P file:
66 9181577c Fabrice Bellard
67
@example
68 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/test.yuv /tmp/out.avi
69 9181577c Fabrice Bellard
@end example
70
71 4c5f7207 Diego Biurrun
test.yuv is a file containing raw YUV planar data. Each frame is composed
72
of the Y plane followed by the U and V planes at half vertical and
73 e99c4e10 Fabrice Bellard
horizontal resolution.
74 9181577c Fabrice Bellard
75 4c5f7207 Diego Biurrun
* You can output to a raw YUV420P file:
76 9181577c Fabrice Bellard
77
@example
78 f926cbe7 Michel Bardiaux
ffmpeg -i mydivx.avi hugefile.yuv
79 9181577c Fabrice Bellard
@end example
80
81
* You can set several input files and output files:
82
83
@example
84 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
85 9181577c Fabrice Bellard
@end example
86
87 4c5f7207 Diego Biurrun
Converts the audio file a.wav and the raw YUV video file a.yuv
88
to MPEG file a.mpg.
89 9181577c Fabrice Bellard
90 6bf40f39 Philip Gladstone
* You can also do audio and video conversions at the same time:
91 9181577c Fabrice Bellard
92
@example
93 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
94 9181577c Fabrice Bellard
@end example
95
96 4c5f7207 Diego Biurrun
Converts a.wav to MPEG audio at 22050Hz sample rate.
97 9181577c Fabrice Bellard
98
* You can encode to several formats at the same time and define a
99 e99c4e10 Fabrice Bellard
mapping from input stream to output streams:
100 9181577c Fabrice Bellard
101
@example
102 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
103 9181577c Fabrice Bellard
@end example
104
105 4c5f7207 Diego Biurrun
Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
106
file:index' specifies which input stream is used for each output
107 e99c4e10 Fabrice Bellard
stream, in the order of the definition of output streams.
108 9181577c Fabrice Bellard
109
* You can transcode decrypted VOBs
110
111
@example
112 3c0ba870 Panagiotis Issaris
ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
113 9181577c Fabrice Bellard
@end example
114
115 4c5f7207 Diego Biurrun
This is a typical DVD ripping example; the input is a VOB file, the
116
output an AVI file with MPEG-4 video and MP3 audio. Note that in this
117
command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
118
GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
119
input video. Furthermore, the audio stream is MP3-encoded so you need
120
to enable LAME support by passing @code{--enable-mp3lame} to configure.
121
The mapping is particularly useful for DVD transcoding
122 e99c4e10 Fabrice Bellard
to get the desired audio language.
123 9181577c Fabrice Bellard
124 4c5f7207 Diego Biurrun
NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
125 e99c4e10 Fabrice Bellard
@c man end
126 9181577c Fabrice Bellard
127
@chapter Invocation
128
129
@section Syntax
130
131 e99c4e10 Fabrice Bellard
The generic syntax is:
132 9181577c Fabrice Bellard
133 115329f1 Diego Biurrun
@example
134 e99c4e10 Fabrice Bellard
@c man begin SYNOPSIS
135 28f88dc8 Michael Niedermayer
ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
136 e99c4e10 Fabrice Bellard
@c man end
137 9181577c Fabrice Bellard
@end example
138 e99c4e10 Fabrice Bellard
@c man begin DESCRIPTION
139
If no input file is given, audio/video grabbing is done.
140 9181577c Fabrice Bellard
141 e99c4e10 Fabrice Bellard
As a general rule, options are applied to the next specified
142 3c0ba870 Panagiotis Issaris
file. For example, if you give the @option{-b 64k} option, it sets the video
143 4c5f7207 Diego Biurrun
bitrate of the next file. The format option may be needed for raw input
144 e99c4e10 Fabrice Bellard
files.
145 9181577c Fabrice Bellard
146 4c5f7207 Diego Biurrun
By default, FFmpeg tries to convert as losslessly as possible: It
147
uses the same audio and video parameters for the outputs as the one
148 e99c4e10 Fabrice Bellard
specified for the inputs.
149
@c man end
150 9181577c Fabrice Bellard
151 e99c4e10 Fabrice Bellard
@c man begin OPTIONS
152 9181577c Fabrice Bellard
@section Main options
153
154 e99c4e10 Fabrice Bellard
@table @option
155 9181577c Fabrice Bellard
@item -L
156 4c5f7207 Diego Biurrun
Show license.
157 18bff752 Fabrice Bellard
158 9181577c Fabrice Bellard
@item -h
159 4c5f7207 Diego Biurrun
Show help.
160 18bff752 Fabrice Bellard
161 4386f941 Diego Biurrun
@item -version
162
Show version.
163
164 e99c4e10 Fabrice Bellard
@item -formats
165 4c5f7207 Diego Biurrun
Show available formats, codecs, protocols, ...
166 18bff752 Fabrice Bellard
167 115329f1 Diego Biurrun
@item -f fmt
168 4c5f7207 Diego Biurrun
Force format.
169 18bff752 Fabrice Bellard
170 115329f1 Diego Biurrun
@item -i filename
171 4c5f7207 Diego Biurrun
input filename
172 9181577c Fabrice Bellard
173 115329f1 Diego Biurrun
@item -y
174 4c5f7207 Diego Biurrun
Overwrite output files.
175 9181577c Fabrice Bellard
176 115329f1 Diego Biurrun
@item -t duration
177 4c5f7207 Diego Biurrun
Set the recording time in seconds.
178
@code{hh:mm:ss[.xxx]} syntax is also supported.
179 9181577c Fabrice Bellard
180 4386f941 Diego Biurrun
@item -fs limit_size
181
Set the file size limit.
182
183 e83a84ac Benjamin Larsson
@item -ss position
184 4c5f7207 Diego Biurrun
Seek to given time position in seconds.
185
@code{hh:mm:ss[.xxx]} syntax is also supported.
186 e83a84ac Benjamin Larsson
187 4386f941 Diego Biurrun
@item -itsoffset offset
188
Set the input time offset in seconds.
189
@code{[-]hh:mm:ss[.xxx]} syntax is also supported.
190
This option affects all the input files that follow it.
191
The offset is added to the timestamps of the input files.
192
Specifying a positive offset means that the corresponding
193
streams are delayed by 'offset' seconds.
194
195 115329f1 Diego Biurrun
@item -title string
196 4c5f7207 Diego Biurrun
Set the title.
197 9181577c Fabrice Bellard
198 4386f941 Diego Biurrun
@item -timestamp time
199
Set the timestamp.
200
201 115329f1 Diego Biurrun
@item -author string
202 4c5f7207 Diego Biurrun
Set the author.
203 9181577c Fabrice Bellard
204 115329f1 Diego Biurrun
@item -copyright string
205 4c5f7207 Diego Biurrun
Set the copyright.
206 9181577c Fabrice Bellard
207 115329f1 Diego Biurrun
@item -comment string
208 4c5f7207 Diego Biurrun
Set the comment.
209 9181577c Fabrice Bellard
210 4386f941 Diego Biurrun
@item -album string
211
Set the album.
212
213 ec1b10f4 Panagiotis Issaris
@item -track number
214
Set the track.
215
216
@item -year number
217
Set the year.
218
219 4386f941 Diego Biurrun
@item -v verbose
220
Control amount of logging.
221
222 99db6420 Fabrice Bellard
@item -target type
223 4386f941 Diego Biurrun
Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
224 4c5f7207 Diego Biurrun
"ntsc-svcd", ... ). All the format options (bitrate, codecs,
225
buffer sizes) are then set automatically. You can just type:
226 99db6420 Fabrice Bellard
227
@example
228
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
229
@end example
230
231 4c5f7207 Diego Biurrun
Nevertheless you can specify additional options as long as you know
232
they do not conflict with the standard, as in:
233 791d8d1d Michel Bardiaux
234
@example
235
ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
236
@end example
237
238 4386f941 Diego Biurrun
@item -dframes number
239
Set the number of data frames to record.
240
241
@item -scodec codec
242
Force subtitle codec ('copy' to copy stream).
243
244
@item -newsubtitle
245
Add a new subtitle stream to the current output stream.
246
247
@item -slang code
248
Set the ISO 639 language code (3 letters) of the current subtitle stream.
249 401fbdde Michael Niedermayer
250 9181577c Fabrice Bellard
@end table
251
252
@section Video Options
253
254 e99c4e10 Fabrice Bellard
@table @option
255 9181577c Fabrice Bellard
@item -b bitrate
256 3c0ba870 Panagiotis Issaris
Set the video bitrate in bit/s (default = 200 kb/s).
257 4386f941 Diego Biurrun
@item -vframes number
258
Set the number of video frames to record.
259 115329f1 Diego Biurrun
@item -r fps
260 4386f941 Diego Biurrun
Set frame rate (Hz value, fraction or abbreviation), (default = 25).
261 115329f1 Diego Biurrun
@item -s size
262 4c5f7207 Diego Biurrun
Set frame size. The format is @samp{wxh} (default = 160x128).
263
The following abbreviations are recognized:
264 5ee03c86 Fabrice Bellard
@table @samp
265 18bff752 Fabrice Bellard
@item sqcif
266
128x96
267
@item qcif
268
176x144
269
@item cif
270
352x288
271
@item 4cif
272
704x576
273
@end table
274
275
@item -aspect aspect
276 4c5f7207 Diego Biurrun
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
277 18bff752 Fabrice Bellard
@item -croptop size
278 4c5f7207 Diego Biurrun
Set top crop band size (in pixels).
279 18bff752 Fabrice Bellard
@item -cropbottom size
280 4c5f7207 Diego Biurrun
Set bottom crop band size (in pixels).
281 18bff752 Fabrice Bellard
@item -cropleft size
282 4c5f7207 Diego Biurrun
Set left crop band size (in pixels).
283 18bff752 Fabrice Bellard
@item -cropright size
284 4c5f7207 Diego Biurrun
Set right crop band size (in pixels).
285 1ff93ffc Todd Kirby
@item -padtop size
286 4c5f7207 Diego Biurrun
Set top pad band size (in pixels).
287 1ff93ffc Todd Kirby
@item -padbottom size
288 4c5f7207 Diego Biurrun
Set bottom pad band size (in pixels).
289 1ff93ffc Todd Kirby
@item -padleft size
290 4c5f7207 Diego Biurrun
Set left pad band size (in pixels).
291 1ff93ffc Todd Kirby
@item -padright size
292 4c5f7207 Diego Biurrun
Set right pad band size (in pixels).
293 5b79a73e Todd Kirby
@item -padcolor (hex color)
294 4c5f7207 Diego Biurrun
Set color of padded bands. The value for padcolor is expressed
295
as a six digit hexadecimal number where the first two digits
296
represent red, the middle two digits green and last two digits
297
blue (default = 000000 (black)).
298 9181577c Fabrice Bellard
@item -vn
299 4c5f7207 Diego Biurrun
Disable video recording.
300 115329f1 Diego Biurrun
@item -bt tolerance
301 dc5ee8bc Panagiotis Issaris
Set video bitrate tolerance (in bit/s).
302 18bff752 Fabrice Bellard
@item -maxrate bitrate
303 a5515106 Panagiotis Issaris
Set max video bitrate tolerance (in bit/s).
304 18bff752 Fabrice Bellard
@item -minrate bitrate
305 a5515106 Panagiotis Issaris
Set min video bitrate tolerance (in bit/s).
306 18bff752 Fabrice Bellard
@item -bufsize size
307 81d0618f Panagiotis Issaris
Set rate control buffer size (in bits).
308 115329f1 Diego Biurrun
@item -vcodec codec
309 4c5f7207 Diego Biurrun
Force video codec to @var{codec}. Use the @code{copy} special value to
310 5ee03c86 Fabrice Bellard
tell that the raw codec data must be copied as is.
311 18bff752 Fabrice Bellard
@item -sameq
312 4c5f7207 Diego Biurrun
Use same video quality as source (implies VBR).
313 9181577c Fabrice Bellard
314 115329f1 Diego Biurrun
@item -pass n
315 4c5f7207 Diego Biurrun
Select the pass number (1 or 2). It is useful to do two pass
316
encoding. The statistics of the video are recorded in the first
317
pass and the video is generated at the exact requested bitrate
318
in the second pass.
319 9181577c Fabrice Bellard
320 115329f1 Diego Biurrun
@item -passlogfile file
321 4c5f7207 Diego Biurrun
Set two pass logfile name to @var{file}.
322 9181577c Fabrice Bellard
323 4386f941 Diego Biurrun
@item -newvideo
324
Add a new video stream to the current output stream.
325
326 9181577c Fabrice Bellard
@end table
327
328 18bff752 Fabrice Bellard
@section Advanced Video Options
329 9181577c Fabrice Bellard
330 e99c4e10 Fabrice Bellard
@table @option
331 4386f941 Diego Biurrun
@item -pix_fmt format
332
Set pixel format.
333 115329f1 Diego Biurrun
@item -g gop_size
334 4c5f7207 Diego Biurrun
Set the group of pictures size.
335 115329f1 Diego Biurrun
@item -intra
336 4c5f7207 Diego Biurrun
Use only intra frames.
337 4386f941 Diego Biurrun
@item -vdt n
338
Discard threshold.
339 115329f1 Diego Biurrun
@item -qscale q
340 4bef236b Diego Biurrun
Use fixed video quantizer scale (VBR).
341 115329f1 Diego Biurrun
@item -qmin q
342 4bef236b Diego Biurrun
minimum video quantizer scale (VBR)
343 115329f1 Diego Biurrun
@item -qmax q
344 4bef236b Diego Biurrun
maximum video quantizer scale (VBR)
345 115329f1 Diego Biurrun
@item -qdiff q
346 4bef236b Diego Biurrun
maximum difference between the quantizer scales (VBR)
347 115329f1 Diego Biurrun
@item -qblur blur
348 4bef236b Diego Biurrun
video quantizer scale blur (VBR)
349 115329f1 Diego Biurrun
@item -qcomp compression
350 4bef236b Diego Biurrun
video quantizer scale compression (VBR)
351 18bff752 Fabrice Bellard
352 9ae711e1 Víctor Paesa
@item -lmin lambda
353
minimum video lagrange factor (VBR)
354
@item -lmax lambda
355
max video lagrange factor (VBR)
356
@item -mblmin lambda
357
minimum macroblock quantizer scale (VBR)
358
@item -mblmax lambda
359
maximum macroblock quantizer scale (VBR)
360
361
These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
362
but you may use the QP2LAMBDA constant to easily convert from 'q' units:
363
@example
364
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
365
@end example
366
367 18bff752 Fabrice Bellard
@item -rc_init_cplx complexity
368 4c5f7207 Diego Biurrun
initial complexity for single pass encoding
369 18bff752 Fabrice Bellard
@item -b_qfactor factor
370 4c5f7207 Diego Biurrun
qp factor between P- and B-frames
371 18bff752 Fabrice Bellard
@item -i_qfactor factor
372 4c5f7207 Diego Biurrun
qp factor between P- and I-frames
373 18bff752 Fabrice Bellard
@item -b_qoffset offset
374 4c5f7207 Diego Biurrun
qp offset between P- and B-frames
375 18bff752 Fabrice Bellard
@item -i_qoffset offset
376 4c5f7207 Diego Biurrun
qp offset between P- and I-frames
377 18bff752 Fabrice Bellard
@item -rc_eq equation
378 4c5f7207 Diego Biurrun
Set rate control equation (@pxref{FFmpeg formula
379
evaluator}) (default = @code{tex^qComp}).
380 5ee03c86 Fabrice Bellard
@item -rc_override override
381
rate control override for specific intervals
382 18bff752 Fabrice Bellard
@item -me method
383 4c5f7207 Diego Biurrun
Set motion estimation method to @var{method}.
384
Available methods are (from lowest to best quality):
385 18bff752 Fabrice Bellard
@table @samp
386
@item zero
387 5ee03c86 Fabrice Bellard
Try just the (0, 0) vector.
388 18bff752 Fabrice Bellard
@item phods
389
@item log
390
@item x1
391
@item epzs
392
(default method)
393
@item full
394
exhaustive search (slow and marginally better than epzs)
395
@end table
396
397
@item -dct_algo algo
398 4c5f7207 Diego Biurrun
Set DCT algorithm to @var{algo}. Available values are:
399 18bff752 Fabrice Bellard
@table @samp
400
@item 0
401
FF_DCT_AUTO (default)
402
@item 1
403
FF_DCT_FASTINT
404
@item 2
405
FF_DCT_INT
406
@item 3
407
FF_DCT_MMX
408
@item 4
409
FF_DCT_MLIB
410
@item 5
411
FF_DCT_ALTIVEC
412
@end table
413
414
@item -idct_algo algo
415 4c5f7207 Diego Biurrun
Set IDCT algorithm to @var{algo}. Available values are:
416 18bff752 Fabrice Bellard
@table @samp
417
@item 0
418
FF_IDCT_AUTO (default)
419
@item 1
420 115329f1 Diego Biurrun
FF_IDCT_INT
421 18bff752 Fabrice Bellard
@item 2
422 115329f1 Diego Biurrun
FF_IDCT_SIMPLE
423 18bff752 Fabrice Bellard
@item 3
424 115329f1 Diego Biurrun
FF_IDCT_SIMPLEMMX
425 18bff752 Fabrice Bellard
@item 4
426 115329f1 Diego Biurrun
FF_IDCT_LIBMPEG2MMX
427 18bff752 Fabrice Bellard
@item 5
428 115329f1 Diego Biurrun
FF_IDCT_PS2
429 18bff752 Fabrice Bellard
@item 6
430 115329f1 Diego Biurrun
FF_IDCT_MLIB
431 18bff752 Fabrice Bellard
@item 7
432 115329f1 Diego Biurrun
FF_IDCT_ARM
433 18bff752 Fabrice Bellard
@item 8
434 115329f1 Diego Biurrun
FF_IDCT_ALTIVEC
435 18bff752 Fabrice Bellard
@item 9
436 115329f1 Diego Biurrun
FF_IDCT_SH4
437 18bff752 Fabrice Bellard
@item 10
438 115329f1 Diego Biurrun
FF_IDCT_SIMPLEARM
439 18bff752 Fabrice Bellard
@end table
440
441
@item -er n
442 4c5f7207 Diego Biurrun
Set error resilience to @var{n}.
443 18bff752 Fabrice Bellard
@table @samp
444 115329f1 Diego Biurrun
@item 1
445 1471c6c2 Diego Biurrun
FF_ER_CAREFUL (default)
446 18bff752 Fabrice Bellard
@item 2
447 5ee03c86 Fabrice Bellard
FF_ER_COMPLIANT
448 18bff752 Fabrice Bellard
@item 3
449
FF_ER_AGGRESSIVE
450
@item 4
451
FF_ER_VERY_AGGRESSIVE
452
@end table
453
454 5ee03c86 Fabrice Bellard
@item -ec bit_mask
455 4c5f7207 Diego Biurrun
Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
456 5ee03c86 Fabrice Bellard
the following values:
457 18bff752 Fabrice Bellard
@table @samp
458
@item 1
459 4c5f7207 Diego Biurrun
FF_EC_GUESS_MVS (default = enabled)
460 18bff752 Fabrice Bellard
@item 2
461 4c5f7207 Diego Biurrun
FF_EC_DEBLOCK (default = enabled)
462 18bff752 Fabrice Bellard
@end table
463
464
@item -bf frames
465 4c5f7207 Diego Biurrun
Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
466 18bff752 Fabrice Bellard
@item -mbd mode
467
macroblock decision
468
@table @samp
469
@item 0
470 4c5f7207 Diego Biurrun
FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
471 18bff752 Fabrice Bellard
@item 1
472 4c5f7207 Diego Biurrun
FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
473 18bff752 Fabrice Bellard
@item 2
474 019c8838 Diego Biurrun
FF_MB_DECISION_RD: rate distortion
475 18bff752 Fabrice Bellard
@end table
476
477
@item -4mv
478 4c5f7207 Diego Biurrun
Use four motion vector by macroblock (MPEG-4 only).
479 18bff752 Fabrice Bellard
@item -part
480 4c5f7207 Diego Biurrun
Use data partitioning (MPEG-4 only).
481 18bff752 Fabrice Bellard
@item -bug param
482 4c5f7207 Diego Biurrun
Work around encoder bugs that are not auto-detected.
483 18bff752 Fabrice Bellard
@item -strict strictness
484 4c5f7207 Diego Biurrun
How strictly to follow the standards.
485 5ee03c86 Fabrice Bellard
@item -aic
486 4c5f7207 Diego Biurrun
Enable Advanced intra coding (h263+).
487 5ee03c86 Fabrice Bellard
@item -umv
488 4c5f7207 Diego Biurrun
Enable Unlimited Motion Vector (h263+)
489 18bff752 Fabrice Bellard
490
@item -deinterlace
491 4c5f7207 Diego Biurrun
Deinterlace pictures.
492 3841e813 Benjamin Larsson
@item -ilme
493 4c5f7207 Diego Biurrun
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
494
Use this option if your input file is interlaced and you want
495
to keep the interlaced format for minimum losses.
496
The alternative is to deinterlace the input stream with
497
@option{-deinterlace}, but deinterlacing introduces losses.
498 18bff752 Fabrice Bellard
@item -psnr
499 4c5f7207 Diego Biurrun
Calculate PSNR of compressed frames.
500 18bff752 Fabrice Bellard
@item -vstats
501 4c5f7207 Diego Biurrun
Dump video coding statistics to @file{vstats_HHMMSS.log}.
502 18bff752 Fabrice Bellard
@item -vhook module
503 4c5f7207 Diego Biurrun
Insert video processing @var{module}. @var{module} contains the module
504 18bff752 Fabrice Bellard
name and its parameters separated by spaces.
505 4386f941 Diego Biurrun
@item -top n
506
top=1/bottom=0/auto=-1 field first
507
@item -dc precision
508
Intra_dc_precision.
509
@item -vtag fourcc/tag
510
Force video tag/fourcc.
511
@item -qphist
512
Show QP histogram.
513
@item -vbsf bitstream filter
514
Bitstream filters available are "dump_extra", "remove_extra", "noise".
515 18bff752 Fabrice Bellard
@end table
516
517
@section Audio Options
518
519
@table @option
520 4386f941 Diego Biurrun
@item -aframes number
521
Set the number of audio frames to record.
522 115329f1 Diego Biurrun
@item -ar freq
523 4c5f7207 Diego Biurrun
Set the audio sampling frequency (default = 44100 Hz).
524 115329f1 Diego Biurrun
@item -ab bitrate
525 4c5f7207 Diego Biurrun
Set the audio bitrate in kbit/s (default = 64).
526 18bff752 Fabrice Bellard
@item -ac channels
527 4c5f7207 Diego Biurrun
Set the number of audio channels (default = 1).
528 5ee03c86 Fabrice Bellard
@item -an
529 4c5f7207 Diego Biurrun
Disable audio recording.
530 5ee03c86 Fabrice Bellard
@item -acodec codec
531 4c5f7207 Diego Biurrun
Force audio codec to @var{codec}. Use the @code{copy} special value to
532
specify that the raw codec data must be copied as is.
533 de62a89d Víctor Paesa
@item -newaudio
534 18fd519f Diego Biurrun
Add a new audio track to the output file. If you want to specify parameters,
535
do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
536 de62a89d Víctor Paesa
537 18fd519f Diego Biurrun
Mapping will be done automatically, if the number of output streams is equal to
538
the number of input streams, else it will pick the first one that matches. You
539 de62a89d Víctor Paesa
can override the mapping using @code{-map} as usual.
540
541
Example:
542
@example
543
ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384 test.mpg -acodec mp2 -ab 192 -newaudio
544
@end example
545 4386f941 Diego Biurrun
@item -alang code
546
Set the ISO 639 language code (3 letters) of the current audio stream.
547
@end table
548
549
@section Advanced Audio options:
550
551
@table @option
552
@item -atag fourcc/tag
553
Force audio tag/fourcc.
554
@item -absf bitstream filter
555
Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
556
@end table
557
558
@section Subtitle options:
559
560
@table @option
561
@item -scodec codec
562
Force subtitle codec ('copy' to copy stream).
563
@item -newsubtitle
564
Add a new subtitle stream to the current output stream.
565
@item -slang code
566
Set the ISO 639 language code (3 letters) of the current subtitle stream.
567 18bff752 Fabrice Bellard
@end table
568
569
@section Audio/Video grab options
570
571
@table @option
572
@item -vd device
573 4c5f7207 Diego Biurrun
sEt video grab device (e.g. @file{/dev/video0}).
574 18bff752 Fabrice Bellard
@item -vc channel
575 4c5f7207 Diego Biurrun
Set video grab channel (DV1394 only).
576 18bff752 Fabrice Bellard
@item -tvstd standard
577 4c5f7207 Diego Biurrun
Set television standard (NTSC, PAL (SECAM)).
578 18bff752 Fabrice Bellard
@item -dv1394
579 4c5f7207 Diego Biurrun
Set DV1394 grab.
580 18bff752 Fabrice Bellard
@item -ad device
581 4c5f7207 Diego Biurrun
Set audio device (e.g. @file{/dev/dsp}).
582 4386f941 Diego Biurrun
@item -grab format
583
Request grabbing using.
584
@item -gd device
585
Set grab device.
586 18bff752 Fabrice Bellard
@end table
587
588
@section Advanced options
589
590
@table @option
591 e645a733 Benjamin Larsson
@item -map input stream id[:input stream id]
592
Set stream mapping from input streams to output streams.
593
Just enumerate the input streams in the order you want them in the output.
594
[input stream id] sets the (input) stream to sync against.
595 4386f941 Diego Biurrun
@item -map_meta_data outfile:infile
596
Set meta data information of outfile from infile.
597 18bff752 Fabrice Bellard
@item -debug
598 4c5f7207 Diego Biurrun
Print specific debug info.
599 115329f1 Diego Biurrun
@item -benchmark
600 4c5f7207 Diego Biurrun
Add timings for benchmarking.
601 4386f941 Diego Biurrun
@item -dump
602 4c5f7207 Diego Biurrun
Dump each input packet.
603 4386f941 Diego Biurrun
@item -hex
604
When dumping packets, also dump the payload.
605 18bff752 Fabrice Bellard
@item -bitexact
606 4c5f7207 Diego Biurrun
Only use bit exact algorithms (for codec testing).
607 18bff752 Fabrice Bellard
@item -ps size
608 4c5f7207 Diego Biurrun
Set packet size in bits.
609 5ee03c86 Fabrice Bellard
@item -re
610 4c5f7207 Diego Biurrun
Read input at native frame rate. Mainly used to simulate a grab device.
611 4386f941 Diego Biurrun
@item -loop_input
612 4c5f7207 Diego Biurrun
Loop over the input stream. Currently it works only for image
613
streams. This option is used for automatic FFserver testing.
614 8108551a Todd Kirby
@item -loop_output number_of_times
615 019c8838 Diego Biurrun
Repeatedly loop output for formats that support looping such as animated GIF
616 4c5f7207 Diego Biurrun
(0 will loop the output infinitely).
617 4386f941 Diego Biurrun
@item -threads count
618
Thread count.
619 c52e13f1 Benjamin Larsson
@item -vsync parameter
620 29c9183c Diego Biurrun
Video sync method. Video will be stretched/squeezed to match the timestamps,
621
it is done by duplicating and dropping frames. With -map you can select from
622
which stream the timestamps should be taken. You can leave either video or
623 c52e13f1 Benjamin Larsson
audio unchanged and sync the remaining stream(s) to the unchanged one.
624
@item -async samples_per_second
625 29c9183c Diego Biurrun
Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
626 c52e13f1 Benjamin Larsson
the parameter is the maximum samples per second by which the audio is changed.
627
-async 1 is a special case where only the start of the audio stream is corrected
628
without any later correction.
629 9181577c Fabrice Bellard
@end table
630 18bff752 Fabrice Bellard
631
@node FFmpeg formula evaluator
632
@section FFmpeg formula evaluator
633
634
When evaluating a rate control string, FFmpeg uses an internal formula
635 115329f1 Diego Biurrun
evaluator.
636 18bff752 Fabrice Bellard
637
The following binary operators are available: @code{+}, @code{-},
638
@code{*}, @code{/}, @code{^}.
639
640
The following unary operators are available: @code{+}, @code{-},
641
@code{(...)}.
642
643
The following functions are available:
644
@table @var
645
@item sinh(x)
646
@item cosh(x)
647
@item tanh(x)
648
@item sin(x)
649
@item cos(x)
650
@item tan(x)
651
@item exp(x)
652
@item log(x)
653
@item squish(x)
654
@item gauss(x)
655
@item abs(x)
656
@item max(x, y)
657
@item min(x, y)
658
@item gt(x, y)
659
@item lt(x, y)
660
@item eq(x, y)
661
@item bits2qp(bits)
662
@item qp2bits(qp)
663
@end table
664
665
The following constants are available:
666
@table @var
667
@item PI
668
@item E
669
@item iTex
670
@item pTex
671
@item tex
672
@item mv
673
@item fCode
674
@item iCount
675
@item mcVar
676
@item var
677
@item isI
678
@item isP
679
@item isB
680
@item avgQP
681
@item qComp
682
@item avgIITex
683
@item avgPITex
684
@item avgPPTex
685
@item avgBPTex
686
@item avgTex
687
@end table
688
689 e99c4e10 Fabrice Bellard
@c man end
690
691
@ignore
692
693
@setfilename ffmpeg
694
@settitle FFmpeg video converter
695
696
@c man begin SEEALSO
697 019c8838 Diego Biurrun
ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
698 e99c4e10 Fabrice Bellard
@c man end
699
700
@c man begin AUTHOR
701
Fabrice Bellard
702
@c man end
703
704
@end ignore
705 9181577c Fabrice Bellard
706
@section Protocols
707
708 4c5f7207 Diego Biurrun
The filename can be @file{-} to read from standard input or to write
709
to standard output.
710 9181577c Fabrice Bellard
711 4c5f7207 Diego Biurrun
FFmpeg also handles many protocols specified with an URL syntax.
712 9181577c Fabrice Bellard
713 4c5f7207 Diego Biurrun
Use 'ffmpeg -formats' to see a list of the supported protocols.
714 9181577c Fabrice Bellard
715 e99c4e10 Fabrice Bellard
The protocol @code{http:} is currently used only to communicate with
716 4c5f7207 Diego Biurrun
FFserver (see the FFserver documentation). When FFmpeg will be a
717 e99c4e10 Fabrice Bellard
video player it will also be used for streaming :-)
718 9181577c Fabrice Bellard
719
@chapter Tips
720
721
@itemize
722 4c5f7207 Diego Biurrun
@item For streaming at very low bitrate application, use a low frame rate
723
and a small GOP size. This is especially true for RealVideo where
724 e99c4e10 Fabrice Bellard
the Linux player does not seem to be very fast, so it can miss
725
frames. An example is:
726 9181577c Fabrice Bellard
727
@example
728 3c0ba870 Panagiotis Issaris
ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
729 9181577c Fabrice Bellard
@end example
730
731
@item  The parameter 'q' which is displayed while encoding is the current
732 4c5f7207 Diego Biurrun
quantizer. The value 1 indicates that a very good quality could
733
be achieved. The value 31 indicates the worst quality. If q=31 appears
734 e99c4e10 Fabrice Bellard
too often, it means that the encoder cannot compress enough to meet
735 4c5f7207 Diego Biurrun
your bitrate. You must either increase the bitrate, decrease the
736 e99c4e10 Fabrice Bellard
frame rate or decrease the frame size.
737 9181577c Fabrice Bellard
738
@item If your computer is not fast enough, you can speed up the
739 e99c4e10 Fabrice Bellard
compression at the expense of the compression ratio. You can use
740
'-me zero' to speed up motion estimation, and '-intra' to disable
741 4c5f7207 Diego Biurrun
motion estimation completely (you have only I-frames, which means it
742 e99c4e10 Fabrice Bellard
is about as good as JPEG compression).
743 9181577c Fabrice Bellard
744 4c5f7207 Diego Biurrun
@item To have very low audio bitrates, reduce the sampling frequency
745 019c8838 Diego Biurrun
(down to 22050 kHz for MPEG audio, 22050 or 11025 for AC3).
746 9181577c Fabrice Bellard
747
@item To have a constant quality (but a variable bitrate), use the option
748 e99c4e10 Fabrice Bellard
'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
749
quality).
750 9181577c Fabrice Bellard
751
@item When converting video files, you can use the '-sameq' option which
752 4c5f7207 Diego Biurrun
uses the same quality factor in the encoder as in the decoder.
753
It allows almost lossless encoding.
754 9181577c Fabrice Bellard
755
@end itemize
756
757
@chapter Supported File Formats and Codecs
758
759
You can use the @code{-formats} option to have an exhaustive list.
760
761
@section File Formats
762
763 6bf40f39 Philip Gladstone
FFmpeg supports the following file formats through the @code{libavformat}
764 0699d2fe Fabrice Bellard
library:
765 9181577c Fabrice Bellard
766 3fc9e78f Diego Biurrun
@multitable @columnfractions .4 .1 .1 .4
767 9181577c Fabrice Bellard
@item Supported File Format @tab Encoding @tab Decoding @tab Comments
768
@item MPEG audio @tab X @tab X
769 4c5f7207 Diego Biurrun
@item MPEG-1 systems @tab X  @tab  X
770 9181577c Fabrice Bellard
@tab muxed audio and video
771 4c5f7207 Diego Biurrun
@item MPEG-2 PS @tab X  @tab  X
772 9181577c Fabrice Bellard
@tab also known as @code{VOB} file
773 4c5f7207 Diego Biurrun
@item MPEG-2 TS @tab    @tab  X
774 9181577c Fabrice Bellard
@tab also known as DVB Transport Stream
775 115329f1 Diego Biurrun
@item ASF@tab X @tab X
776
@item AVI@tab X @tab X
777
@item WAV@tab X @tab X
778 9181577c Fabrice Bellard
@item Macromedia Flash@tab X @tab X
779 4c5f7207 Diego Biurrun
@tab Only embedded audio is decoded.
780 2eb5d024 Fabrice Bellard
@item FLV              @tab  X @tab X
781
@tab Macromedia Flash video files
782 115329f1 Diego Biurrun
@item Real Audio and Video @tab X @tab X
783
@item Raw AC3 @tab X  @tab  X
784
@item Raw MJPEG @tab X  @tab  X
785
@item Raw MPEG video @tab X  @tab  X
786
@item Raw PCM8/16 bits, mulaw/Alaw@tab X  @tab  X
787
@item Raw CRI ADX audio @tab X  @tab  X
788
@item Raw Shorten audio @tab    @tab  X
789
@item SUN AU format @tab X  @tab  X
790 7fe4c823 Alex Beregszaszi
@item NUT @tab X @tab X @tab NUT Open Container Format
791 115329f1 Diego Biurrun
@item QuickTime        @tab X @tab  X
792 4c5f7207 Diego Biurrun
@item MPEG-4           @tab X @tab  X
793
@tab MPEG-4 is a variant of QuickTime.
794 115329f1 Diego Biurrun
@item Raw MPEG4 video  @tab  X @tab  X
795 4fa1c4fa Roman Shaposhnik
@item DV               @tab  X @tab  X
796 701b603d Mike Melanson
@item 4xm              @tab    @tab X
797 4c5f7207 Diego Biurrun
@tab 4X Technologies format, used in some games.
798 4d3b1f8d Mike Melanson
@item Playstation STR  @tab    @tab X
799
@item Id RoQ           @tab    @tab X
800 4c5f7207 Diego Biurrun
@tab Used in Quake III, Jedi Knight 2, other computer games.
801 4d3b1f8d Mike Melanson
@item Interplay MVE    @tab    @tab X
802 4c5f7207 Diego Biurrun
@tab Format used in various Interplay computer games.
803 b17e9c99 Mike Melanson
@item WC3 Movie        @tab    @tab X
804 4c5f7207 Diego Biurrun
@tab Multimedia format used in Origin's Wing Commander III computer game.
805 2fdf638b Mike Melanson
@item Sega FILM/CPK    @tab    @tab X
806 4c5f7207 Diego Biurrun
@tab Used in many Sega Saturn console games.
807 2fdf638b Mike Melanson
@item Westwood Studios VQA/AUD  @tab    @tab X
808 4c5f7207 Diego Biurrun
@tab Multimedia formats used in Westwood Studios games.
809 4120a53a Mike Melanson
@item Id Cinematic (.cin) @tab    @tab X
810 4c5f7207 Diego Biurrun
@tab Used in Quake II.
811 42cad81a Mike Melanson
@item FLIC format      @tab    @tab X
812
@tab .fli/.flc files
813 da00f30e Mike Melanson
@item Sierra VMD       @tab    @tab X
814 4c5f7207 Diego Biurrun
@tab Used in Sierra CD-ROM games.
815 d08d7142 Mike Melanson
@item Sierra Online    @tab    @tab X
816 4c5f7207 Diego Biurrun
@tab .sol files used in Sierra Online games.
817 38088adf Mike Melanson
@item Matroska         @tab    @tab X
818 ad81a9fe Mike Melanson
@item Electronic Arts Multimedia    @tab    @tab X
819 4c5f7207 Diego Biurrun
@tab Used in various EA games; files have extensions like WVE and UV2.
820 353147ed Mike Melanson
@item Nullsoft Video (NSV) format @tab    @tab X
821 4accd1fd Måns Rullgård
@item ADTS AAC audio @tab X @tab X
822 ea395e8c Aurelien Jacobs
@item Creative VOC @tab X @tab X @tab Created for the Sound Blaster Pro.
823 4e114829 Mike Melanson
@item American Laser Games MM  @tab    @tab X
824
@tab Multimedia format used in games like Mad Dog McCree
825 26376701 Mike Melanson
@item AVS @tab    @tab X
826
@tab Multimedia format used by the Creature Shock game.
827 348efc18 Kostya Shishkov
@item Smacker @tab    @tab X
828
@tab Multimedia format used by many games.
829 d7a3a783 Baptiste Coudurier
@item GXF @tab  X @tab X
830
@tab General eXchange Format SMPTE 360M, used by Thomson Grass Valley playout servers.
831 dc56e0de Baptiste Coudurier
@item CIN @tab    @tab X
832
@tab Multimedia format used by Delphine Software games.
833 f3239539 Baptiste Coudurier
@item MXF @tab    @tab X
834
@tab Material eXchange Format SMPTE 377M, used by D-Cinema, broadcast industry.
835 29f86228 Baptiste Coudurier
@item SEQ @tab    @tab X
836
@tab Tiertex .seq files used in the DOS CDROM version of the game Flashback.
837 353147ed Mike Melanson
@end multitable
838 9181577c Fabrice Bellard
839 4c5f7207 Diego Biurrun
@code{X} means that encoding (resp. decoding) is supported.
840 9181577c Fabrice Bellard
841 0699d2fe Fabrice Bellard
@section Image Formats
842
843
FFmpeg can read and write images for each frame of a video sequence. The
844
following image formats are supported:
845
846 3fc9e78f Diego Biurrun
@multitable @columnfractions .4 .1 .1 .4
847 0699d2fe Fabrice Bellard
@item Supported Image Format @tab Encoding @tab Decoding @tab Comments
848 115329f1 Diego Biurrun
@item PGM, PPM     @tab X @tab X
849 4c5f7207 Diego Biurrun
@item PAM          @tab X @tab X @tab PAM is a PNM extension with alpha support.
850 2eb5d024 Fabrice Bellard
@item PGMYUV       @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
851 4c5f7207 Diego Biurrun
@item JPEG         @tab X @tab X @tab Progressive JPEG is not supported.
852
@item .Y.U.V       @tab X @tab X @tab one raw file per component
853
@item animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated.
854
@item PNG          @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet.
855 3689cf16 Kostya Shishkov
@item Targa        @tab   @tab X @tab Targa (.TGA) image format.
856 a991b1fe Kostya Shishkov
@item TIFF         @tab   @tab X @tab Only 24 bit/pixel images are supported.
857 6a91ec51 Mike Melanson
@item SGI          @tab X @tab X @tab SGI RGB image format
858 0699d2fe Fabrice Bellard
@end multitable
859
860 4c5f7207 Diego Biurrun
@code{X} means that encoding (resp. decoding) is supported.
861 0699d2fe Fabrice Bellard
862 9181577c Fabrice Bellard
@section Video Codecs
863
864 3fc9e78f Diego Biurrun
@multitable @columnfractions .4 .1 .1 .4
865 9181577c Fabrice Bellard
@item Supported Codec @tab Encoding @tab Decoding @tab Comments
866 4c5f7207 Diego Biurrun
@item MPEG-1 video           @tab  X  @tab  X
867
@item MPEG-2 video           @tab  X  @tab  X
868 2bc5da7b Michael Niedermayer
@item MPEG-4                 @tab  X  @tab  X
869 9181577c Fabrice Bellard
@item MSMPEG4 V1             @tab  X  @tab  X
870
@item MSMPEG4 V2             @tab  X  @tab  X
871 2bc5da7b Michael Niedermayer
@item MSMPEG4 V3             @tab  X  @tab  X
872 9181577c Fabrice Bellard
@item WMV7                   @tab  X  @tab  X
873 4c5f7207 Diego Biurrun
@item WMV8                   @tab  X  @tab  X @tab not completely working
874 17a21f3c Diego Biurrun
@item WMV9                   @tab     @tab  X @tab not completely working
875
@item VC1                    @tab     @tab  X
876 b06b45c4 Mike Melanson
@item H.261                  @tab  X  @tab  X
877 4c5f7207 Diego Biurrun
@item H.263(+)               @tab  X  @tab  X @tab also known as RealVideo 1.0
878 b06b45c4 Mike Melanson
@item H.264                  @tab     @tab  X
879 e839a994 Diego Biurrun
@item RealVideo 1.0          @tab  X  @tab  X
880
@item RealVideo 2.0          @tab  X  @tab  X
881 115329f1 Diego Biurrun
@item MJPEG                  @tab  X  @tab  X
882 4c5f7207 Diego Biurrun
@item lossless MJPEG         @tab  X  @tab  X
883 26d6d032 Benjamin Larsson
@item JPEG-LS                @tab  X  @tab  X @tab fourcc: MJLS, lossless and near-lossless is supported
884 d6896c49 Alex Beregszaszi
@item Apple MJPEG-B          @tab     @tab  X
885
@item Sunplus MJPEG          @tab     @tab  X @tab fourcc: SP5X
886 115329f1 Diego Biurrun
@item DV                     @tab  X  @tab  X
887 4c5f7207 Diego Biurrun
@item HuffYUV                @tab  X  @tab  X
888
@item FFmpeg Video 1         @tab  X  @tab  X @tab experimental lossless codec (fourcc: FFV1)
889
@item FFmpeg Snow            @tab  X  @tab  X @tab experimental wavelet codec (fourcc: SNOW)
890 701b603d Mike Melanson
@item Asus v1                @tab  X  @tab  X @tab fourcc: ASV1
891 4d3b1f8d Mike Melanson
@item Asus v2                @tab  X  @tab  X @tab fourcc: ASV2
892 701b603d Mike Melanson
@item Creative YUV           @tab     @tab  X @tab fourcc: CYUV
893 d2bfadc0 Mike Melanson
@item Sorenson Video 1       @tab  X  @tab  X @tab fourcc: SVQ1
894 701b603d Mike Melanson
@item Sorenson Video 3       @tab     @tab  X @tab fourcc: SVQ3
895
@item On2 VP3                @tab     @tab  X @tab still experimental
896 5ce117c3 Aurelien Jacobs
@item On2 VP5                @tab     @tab  X @tab fourcc: VP50
897
@item On2 VP6                @tab     @tab  X @tab fourcc: VP62
898 d6896c49 Alex Beregszaszi
@item Theora                 @tab     @tab  X @tab still experimental
899 cdb2c1ca Sebastian Jedruszkiewicz
@item Intel Indeo 3          @tab     @tab  X
900 9303d49c Alex Beregszaszi
@item FLV                    @tab  X  @tab  X @tab Sorenson H.263 used in Flash
901 0919e788 Benjamin Larsson
@item Flash Screen Video     @tab     @tab  X @tab fourcc: FSV1
902 4d3b1f8d Mike Melanson
@item ATI VCR1               @tab     @tab  X @tab fourcc: VCR1
903 7fe4c823 Alex Beregszaszi
@item ATI VCR2               @tab     @tab  X @tab fourcc: VCR2
904 4d3b1f8d Mike Melanson
@item Cirrus Logic AccuPak   @tab     @tab  X @tab fourcc: CLJR
905 4c5f7207 Diego Biurrun
@item 4X Video               @tab     @tab  X @tab Used in certain computer games.
906 115329f1 Diego Biurrun
@item Sony Playstation MDEC  @tab     @tab  X
907 4c5f7207 Diego Biurrun
@item Id RoQ                 @tab     @tab  X @tab Used in Quake III, Jedi Knight 2, other computer games.
908
@item Xan/WC3                @tab     @tab  X @tab Used in Wing Commander III .MVE files.
909
@item Interplay Video        @tab     @tab  X @tab Used in Interplay .MVE files.
910 070ed1bc Mike Melanson
@item Apple Animation        @tab     @tab  X @tab fourcc: 'rle '
911 42cad81a Mike Melanson
@item Apple Graphics         @tab     @tab  X @tab fourcc: 'smc '
912 2fdf638b Mike Melanson
@item Apple Video            @tab     @tab  X @tab fourcc: rpza
913 d08d7142 Mike Melanson
@item Apple QuickDraw        @tab     @tab  X @tab fourcc: qdrw
914 2fdf638b Mike Melanson
@item Cinepak                @tab     @tab  X
915
@item Microsoft RLE          @tab     @tab  X
916
@item Microsoft Video-1      @tab     @tab  X
917 4120a53a Mike Melanson
@item Westwood VQA           @tab     @tab  X
918 4c5f7207 Diego Biurrun
@item Id Cinematic Video     @tab     @tab  X @tab Used in Quake II.
919 1dc1ed99 Roberto Togni
@item Planar RGB             @tab     @tab  X @tab fourcc: 8BPS
920 42cad81a Mike Melanson
@item FLIC video             @tab     @tab  X
921 9a4117d5 Mike Melanson
@item Duck TrueMotion v1     @tab     @tab  X @tab fourcc: DUCK
922 dce76c20 Mike Melanson
@item Duck TrueMotion v2     @tab     @tab  X @tab fourcc: TM20
923 4c5f7207 Diego Biurrun
@item VMD Video              @tab     @tab  X @tab Used in Sierra VMD files.
924 a273bbfb Roberto Togni
@item MSZH                   @tab     @tab  X @tab Part of LCL
925
@item ZLIB                   @tab  X  @tab  X @tab Part of LCL, encoder experimental
926 9d53d58e Mike Melanson
@item TechSmith Camtasia     @tab     @tab  X @tab fourcc: TSCC
927 d0a0bbd2 Mike Melanson
@item IBM Ultimotion         @tab     @tab  X @tab fourcc: ULTI
928 ab711b3c Mike Melanson
@item Miro VideoXL           @tab     @tab  X @tab fourcc: VIXL
929 acfd8f0f Mike Melanson
@item QPEG                   @tab     @tab  X @tab fourccs: QPEG, Q1.0, Q1.1
930 115329f1 Diego Biurrun
@item LOCO                   @tab     @tab  X @tab
931
@item Winnov WNV1            @tab     @tab  X @tab
932 589f8220 Mike Melanson
@item Autodesk Animator Studio Codec  @tab     @tab  X @tab fourcc: AASC
933 115329f1 Diego Biurrun
@item Fraps FPS1             @tab     @tab  X @tab
934 2b6c1d80 Diego Biurrun
@item CamStudio              @tab     @tab  X @tab fourcc: CSCD
935 4e114829 Mike Melanson
@item American Laser Games Video  @tab    @tab X @tab Used in games like Mad Dog McCree
936 9c8d8e84 Mike Melanson
@item ZMBV                   @tab     @tab  X @tab
937 26376701 Mike Melanson
@item AVS Video              @tab     @tab  X @tab Video encoding used by the Creature Shock game.
938 348efc18 Kostya Shishkov
@item Smacker Video          @tab     @tab  X @tab Video encoding used in Smacker.
939 dfca23e3 Reimar Döffinger
@item RTjpeg                 @tab     @tab  X @tab Video encoding used in NuppelVideo files.
940 fd7b1991 Kostya Shishkov
@item KMVC                   @tab     @tab  X @tab Codec used in Worms games.
941 eb57c889 Kostya Shishkov
@item VMware Video           @tab     @tab  X @tab Codec used in videos captured by VMware.
942 dc56e0de Baptiste Coudurier
@item Cin Video              @tab     @tab  X @tab Codec used in Delphine Software games.
943 29f86228 Baptiste Coudurier
@item Tiertex Seq Video      @tab     @tab  X @tab Codec used in DOS CDROM FlashBack game.
944 9181577c Fabrice Bellard
@end multitable
945
946 4c5f7207 Diego Biurrun
@code{X} means that encoding (resp. decoding) is supported.
947 9181577c Fabrice Bellard
948
@section Audio Codecs
949
950
@multitable @columnfractions .4 .1 .1 .1 .7
951
@item Supported Codec @tab Encoding @tab Decoding @tab Comments
952 115329f1 Diego Biurrun
@item MPEG audio layer 2     @tab  IX  @tab  IX
953 9181577c Fabrice Bellard
@item MPEG audio layer 1/3   @tab IX   @tab  IX
954 4c5f7207 Diego Biurrun
@tab MP3 encoding is supported through the external library LAME.
955 37776c3b Benjamin Larsson
@item AC3                    @tab  IX  @tab  IX
956 4c5f7207 Diego Biurrun
@tab liba52 is used internally for decoding.
957 34d7008d Philip Gladstone
@item Vorbis                 @tab  X   @tab  X
958 4745b5bf Fabrice Bellard
@item WMA V1/V2              @tab      @tab X
959 f6fa7a6c Benjamin Larsson
@item AAC                    @tab X    @tab X
960 4c5f7207 Diego Biurrun
@tab Supported through the external library libfaac/libfaad.
961 d4c3c5a6 Michael Niedermayer
@item Microsoft ADPCM        @tab X    @tab X
962 4d3b1f8d Mike Melanson
@item MS IMA ADPCM           @tab X    @tab X
963
@item QT IMA ADPCM           @tab      @tab X
964
@item 4X IMA ADPCM           @tab      @tab X
965 d4e437df Roman Shaposhnik
@item G.726  ADPCM           @tab X    @tab X
966 b17e9c99 Mike Melanson
@item Duck DK3 IMA ADPCM     @tab      @tab X
967 4c5f7207 Diego Biurrun
@tab Used in some Sega Saturn console games.
968 b17e9c99 Mike Melanson
@item Duck DK4 IMA ADPCM     @tab      @tab X
969 4c5f7207 Diego Biurrun
@tab Used in some Sega Saturn console games.
970 2fdf638b Mike Melanson
@item Westwood Studios IMA ADPCM @tab      @tab X
971 4c5f7207 Diego Biurrun
@tab Used in Westwood Studios games like Command and Conquer.
972 7d8379f2 Mike Melanson
@item SMJPEG IMA ADPCM       @tab      @tab X
973 4c5f7207 Diego Biurrun
@tab Used in certain Loki game ports.
974 42cad81a Mike Melanson
@item CD-ROM XA ADPCM        @tab      @tab X
975
@item CRI ADX ADPCM          @tab X    @tab X
976 4c5f7207 Diego Biurrun
@tab Used in Sega Dreamcast games.
977 7d8379f2 Mike Melanson
@item Electronic Arts ADPCM  @tab      @tab X
978 4c5f7207 Diego Biurrun
@tab Used in various EA titles.
979 b3bfb299 Mike Melanson
@item Creative ADPCM         @tab      @tab X
980 2433f24f Aurelien Jacobs
@tab 16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
981 2eb5d024 Fabrice Bellard
@item RA144                  @tab      @tab X
982
@tab Real 14400 bit/s codec
983
@item RA288                  @tab      @tab X
984
@tab Real 28800 bit/s codec
985 37776c3b Benjamin Larsson
@item RADnet                 @tab X    @tab IX
986 4c5f7207 Diego Biurrun
@tab Real low bitrate AC3 codec, liba52 is used for decoding.
987 2eb5d024 Fabrice Bellard
@item AMR-NB                 @tab X    @tab X
988 4c5f7207 Diego Biurrun
@tab Supported through an external library.
989 d663a1fd Michael Niedermayer
@item AMR-WB                 @tab X    @tab X
990 4c5f7207 Diego Biurrun
@tab Supported through an external library.
991 2eb5d024 Fabrice Bellard
@item DV audio               @tab      @tab X
992 4d3b1f8d Mike Melanson
@item Id RoQ DPCM            @tab      @tab X
993 4c5f7207 Diego Biurrun
@tab Used in Quake III, Jedi Knight 2, other computer games.
994 4d3b1f8d Mike Melanson
@item Interplay MVE DPCM     @tab      @tab X
995 4c5f7207 Diego Biurrun
@tab Used in various Interplay computer games.
996 b17e9c99 Mike Melanson
@item Xan DPCM               @tab      @tab X
997 4c5f7207 Diego Biurrun
@tab Used in Origin's Wing Commander IV AVI files.
998 d08d7142 Mike Melanson
@item Sierra Online DPCM     @tab      @tab X
999 4c5f7207 Diego Biurrun
@tab Used in Sierra Online game audio files.
1000 d6896c49 Alex Beregszaszi
@item Apple MACE 3           @tab      @tab X
1001
@item Apple MACE 6           @tab      @tab X
1002 13dfd2b9 Mike Melanson
@item FLAC lossless audio    @tab      @tab X
1003
@item Shorten lossless audio @tab      @tab X
1004 f770ee03 Mike Melanson
@item Apple lossless audio   @tab      @tab X
1005
@tab QuickTime fourcc 'alac'
1006 33a4d8b1 Alex Beregszaszi
@item FFmpeg Sonic           @tab X    @tab X
1007 4c5f7207 Diego Biurrun
@tab experimental lossy/lossless codec
1008 d9b1c197 Roberto Togni
@item Qdesign QDM2           @tab      @tab X
1009
@tab there are still some distortions
1010 440e7988 Roberto Togni
@item Real COOK              @tab      @tab X
1011
@tab All versions except 5.1 are supported
1012 e839a994 Diego Biurrun
@item DSP Group TrueSpeech   @tab      @tab X
1013 3dc411c0 Alex Beregszaszi
@item True Audio (TTA)       @tab      @tab X
1014 348efc18 Kostya Shishkov
@item Smacker Audio          @tab      @tab X
1015 730581f3 Kostya Shishkov
@item WavPack Audio          @tab      @tab X
1016 dc56e0de Baptiste Coudurier
@item Cin Audio              @tab      @tab X
1017
@tab Codec used in Delphine Software games.
1018 84ed36da Kostya Shishkov
@item Intel Music Coder      @tab      @tab X
1019 9181577c Fabrice Bellard
@end multitable
1020
1021 4c5f7207 Diego Biurrun
@code{X} means that encoding (resp. decoding) is supported.
1022 9181577c Fabrice Bellard
1023 4c5f7207 Diego Biurrun
@code{I} means that an integer-only version is available, too (ensures high
1024
performance on systems without hardware floating point support).
1025 9181577c Fabrice Bellard
1026 47d944d2 Fabrice Bellard
@chapter Platform Specific information
1027
1028
@section Linux
1029
1030 4c5f7207 Diego Biurrun
FFmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
1031
preferred compiler now for FFmpeg. All future optimizations will depend on
1032 47d944d2 Fabrice Bellard
features only found in GCC 3.2.
1033
1034
@section BSD
1035
1036 21d1cb12 Diego Biurrun
BSD make will not build FFmpeg, you need to install and use GNU Make
1037
(@file{gmake}).
1038
1039 47d944d2 Fabrice Bellard
@section Windows
1040
1041 b030b284 Fabrice Bellard
@subsection Native Windows compilation
1042
1043
@itemize
1044
@item Install the current versions of MSYS and MinGW from
1045
@url{http://www.mingw.org/}. You can find detailed installation
1046
instructions in the download section and the FAQ.
1047
1048 4c5f7207 Diego Biurrun
@item If you want to test the FFplay, also download
1049 50f52fcd Fabrice Bellard
the MinGW development library of SDL 1.2.x
1050
(@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
1051 4c5f7207 Diego Biurrun
@url{http://www.libsdl.org}. Unpack it in a temporary directory, and
1052 50f52fcd Fabrice Bellard
unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
1053 988a9f9e Fabrice Bellard
directory. Edit the @file{sdl-config} script so that it gives the
1054
correct SDL directory when invoked.
1055 50f52fcd Fabrice Bellard
1056 e926e391 Diego Biurrun
@item Extract the current version of FFmpeg.
1057 115329f1 Diego Biurrun
1058 b030b284 Fabrice Bellard
@item Start the MSYS shell (file @file{msys.bat}).
1059
1060 4c5f7207 Diego Biurrun
@item Change to the FFmpeg directory and follow
1061
 the instructions of how to compile FFmpeg (file
1062 50f52fcd Fabrice Bellard
@file{INSTALL}). Usually, launching @file{./configure} and @file{make}
1063
suffices. If you have problems using SDL, verify that
1064
@file{sdl-config} can be launched from the MSYS command line.
1065
1066 4c5f7207 Diego Biurrun
@item You can install FFmpeg in @file{Program Files/FFmpeg} by typing
1067
@file{make install}. Don't forget to copy @file{SDL.dll} to the place
1068
you launch @file{ffplay} from.
1069 50f52fcd Fabrice Bellard
1070 b030b284 Fabrice Bellard
@end itemize
1071
1072 115329f1 Diego Biurrun
Notes:
1073 988a9f9e Fabrice Bellard
@itemize
1074 50f52fcd Fabrice Bellard
1075 988a9f9e Fabrice Bellard
@item The target @file{make wininstaller} can be used to create a
1076
Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
1077 4c5f7207 Diego Biurrun
must be copied to the FFmpeg directory in order to build the
1078 988a9f9e Fabrice Bellard
installer.
1079
1080 4c5f7207 Diego Biurrun
@item By using @code{./configure --enable-shared} when configuring FFmpeg,
1081 988a9f9e Fabrice Bellard
you can build @file{avcodec.dll} and @file{avformat.dll}. With
1082
@code{make install} you install the FFmpeg DLLs and the associated
1083 115329f1 Diego Biurrun
headers in @file{Program Files/FFmpeg}.
1084 988a9f9e Fabrice Bellard
1085 4c5f7207 Diego Biurrun
@item Visual C++ compatibility: If you used @code{./configure --enable-shared}
1086
when configuring FFmpeg, FFmpeg tries to use the Microsoft Visual
1087 988a9f9e Fabrice Bellard
C++ @code{lib} tool to build @code{avcodec.lib} and
1088 4c5f7207 Diego Biurrun
@code{avformat.lib}. With these libraries you can link your Visual C++
1089 be0efc0c Martin Boehme
code directly with the FFmpeg DLLs (see below).
1090 988a9f9e Fabrice Bellard
1091
@end itemize
1092 b030b284 Fabrice Bellard
1093 be0efc0c Martin Boehme
@subsection Visual C++ compatibility
1094
1095
FFmpeg will not compile under Visual C++ -- and it has too many
1096
dependencies on the GCC compiler to make a port viable. However,
1097
if you want to use the FFmpeg libraries in your own applications,
1098
you can still compile those applications using Visual C++. An
1099
important restriction to this is that you have to use the
1100
dynamically linked versions of the FFmpeg libraries (i.e. the
1101
DLLs), and you have to make sure that Visual-C++-compatible
1102
import libraries are created during the FFmpeg build process.
1103
1104
This description of how to use the FFmpeg libraries with Visual C++ is
1105
based on Visual C++ 2005 Express Edition Beta 2. If you have a different
1106
version, you might have to modify the procedures slightly.
1107
1108
Here are the step-by-step instructions for building the FFmpeg libraries
1109
so they can be used with Visual C++:
1110
1111
@enumerate
1112
1113
@item Install Visual C++ (if you haven't done so already).
1114
1115
@item Install MinGW and MSYS as described above.
1116
1117
@item Add a call to @file{vcvars32.bat} (which sets up the environment
1118
variables for the Visual C++ tools) as the first line of
1119
@file{msys.bat}. The standard location for @file{vcvars32.bat} is
1120
@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat},
1121
and the standard location for @file{msys.bat} is
1122
@file{C:\msys\1.0\msys.bat}. If this corresponds to your setup, add the
1123
following line as the first line of @file{msys.bat}:
1124
1125
@code{call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"}
1126
1127
@item Start the MSYS shell (file @file{msys.bat}) and type @code{link.exe}.
1128
If you get a help message with the command line options of @code{link.exe},
1129
this means your environment variables are set up correctly, the
1130
Microsoft linker is on the path and will be used by FFmpeg to
1131
create Visual-C++-compatible import libraries.
1132
1133 e926e391 Diego Biurrun
@item Extract the current version of FFmpeg and change to the FFmpeg directory.
1134 be0efc0c Martin Boehme
1135
@item Type the command
1136 51d8321d Diego Biurrun
@code{./configure --enable-shared --disable-static --enable-memalign-hack}
1137
to configure and, if that didn't produce any errors,
1138
type @code{make} to build FFmpeg.
1139 be0efc0c Martin Boehme
1140
@item The subdirectories @file{libavformat}, @file{libavcodec}, and
1141
@file{libavutil} should now contain the files @file{avformat.dll},
1142
@file{avformat.lib}, @file{avcodec.dll}, @file{avcodec.lib},
1143
@file{avutil.dll}, and @file{avutil.lib}, respectively. Copy the three
1144
DLLs to your System32 directory (typically @file{C:\Windows\System32}).
1145
1146
@end enumerate
1147
1148
And here is how to use these libraries with Visual C++:
1149
1150
@enumerate
1151
1152
@item Create a new console application ("File / New / Project") and then
1153
select "Win32 Console Application". On the appropriate page of the
1154
Application Wizard, uncheck the "Precompiled headers" option.
1155
1156
@item Write the source code for your application, or, for testing, just
1157
copy the code from an existing sample application into the source file
1158
that Visual C++ has already created for you. (Note that your source
1159
filehas to have a @code{.cpp} extension; otherwise, Visual C++ won't
1160
compile the FFmpeg headers correctly because in C mode, it doesn't
1161
recognize the @code{inline} keyword.)  For example, you can copy
1162
@file{output_example.c} from the FFmpeg distribution (but you will
1163
have to make minor modifications so the code will compile under
1164
C++, see below).
1165
1166
@item Open the "Project / Properties" dialog box. In the "Configuration"
1167
combo box, select "All Configurations" so that the changes you make will
1168
affect both debug and release builds. In the tree view on the left hand
1169
side, select "C/C++ / General", then edit the "Additional Include
1170
Directories" setting to contain the complete paths to the
1171
@file{libavformat}, @file{libavcodec}, and @file{libavutil}
1172
subdirectories of your FFmpeg directory. Note that the directories have
1173
to be separated using semicolons. Now select "Linker / General" from the
1174
tree view and edit the "Additional Library Directories" setting to
1175
contain the same three directories.
1176
1177
@item Still in the "Project / Properties" dialog box, select "Linker / Input"
1178
from the tree view, then add the files @file{avformat.lib},
1179
@file{avcodec.lib}, and @file{avutil.lib} to the end of the "Additional
1180
Dependencies". Note that the names of the libraries have to be separated
1181
using spaces.
1182
1183 765c3440 Fredrik Orderud
@item Now, select "C/C++ / Code Generation" from the tree view. Select
1184 be0efc0c Martin Boehme
"Debug" in the "Configuration" combo box. Make sure that "Runtime
1185
Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in
1186
the "Configuration" combo box and make sure that "Runtime Library" is
1187
set to "Multi-threaded DLL".
1188
1189
@item Click "OK" to close the "Project / Properties" dialog box and build
1190
the application. Hopefully, it should compile and run cleanly. If you
1191
used @file{output_example.c} as your sample application, you will get a
1192
few compiler errors, but they are easy to fix. The first type of error
1193
occurs because Visual C++ doesn't allow an @code{int} to be converted to
1194
an @code{enum} without a cast. To solve the problem, insert the required
1195
casts (this error occurs once for a @code{CodecID} and once for a
1196
@code{CodecType}).  The second type of error occurs because C++ requires
1197
the return value of @code{malloc} to be cast to the exact type of the
1198
pointer it is being assigned to. Visual C++ will complain that, for
1199
example, @code{(void *)} is being assigned to @code{(uint8_t *)} without
1200
an explicit cast. So insert an explicit cast in these places to silence
1201
the compiler. The third type of error occurs because the @code{snprintf}
1202
library function is called @code{_snprintf} under Visual C++.  So just
1203
add an underscore to fix the problem. With these changes,
1204
@file{output_example.c} should compile under Visual C++, and the
1205
resulting executable should produce valid video files.
1206
1207
@end enumerate
1208
1209 b030b284 Fabrice Bellard
@subsection Cross compilation for Windows with Linux
1210
1211
You must use the MinGW cross compilation tools available at
1212
@url{http://www.mingw.org/}.
1213
1214 4c5f7207 Diego Biurrun
Then configure FFmpeg with the following options:
1215 b030b284 Fabrice Bellard
@example
1216
./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
1217
@end example
1218 019c8838 Diego Biurrun
(you can change the cross-prefix according to the prefix chosen for the
1219 b030b284 Fabrice Bellard
MinGW tools).
1220
1221 4c5f7207 Diego Biurrun
Then you can easily test FFmpeg with Wine
1222 b030b284 Fabrice Bellard
(@url{http://www.winehq.com/}).
1223
1224 30aee296 Diego Biurrun
@subsection Compilation under Cygwin
1225
1226
Cygwin works very much like Unix.
1227
1228
Just install your Cygwin with all the "Base" packages, plus the
1229
following "Devel" ones:
1230
@example
1231
binutils, gcc-core, make, subversion
1232
@end example
1233
1234
Do not install binutils-20060709-1 (they are buggy on shared builds);
1235
use binutils-20050610-1 instead.
1236
1237
Then run
1238
1239
@example
1240
./configure --enable-static --disable-shared
1241
@end example
1242
1243
to make a static build or
1244
1245
@example
1246
./configure --enable-shared --disable-static
1247
@end example
1248
1249
to build shared libraries.
1250
1251
If you want to build FFmpeg with additional libraries, download Cygwin
1252
"Devel" packages for Ogg and Vorbis from any Cygwin packages repository
1253
and/or SDL, xvid, faac, faad2 packages from Cygwin Ports,
1254
(@url{http://cygwinports.dotsrc.org/}).
1255
1256
@subsection Crosscompilation for Windows under Cygwin
1257
1258
With Cygwin you can create Windows binaries that don't need the cygwin1.dll.
1259
1260
Just install your Cygwin as explained before, plus these additional
1261
"Devel" packages:
1262
@example
1263
gcc-mingw-core, mingw-runtime, mingw-zlib
1264
@end example
1265
1266
and add some special flags to your configure invocation.
1267
1268
For a static build run
1269
@example
1270
./configure --enable-mingw32 --enable-memalign-hack --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
1271
@end example
1272
1273
and for a build with shared libraries
1274
@example
1275
./configure --enable-mingw32 --enable-memalign-hack --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
1276
@end example
1277
1278 019c8838 Diego Biurrun
@section Mac OS X
1279 47d944d2 Fabrice Bellard
1280
@section BeOS
1281
1282
The configure script should guess the configuration itself.
1283
Networking support is currently not finished.
1284
errno issues fixed by Andrew Bachmann.
1285
1286
Old stuff:
1287
1288 7dd611c9 François Revol
François Revol - revol at free dot fr - April 2002
1289 47d944d2 Fabrice Bellard
1290 115329f1 Diego Biurrun
The configure script should guess the configuration itself,
1291 4c5f7207 Diego Biurrun
however I still didn't test building on the net_server version of BeOS.
1292 47d944d2 Fabrice Bellard
1293 4c5f7207 Diego Biurrun
FFserver is broken (needs poll() implementation).
1294 47d944d2 Fabrice Bellard
1295 4c5f7207 Diego Biurrun
There are still issues with errno codes, which are negative in BeOS, and
1296 115329f1 Diego Biurrun
that FFmpeg negates when returning. This ends up turning errors into
1297 47d944d2 Fabrice Bellard
valid results, then crashes.
1298
(To be fixed)
1299
1300 34d7008d Philip Gladstone
@chapter Developers Guide
1301 9181577c Fabrice Bellard
1302
@section API
1303 a0b72f90 Diego Biurrun
@itemize @bullet
1304 9181577c Fabrice Bellard
@item libavcodec is the library containing the codecs (both encoding and
1305 4c5f7207 Diego Biurrun
decoding). Look at @file{libavcodec/apiexample.c} to see how to use it.
1306 9181577c Fabrice Bellard
1307 4c5f7207 Diego Biurrun
@item libavformat is the library containing the file format handling (mux and
1308
demux code for several formats). Look at @file{ffplay.c} to use it in a
1309 a93b9dba Fabrice Bellard
player. See @file{output_example.c} to use it to generate audio or video
1310
streams.
1311
1312 9181577c Fabrice Bellard
@end itemize
1313
1314
@section Integrating libavcodec or libavformat in your program
1315
1316
You can integrate all the source code of the libraries to link them
1317
statically to avoid any version problem. All you need is to provide a
1318
'config.mak' and a 'config.h' in the parent directory. See the defines
1319
generated by ./configure to understand what is needed.
1320
1321
You can use libavcodec or libavformat in your commercial program, but
1322
@emph{any patch you make must be published}. The best way to proceed is
1323 4c5f7207 Diego Biurrun
to send your patches to the FFmpeg mailing list.
1324 9181577c Fabrice Bellard
1325 80d1c272 Michael Niedermayer
@node Coding Rules
1326 9181577c Fabrice Bellard
@section Coding Rules
1327
1328 4c5f7207 Diego Biurrun
FFmpeg is programmed in the ISO C90 language with a few additional
1329 cb6e87c1 Falk Hüffner
features from ISO C99, namely:
1330
@itemize @bullet
1331
@item
1332
the @samp{inline} keyword;
1333
@item
1334
@samp{//} comments;
1335
@item
1336
designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
1337
@item
1338 114afa9c Diego Biurrun
compound literals (@samp{x = (struct s) @{ 17, 23 @};})
1339 cb6e87c1 Falk Hüffner
@end itemize
1340
1341
These features are supported by all compilers we care about, so we won't
1342
accept patches to remove their use unless they absolutely don't impair
1343
clarity and performance.
1344
1345 4c5f7207 Diego Biurrun
All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg also
1346 cb6e87c1 Falk Hüffner
compiles with several other compilers, such as the Compaq ccc compiler
1347
or Sun Studio 9, and we would like to keep it that way unless it would
1348
be exceedingly involved. To ensure compatibility, please don't use any
1349 4c5f7207 Diego Biurrun
additional C99 features or GCC extensions. Especially watch out for:
1350 cb6e87c1 Falk Hüffner
@itemize @bullet
1351
@item
1352
mixing statements and declarations;
1353
@item
1354
@samp{long long} (use @samp{int64_t} instead);
1355
@item
1356
@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
1357
@item
1358 019c8838 Diego Biurrun
GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
1359 cb6e87c1 Falk Hüffner
@end itemize
1360 9181577c Fabrice Bellard
1361 53862e0f Diego Biurrun
Indent size is 4.
1362 b86e38a0 Aurelien Jacobs
The presentation is the one specified by 'indent -i4 -kr -nut'.
1363 53862e0f Diego Biurrun
The TAB character is forbidden outside of Makefiles as is any
1364
form of trailing whitespace. Commits containing either will be
1365 1c1b5a40 Diego Biurrun
rejected by the Subversion repository.
1366 9181577c Fabrice Bellard
1367 4c5f7207 Diego Biurrun
Main priority in FFmpeg is simplicity and small code size (=less
1368 9181577c Fabrice Bellard
bugs).
1369
1370 4c5f7207 Diego Biurrun
Comments: Use the JavaDoc/Doxygen
1371
format (see examples below) so that code documentation
1372
can be generated automatically. All nontrivial functions should have a comment
1373
above them explaining what the function does, even if it's just one sentence.
1374
All structures and their member variables should be documented, too.
1375 f4888b83 Michael Niedermayer
@example
1376
/**
1377 2185824b Måns Rullgård
 * @@file mpeg.c
1378
 * MPEG codec.
1379
 * @@author ...
1380
 */
1381 f4888b83 Michael Niedermayer
1382
/**
1383 2185824b Måns Rullgård
 * Summary sentence.
1384
 * more text ...
1385
 * ...
1386
 */
1387 114afa9c Diego Biurrun
typedef struct Foobar@{
1388 2185824b Måns Rullgård
    int var1; /**< var1 description */
1389
    int var2; ///< var2 description
1390
    /** var3 description */
1391
    int var3;
1392 114afa9c Diego Biurrun
@} Foobar;
1393 f4888b83 Michael Niedermayer
1394
/**
1395 2185824b Måns Rullgård
 * Summary sentence.
1396
 * more text ...
1397
 * ...
1398
 * @@param my_parameter description of my_parameter
1399
 * @@return return value description
1400
 */
1401 f4888b83 Michael Niedermayer
int myfunc(int my_parameter)
1402
...
1403
@end example
1404 9181577c Fabrice Bellard
1405 115329f1 Diego Biurrun
fprintf and printf are forbidden in libavformat and libavcodec,
1406 36d9b4e8 Michael Niedermayer
please use av_log() instead.
1407
1408 1c1b5a40 Diego Biurrun
@section Development Policy
1409 7a57b90c Michael Niedermayer
1410
@enumerate
1411 115329f1 Diego Biurrun
@item
1412 7a57b90c Michael Niedermayer
   You must not commit code which breaks FFmpeg! (Meaning unfinished but
1413 4c5f7207 Diego Biurrun
   enabled code which breaks compilation or compiles but does not work or
1414 7a57b90c Michael Niedermayer
   breaks the regression tests)
1415
   You can commit unfinished stuff (for testing etc), but it must be disabled
1416
   (#ifdef etc) by default so it does not interfere with other developers'
1417
   work.
1418 115329f1 Diego Biurrun
@item
1419 7a57b90c Michael Niedermayer
   You don't have to over-test things. If it works for you, and you think it
1420 4c5f7207 Diego Biurrun
   should work for others, then commit. If your code has problems
1421
   (portability, triggers compiler bugs, unusual environment etc) they will be
1422 7a57b90c Michael Niedermayer
   reported and eventually fixed.
1423 115329f1 Diego Biurrun
@item
1424 7a57b90c Michael Niedermayer
   Do not commit unrelated changes together, split them into self-contained
1425
   pieces.
1426
@item
1427
   Do not change behavior of the program (renaming options etc) without
1428 019c8838 Diego Biurrun
   first discussing it on the ffmpeg-devel mailing list. Do not remove
1429 7a57b90c Michael Niedermayer
   functionality from the code. Just improve!
1430 115329f1 Diego Biurrun
1431 4c5f7207 Diego Biurrun
   Note: Redundant code can be removed.
1432 7a57b90c Michael Niedermayer
@item
1433
   Do not commit changes to the build system (Makefiles, configure script)
1434 019c8838 Diego Biurrun
   which change behavior, defaults etc, without asking first. The same
1435 7a57b90c Michael Niedermayer
   applies to compiler warning fixes, trivial looking fixes and to code
1436
   maintained by other developers. We usually have a reason for doing things
1437 019c8838 Diego Biurrun
   the way we do. Send your changes as patches to the ffmpeg-devel mailing
1438 7a57b90c Michael Niedermayer
   list, and if the code maintainers say OK, you may commit. This does not
1439
   apply to files you wrote and/or maintain.
1440
@item
1441
   We refuse source indentation and other cosmetic changes if they are mixed
1442
   with functional changes, such commits will be rejected and removed. Every
1443
   developer has his own indentation style, you should not change it. Of course
1444
   if you (re)write something, you can use your own style, even though we would
1445 4c5f7207 Diego Biurrun
   prefer if the indentation throughout FFmpeg was consistent (Many projects
1446
   force a given indentation style - we don't.). If you really need to make
1447 7a57b90c Michael Niedermayer
   indentation changes (try to avoid this), separate them strictly from real
1448
   changes.
1449
1450 114afa9c Diego Biurrun
   NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
1451 115329f1 Diego Biurrun
   then either do NOT change the indentation of the inner part within (don't
1452 019c8838 Diego Biurrun
   move it to the right)! or do so in a separate commit
1453 7a57b90c Michael Niedermayer
@item
1454
   Always fill out the commit log message. Describe in a few lines what you
1455
   changed and why. You can refer to mailing list postings if you fix a
1456
   particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
1457
@item
1458
   If you apply a patch by someone else, include the name and email address in
1459 1c1b5a40 Diego Biurrun
   the log message. Since the ffmpeg-cvslog mailing list is publicly
1460 019c8838 Diego Biurrun
   archived you should add some SPAM protection to the email address. Send an
1461
   answer to ffmpeg-devel (or wherever you got the patch from) saying that
1462 7a57b90c Michael Niedermayer
   you applied the patch.
1463
@item
1464 5ab0f204 Diego Biurrun
    Do NOT commit to code actively maintained by others without permission.
1465
    Send a patch to ffmpeg-devel instead. If noone answers within a reasonable
1466
    timeframe (12h for build failures and security fixes, 3 days small changes,
1467
    1 week for big patches) then commit your patch if you think it's OK.
1468
    Also note, the maintainer can simply ask for more time to review!
1469 7a57b90c Michael Niedermayer
@item
1470 1c1b5a40 Diego Biurrun
    Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
1471 7a57b90c Michael Niedermayer
    are sent there and reviewed by all the other developers. Bugs and possible
1472
    improvements or general questions regarding commits are discussed there. We
1473
    expect you to react if problems with your code are uncovered.
1474
@item
1475
    Update the documentation if you change behavior or add features. If you are
1476 019c8838 Diego Biurrun
    unsure how best to do this, send a patch to ffmpeg-devel, the documentation
1477 7a57b90c Michael Niedermayer
    maintainer(s) will review and commit your stuff.
1478
@item
1479 4c5f7207 Diego Biurrun
    Never write to unallocated memory, never write over the end of arrays,
1480
    always check values read from some untrusted source before using them
1481
    as array index or other risky things.
1482 76bec1d8 Alexander Strasser
@item
1483
    Remember to check if you need to bump versions for the specific libav
1484 f0efbde7 Diego Biurrun
    parts (libavutil, libavcodec, libavformat) you are changing. You need
1485 76bec1d8 Alexander Strasser
    to change the version integer and the version string.
1486
    Incrementing the first component means no backward compatibility to
1487 a940b428 Michael Niedermayer
    previous versions (e.g. removal of a function from the public API).
1488 76bec1d8 Alexander Strasser
    Incrementing the second component means backward compatible change
1489 a940b428 Michael Niedermayer
    (e.g. addition of a function to the public API).
1490 76bec1d8 Alexander Strasser
    Incrementing the third component means a noteworthy binary compatible
1491
    change (e.g. encoder bug fix that matters for the decoder).
1492 ebd32fd7 Diego Biurrun
@item
1493 3f1965c4 Diego Biurrun
    If you add a new codec, remember to update the changelog, add it to
1494
    the supported codecs table in the documentation and bump the second
1495
    component of the @file{libavcodec} version number appropriately. If
1496
    it has a fourcc, add it to @file{libavformat/avienc.c}, even if it
1497
    is only a decoder.
1498 114afa9c Diego Biurrun
@end enumerate
1499 7a57b90c Michael Niedermayer
1500
We think our rules are not too hard. If you have comments, contact us.
1501
1502
Note, these rules are mostly borrowed from the MPlayer project.
1503
1504 9181577c Fabrice Bellard
@section Submitting patches
1505
1506 80d1c272 Michael Niedermayer
First, (@pxref{Coding Rules}) above if you didn't yet.
1507
1508 6a6810b1 Michael Niedermayer
When you submit your patch, try to send a unified diff (diff '-up'
1509 9181577c Fabrice Bellard
option). I cannot read other diffs :-)
1510
1511 6e5c1877 Michael Niedermayer
Also please do not submit patches which contain several unrelated changes.
1512 115329f1 Diego Biurrun
Split them into individual self-contained patches; this makes reviewing
1513 7885603a Michael Niedermayer
them much easier.
1514
1515 9181577c Fabrice Bellard
Run the regression tests before submitting a patch so that you can
1516 6bf40f39 Philip Gladstone
verify that there are no big problems.
1517 9181577c Fabrice Bellard
1518
Patches should be posted as base64 encoded attachments (or any other
1519 4c5f7207 Diego Biurrun
encoding which ensures that the patch won't be trashed during
1520 115329f1 Diego Biurrun
transmission) to the ffmpeg-devel mailing list, see
1521 2b165e29 Diego Biurrun
@url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel}
1522 9181577c Fabrice Bellard
1523 54fcf429 Michael Niedermayer
It also helps quite a bit if you tell us what the patch does (for example
1524 4c5f7207 Diego Biurrun
'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant
1525 54fcf429 Michael Niedermayer
and has no lrint()')
1526
1527 4c5f7207 Diego Biurrun
We reply to all submitted patches and either apply or reject with some
1528
explanation why, but sometimes we are quite busy so it can take a week or two.
1529 cf7f2b16 Michael Niedermayer
1530 9181577c Fabrice Bellard
@section Regression tests
1531
1532 1c1b5a40 Diego Biurrun
Before submitting a patch (or committing to the repository), you should at least
1533 9181577c Fabrice Bellard
test that you did not break anything.
1534
1535 4c5f7207 Diego Biurrun
The regression tests build a synthetic video stream and a synthetic
1536
audio stream. These are then encoded and decoded with all codecs or
1537 9181577c Fabrice Bellard
formats. The CRC (or MD5) of each generated file is recorded in a
1538 4c5f7207 Diego Biurrun
result file. A 'diff' is launched to compare the reference results and
1539 9181577c Fabrice Bellard
the result file.
1540
1541 4c5f7207 Diego Biurrun
The regression tests then go on to test the FFserver code with a
1542 6bf40f39 Philip Gladstone
limited set of streams. It is important that this step runs correctly
1543
as well.
1544
1545 36d9b4e8 Michael Niedermayer
Run 'make test' to test all the codecs and formats.
1546 9181577c Fabrice Bellard
1547 4c5f7207 Diego Biurrun
Run 'make fulltest' to test all the codecs, formats and FFserver.
1548 9181577c Fabrice Bellard
1549 4c5f7207 Diego Biurrun
[Of course, some patches may change the results of the regression tests. In
1550
this case, the reference results of the regression tests shall be modified
1551 9181577c Fabrice Bellard
accordingly].
1552
1553
@bye