]> git.sesse.net Git - ffmpeg/blob - doc/ffmpeg-doc.texi
771f1e54ee7a46072649e186b7d1ea1a62aebcbb
[ffmpeg] / doc / ffmpeg-doc.texi
1 \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 @c man begin EXAMPLES
26 @section Video and Audio grabbing
27
28 FFmpeg can use a video4linux compatible video source and any Open Sound
29 System audio source:
30
31 @example
32 ffmpeg /tmp/out.mpg 
33 @end example
34
35 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
41 @section Video and Audio file format conversion
42
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 ffmpeg -i /tmp/test%d.Y /tmp/out.mpg 
51 @end example
52
53 It will use the files: 
54 @example
55 /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
56 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
57 @end example
58
59 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
64 * You can input from a RAW YUV420P file:
65
66 @example
67 ffmpeg -i /tmp/test.yuv /tmp/out.avi
68 @end example
69
70 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
74 * You can output to a RAW YUV420P file:
75
76 @example
77 ffmpeg -i mydivx.avi -o hugefile.yuv
78 @end example
79
80 * You can set several input files and output files:
81
82 @example
83 ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
84 @end example
85
86 Convert the audio file a.wav and the raw yuv video file a.yuv
87 to mpeg file a.mpg
88
89 * You can also do audio and video conversions at the same time:
90
91 @example
92 ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
93 @end example
94
95 Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
96
97 * You can encode to several formats at the same time and define a
98 mapping from input stream to output streams:
99
100 @example
101 ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
102 @end example
103
104 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
108 * You can transcode decrypted VOBs
109
110 @example
111 ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
112 @end example
113
114 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
123 NOTE: to see the supported input formats, use @code{ffmpeg -formats}.
124 @c man end
125
126 @chapter Invocation
127
128 @section Syntax
129
130 The generic syntax is:
131
132 @example 
133 @c man begin SYNOPSIS
134 ffmpeg [[options][@option{-i} @var{input_file}]]... @{[options] @var{output_file}@}...
135 @c man end
136 @end example
137 @c man begin DESCRIPTION
138 If no input file is given, audio/video grabbing is done.
139
140 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
145 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
150 @c man begin OPTIONS
151 @section Main options
152
153 @table @option
154 @item -L
155 show license
156
157 @item -h
158 show help
159
160 @item -formats
161 show available formats, codecs, protocols, ...
162
163 @item -f fmt              
164 force format
165
166 @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 @item -title string       
177 set the title
178
179 @item -author string      
180 set the author
181
182 @item -copyright string   
183 set the copyright
184
185 @item -comment string     
186 set the comment
187
188 @item -hq                 
189 activate high quality settings
190
191 @end table
192
193 @section Video Options
194
195 @table @option
196 @item -b bitrate
197 set the video bitrate in kbit/s (default = 200 kb/s)
198 @item -r fps           
199 set frame rate (default = 25)
200 @item -s size             
201 set frame size. The format is @samp{WxH}. (default 160x128)
202 The following abbreviations are regognized:
203 @table @sampe
204 @item sqcif
205 128x96
206 @item qcif
207 176x144
208 @item cif
209 352x288
210 @item 4cif
211 704x576
212 @end table
213
214 @item -aspect aspect
215 set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
216 @item -croptop size
217 set top crop band size (in pixels)
218 @item -cropbottom size
219 set bottom crop band size (in pixels)
220 @item -cropleft size
221 set left crop band size (in pixels)
222 @item -cropright size
223 set right crop band size (in pixels)
224 @item -vn
225 disable video recording
226 @item -bt tolerance       
227 set video bitrate tolerance (in kbit/s)
228 @item -maxrate bitrate
229 set max video bitrate tolerance (in kbit/s)
230 @item -minrate bitrate
231 set min video bitrate tolerance (in kbit/s)
232 @item -bufsize size
233 set ratecontrol buffere size (in kbit)
234 @item -vcodec codec       
235 force video codec
236 @item -sameq
237 use same video quality as source (implies VBR)
238
239 @item -pass n  
240 select the pass number (1 or 2). It is useful to do two pass encoding. The statistics of the video are recorded in the first pass and the video at the exact requested bit rate is generated in the second pass.
241
242 @item -passlogfile file   
243 select two pass log file name
244
245 @end table
246
247 @section Advanced Video Options
248
249 @table @option
250 @item -g gop_size         
251 set the group of picture size
252 @item -intra              
253 use only intra frames
254 @item -qscale q           
255 use fixed video quantiser scale (VBR)
256 @item -qmin q             
257 min video quantiser scale (VBR)
258 @item -qmax q             
259 max video quantiser scale (VBR)
260 @item -qdiff q            
261 max difference between the quantiser scale (VBR)
262 @item -qblur blur         
263 video quantiser scale blur (VBR)
264 @item -qcomp compression  
265 video quantiser scale compression (VBR)
266
267 @item -rc_init_cplx complexity
268 initial complexity for 1-pass encoding
269 @item -b_qfactor factor
270 qp factor between p and b frames
271 @item -i_qfactor factor
272 qp factor between p and i frames
273 @item -b_qoffset offset
274 qp offset between p and b frames
275 @item -i_qoffset offset
276 qp offset between p and i frames
277 @item -rc_eq equation
278 set rate control equation (@pxref{FFmpeg formula evaluator})
279 @item -rc_override override_string
280 rate control override for specific internals
281 @item -me method
282 set motion estimation method. Available methods are (from lower to best quality):
283 @table @samp
284 @item zero
285 Try just (0, 0) vector.
286 @item phods
287 @item log
288 @item x1
289 @item epzs
290 (default method)
291 @item full
292 exhaustive search (slow and marginally better than epzs)
293 @end table
294
295 @item -dct_algo algo
296 set dct algo
297 @table @samp
298 @item 0
299 FF_DCT_AUTO (default)
300 @item 1
301 FF_DCT_FASTINT
302 @item 2
303 FF_DCT_INT
304 @item 3
305 FF_DCT_MMX
306 @item 4
307 FF_DCT_MLIB
308 @item 5
309 FF_DCT_ALTIVEC
310 @end table
311
312 @item -idct_algo algo
313 set idct algo
314 @table @samp
315 @item 0
316 FF_IDCT_AUTO (default)
317 @item 1
318 FF_IDCT_INT          
319 @item 2
320 FF_IDCT_SIMPLE       
321 @item 3
322 FF_IDCT_SIMPLEMMX    
323 @item 4
324 FF_IDCT_LIBMPEG2MMX  
325 @item 5
326 FF_IDCT_PS2          
327 @item 6
328 FF_IDCT_MLIB         
329 @item 7
330 FF_IDCT_ARM          
331 @item 8
332 FF_IDCT_ALTIVEC      
333 @item 9
334 FF_IDCT_SH4          
335 @item 10
336 FF_IDCT_SIMPLEARM    
337 @end table
338
339 @item -er n
340 set error resilience to 'n'
341 @table @samp
342 @item 1 
343 FF_ER_CAREFULL
344 @item 2
345 FF_ER_COMPLIANT (default)
346 @item 3
347 FF_ER_AGGRESSIVE
348 @item 4
349 FF_ER_VERY_AGGRESSIVE
350 @end table
351
352 @item -ec n
353 set error concealment to n
354 @table @samp
355 @item 1
356 FF_EC_GUESS_MVS
357 @item 2
358 FF_EC_DEBLOCK
359 @end table
360
361 @item -bf frames
362 use 'frames' B frames (only MPEG-4)
363 @item -mbd mode
364 macroblock decision
365 @table @samp
366 @item 0
367 FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
368 @item 1
369 FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
370 @item 2
371 FF_MB_DECISION_RD: rate distoration
372 @end table
373
374 @item -4mv
375 use four motion vector by macroblock (only MPEG-4)
376 @item -part
377 use data partitioning (only MPEG-4)
378 @item -bug param
379 workaround not auto detected encoder bugs
380 @item -strict strictness
381 how strictly to follow the standarts
382
383 @item -deinterlace
384 deinterlace pictures
385 @item -psnr
386 calculate PSNR of compressed frames
387 @item -vstats
388 dump video coding statistics to file
389 @item -vhook module
390 insert video processing @var{module}. @var{module} contains the module
391 name and its parameters separated by spaces.
392 @item -aic
393 enable Advanced intra coding (h263+)
394 @item -umv
395 enable Unlimited Motion Vector (h263+)
396 @end table
397
398 @section Audio Options
399
400 @table @option
401 @item -ab bitrate         
402 set audio bitrate (in kbit/s)
403 @item -ar freq    
404  set the audio sampling freq (default = 44100 Hz)
405 @item -ab bitrate 
406  set the audio bitrate in kbit/s (default = 64)
407 @item -ac channels
408  set the number of audio channels (default = 1)
409 @item -an     
410  disable audio recording
411 @item -acodec codec       
412 force audio codec
413 @end table
414
415 @section Audio/Video grab options
416
417 @table @option
418 @item -vd device
419 set video grab device (e.g. @file{/dev/video0})
420 @item -vc channel
421 set video grab channel (DV1394 only)
422 @item -tvstd standard
423 set television standard (NTSC, PAL (SECAM))
424 @item -dv1394
425 set DV1394 grab
426 @item -ad device
427 set audio device (e.g. @file{/dev/dsp})
428 @end table
429
430 @section Advanced options
431
432 @table @option
433 @item -map file:stream    
434 set input stream mapping
435 @item -debug
436 print specific debug info
437 @item -benchmark          
438 add timings for benchmarking
439 @item -hex                
440 dump each input packet
441 @item -bitexact
442 only use bit exact algorithms (for codec testing)
443 @item -ps size
444 set packet size in bits
445 @end table
446
447 @node FFmpeg formula evaluator
448 @section FFmpeg formula evaluator
449
450 When evaluating a rate control string, FFmpeg uses an internal formula
451 evaluator. 
452
453 The following binary operators are available: @code{+}, @code{-},
454 @code{*}, @code{/}, @code{^}.
455
456 The following unary operators are available: @code{+}, @code{-},
457 @code{(...)}.
458
459 The following functions are available:
460 @table @var
461 @item sinh(x)
462 @item cosh(x)
463 @item tanh(x)
464 @item sin(x)
465 @item cos(x)
466 @item tan(x)
467 @item exp(x)
468 @item log(x)
469 @item squish(x)
470 @item gauss(x)
471 @item abs(x)
472 @item max(x, y)
473 @item min(x, y)
474 @item gt(x, y)
475 @item lt(x, y)
476 @item eq(x, y)
477 @item bits2qp(bits)
478 @item qp2bits(qp)
479 @end table
480
481 The following constants are available:
482 @table @var
483 @item PI
484 @item E
485 @item iTex
486 @item pTex
487 @item tex
488 @item mv
489 @item fCode
490 @item iCount
491 @item mcVar
492 @item var
493 @item isI
494 @item isP
495 @item isB
496 @item avgQP
497 @item qComp
498 @item avgIITex
499 @item avgPITex
500 @item avgPPTex
501 @item avgBPTex
502 @item avgTex
503 @end table
504
505 @c man end
506
507 @ignore
508
509 @setfilename ffmpeg
510 @settitle FFmpeg video converter
511
512 @c man begin SEEALSO
513 ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
514 @c man end
515
516 @c man begin AUTHOR
517 Fabrice Bellard
518 @c man end
519
520 @end ignore
521
522 @section Protocols
523
524 The filename can be @file{-} to read from the standard input or to write
525 to the standard output.
526
527 ffmpeg handles also many protocols specified with the URL syntax.
528
529 Use 'ffmpeg -formats' to have a list of the supported protocols.
530
531 The protocol @code{http:} is currently used only to communicate with
532 ffserver (see the ffserver documentation). When ffmpeg will be a
533 video player it will also be used for streaming :-)
534
535 @chapter Tips
536
537 @itemize
538 @item For streaming at very low bit rate application, use a low frame rate
539 and a small gop size. This is especially true for real video where
540 the Linux player does not seem to be very fast, so it can miss
541 frames. An example is:
542
543 @example
544 ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
545 @end example
546
547 @item  The parameter 'q' which is displayed while encoding is the current
548 quantizer. The value of 1 indicates that a very good quality could
549 be achieved. The value of 31 indicates the worst quality. If q=31
550 too often, it means that the encoder cannot compress enough to meet
551 your bit rate. You must either increase the bit rate, decrease the
552 frame rate or decrease the frame size.
553
554 @item If your computer is not fast enough, you can speed up the
555 compression at the expense of the compression ratio. You can use
556 '-me zero' to speed up motion estimation, and '-intra' to disable
557 completely motion estimation (you have only I frames, which means it
558 is about as good as JPEG compression).
559
560 @item To have very low bitrates in audio, reduce the sampling frequency
561 (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
562
563 @item To have a constant quality (but a variable bitrate), use the option
564 '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
565 quality).
566
567 @item When converting video files, you can use the '-sameq' option which
568 uses in the encoder the same quality factor than in the decoder. It
569 allows to be almost lossless in encoding.
570
571 @end itemize
572
573 @chapter Supported File Formats and Codecs
574
575 You can use the @code{-formats} option to have an exhaustive list.
576
577 @section File Formats
578
579 FFmpeg supports the following file formats through the @code{libavformat}
580 library:
581
582 @multitable @columnfractions .4 .1 .1
583 @item Supported File Format @tab Encoding @tab Decoding @tab Comments
584 @item MPEG audio @tab X @tab X
585 @item MPEG1 systems @tab X  @tab  X 
586 @tab muxed audio and video
587 @item MPEG2 PS @tab X  @tab  X 
588 @tab also known as @code{VOB} file
589 @item MPEG2 TS @tab    @tab  X 
590 @tab also known as DVB Transport Stream
591 @item ASF@tab X @tab X 
592 @item AVI@tab X @tab X 
593 @item WAV@tab X @tab X 
594 @item Macromedia Flash@tab X @tab X
595 @tab Only embedded audio is decoded
596 @item FLV              @tab  X @tab X
597 @tab Macromedia Flash video files
598 @item Real Audio and Video @tab X @tab X 
599 @item Raw AC3 @tab X  @tab  X 
600 @item Raw MJPEG @tab X  @tab  X 
601 @item Raw MPEG video @tab X  @tab  X 
602 @item Raw PCM8/16 bits, mulaw/Alaw@tab X  @tab  X 
603 @item SUN AU format @tab X  @tab  X 
604 @item Quicktime        @tab   @tab  X 
605 @item MPEG4            @tab  @tab  X 
606 @tab MPEG4 is a variant of Quicktime
607 @item Raw MPEG4 video  @tab  X @tab  X 
608 @item DV               @tab  @tab X
609 @item 4xm              @tab    @tab X
610 @tab 4X Technologies format, used in some games
611 @end multitable
612
613 @code{X} means that the encoding (resp. decoding) is supported.
614
615 @section Image Formats
616
617 FFmpeg can read and write images for each frame of a video sequence. The
618 following image formats are supported:
619
620 @multitable @columnfractions .4 .1 .1
621 @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
622 @item PGM, PPM     @tab X @tab X 
623 @item PAM          @tab X @tab X @tab PAM is a PNM extension with alpha support
624 @item PGMYUV       @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
625 @item JPEG         @tab X @tab X @tab Progressive JPEG is not supported
626 @item .Y.U.V       @tab X @tab X @tab One raw file per component
627 @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
628 @item PNG          @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
629 @end multitable
630
631 @code{X} means that the encoding (resp. decoding) is supported.
632
633 @section Video Codecs
634
635 @multitable @columnfractions .4 .1 .1 .7
636 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
637 @item MPEG1 video            @tab  X  @tab  X
638 @item MPEG2 video            @tab     @tab  X 
639 @item MPEG4                  @tab  X  @tab  X @tab Also known as DIVX4/5
640 @item MSMPEG4 V1             @tab  X  @tab  X
641 @item MSMPEG4 V2             @tab  X  @tab  X
642 @item MSMPEG4 V3             @tab  X  @tab  X @tab Also known as DIVX3
643 @item WMV7                   @tab  X  @tab  X
644 @item WMV8                   @tab  X  @tab  X @tab Not completely working
645 @item H263(+)                @tab  X  @tab  X @tab Also known as Real Video 1.0
646 @item MJPEG                  @tab  X  @tab  X 
647 @item DV                     @tab     @tab  X 
648 @item Huff YUV               @tab  X  @tab  X
649 @item Asus v1                @tab  X  @tab  X @tab fourcc: ASV1
650 @item Creative YUV           @tab     @tab  X @tab fourcc: CYUV
651 @item H.264                  @tab     @tab  X
652 @item Sorenson Video 1       @tab     @tab  X @tab fourcc: SVQ1
653 @item Sorenson Video 3       @tab     @tab  X @tab fourcc: SVQ3
654 @item On2 VP3                @tab     @tab  X @tab still experimental
655 @item Intel Indeo 3          @tab     @tab  X @tab only works on i386 right now
656 @item FLV                    @tab  X  @tab  X @tab Flash H263 variant
657 @end multitable
658
659 @code{X} means that the encoding (resp. decoding) is supported.
660
661 Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
662 get a precise comparison of FFmpeg MPEG4 codec compared to the other
663 solutions.
664
665 @section Audio Codecs
666
667 @multitable @columnfractions .4 .1 .1 .1 .7
668 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
669 @item MPEG audio layer 2     @tab  IX  @tab  IX 
670 @item MPEG audio layer 1/3   @tab IX   @tab  IX
671 @tab MP3 encoding is supported through the external library LAME
672 @item AC3                    @tab  IX  @tab  X
673 @tab liba52 is used internally for decoding
674 @item Vorbis                 @tab  X   @tab  X
675 @tab supported through the external library libvorbis
676 @item WMA V1/V2              @tab      @tab X
677 @item Microsoft ADPCM        @tab X    @tab X
678 @item IMA ADPCM              @tab X    @tab X
679 @item RA144                  @tab      @tab X
680 @tab Real 14400 bit/s codec
681 @item RA288                  @tab      @tab X
682 @tab Real 28800 bit/s codec
683 @item AMR-NB                 @tab X    @tab X
684 @tab supported through an external library
685 @item DV audio               @tab      @tab X
686 @end multitable
687
688 @code{X} means that the encoding (resp. decoding) is supported.
689
690 @code{I} means that an integer only version is available too (ensures highest
691 performances on systems without hardware floating point support).
692
693 @chapter Platform Specific information
694
695 @section Linux
696
697 ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
698 preferred compiler now for ffmpeg. All future optimizations will depend on
699 features only found in GCC 3.2.
700
701 @section BSD
702
703 @section Windows
704
705 @subsection Native Windows compilation
706
707 @itemize
708 @item Install the current versions of MSYS and MinGW from
709 @url{http://www.mingw.org/}. You can find detailed installation
710 instructions in the download section and the FAQ.
711
712 @item Extract the current version of ffmpeg (the latest release version or the current CVS snapshot whichever is recommended).
713  
714 @item Start the MSYS shell (file @file{msys.bat}).
715
716 @item Change to the FFMPEG directory and create the libavcodec.a and libavformat.a libraries, following the instructions of how to compile ffmpeg (file @file{INSTALL}).
717  
718 @end itemize
719
720 @subsection How to create a single Windows DLL from libavcodec and libavformat
721  
722 Read @url{http://ffmpeg.org/win32.html}.
723
724 @subsection Cross compilation for Windows with Linux
725
726 You must use the MinGW cross compilation tools available at
727 @url{http://www.mingw.org/}.
728
729 Then configure ffmpeg with the following options:
730 @example
731 ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
732 @end example
733 (you can change the cross-prefix according to the prefix choosen for the
734 MinGW tools).
735
736 Then you can easily test ffmpeg with wine
737 (@url{http://www.winehq.com/}).
738
739 @section MacOS X
740
741 @section BeOS
742
743 The configure script should guess the configuration itself.
744 Networking support is currently not finished.
745 errno issues fixed by Andrew Bachmann.
746
747 Old stuff:
748
749 François Revol - revol at free dot fr - April 2002
750
751 The configure script should guess the configuration itself, 
752 however I still didn't tested building on net_server version of BeOS.
753
754 ffserver is broken (needs poll() implementation).
755
756 There is still issues with errno codes, which are negative in BeOs, and
757 that ffmpeg negates when returning. This ends up turning errors into 
758 valid results, then crashes.
759 (To be fixed)
760
761 @chapter Developers Guide
762
763 @section API
764 @itemize
765 @item libavcodec is the library containing the codecs (both encoding and
766   decoding). See @file{libavcodec/apiexample.c} to see how to use it.
767
768 @item libavformat is the library containing the file formats handling (mux and
769   demux code for several formats). See @file{ffplay.c} to use it in a
770 player. See @file{output_example.c} to use it to generate audio or video
771 streams.
772
773 @end itemize
774
775 @section Integrating libavcodec or libavformat in your program
776
777 You can integrate all the source code of the libraries to link them
778 statically to avoid any version problem. All you need is to provide a
779 'config.mak' and a 'config.h' in the parent directory. See the defines
780 generated by ./configure to understand what is needed.
781
782 You can use libavcodec or libavformat in your commercial program, but
783 @emph{any patch you make must be published}. The best way to proceed is
784 to send your patches to the ffmpeg mailing list.
785
786 @section Coding Rules
787
788 ffmpeg is programmed in ANSI C language. GCC extensions are
789 tolerated. Indent size is 4. The TAB character should not be used.
790
791 The presentation is the one specified by 'indent -i4 -kr'.
792
793 Main priority in ffmpeg is simplicity and small code size (=less
794 bugs).
795
796 Comments: for functions visible from other modules, use the JavaDoc
797 format (see examples in @file{libav/utils.c}) so that a documentation
798 can be generated automatically.
799
800 @section Submitting patches
801
802 When you submit your patch, try to send a unified diff (diff '-u'
803 option). I cannot read other diffs :-)
804
805 Run the regression tests before submitting a patch so that you can
806 verify that there are no big problems.
807
808 Patches should be posted as base64 encoded attachments (or any other
809 encoding which ensures that the patch wont be trashed during 
810 transmission) to the ffmpeg-devel mailinglist, see 
811 @url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
812
813 @section Regression tests
814
815 Before submitting a patch (or committing with CVS), you should at least
816 test that you did not break anything.
817
818 The regression test build a synthetic video stream and a synthetic
819 audio stream. Then these are encoded then decoded with all codecs or
820 formats. The CRC (or MD5) of each generated file is recorded in a
821 result file. Then a 'diff' is launched with the reference results and
822 the result file.
823
824 The regression test then goes on to test the ffserver code with a 
825 limited set of streams. It is important that this step runs correctly
826 as well.
827
828 Run 'make test' to test all the codecs.
829
830 Run 'make libavtest' to test all the codecs.
831
832 [Of course, some patches may change the regression tests results. In
833 this case, the regression tests reference results shall be modified
834 accordingly].
835
836 @bye