Statistics
| Branch: | Revision:

ffmpeg / doc / ffmpeg-doc.texi @ 7a57b90c

History | View | Annotate | Download (37.6 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
  
16
The command line interface is designed to be intuitive, in the sense
17
that ffmpeg tries to figure out all the parameters, when
18
possible. You have usually to give only the target bitrate you want.
19
20
FFmpeg can also convert from any sample rate to any other, and resize
21
video on the fly with a high quality polyphase filter.
22
23
@chapter Quick Start
24
25 e99c4e10 Fabrice Bellard
@c man begin EXAMPLES
26 9181577c Fabrice Bellard
@section Video and Audio grabbing
27
28 e99c4e10 Fabrice Bellard
FFmpeg can use a video4linux compatible video source and any Open Sound
29
System audio source:
30
31 9181577c Fabrice Bellard
@example
32 e99c4e10 Fabrice Bellard
ffmpeg /tmp/out.mpg 
33 9181577c Fabrice Bellard
@end example
34
35 e99c4e10 Fabrice Bellard
Note that you must activate the right video source and channel before
36
launching ffmpeg. You can use any TV viewer such as xawtv
37
(@url{http://bytesex.org/xawtv/}) by Gerd Knorr which I find very
38
good. You must also set correctly the audio recording levels with a
39
standard mixer.
40 9181577c Fabrice Bellard
41 6bf40f39 Philip Gladstone
@section Video and Audio file format conversion
42 9181577c Fabrice Bellard
43
* ffmpeg can use any supported file format and protocol as input: 
44
45
Examples:
46
47
* You can input from YUV files:
48
49
@example
50 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/test%d.Y /tmp/out.mpg 
51 9181577c Fabrice Bellard
@end example
52
53 e99c4e10 Fabrice Bellard
It will use the files: 
54 9181577c Fabrice Bellard
@example
55 e99c4e10 Fabrice Bellard
/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
56
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
57 9181577c Fabrice Bellard
@end example
58
59 e99c4e10 Fabrice Bellard
The Y files use twice the resolution of the U and V files. They are
60
raw files, without header. They can be generated by all decent video
61
decoders. You must specify the size of the image with the @option{-s} option
62
if ffmpeg cannot guess it.
63 9181577c Fabrice Bellard
64
* You can input from a RAW YUV420P file:
65
66
@example
67 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/test.yuv /tmp/out.avi
68 9181577c Fabrice Bellard
@end example
69
70 e99c4e10 Fabrice Bellard
The RAW YUV420P is a file containing RAW YUV planar, for each frame first
71
come the Y plane followed by U and V planes, which are half vertical and
72
horizontal resolution.
73 9181577c Fabrice Bellard
74
* You can output to a RAW YUV420P file:
75
76
@example
77 e99c4e10 Fabrice Bellard
ffmpeg -i mydivx.avi -o hugefile.yuv
78 9181577c Fabrice Bellard
@end example
79
80
* You can set several input files and output files:
81
82
@example
83 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
84 9181577c Fabrice Bellard
@end example
85
86 e99c4e10 Fabrice Bellard
Convert the audio file a.wav and the raw yuv video file a.yuv
87
to mpeg file a.mpg
88 9181577c Fabrice Bellard
89 6bf40f39 Philip Gladstone
* You can also do audio and video conversions at the same time:
90 9181577c Fabrice Bellard
91
@example
92 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
93 9181577c Fabrice Bellard
@end example
94
95 e99c4e10 Fabrice Bellard
Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
96 9181577c Fabrice Bellard
97
* You can encode to several formats at the same time and define a
98 e99c4e10 Fabrice Bellard
mapping from input stream to output streams:
99 9181577c Fabrice Bellard
100
@example
101 e99c4e10 Fabrice Bellard
ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
102 9181577c Fabrice Bellard
@end example
103
104 e99c4e10 Fabrice Bellard
Convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. '-map
105
file:index' specify which input stream is used for each output
106
stream, in the order of the definition of output streams.
107 9181577c Fabrice Bellard
108
* You can transcode decrypted VOBs
109
110
@example
111 e99c4e10 Fabrice Bellard
ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
112 9181577c Fabrice Bellard
@end example
113
114 e99c4e10 Fabrice Bellard
This is a typical DVD ripper example, input from a VOB file, output
115
to an AVI file with MPEG-4 video and MP3 audio, note that in this
116
command we use B frames so the MPEG-4 stream is DivX5 compatible, GOP
117
size is 300 that means an INTRA frame every 10 seconds for 29.97 fps
118
input video.  Also the audio stream is MP3 encoded so you need LAME
119
support which is enabled using @code{--enable-mp3lame} when
120
configuring.  The mapping is particularly useful for DVD transcoding
121
to get the desired audio language.
122 9181577c Fabrice Bellard
123 e99c4e10 Fabrice Bellard
NOTE: to see the supported input formats, use @code{ffmpeg -formats}.
124
@c man end
125 9181577c Fabrice Bellard
126
@chapter Invocation
127
128
@section Syntax
129
130 e99c4e10 Fabrice Bellard
The generic syntax is:
131 9181577c Fabrice Bellard
132
@example 
133 e99c4e10 Fabrice Bellard
@c man begin SYNOPSIS
134 28f88dc8 Michael Niedermayer
ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
135 e99c4e10 Fabrice Bellard
@c man end
136 9181577c Fabrice Bellard
@end example
137 e99c4e10 Fabrice Bellard
@c man begin DESCRIPTION
138
If no input file is given, audio/video grabbing is done.
139 9181577c Fabrice Bellard
140 e99c4e10 Fabrice Bellard
As a general rule, options are applied to the next specified
141
file. For example, if you give the @option{-b 64} option, it sets the video
142
bitrate of the next file. Format option may be needed for raw input
143
files.
144 9181577c Fabrice Bellard
145 e99c4e10 Fabrice Bellard
By default, ffmpeg tries to convert as losslessly as possible: it
146
uses the same audio and video parameter for the outputs as the one
147
specified for the inputs.
148
@c man end
149 9181577c Fabrice Bellard
150 e99c4e10 Fabrice Bellard
@c man begin OPTIONS
151 9181577c Fabrice Bellard
@section Main options
152
153 e99c4e10 Fabrice Bellard
@table @option
154 9181577c Fabrice Bellard
@item -L
155
show license
156 18bff752 Fabrice Bellard
157 9181577c Fabrice Bellard
@item -h
158 e99c4e10 Fabrice Bellard
show help
159 18bff752 Fabrice Bellard
160 e99c4e10 Fabrice Bellard
@item -formats
161 9181577c Fabrice Bellard
show available formats, codecs, protocols, ...
162 18bff752 Fabrice Bellard
163 9181577c Fabrice Bellard
@item -f fmt              
164
force format
165 18bff752 Fabrice Bellard
166 9181577c Fabrice Bellard
@item -i filename         
167
input file name
168
169
@item -y                  
170
overwrite output files
171
172
@item -t duration         
173
set the recording time in seconds. @code{hh:mm:ss[.xxx]} syntax is also
174
supported.
175
176 e83a84ac Benjamin Larsson
@item -ss position
177
seek to given time position. @code{hh:mm:ss[.xxx]} syntax is also
178
supported.
179
180 9181577c Fabrice Bellard
@item -title string       
181
set the title
182
183
@item -author string      
184
set the author
185
186
@item -copyright string   
187
set the copyright
188
189
@item -comment string     
190
set the comment
191
192 99db6420 Fabrice Bellard
@item -target type
193 791d8d1d Michel Bardiaux
specify target file type ("vcd", "svcd", "dvd", "pal-vcd", "ntsc-svcd", ... ). All the format
194 99db6420 Fabrice Bellard
options (bitrate, codecs, buffer sizes) are automatically set by this
195
option. You can just type:
196
197
@example
198
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
199
@end example
200
201 791d8d1d Michel Bardiaux
Nevertheless you can specify additional options as long as you know they do not compromise the
202
standard, as in:
203
204
@example
205
ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
206
@end example
207
208 99db6420 Fabrice Bellard
@item -hq
209 18bff752 Fabrice Bellard
activate high quality settings
210
211 401fbdde Michael Niedermayer
@item -itsoffset offset
212
set the input time offset in seconds. @code{[-]hh:mm:ss[.xxx]} syntax
213
is also supported.  This option affects all the input files that
214
follow it.  The offset is added to the input files' timestamps;
215
specifying a positive offset means that the corresponding streams are
216
delayed by 'offset' seconds.
217
218 9181577c Fabrice Bellard
@end table
219
220
@section Video Options
221
222 e99c4e10 Fabrice Bellard
@table @option
223 9181577c Fabrice Bellard
@item -b bitrate
224 18bff752 Fabrice Bellard
set the video bitrate in kbit/s (default = 200 kb/s)
225
@item -r fps           
226
set frame rate (default = 25)
227
@item -s size             
228 5ee03c86 Fabrice Bellard
set frame size. The format is @samp{WxH} (default 160x128).  The
229
following abbreviations are recognized:
230
@table @samp
231 18bff752 Fabrice Bellard
@item sqcif
232
128x96
233
@item qcif
234
176x144
235
@item cif
236
352x288
237
@item 4cif
238
704x576
239
@end table
240
241
@item -aspect aspect
242
set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
243
@item -croptop size
244
set top crop band size (in pixels)
245
@item -cropbottom size
246
set bottom crop band size (in pixels)
247
@item -cropleft size
248
set left crop band size (in pixels)
249
@item -cropright size
250
set right crop band size (in pixels)
251 1ff93ffc Todd Kirby
@item -padtop size
252
set top pad band size (in pixels)
253
@item -padbottom size
254
set bottom pad band size (in pixels)
255
@item -padleft size
256
set left pad band size (in pixels)
257
@item -padright size
258
set right pad band size (in pixels)
259 5b79a73e Todd Kirby
@item -padcolor (hex color)
260
set color of padded bands. The value for pad color is expressed 
261 1ff93ffc Todd Kirby
as a six digit hexidecimal number where the first two digits represent red, 
262
middle two digits green and last two digits blue. Defaults to 000000 (black)
263 9181577c Fabrice Bellard
@item -vn
264 18bff752 Fabrice Bellard
disable video recording
265 9181577c Fabrice Bellard
@item -bt tolerance       
266
set video bitrate tolerance (in kbit/s)
267 18bff752 Fabrice Bellard
@item -maxrate bitrate
268
set max video bitrate tolerance (in kbit/s)
269
@item -minrate bitrate
270
set min video bitrate tolerance (in kbit/s)
271
@item -bufsize size
272
set ratecontrol buffere size (in kbit)
273
@item -vcodec codec       
274 5ee03c86 Fabrice Bellard
force video codec to @var{codec}. Use the @code{copy} special value to
275
tell that the raw codec data must be copied as is.
276 18bff752 Fabrice Bellard
@item -sameq
277 9181577c Fabrice Bellard
use same video quality as source (implies VBR)
278
279
@item -pass n  
280 5ee03c86 Fabrice Bellard
select the pass number (1 or 2). It is useful to do two pass
281
encoding. The statistics of the video are recorded in the first pass and
282
the video at the exact requested bit rate is generated in the second
283
pass.
284 9181577c Fabrice Bellard
285
@item -passlogfile file   
286 5ee03c86 Fabrice Bellard
select two pass log file name to @var{file}.
287 9181577c Fabrice Bellard
288
@end table
289
290 18bff752 Fabrice Bellard
@section Advanced Video Options
291 9181577c Fabrice Bellard
292 e99c4e10 Fabrice Bellard
@table @option
293 9181577c Fabrice Bellard
@item -g gop_size         
294
set the group of picture size
295
@item -intra              
296
use only intra frames
297
@item -qscale q           
298
use fixed video quantiser scale (VBR)
299
@item -qmin q             
300
min video quantiser scale (VBR)
301
@item -qmax q             
302
max video quantiser scale (VBR)
303
@item -qdiff q            
304
max difference between the quantiser scale (VBR)
305
@item -qblur blur         
306
video quantiser scale blur (VBR)
307
@item -qcomp compression  
308
video quantiser scale compression (VBR)
309 18bff752 Fabrice Bellard
310
@item -rc_init_cplx complexity
311
initial complexity for 1-pass encoding
312
@item -b_qfactor factor
313
qp factor between p and b frames
314
@item -i_qfactor factor
315
qp factor between p and i frames
316
@item -b_qoffset offset
317
qp offset between p and b frames
318
@item -i_qoffset offset
319
qp offset between p and i frames
320
@item -rc_eq equation
321 5ee03c86 Fabrice Bellard
set rate control equation (@pxref{FFmpeg formula
322
evaluator}). Default is @code{tex^qComp}.
323
@item -rc_override override
324
rate control override for specific intervals
325 18bff752 Fabrice Bellard
@item -me method
326 5ee03c86 Fabrice Bellard
set motion estimation method to @var{method}. Available methods are
327
(from lower to best quality):
328 18bff752 Fabrice Bellard
@table @samp
329
@item zero
330 5ee03c86 Fabrice Bellard
Try just the (0, 0) vector.
331 18bff752 Fabrice Bellard
@item phods
332
@item log
333
@item x1
334
@item epzs
335
(default method)
336
@item full
337
exhaustive search (slow and marginally better than epzs)
338
@end table
339
340
@item -dct_algo algo
341 5ee03c86 Fabrice Bellard
set dct algorithm to @var{algo}. Available values are:
342 18bff752 Fabrice Bellard
@table @samp
343
@item 0
344
FF_DCT_AUTO (default)
345
@item 1
346
FF_DCT_FASTINT
347
@item 2
348
FF_DCT_INT
349
@item 3
350
FF_DCT_MMX
351
@item 4
352
FF_DCT_MLIB
353
@item 5
354
FF_DCT_ALTIVEC
355
@end table
356
357
@item -idct_algo algo
358 5ee03c86 Fabrice Bellard
set idct algorithm to @var{algo}. Available values are:
359 18bff752 Fabrice Bellard
@table @samp
360
@item 0
361
FF_IDCT_AUTO (default)
362
@item 1
363
FF_IDCT_INT          
364
@item 2
365
FF_IDCT_SIMPLE       
366
@item 3
367
FF_IDCT_SIMPLEMMX    
368
@item 4
369
FF_IDCT_LIBMPEG2MMX  
370
@item 5
371
FF_IDCT_PS2          
372
@item 6
373
FF_IDCT_MLIB         
374
@item 7
375
FF_IDCT_ARM          
376
@item 8
377
FF_IDCT_ALTIVEC      
378
@item 9
379
FF_IDCT_SH4          
380
@item 10
381
FF_IDCT_SIMPLEARM    
382
@end table
383
384
@item -er n
385 5ee03c86 Fabrice Bellard
set error resilience to @var{n}.
386 18bff752 Fabrice Bellard
@table @samp
387
@item 1 
388 5ee03c86 Fabrice Bellard
FF_ER_CAREFULL (default)
389 18bff752 Fabrice Bellard
@item 2
390 5ee03c86 Fabrice Bellard
FF_ER_COMPLIANT
391 18bff752 Fabrice Bellard
@item 3
392
FF_ER_AGGRESSIVE
393
@item 4
394
FF_ER_VERY_AGGRESSIVE
395
@end table
396
397 5ee03c86 Fabrice Bellard
@item -ec bit_mask
398
set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
399
the following values:
400 18bff752 Fabrice Bellard
@table @samp
401
@item 1
402 5ee03c86 Fabrice Bellard
FF_EC_GUESS_MVS (default=enabled)
403 18bff752 Fabrice Bellard
@item 2
404 5ee03c86 Fabrice Bellard
FF_EC_DEBLOCK (default=enabled)
405 18bff752 Fabrice Bellard
@end table
406
407
@item -bf frames
408 50f52fcd Fabrice Bellard
use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
409 18bff752 Fabrice Bellard
@item -mbd mode
410
macroblock decision
411
@table @samp
412
@item 0
413
FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
414
@item 1
415
FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
416
@item 2
417
FF_MB_DECISION_RD: rate distoration
418
@end table
419
420
@item -4mv
421 9181577c Fabrice Bellard
use four motion vector by macroblock (only MPEG-4)
422 18bff752 Fabrice Bellard
@item -part
423
use data partitioning (only MPEG-4)
424
@item -bug param
425
workaround not auto detected encoder bugs
426
@item -strict strictness
427
how strictly to follow the standarts
428 5ee03c86 Fabrice Bellard
@item -aic
429
enable Advanced intra coding (h263+)
430
@item -umv
431
enable Unlimited Motion Vector (h263+)
432 18bff752 Fabrice Bellard
433
@item -deinterlace
434
deinterlace pictures
435 99db6420 Fabrice Bellard
@item -interlace
436
force interlacing support in encoder (only MPEG-2 and MPEG-4). Use this option
437
if your input file is interlaced and if you want to keep the interlaced
438
format for minimum losses. The alternative is to deinterlace the input
439
stream with @option{-deinterlace}, but deinterlacing introduces more
440
losses.
441 18bff752 Fabrice Bellard
@item -psnr
442
calculate PSNR of compressed frames
443
@item -vstats
444 5ee03c86 Fabrice Bellard
dump video coding statistics to @file{vstats_HHMMSS.log}.
445 18bff752 Fabrice Bellard
@item -vhook module
446
insert video processing @var{module}. @var{module} contains the module
447
name and its parameters separated by spaces.
448
@end table
449
450
@section Audio Options
451
452
@table @option
453
@item -ar freq    
454 5ee03c86 Fabrice Bellard
set the audio sampling freq (default = 44100 Hz)
455 18bff752 Fabrice Bellard
@item -ab bitrate 
456 5ee03c86 Fabrice Bellard
set the audio bitrate in kbit/s (default = 64)
457 18bff752 Fabrice Bellard
@item -ac channels
458 5ee03c86 Fabrice Bellard
set the number of audio channels (default = 1)
459
@item -an
460
disable audio recording
461
@item -acodec codec
462
force audio codec to @var{codec}. Use the @code{copy} special value to
463
tell that the raw codec data must be copied as is.
464 18bff752 Fabrice Bellard
@end table
465
466
@section Audio/Video grab options
467
468
@table @option
469
@item -vd device
470
set video grab device (e.g. @file{/dev/video0})
471
@item -vc channel
472
set video grab channel (DV1394 only)
473
@item -tvstd standard
474
set television standard (NTSC, PAL (SECAM))
475
@item -dv1394
476
set DV1394 grab
477
@item -ad device
478
set audio device (e.g. @file{/dev/dsp})
479
@end table
480
481
@section Advanced options
482
483
@table @option
484
@item -map file:stream    
485
set input stream mapping
486
@item -debug
487
print specific debug info
488 9181577c Fabrice Bellard
@item -benchmark          
489
add timings for benchmarking
490
@item -hex                
491
dump each input packet
492 18bff752 Fabrice Bellard
@item -bitexact
493
only use bit exact algorithms (for codec testing)
494
@item -ps size
495
set packet size in bits
496 5ee03c86 Fabrice Bellard
@item -re
497
read input at native frame rate. Mainly used to simulate a grab device.
498
@item -loop
499
loop over the input stream. Currently it works only for image
500
streams. This option is used for ffserver automatic testing.
501 9181577c Fabrice Bellard
@end table
502 18bff752 Fabrice Bellard
503
@node FFmpeg formula evaluator
504
@section FFmpeg formula evaluator
505
506
When evaluating a rate control string, FFmpeg uses an internal formula
507
evaluator. 
508
509
The following binary operators are available: @code{+}, @code{-},
510
@code{*}, @code{/}, @code{^}.
511
512
The following unary operators are available: @code{+}, @code{-},
513
@code{(...)}.
514
515
The following functions are available:
516
@table @var
517
@item sinh(x)
518
@item cosh(x)
519
@item tanh(x)
520
@item sin(x)
521
@item cos(x)
522
@item tan(x)
523
@item exp(x)
524
@item log(x)
525
@item squish(x)
526
@item gauss(x)
527
@item abs(x)
528
@item max(x, y)
529
@item min(x, y)
530
@item gt(x, y)
531
@item lt(x, y)
532
@item eq(x, y)
533
@item bits2qp(bits)
534
@item qp2bits(qp)
535
@end table
536
537
The following constants are available:
538
@table @var
539
@item PI
540
@item E
541
@item iTex
542
@item pTex
543
@item tex
544
@item mv
545
@item fCode
546
@item iCount
547
@item mcVar
548
@item var
549
@item isI
550
@item isP
551
@item isB
552
@item avgQP
553
@item qComp
554
@item avgIITex
555
@item avgPITex
556
@item avgPPTex
557
@item avgBPTex
558
@item avgTex
559
@end table
560
561 e99c4e10 Fabrice Bellard
@c man end
562
563
@ignore
564
565
@setfilename ffmpeg
566
@settitle FFmpeg video converter
567
568
@c man begin SEEALSO
569
ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
570
@c man end
571
572
@c man begin AUTHOR
573
Fabrice Bellard
574
@c man end
575
576
@end ignore
577 9181577c Fabrice Bellard
578
@section Protocols
579
580 47d944d2 Fabrice Bellard
The filename can be @file{-} to read from the standard input or to write
581
to the standard output.
582 9181577c Fabrice Bellard
583
ffmpeg handles also many protocols specified with the URL syntax.
584
585 e99c4e10 Fabrice Bellard
Use 'ffmpeg -formats' to have a list of the supported protocols.
586 9181577c Fabrice Bellard
587 e99c4e10 Fabrice Bellard
The protocol @code{http:} is currently used only to communicate with
588
ffserver (see the ffserver documentation). When ffmpeg will be a
589
video player it will also be used for streaming :-)
590 9181577c Fabrice Bellard
591
@chapter Tips
592
593
@itemize
594
@item For streaming at very low bit rate application, use a low frame rate
595 e99c4e10 Fabrice Bellard
and a small gop size. This is especially true for real video where
596
the Linux player does not seem to be very fast, so it can miss
597
frames. An example is:
598 9181577c Fabrice Bellard
599
@example
600 e99c4e10 Fabrice Bellard
ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
601 9181577c Fabrice Bellard
@end example
602
603
@item  The parameter 'q' which is displayed while encoding is the current
604 e99c4e10 Fabrice Bellard
quantizer. The value of 1 indicates that a very good quality could
605
be achieved. The value of 31 indicates the worst quality. If q=31
606
too often, it means that the encoder cannot compress enough to meet
607
your bit rate. You must either increase the bit rate, decrease the
608
frame rate or decrease the frame size.
609 9181577c Fabrice Bellard
610
@item If your computer is not fast enough, you can speed up the
611 e99c4e10 Fabrice Bellard
compression at the expense of the compression ratio. You can use
612
'-me zero' to speed up motion estimation, and '-intra' to disable
613
completely motion estimation (you have only I frames, which means it
614
is about as good as JPEG compression).
615 9181577c Fabrice Bellard
616
@item To have very low bitrates in audio, reduce the sampling frequency
617 e99c4e10 Fabrice Bellard
(down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
618 9181577c Fabrice Bellard
619
@item To have a constant quality (but a variable bitrate), use the option
620 e99c4e10 Fabrice Bellard
'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
621
quality).
622 9181577c Fabrice Bellard
623
@item When converting video files, you can use the '-sameq' option which
624 e99c4e10 Fabrice Bellard
uses in the encoder the same quality factor than in the decoder. It
625
allows to be almost lossless in encoding.
626 9181577c Fabrice Bellard
627
@end itemize
628
629
@chapter Supported File Formats and Codecs
630
631
You can use the @code{-formats} option to have an exhaustive list.
632
633
@section File Formats
634
635 6bf40f39 Philip Gladstone
FFmpeg supports the following file formats through the @code{libavformat}
636 0699d2fe Fabrice Bellard
library:
637 9181577c Fabrice Bellard
638
@multitable @columnfractions .4 .1 .1
639
@item Supported File Format @tab Encoding @tab Decoding @tab Comments
640
@item MPEG audio @tab X @tab X
641
@item MPEG1 systems @tab X  @tab  X 
642
@tab muxed audio and video
643
@item MPEG2 PS @tab X  @tab  X 
644
@tab also known as @code{VOB} file
645
@item MPEG2 TS @tab    @tab  X 
646
@tab also known as DVB Transport Stream
647
@item ASF@tab X @tab X 
648
@item AVI@tab X @tab X 
649
@item WAV@tab X @tab X 
650
@item Macromedia Flash@tab X @tab X
651
@tab Only embedded audio is decoded
652 2eb5d024 Fabrice Bellard
@item FLV              @tab  X @tab X
653
@tab Macromedia Flash video files
654 9181577c Fabrice Bellard
@item Real Audio and Video @tab X @tab X 
655
@item Raw AC3 @tab X  @tab  X 
656
@item Raw MJPEG @tab X  @tab  X 
657
@item Raw MPEG video @tab X  @tab  X 
658
@item Raw PCM8/16 bits, mulaw/Alaw@tab X  @tab  X 
659 42cad81a Mike Melanson
@item Raw CRI ADX audio @tab X  @tab  X 
660 9181577c Fabrice Bellard
@item SUN AU format @tab X  @tab  X 
661 7fe4c823 Alex Beregszaszi
@item NUT @tab X @tab X @tab NUT Open Container Format
662 8a5483e7 Mike Melanson
@item Quicktime        @tab X @tab  X 
663
@item MPEG4            @tab X @tab  X 
664 9181577c Fabrice Bellard
@tab MPEG4 is a variant of Quicktime
665 0699d2fe Fabrice Bellard
@item Raw MPEG4 video  @tab  X @tab  X 
666 4fa1c4fa Roman Shaposhnik
@item DV               @tab  X @tab  X
667 701b603d Mike Melanson
@item 4xm              @tab    @tab X
668
@tab 4X Technologies format, used in some games
669 4d3b1f8d Mike Melanson
@item Playstation STR  @tab    @tab X
670
@item Id RoQ           @tab    @tab X
671
@tab used in Quake III, Jedi Knight 2, other computer games
672
@item Interplay MVE    @tab    @tab X
673
@tab format used in various Interplay computer games
674 b17e9c99 Mike Melanson
@item WC3 Movie        @tab    @tab X
675
@tab multimedia format used in Origin's Wing Commander III computer game
676 2fdf638b Mike Melanson
@item Sega FILM/CPK    @tab    @tab X
677
@tab used in many Sega Saturn console games
678
@item Westwood Studios VQA/AUD  @tab    @tab X
679
@tab Multimedia formats used in Westwood Studios games
680 4120a53a Mike Melanson
@item Id Cinematic (.cin) @tab    @tab X
681
@tab Used in Quake II
682 42cad81a Mike Melanson
@item FLIC format      @tab    @tab X
683
@tab .fli/.flc files
684 da00f30e Mike Melanson
@item Sierra VMD       @tab    @tab X
685
@tab used in Sierra CD-ROM games
686 d08d7142 Mike Melanson
@item Sierra Online    @tab    @tab X
687
@tab .sol files used in Sierra Online games
688 38088adf Mike Melanson
@item Matroska         @tab    @tab X
689 ad81a9fe Mike Melanson
@item Electronic Arts Multimedia    @tab    @tab X
690
@tab used in various EA games; files have extensions like WVE and UV2
691 353147ed Mike Melanson
@item Nullsoft Video (NSV) format @tab    @tab X
692
@end multitable
693 9181577c Fabrice Bellard
694
@code{X} means that the encoding (resp. decoding) is supported.
695
696 0699d2fe Fabrice Bellard
@section Image Formats
697
698
FFmpeg can read and write images for each frame of a video sequence. The
699
following image formats are supported:
700
701
@multitable @columnfractions .4 .1 .1
702
@item Supported Image Format @tab Encoding @tab Decoding @tab Comments
703
@item PGM, PPM     @tab X @tab X 
704 2eb5d024 Fabrice Bellard
@item PAM          @tab X @tab X @tab PAM is a PNM extension with alpha support
705
@item PGMYUV       @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
706 0699d2fe Fabrice Bellard
@item JPEG         @tab X @tab X @tab Progressive JPEG is not supported
707
@item .Y.U.V       @tab X @tab X @tab One raw file per component
708 2eb5d024 Fabrice Bellard
@item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
709
@item PNG          @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
710 6a91ec51 Mike Melanson
@item SGI          @tab X @tab X @tab SGI RGB image format
711 0699d2fe Fabrice Bellard
@end multitable
712
713
@code{X} means that the encoding (resp. decoding) is supported.
714
715 9181577c Fabrice Bellard
@section Video Codecs
716
717
@multitable @columnfractions .4 .1 .1 .7
718
@item Supported Codec @tab Encoding @tab Decoding @tab Comments
719 4745b5bf Fabrice Bellard
@item MPEG1 video            @tab  X  @tab  X
720 50f52fcd Fabrice Bellard
@item MPEG2 video            @tab  X  @tab  X 
721 9181577c Fabrice Bellard
@item MPEG4                  @tab  X  @tab  X @tab Also known as DIVX4/5
722
@item MSMPEG4 V1             @tab  X  @tab  X
723
@item MSMPEG4 V2             @tab  X  @tab  X
724
@item MSMPEG4 V3             @tab  X  @tab  X @tab Also known as DIVX3
725
@item WMV7                   @tab  X  @tab  X
726 701b603d Mike Melanson
@item WMV8                   @tab  X  @tab  X @tab Not completely working
727 b06b45c4 Mike Melanson
@item H.261                  @tab  X  @tab  X
728
@item H.263(+)               @tab  X  @tab  X @tab Also known as Real Video 1.0
729
@item H.264                  @tab     @tab  X
730 9181577c Fabrice Bellard
@item MJPEG                  @tab  X  @tab  X 
731 d6896c49 Alex Beregszaszi
@item Lossless MJPEG         @tab  X  @tab  X
732
@item Apple MJPEG-B          @tab     @tab  X
733
@item Sunplus MJPEG          @tab     @tab  X @tab fourcc: SP5X
734 4fa1c4fa Roman Shaposhnik
@item DV                     @tab  X  @tab  X 
735 4745b5bf Fabrice Bellard
@item Huff YUV               @tab  X  @tab  X
736 33a4d8b1 Alex Beregszaszi
@item FFmpeg Video 1         @tab  X  @tab  X @tab Experimental lossless codec (fourcc: FFV1)
737
@item FFmpeg Snow            @tab  X  @tab  X @tab Experimental wavelet codec (fourcc: SNOW)
738 701b603d Mike Melanson
@item Asus v1                @tab  X  @tab  X @tab fourcc: ASV1
739 4d3b1f8d Mike Melanson
@item Asus v2                @tab  X  @tab  X @tab fourcc: ASV2
740 701b603d Mike Melanson
@item Creative YUV           @tab     @tab  X @tab fourcc: CYUV
741 d2bfadc0 Mike Melanson
@item Sorenson Video 1       @tab  X  @tab  X @tab fourcc: SVQ1
742 701b603d Mike Melanson
@item Sorenson Video 3       @tab     @tab  X @tab fourcc: SVQ3
743
@item On2 VP3                @tab     @tab  X @tab still experimental
744 d6896c49 Alex Beregszaszi
@item Theora                 @tab     @tab  X @tab still experimental
745 701b603d Mike Melanson
@item Intel Indeo 3          @tab     @tab  X @tab only works on i386 right now
746 9303d49c Alex Beregszaszi
@item FLV                    @tab  X  @tab  X @tab Sorenson H.263 used in Flash
747 4d3b1f8d Mike Melanson
@item ATI VCR1               @tab     @tab  X @tab fourcc: VCR1
748 7fe4c823 Alex Beregszaszi
@item ATI VCR2               @tab     @tab  X @tab fourcc: VCR2
749 4d3b1f8d Mike Melanson
@item Cirrus Logic AccuPak   @tab     @tab  X @tab fourcc: CLJR
750
@item 4X Video               @tab     @tab  X @tab used in certain computer games
751
@item Sony Playstation MDEC  @tab     @tab  X 
752
@item Id RoQ                 @tab     @tab  X @tab used in Quake III, Jedi Knight 2, other computer games
753 b17e9c99 Mike Melanson
@item Xan/WC3                @tab     @tab  X @tab used in Wing Commander III .MVE files
754 186447f8 Mike Melanson
@item Interplay Video        @tab     @tab  X @tab used in Interplay .MVE files
755 070ed1bc Mike Melanson
@item Apple Animation        @tab     @tab  X @tab fourcc: 'rle '
756 42cad81a Mike Melanson
@item Apple Graphics         @tab     @tab  X @tab fourcc: 'smc '
757 2fdf638b Mike Melanson
@item Apple Video            @tab     @tab  X @tab fourcc: rpza
758 d08d7142 Mike Melanson
@item Apple QuickDraw        @tab     @tab  X @tab fourcc: qdrw
759 2fdf638b Mike Melanson
@item Cinepak                @tab     @tab  X
760
@item Microsoft RLE          @tab     @tab  X
761
@item Microsoft Video-1      @tab     @tab  X
762 4120a53a Mike Melanson
@item Westwood VQA           @tab     @tab  X
763
@item Id Cinematic Video     @tab     @tab  X @tab used in Quake II
764 1dc1ed99 Roberto Togni
@item Planar RGB             @tab     @tab  X @tab fourcc: 8BPS
765 42cad81a Mike Melanson
@item FLIC video             @tab     @tab  X
766 9a4117d5 Mike Melanson
@item Duck TrueMotion v1     @tab     @tab  X @tab fourcc: DUCK
767 da00f30e Mike Melanson
@item VMD Video              @tab     @tab  X @tab used in Sierra VMD files
768 a273bbfb Roberto Togni
@item MSZH                   @tab     @tab  X @tab Part of LCL
769
@item ZLIB                   @tab  X  @tab  X @tab Part of LCL, encoder experimental
770 9d53d58e Mike Melanson
@item TechSmith Camtasia     @tab     @tab  X @tab fourcc: TSCC
771 d0a0bbd2 Mike Melanson
@item IBM Ultimotion         @tab     @tab  X @tab fourcc: ULTI
772 ab711b3c Mike Melanson
@item Miro VideoXL           @tab     @tab  X @tab fourcc: VIXL
773 acfd8f0f Mike Melanson
@item QPEG                   @tab     @tab  X @tab fourccs: QPEG, Q1.0, Q1.1
774 9181577c Fabrice Bellard
@end multitable
775
776
@code{X} means that the encoding (resp. decoding) is supported.
777
778 60837265 Fabrice Bellard
Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
779
get a precise comparison of FFmpeg MPEG4 codec compared to the other
780
solutions.
781
782 9181577c Fabrice Bellard
@section Audio Codecs
783
784
@multitable @columnfractions .4 .1 .1 .1 .7
785
@item Supported Codec @tab Encoding @tab Decoding @tab Comments
786
@item MPEG audio layer 2     @tab  IX  @tab  IX 
787
@item MPEG audio layer 1/3   @tab IX   @tab  IX
788 6bf40f39 Philip Gladstone
@tab MP3 encoding is supported through the external library LAME
789 37776c3b Benjamin Larsson
@item AC3                    @tab  IX  @tab  IX
790 2eb5d024 Fabrice Bellard
@tab liba52 is used internally for decoding
791 34d7008d Philip Gladstone
@item Vorbis                 @tab  X   @tab  X
792 2eb5d024 Fabrice Bellard
@tab supported through the external library libvorbis
793 4745b5bf Fabrice Bellard
@item WMA V1/V2              @tab      @tab X
794 f6fa7a6c Benjamin Larsson
@item AAC                    @tab X    @tab X
795
@tab supported through the external library libfaac/libfaad
796 d4c3c5a6 Michael Niedermayer
@item Microsoft ADPCM        @tab X    @tab X
797 4d3b1f8d Mike Melanson
@item MS IMA ADPCM           @tab X    @tab X
798
@item QT IMA ADPCM           @tab      @tab X
799
@item 4X IMA ADPCM           @tab      @tab X
800 d4e437df Roman Shaposhnik
@item G.726  ADPCM           @tab X    @tab X
801 b17e9c99 Mike Melanson
@item Duck DK3 IMA ADPCM     @tab      @tab X
802
@tab used in some Sega Saturn console games
803
@item Duck DK4 IMA ADPCM     @tab      @tab X
804
@tab used in some Sega Saturn console games
805 2fdf638b Mike Melanson
@item Westwood Studios IMA ADPCM @tab      @tab X
806 42cad81a Mike Melanson
@tab used in Westwood Studios games like Command and Conquer
807 7d8379f2 Mike Melanson
@item SMJPEG IMA ADPCM       @tab      @tab X
808
@tab used in certain Loki game ports
809 42cad81a Mike Melanson
@item CD-ROM XA ADPCM        @tab      @tab X
810
@item CRI ADX ADPCM          @tab X    @tab X
811
@tab used in Sega Dreamcast games
812 7d8379f2 Mike Melanson
@item Electronic Arts ADPCM  @tab      @tab X
813
@tab used in various EA titles
814 b3bfb299 Mike Melanson
@item Creative ADPCM         @tab      @tab X
815 2eb5d024 Fabrice Bellard
@item RA144                  @tab      @tab X
816
@tab Real 14400 bit/s codec
817
@item RA288                  @tab      @tab X
818
@tab Real 28800 bit/s codec
819 37776c3b Benjamin Larsson
@item RADnet                 @tab X    @tab IX
820
@tab Real lowbitrate AC3 codec, liba52 is used for decoding
821 2eb5d024 Fabrice Bellard
@item AMR-NB                 @tab X    @tab X
822
@tab supported through an external library
823 d663a1fd Michael Niedermayer
@item AMR-WB                 @tab X    @tab X
824
@tab supported through an external library
825 2eb5d024 Fabrice Bellard
@item DV audio               @tab      @tab X
826 4d3b1f8d Mike Melanson
@item Id RoQ DPCM            @tab      @tab X
827
@tab used in Quake III, Jedi Knight 2, other computer games
828
@item Interplay MVE DPCM     @tab      @tab X
829
@tab used in various Interplay computer games
830 b17e9c99 Mike Melanson
@item Xan DPCM               @tab      @tab X
831
@tab used in Origin's Wing Commander IV AVI files
832 d08d7142 Mike Melanson
@item Sierra Online DPCM     @tab      @tab X
833
@tab used in Sierra Online game audio files
834 d6896c49 Alex Beregszaszi
@item Apple MACE 3           @tab      @tab X
835
@item Apple MACE 6           @tab      @tab X
836 f8d58f4d Alex Beregszaszi
@item FLAC                   @tab      @tab X
837 33a4d8b1 Alex Beregszaszi
@item FFmpeg Sonic           @tab X    @tab X
838
@tab Experimental lossy/lossless codec
839 9181577c Fabrice Bellard
@end multitable
840
841
@code{X} means that the encoding (resp. decoding) is supported.
842
843
@code{I} means that an integer only version is available too (ensures highest
844
performances on systems without hardware floating point support).
845
846 47d944d2 Fabrice Bellard
@chapter Platform Specific information
847
848
@section Linux
849
850
ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
851 6bf40f39 Philip Gladstone
preferred compiler now for ffmpeg. All future optimizations will depend on
852 47d944d2 Fabrice Bellard
features only found in GCC 3.2.
853
854
@section BSD
855
856
@section Windows
857
858 b030b284 Fabrice Bellard
@subsection Native Windows compilation
859
860
@itemize
861
@item Install the current versions of MSYS and MinGW from
862
@url{http://www.mingw.org/}. You can find detailed installation
863
instructions in the download section and the FAQ.
864
865 50f52fcd Fabrice Bellard
@item If you want to test the FFmpeg Simple Media Player, also download 
866
the MinGW development library of SDL 1.2.x
867
(@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
868
@url{http://www.libsdl.org}. Unpack it in a temporary place, and
869
unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
870 988a9f9e Fabrice Bellard
directory. Edit the @file{sdl-config} script so that it gives the
871
correct SDL directory when invoked.
872 50f52fcd Fabrice Bellard
873
@item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
874 b030b284 Fabrice Bellard
 
875
@item Start the MSYS shell (file @file{msys.bat}).
876
877 50f52fcd Fabrice Bellard
@item Change to the FFMPEG directory and follow
878
 the instructions of how to compile ffmpeg (file
879
@file{INSTALL}). Usually, launching @file{./configure} and @file{make}
880
suffices. If you have problems using SDL, verify that
881
@file{sdl-config} can be launched from the MSYS command line.
882
883 988a9f9e Fabrice Bellard
@item You can install FFmpeg in @file{Program Files/FFmpeg} by typing @file{make install}. Don't forget to copy @file{SDL.dll} at the place you launch 
884
@file{ffplay}.
885 50f52fcd Fabrice Bellard
886 b030b284 Fabrice Bellard
@end itemize
887
888 988a9f9e Fabrice Bellard
Notes: 
889
@itemize
890 50f52fcd Fabrice Bellard
891 988a9f9e Fabrice Bellard
@item The target @file{make wininstaller} can be used to create a
892
Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
893
must be copied in the ffmpeg directory in order to build the
894
installer.
895
896
@item By using @code{./configure --enable-shared} when configuring ffmpeg, 
897
you can build @file{avcodec.dll} and @file{avformat.dll}. With
898
@code{make install} you install the FFmpeg DLLs and the associated
899
headers in @file{Program Files/FFmpeg}. 
900
901
@item Visual C++ compatibility: if you used @code{./configure --enable-shared} 
902
when configuring FFmpeg, then FFmpeg tries to use the Microsoft Visual
903
C++ @code{lib} tool to build @code{avcodec.lib} and
904
@code{avformat.lib}. With these libraries, you can link your Visual C++
905
code directly with the FFmpeg DLLs.
906
907
@end itemize
908 b030b284 Fabrice Bellard
909
@subsection Cross compilation for Windows with Linux
910
911
You must use the MinGW cross compilation tools available at
912
@url{http://www.mingw.org/}.
913
914
Then configure ffmpeg with the following options:
915
@example
916
./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
917
@end example
918
(you can change the cross-prefix according to the prefix choosen for the
919
MinGW tools).
920
921
Then you can easily test ffmpeg with wine
922
(@url{http://www.winehq.com/}).
923
924 47d944d2 Fabrice Bellard
@section MacOS X
925
926
@section BeOS
927
928
The configure script should guess the configuration itself.
929
Networking support is currently not finished.
930
errno issues fixed by Andrew Bachmann.
931
932
Old stuff:
933
934
Fran?ois Revol - revol at free dot fr - April 2002
935
936
The configure script should guess the configuration itself, 
937
however I still didn't tested building on net_server version of BeOS.
938
939
ffserver is broken (needs poll() implementation).
940
941
There is still issues with errno codes, which are negative in BeOs, and
942
that ffmpeg negates when returning. This ends up turning errors into 
943
valid results, then crashes.
944
(To be fixed)
945
946 34d7008d Philip Gladstone
@chapter Developers Guide
947 9181577c Fabrice Bellard
948
@section API
949
@itemize
950
@item libavcodec is the library containing the codecs (both encoding and
951
  decoding). See @file{libavcodec/apiexample.c} to see how to use it.
952
953
@item libavformat is the library containing the file formats handling (mux and
954 a93b9dba Fabrice Bellard
  demux code for several formats). See @file{ffplay.c} to use it in a
955
player. See @file{output_example.c} to use it to generate audio or video
956
streams.
957
958 9181577c Fabrice Bellard
@end itemize
959
960
@section Integrating libavcodec or libavformat in your program
961
962
You can integrate all the source code of the libraries to link them
963
statically to avoid any version problem. All you need is to provide a
964
'config.mak' and a 'config.h' in the parent directory. See the defines
965
generated by ./configure to understand what is needed.
966
967
You can use libavcodec or libavformat in your commercial program, but
968
@emph{any patch you make must be published}. The best way to proceed is
969
to send your patches to the ffmpeg mailing list.
970
971 80d1c272 Michael Niedermayer
@node Coding Rules
972 9181577c Fabrice Bellard
@section Coding Rules
973
974 cb6e87c1 Falk Hüffner
ffmpeg is programmed in the ISO C90 language with a few additional
975
features from ISO C99, namely:
976
@itemize @bullet
977
@item
978
the @samp{inline} keyword;
979
@item
980
@samp{//} comments;
981
@item
982
designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
983
@item
984
compound literals (@samp{x = (struct s) { 17, 23 @};})
985
@end itemize
986
987
These features are supported by all compilers we care about, so we won't
988
accept patches to remove their use unless they absolutely don't impair
989
clarity and performance.
990
991
All code must compile with gcc 2.95 and gcc 3.3. Currently, ffmpeg also
992
compiles with several other compilers, such as the Compaq ccc compiler
993
or Sun Studio 9, and we would like to keep it that way unless it would
994
be exceedingly involved. To ensure compatibility, please don't use any
995
additional C99 features or gcc extensions. Watch out especially for:
996
@itemize @bullet
997
@item
998
mixing statements and declarations;
999
@item
1000
@samp{long long} (use @samp{int64_t} instead);
1001
@item
1002
@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
1003
@item
1004
gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
1005
@end itemize
1006 9181577c Fabrice Bellard
1007 cb6e87c1 Falk Hüffner
Indent size is 4. The TAB character should not be used.
1008 9181577c Fabrice Bellard
The presentation is the one specified by 'indent -i4 -kr'.
1009
1010
Main priority in ffmpeg is simplicity and small code size (=less
1011
bugs).
1012
1013 80d1c272 Michael Niedermayer
Comments: use the JavaDoc/Doxygen 
1014 f4888b83 Michael Niedermayer
format (see examples below) so that a documentation
1015 80d1c272 Michael Niedermayer
can be generated automatically. All non trivial functions should have a comment
1016
above it explaining what the function does, even if its just one sentance.
1017
All Structures and their member variables should be documented too.
1018 f4888b83 Michael Niedermayer
@example
1019
/**
1020
?* @file mpeg.c
1021
?* mpeg codec.
1022
?* @author ...
1023
?*/
1024
1025
/**
1026
?* Summary sentance.
1027
?* more text ...
1028
?* ...
1029
?*/
1030
typedef struct Foobar{
1031
? ? int var1; /**< var1 description */
1032
? ? int var2; ///< var2 description
1033
? ? /** var3 description */
1034
? ? int var3;
1035
} Foobar;
1036
1037
/**
1038
?* Summary sentance.
1039
?* more text ...
1040
?* ...
1041
?* @param my_parameter description of my_parameter
1042
?* @return return value description
1043
?*/
1044
int myfunc(int my_parameter)
1045
...
1046
@end example
1047 9181577c Fabrice Bellard
1048 36d9b4e8 Michael Niedermayer
fprintf and printf are forbidden in libavformat and libavcodec, 
1049
please use av_log() instead.
1050
1051 7a57b90c Michael Niedermayer
@node CVS Policy
1052
@section CVS Policy
1053
1054
@enumerate
1055
@item 
1056
   You must not commit code which breaks FFmpeg! (Meaning unfinished but
1057
   enabled code which breaks compilation or compiles but does not work. Or 
1058
   breaks the regression tests)
1059
   You can commit unfinished stuff (for testing etc), but it must be disabled
1060
   (#ifdef etc) by default so it does not interfere with other developers'
1061
   work.
1062
@item 
1063
   You don't have to over-test things. If it works for you, and you think it
1064
   should work for others, too, then commit. If your code has problems
1065
   (portability, exploits compiler bugs, unusual environment etc) they will be
1066
   reported and eventually fixed.
1067
@item 
1068
   Do not commit unrelated changes together, split them into self-contained
1069
   pieces.
1070
@item
1071
   Do not change behavior of the program (renaming options etc) without
1072
   first discussing it on the ffmpeg-dev mailing list. Do not remove
1073
   functionality from the code. Just improve!
1074
   
1075
   Note: Redundant code can be removed
1076
@item
1077
   Do not commit changes to the build system (Makefiles, configure script)
1078
   which change behaviour, defaults etc, without asking first. The same
1079
   applies to compiler warning fixes, trivial looking fixes and to code
1080
   maintained by other developers. We usually have a reason for doing things
1081
   the way we do. Send your changes as patches to the ffmpeg-dev mailing
1082
   list, and if the code maintainers say OK, you may commit. This does not
1083
   apply to files you wrote and/or maintain.
1084
@item
1085
   We refuse source indentation and other cosmetic changes if they are mixed
1086
   with functional changes, such commits will be rejected and removed. Every
1087
   developer has his own indentation style, you should not change it. Of course
1088
   if you (re)write something, you can use your own style, even though we would
1089
   prefer if the indention throughout ffmpeg would be consistant (Many projects
1090
   force a given indentation style - we don't.) If you really need to make
1091
   indentation changes (try to avoid this), separate them strictly from real
1092
   changes.
1093
1094
   NOTE: If you had to put if(){ .. } over a large (> 5 lines) chunk of code,
1095
   then either do NOT change the indentation of the inner part within (don't 
1096
   move it to the right)! or do so in a seperate commit
1097
@item
1098
   Always fill out the commit log message. Describe in a few lines what you
1099
   changed and why. You can refer to mailing list postings if you fix a
1100
   particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
1101
@item
1102
   If you apply a patch by someone else, include the name and email address in
1103
   the CVS log message. Since the ffmpeg-cvslog mailing list is publicly
1104
   archived you should add some spam protection to the email address. Send an
1105
   answer to ffmpeg-dev (or wherever you got the patch from) saying that
1106
   you applied the patch.
1107
@item
1108
   Do NOT commit to code actively maintained by others without permission. Send
1109
   a patch to ffmpeg-dev instead.
1110
@item
1111
    Subscribe to the ffmpeg-cvslog mailing list. The diffs of all CVS commits
1112
    are sent there and reviewed by all the other developers. Bugs and possible
1113
    improvements or general questions regarding commits are discussed there. We
1114
    expect you to react if problems with your code are uncovered.
1115
@item
1116
    Update the documentation if you change behavior or add features. If you are
1117
    unsure how best to do this, send a patch to ffmpeg-dev, the documentation
1118
    maintainer(s) will review and commit your stuff.
1119
@item
1120
    Revert a commit ONLY in case of a big blunder like committing something not
1121
    intended to be committed or committing a wrong file, the wrong version of a
1122
    patch, cvs policy violation or broken code and you are going to recommit the
1123
    right thing immediately.
1124
1125
    Never revert changes made a long time ago or buggy code. Fix it in the
1126
    normal way instead.
1127
@end itemize
1128
1129
We think our rules are not too hard. If you have comments, contact us.
1130
1131
Note, these rules are mostly borrowed from the MPlayer project.
1132
1133
@subsection Renaming/moving files or content of files
1134
  You CANNOT do that. Post a request for such a change to the mailinglist
1135
  Do NOT remove & readd a file - it will kill the changelog!!!!
1136
1137 9181577c Fabrice Bellard
@section Submitting patches
1138
1139 80d1c272 Michael Niedermayer
First, (@pxref{Coding Rules}) above if you didn't yet.
1140
1141 6a6810b1 Michael Niedermayer
When you submit your patch, try to send a unified diff (diff '-up'
1142 9181577c Fabrice Bellard
option). I cannot read other diffs :-)
1143
1144
Run the regression tests before submitting a patch so that you can
1145 6bf40f39 Philip Gladstone
verify that there are no big problems.
1146 9181577c Fabrice Bellard
1147
Patches should be posted as base64 encoded attachments (or any other
1148
encoding which ensures that the patch wont be trashed during 
1149
transmission) to the ffmpeg-devel mailinglist, see 
1150
@url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
1151
1152 54fcf429 Michael Niedermayer
It also helps quite a bit if you tell us what the patch does (for example
1153
'replaces lrint by lrintf') , and why (for example '*bsd isnt c99 compliant
1154
and has no lrint()')
1155
1156 cf7f2b16 Michael Niedermayer
We reply to all patches submitted and either apply or reject with some
1157
explanation why, but sometimes we are quite busy so it can take a week or 2
1158
1159 9181577c Fabrice Bellard
@section Regression tests
1160
1161 6bf40f39 Philip Gladstone
Before submitting a patch (or committing with CVS), you should at least
1162 9181577c Fabrice Bellard
test that you did not break anything.
1163
1164
The regression test build a synthetic video stream and a synthetic
1165 6bf40f39 Philip Gladstone
audio stream. Then these are encoded then decoded with all codecs or
1166 9181577c Fabrice Bellard
formats. The CRC (or MD5) of each generated file is recorded in a
1167
result file. Then a 'diff' is launched with the reference results and
1168
the result file.
1169
1170 6bf40f39 Philip Gladstone
The regression test then goes on to test the ffserver code with a 
1171
limited set of streams. It is important that this step runs correctly
1172
as well.
1173
1174 36d9b4e8 Michael Niedermayer
Run 'make test' to test all the codecs and formats.
1175 9181577c Fabrice Bellard
1176 5ee03c86 Fabrice Bellard
Run 'make fulltest' to test all the codecs, formats and ffserver.
1177 9181577c Fabrice Bellard
1178
[Of course, some patches may change the regression tests results. In
1179
this case, the regression tests reference results shall be modified
1180
accordingly].
1181
1182
@bye