2852fa5e564bf2be1d2467734c6ce9afa82491a2
[libav.git] / doc / ffmpeg-doc.html
1 <HTML>
2 <HEAD>
3 <!-- Created by texi2html 1.56k from ffmpeg-doc.texi on 27 October 2002 -->
4
5 <TITLE>FFmpeg Documentation</TITLE>
6 </HEAD>
7 <BODY>
8 <H1>FFmpeg Documentation</H1>
9 <P>
10 <P><HR><P>
11 <H1>Table of Contents</H1>
12 <UL>
13 <LI><A NAME="TOC1" HREF="ffmpeg-doc.html#SEC1">1. Introduction</A>
14 <LI><A NAME="TOC2" HREF="ffmpeg-doc.html#SEC2">2. Quick Start</A>
15 <UL>
16 <LI><A NAME="TOC3" HREF="ffmpeg-doc.html#SEC3">2.1 Video and Audio grabbing</A>
17 <LI><A NAME="TOC4" HREF="ffmpeg-doc.html#SEC4">2.2 Video and Audio file format convertion</A>
18 </UL>
19 <LI><A NAME="TOC5" HREF="ffmpeg-doc.html#SEC5">3. Invocation</A>
20 <UL>
21 <LI><A NAME="TOC6" HREF="ffmpeg-doc.html#SEC6">3.1 Syntax</A>
22 <LI><A NAME="TOC7" HREF="ffmpeg-doc.html#SEC7">3.2 Main options</A>
23 <LI><A NAME="TOC8" HREF="ffmpeg-doc.html#SEC8">3.3 Video Options</A>
24 <LI><A NAME="TOC9" HREF="ffmpeg-doc.html#SEC9">3.4 Audio Options</A>
25 <LI><A NAME="TOC10" HREF="ffmpeg-doc.html#SEC10">3.5 Advanced options</A>
26 <LI><A NAME="TOC11" HREF="ffmpeg-doc.html#SEC11">3.6 Protocols</A>
27 </UL>
28 <LI><A NAME="TOC12" HREF="ffmpeg-doc.html#SEC12">4. Tips</A>
29 <LI><A NAME="TOC13" HREF="ffmpeg-doc.html#SEC13">5. Supported File Formats and Codecs</A>
30 <UL>
31 <LI><A NAME="TOC14" HREF="ffmpeg-doc.html#SEC14">5.1 File Formats</A>
32 <LI><A NAME="TOC15" HREF="ffmpeg-doc.html#SEC15">5.2 Video Codecs</A>
33 <LI><A NAME="TOC16" HREF="ffmpeg-doc.html#SEC16">5.3 Audio Codecs</A>
34 </UL>
35 <LI><A NAME="TOC17" HREF="ffmpeg-doc.html#SEC17">6. Developpers Guide</A>
36 <UL>
37 <LI><A NAME="TOC18" HREF="ffmpeg-doc.html#SEC18">6.1 API</A>
38 <LI><A NAME="TOC19" HREF="ffmpeg-doc.html#SEC19">6.2 Integrating libavcodec or libavformat in your program</A>
39 <LI><A NAME="TOC20" HREF="ffmpeg-doc.html#SEC20">6.3 Coding Rules</A>
40 <LI><A NAME="TOC21" HREF="ffmpeg-doc.html#SEC21">6.4 Submitting patches</A>
41 <LI><A NAME="TOC22" HREF="ffmpeg-doc.html#SEC22">6.5 Regression tests</A>
42 </UL>
43 </UL>
44 <P><HR><P>
45
46 <P>
47 FFmpeg Documentation
48
49
50
51
52 <H1><A NAME="SEC1" HREF="ffmpeg-doc.html#TOC1">1. Introduction</A></H1>
53
54 <P>
55 FFmpeg is a very fast video and audio converter. It can also grab from
56 a live audio/video source.
57
58 The command line interface is designed to be intuitive, in the sense
59 that ffmpeg tries to figure out all the parameters, when
60 possible. You have usually to give only the target bitrate you want.
61
62
63 <P>
64 FFmpeg can also convert from any sample rate to any other, and resize
65 video on the fly with a high quality polyphase filter.
66
67
68
69
70 <H1><A NAME="SEC2" HREF="ffmpeg-doc.html#TOC2">2. Quick Start</A></H1>
71
72
73
74 <H2><A NAME="SEC3" HREF="ffmpeg-doc.html#TOC3">2.1 Video and Audio grabbing</A></H2>
75
76 <P>
77 FFmpeg can use a video4linux compatible video source and any Open Sound
78 System audio source:
79
80 <PRE>
81 ffmpeg /tmp/out.mpg
82 </PRE>
83
84 <P>
85 Note that you must activate the right video source and channel
86 before launching ffmpeg. You can use any TV viewer such as xawtv by
87 Gerd Knorr which I find very good. You must also set correctly the
88 audio recording levels with a standard mixer.
89
90
91
92
93 <H2><A NAME="SEC4" HREF="ffmpeg-doc.html#TOC4">2.2 Video and Audio file format convertion</A></H2>
94
95 <P>
96 * ffmpeg can use any supported file format and protocol as input:
97
98
99 <P>
100 Examples:
101
102
103 <P>
104 * You can input from YUV files:
105
106
107
108 <PRE>
109 ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
110 </PRE>
111
112 <P>
113 It will use the files:
114
115 <PRE>
116 /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
117 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
118 </PRE>
119
120 <P>
121 The Y files use twice the resolution of the U and V files. They are
122 raw files, without header. They can be generated by all decent video
123 decoders. You must specify the size of the image with the '-s' option
124 if ffmpeg cannot guess it.
125
126
127 <P>
128 * You can input from a RAW YUV420P file:
129
130
131
132 <PRE>
133 ffmpeg -i /tmp/test.yuv /tmp/out.avi
134 </PRE>
135
136 <P>
137 The RAW YUV420P is a file containing RAW YUV planar, for each frame first
138 come the Y plane followed by U and V planes, which are half vertical and
139 horizontal resolution.
140
141
142 <P>
143 * You can output to a RAW YUV420P file:
144
145
146
147 <PRE>
148 ffmpeg -i mydivx.avi -o hugefile.yuv
149 </PRE>
150
151 <P>
152 * You can set several input files and output files:
153
154
155
156 <PRE>
157 ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
158 </PRE>
159
160 <P>
161 Convert the audio file a.wav and the raw yuv video file a.yuv
162 to mpeg file a.mpg
163
164
165 <P>
166 * You can also do audio and video convertions at the same time:
167
168
169
170 <PRE>
171 ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
172 </PRE>
173
174 <P>
175 Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
176
177
178 <P>
179 * You can encode to several formats at the same time and define a
180 mapping from input stream to output streams:
181
182
183
184 <PRE>
185 ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
186 </PRE>
187
188 <P>
189 Convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. '-map
190 file:index' specify which input stream is used for each output
191 stream, in the order of the definition of output streams.
192
193
194 <P>
195 * You can transcode decrypted VOBs
196
197
198
199 <PRE>
200 ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
201 </PRE>
202
203 <P>
204 This is a typicall DVD ripper example, input from a VOB file, output
205 to an AVI file with MPEG-4 video and MP3 audio, note that in this
206 command we use B frames so the MPEG-4 stream is DivX5 compatible, GOP
207 size is 300 that means an INTRA frame every 10 seconds for 29.97 fps
208 input video. Also the audio stream is MP3 encoded so you need LAME
209 support which is enabled using <CODE>--enable-mp3lame</CODE> when
210 configuring. The mapping is particullary usefull for DVD transcoding
211 to get the desired audio language.
212
213
214 <P>
215 NOTE: to see the supported input formats, use <CODE>ffmpeg -formats</CODE>.
216
217
218
219
220 <H1><A NAME="SEC5" HREF="ffmpeg-doc.html#TOC5">3. Invocation</A></H1>
221
222
223
224 <H2><A NAME="SEC6" HREF="ffmpeg-doc.html#TOC6">3.1 Syntax</A></H2>
225
226 <P>
227 The generic syntax is:
228
229
230
231 <PRE>
232 ffmpeg [[options][-i input_file]]... {[options] output_file}...
233 </PRE>
234
235 <P>
236 If no input file is given, audio/video grabbing is done.
237
238
239 <P>
240 As a general rule, options are applied to the next specified
241 file. For example, if you give the '-b 64' option, it sets the video
242 bitrate of the next file. Format option may be needed for raw input
243 files.
244
245
246 <P>
247 By default, ffmpeg tries to convert as losslessly as possible: it
248 uses the same audio and video parameter fors the outputs as the one
249 specified for the inputs.
250
251
252
253
254 <H2><A NAME="SEC7" HREF="ffmpeg-doc.html#TOC7">3.2 Main options</A></H2>
255
256 <DL COMPACT>
257
258 <DT><SAMP>`-L'</SAMP>
259 <DD>
260 show license
261 <DT><SAMP>`-h'</SAMP>
262 <DD>
263 show help
264 <DT><SAMP>`-formats'</SAMP>
265 <DD>
266 show available formats, codecs, protocols, ...
267 <DT><SAMP>`-f fmt'</SAMP>
268 <DD>
269 force format
270 <DT><SAMP>`-i filename'</SAMP>
271 <DD>
272 input file name
273
274 <DT><SAMP>`-y'</SAMP>
275 <DD>
276 overwrite output files
277
278 <DT><SAMP>`-t duration'</SAMP>
279 <DD>
280 set the recording time in seconds. <CODE>hh:mm:ss[.xxx]</CODE> syntax is also
281 supported.
282
283 <DT><SAMP>`-title string'</SAMP>
284 <DD>
285 set the title
286
287 <DT><SAMP>`-author string'</SAMP>
288 <DD>
289 set the author
290
291 <DT><SAMP>`-copyright string'</SAMP>
292 <DD>
293 set the copyright
294
295 <DT><SAMP>`-comment string'</SAMP>
296 <DD>
297 set the comment
298
299 <DT><SAMP>`-b bitrate'</SAMP>
300 <DD>
301 set video bitrate (in kbit/s)
302 </DL>
303
304
305
306 <H2><A NAME="SEC8" HREF="ffmpeg-doc.html#TOC8">3.3 Video Options</A></H2>
307
308 <DL COMPACT>
309
310 <DT><SAMP>`-s size'</SAMP>
311 <DD>
312 set frame size [160x128]
313 <DT><SAMP>`-r fps'</SAMP>
314 <DD>
315 set frame rate [25]
316 <DT><SAMP>`-b bitrate'</SAMP>
317 <DD>
318 set the video bitrate in kbit/s [200]
319 <DT><SAMP>`-vn'</SAMP>
320 <DD>
321 disable video recording [no]
322 <DT><SAMP>`-bt tolerance'</SAMP>
323 <DD>
324 set video bitrate tolerance (in kbit/s)
325 <DT><SAMP>`-sameq'</SAMP>
326 <DD>
327 use same video quality as source (implies VBR)
328
329 <DT><SAMP>`-pass n'</SAMP>
330 <DD>
331 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.
332
333 <DT><SAMP>`-passlogfile file'</SAMP>
334 <DD>
335 select two pass log file name
336
337 </DL>
338
339
340
341 <H2><A NAME="SEC9" HREF="ffmpeg-doc.html#TOC9">3.4 Audio Options</A></H2>
342
343 <DL COMPACT>
344
345 <DT><SAMP>`-ab bitrate'</SAMP>
346 <DD>
347 set audio bitrate (in kbit/s)
348 <DT><SAMP>`-ar freq'</SAMP>
349 <DD>
350 set the audio sampling freq [44100]
351 <DT><SAMP>`-ab bitrate'</SAMP>
352 <DD>
353 set the audio bitrate in kbit/s [64]
354 <DT><SAMP>`-ac channels'</SAMP>
355 <DD>
356 set the number of audio channels [1]
357 <DT><SAMP>`-an'</SAMP>
358 <DD>
359 disable audio recording [no]
360 </DL>
361
362
363
364 <H2><A NAME="SEC10" HREF="ffmpeg-doc.html#TOC10">3.5 Advanced options</A></H2>
365
366 <DL COMPACT>
367
368 <DT><SAMP>`-map file:stream'</SAMP>
369 <DD>
370 set input stream mapping
371 <DT><SAMP>`-g gop_size'</SAMP>
372 <DD>
373 set the group of picture size
374 <DT><SAMP>`-intra'</SAMP>
375 <DD>
376 use only intra frames
377 <DT><SAMP>`-qscale q'</SAMP>
378 <DD>
379 use fixed video quantiser scale (VBR)
380 <DT><SAMP>`-qmin q'</SAMP>
381 <DD>
382 min video quantiser scale (VBR)
383 <DT><SAMP>`-qmax q'</SAMP>
384 <DD>
385 max video quantiser scale (VBR)
386 <DT><SAMP>`-qdiff q'</SAMP>
387 <DD>
388 max difference between the quantiser scale (VBR)
389 <DT><SAMP>`-qblur blur'</SAMP>
390 <DD>
391 video quantiser scale blur (VBR)
392 <DT><SAMP>`-qcomp compression'</SAMP>
393 <DD>
394 video quantiser scale compression (VBR)
395 <DT><SAMP>`-vd device'</SAMP>
396 <DD>
397 set video device
398 <DT><SAMP>`-vcodec codec'</SAMP>
399 <DD>
400 force video codec
401 <DT><SAMP>`-me method'</SAMP>
402 <DD>
403 set motion estimation method
404 <DT><SAMP>`-bf frames'</SAMP>
405 <DD>
406 use 'frames' B frames (only MPEG-4)
407 <DT><SAMP>`-hq'</SAMP>
408 <DD>
409 activate high quality settings
410 <DT><SAMP>`-4mv'</SAMP>
411 <DD>
412 use four motion vector by macroblock (only MPEG-4)
413 <DT><SAMP>`-ad device'</SAMP>
414 <DD>
415 set audio device
416 <DT><SAMP>`-acodec codec'</SAMP>
417 <DD>
418 force audio codec
419 <DT><SAMP>`-deinterlace'</SAMP>
420 <DD>
421 deinterlace pictures
422 <DT><SAMP>`-benchmark'</SAMP>
423 <DD>
424 add timings for benchmarking
425 <DT><SAMP>`-hex'</SAMP>
426 <DD>
427 dump each input packet
428 <DT><SAMP>`-psnr'</SAMP>
429 <DD>
430 calculate PSNR of compressed frames
431 <DT><SAMP>`-vstats'</SAMP>
432 <DD>
433 dump video coding statistics to file
434 </DL>
435
436
437
438 <H2><A NAME="SEC11" HREF="ffmpeg-doc.html#TOC11">3.6 Protocols</A></H2>
439
440 <P>
441 The output file can be "-" to output to a pipe. This is only possible
442 with mpeg1 and h263 formats.
443
444
445 <P>
446 ffmpeg handles also many protocols specified with the URL syntax.
447
448
449 <P>
450 Use 'ffmpeg -formats' to have a list of the supported protocols.
451
452
453 <P>
454 The protocol <CODE>http:</CODE> is currently used only to communicate with
455 ffserver (see the ffserver documentation). When ffmpeg will be a
456 video player it will also be used for streaming :-)
457
458
459
460
461 <H1><A NAME="SEC12" HREF="ffmpeg-doc.html#TOC12">4. Tips</A></H1>
462
463
464 <UL>
465 <LI>For streaming at very low bit rate application, use a low frame rate
466
467 and a small gop size. This is especially true for real video where
468 the Linux player does not seem to be very fast, so it can miss
469 frames. An example is:
470
471
472 <PRE>
473 ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
474 </PRE>
475
476 <LI>The parameter 'q' which is displayed while encoding is the current
477
478 quantizer. The value of 1 indicates that a very good quality could
479 be achieved. The value of 31 indicates the worst quality. If q=31
480 too often, it means that the encoder cannot compress enough to meet
481 your bit rate. You must either increase the bit rate, decrease the
482 frame rate or decrease the frame size.
483
484 <LI>If your computer is not fast enough, you can speed up the
485
486 compression at the expense of the compression ratio. You can use
487 '-me zero' to speed up motion estimation, and '-intra' to disable
488 completly motion estimation (you have only I frames, which means it
489 is about as good as JPEG compression).
490
491 <LI>To have very low bitrates in audio, reduce the sampling frequency
492
493 (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
494
495 <LI>To have a constant quality (but a variable bitrate), use the option
496
497 '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
498 quality).
499
500 <LI>When converting video files, you can use the '-sameq' option which
501
502 uses in the encoder the same quality factor than in the decoder. It
503 allows to be almost lossless in encoding.
504
505 </UL>
506
507
508
509 <H1><A NAME="SEC13" HREF="ffmpeg-doc.html#TOC13">5. Supported File Formats and Codecs</A></H1>
510
511 <P>
512 You can use the <CODE>-formats</CODE> option to have an exhaustive list.
513
514
515
516
517 <H2><A NAME="SEC14" HREF="ffmpeg-doc.html#TOC14">5.1 File Formats</A></H2>
518
519 <P>
520 FFmpeg supports the following file formats thru the <CODE>libavformat</CODE>
521 library.
522
523
524 <TABLE BORDER>
525
526 <TR><TD>Supported File Format </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
527
528 </TR>
529 <TR><TD>MPEG audio </TD><TD> X </TD><TD> X</TD>
530
531 </TR>
532 <TR><TD>MPEG1 systems </TD><TD> X </TD><TD> X</TD>
533
534 </TD><TD> muxed audio and video
535 </TR>
536 <TR><TD>MPEG2 PS </TD><TD> X </TD><TD> X</TD>
537
538 </TD><TD> also known as <CODE>VOB</CODE> file
539 </TR>
540 <TR><TD>MPEG2 TS </TD><TD> </TD><TD> X</TD>
541
542 </TD><TD> also known as DVB Transport Stream
543 </TR>
544 <TR><TD>ASF</TD><TD> X </TD><TD> X</TD>
545
546 </TR>
547 <TR><TD>AVI</TD><TD> X </TD><TD> X</TD>
548
549 </TR>
550 <TR><TD>WAV</TD><TD> X </TD><TD> X</TD>
551
552 </TR>
553 <TR><TD>Macromedia Flash</TD><TD> X </TD><TD> X</TD>
554
555 </TD><TD> Only embedded audio is decoded
556 </TR>
557 <TR><TD>Real Audio and Video </TD><TD> X </TD><TD> X</TD>
558
559 </TR>
560 <TR><TD>PGM, YUV, PPM, JPEG images </TD><TD> X </TD><TD> X</TD>
561
562 </TR>
563 <TR><TD>Animated GIF </TD><TD> X </TD><TD></TD>
564
565 </TD><TD> Only uncompressed GIFs are generated
566 </TR>
567 <TR><TD>Raw AC3 </TD><TD> X </TD><TD> X</TD>
568
569 </TR>
570 <TR><TD>Raw MJPEG </TD><TD> X </TD><TD> X</TD>
571
572 </TR>
573 <TR><TD>Raw MPEG video </TD><TD> X </TD><TD> X</TD>
574
575 </TR>
576 <TR><TD>Raw PCM8/16 bits, mulaw/Alaw</TD><TD> X </TD><TD> X</TD>
577
578 </TR>
579 <TR><TD>SUN AU format </TD><TD> X </TD><TD> X</TD>
580
581 </TR>
582 <TR><TD>Quicktime </TD><TD> </TD><TD> X</TD>
583
584 </TR>
585 <TR><TD>MPEG4 </TD><TD> </TD><TD> X</TD>
586
587 </TD><TD> MPEG4 is a variant of Quicktime
588 </TR>
589 <TR><TD>Raw MPEG4 video </TD><TD> </TD><TD> X</TD>
590
591 </TD><TD> Only small files are supported.
592 </TR>
593 <TR><TD>DV </TD><TD> </TD><TD> X</TD>
594
595 </TD><TD> Only the video track is decoded.
596 </TR></TABLE>
597
598 <P>
599 <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
600
601
602
603
604 <H2><A NAME="SEC15" HREF="ffmpeg-doc.html#TOC15">5.2 Video Codecs</A></H2>
605
606 <TABLE BORDER>
607
608 <TR><TD>Supported Codec </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
609
610 </TR>
611 <TR><TD>MPEG1 video </TD><TD> X </TD><TD> X</TD>
612
613 </TR>
614 <TR><TD>MPEG2 video </TD><TD> </TD><TD> X</TD>
615
616 </TR>
617 <TR><TD>MPEG4 </TD><TD> X </TD><TD> X </TD><TD> Also known as DIVX4/5</TD>
618
619 </TR>
620 <TR><TD>MSMPEG4 V1 </TD><TD> X </TD><TD> X</TD>
621
622 </TR>
623 <TR><TD>MSMPEG4 V2 </TD><TD> X </TD><TD> X</TD>
624
625 </TR>
626 <TR><TD>MSMPEG4 V3 </TD><TD> X </TD><TD> X </TD><TD> Also known as DIVX3</TD>
627
628 </TR>
629 <TR><TD>WMV7 </TD><TD> X </TD><TD> X</TD>
630
631 </TR>
632 <TR><TD>H263(+) </TD><TD> X </TD><TD> X </TD><TD> Also known as Real Video 1.0</TD>
633
634 </TR>
635 <TR><TD>MJPEG </TD><TD> X </TD><TD> X</TD>
636
637 </TR>
638 <TR><TD>DV </TD><TD> </TD><TD> X</TD>
639
640 </TR></TABLE>
641
642 <P>
643 <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
644
645
646
647
648 <H2><A NAME="SEC16" HREF="ffmpeg-doc.html#TOC16">5.3 Audio Codecs</A></H2>
649
650 <TABLE BORDER>
651
652 <TR><TD>Supported Codec </TD><TD> Encoding </TD><TD> Decoding </TD><TD> Comments</TD>
653
654 </TR>
655 <TR><TD>MPEG audio layer 2 </TD><TD> IX </TD><TD> IX</TD>
656
657 </TR>
658 <TR><TD>MPEG audio layer 1/3 </TD><TD> IX </TD><TD> IX</TD>
659
660 </TD><TD> MP3 encoding is supported thru the external library LAME
661 </TR>
662 <TR><TD>AC3 </TD><TD> IX </TD><TD> X</TD>
663
664 </TD><TD> liba52 is used internally for decoding.
665 </TR>
666 <TR><TD>Vorbis </TD><TD> X </TD><TD></TD>
667
668 </TD><TD> encoding is supported thru the external library libvorbis.
669 </TR></TABLE>
670
671 <P>
672 <CODE>X</CODE> means that the encoding (resp. decoding) is supported.
673
674
675 <P>
676 <CODE>I</CODE> means that an integer only version is available too (ensures highest
677 performances on systems without hardware floating point support).
678
679
680
681
682 <H1><A NAME="SEC17" HREF="ffmpeg-doc.html#TOC17">6. Developpers Guide</A></H1>
683
684
685
686 <H2><A NAME="SEC18" HREF="ffmpeg-doc.html#TOC18">6.1 API</A></H2>
687
688 <UL>
689 <LI>libavcodec is the library containing the codecs (both encoding and
690
691 decoding). See <TT>`libavcodec/apiexample.c'</TT> to see how to use it.
692
693 <LI>libavformat is the library containing the file formats handling (mux and
694
695 demux code for several formats). (no example yet, the API is likely to
696 evolve).
697 </UL>
698
699
700
701 <H2><A NAME="SEC19" HREF="ffmpeg-doc.html#TOC19">6.2 Integrating libavcodec or libavformat in your program</A></H2>
702
703 <P>
704 You can integrate all the source code of the libraries to link them
705 statically to avoid any version problem. All you need is to provide a
706 'config.mak' and a 'config.h' in the parent directory. See the defines
707 generated by ./configure to understand what is needed.
708
709
710 <P>
711 You can use libavcodec or libavformat in your commercial program, but
712 <EM>any patch you make must be published</EM>. The best way to proceed is
713 to send your patches to the ffmpeg mailing list.
714
715
716
717
718 <H2><A NAME="SEC20" HREF="ffmpeg-doc.html#TOC20">6.3 Coding Rules</A></H2>
719
720 <P>
721 ffmpeg is programmed in ANSI C language. GCC extensions are
722 tolerated. Indent size is 4. The TAB character should not be used.
723
724
725 <P>
726 The presentation is the one specified by 'indent -i4 -kr'.
727
728
729 <P>
730 Main priority in ffmpeg is simplicity and small code size (=less
731 bugs).
732
733
734 <P>
735 Comments: for functions visible from other modules, use the JavaDoc
736 format (see examples in <TT>`libav/utils.c'</TT>) so that a documentation
737 can be generated automatically.
738
739
740
741
742 <H2><A NAME="SEC21" HREF="ffmpeg-doc.html#TOC21">6.4 Submitting patches</A></H2>
743
744 <P>
745 When you submit your patch, try to send a unified diff (diff '-u'
746 option). I cannot read other diffs :-)
747
748
749 <P>
750 Run the regression tests before submitting a patch so that you can
751 verify that there is no big problems.
752
753
754 <P>
755 Except if your patch is really big and adds an important feature, by
756 submitting it to me, you accept implicitely to put it under my
757 copyright. I prefer to do this to avoid potential problems if
758 licensing of ffmpeg changes.
759
760
761 <P>
762 Patches should be posted as base64 encoded attachments (or any other
763 encoding which ensures that the patch wont be trashed during
764 transmission) to the ffmpeg-devel mailinglist, see
765 <A HREF="http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel">http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel</A>
766
767
768
769
770 <H2><A NAME="SEC22" HREF="ffmpeg-doc.html#TOC22">6.5 Regression tests</A></H2>
771
772 <P>
773 Before submitting a patch (or commiting with CVS), you should at least
774 test that you did not break anything.
775
776
777 <P>
778 The regression test build a synthetic video stream and a synthetic
779 audio stream. Then there are encoded then decoded with all codecs or
780 formats. The CRC (or MD5) of each generated file is recorded in a
781 result file. Then a 'diff' is launched with the reference results and
782 the result file.
783
784
785 <P>
786 Run 'make test' to test all the codecs.
787
788
789 <P>
790 Run 'make libavtest' to test all the codecs.
791
792
793 <P>
794 [Of course, some patches may change the regression tests results. In
795 this case, the regression tests reference results shall be modified
796 accordingly].
797
798
799 <P><HR><P>
800 This document was generated on 27 October 2002 using
801 <A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A>&nbsp;1.56k.
802 </BODY>
803 </HTML>