Documentation for -itsoffset switch by (Wolfram Gloger <wmglo at dent dot med dot...
[libav.git] / doc / ffmpeg-doc.texi
1 \input texinfo @c -*- texinfo -*-
3 @settitle FFmpeg Documentation
4 @titlepage
5 @sp 7
6 @center @titlefont{FFmpeg Documentation}
7 @sp 3
8 @end titlepage
11 @chapter Introduction
13 FFmpeg is a very fast video and audio converter. It can also grab from
14 a live audio/video source.
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.
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.
23 @chapter Quick Start
25 @c man begin EXAMPLES
26 @section Video and Audio grabbing
28 FFmpeg can use a video4linux compatible video source and any Open Sound
29 System audio source:
31 @example
32 ffmpeg /tmp/out.mpg
33 @end example
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{}) by Gerd Knorr which I find very
38 good. You must also set correctly the audio recording levels with a
39 standard mixer.
41 @section Video and Audio file format conversion
43 * ffmpeg can use any supported file format and protocol as input:
45 Examples:
47 * You can input from YUV files:
49 @example
50 ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
51 @end example
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
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.
64 * You can input from a RAW YUV420P file:
66 @example
67 ffmpeg -i /tmp/test.yuv /tmp/out.avi
68 @end example
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.
74 * You can output to a RAW YUV420P file:
76 @example
77 ffmpeg -i mydivx.avi -o hugefile.yuv
78 @end example
80 * You can set several input files and output files:
82 @example
83 ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
84 @end example
86 Convert the audio file a.wav and the raw yuv video file a.yuv
87 to mpeg file a.mpg
89 * You can also do audio and video conversions at the same time:
91 @example
92 ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
93 @end example
95 Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
97 * You can encode to several formats at the same time and define a
98 mapping from input stream to output streams:
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
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.
108 * You can transcode decrypted VOBs
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
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.
123 NOTE: to see the supported input formats, use @code{ffmpeg -formats}.
124 @c man end
126 @chapter Invocation
128 @section Syntax
130 The generic syntax is:
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.
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.
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
150 @c man begin OPTIONS
151 @section Main options
153 @table @option
154 @item -L
155 show license
157 @item -h
158 show help
160 @item -formats
161 show available formats, codecs, protocols, ...
163 @item -f fmt
164 force format
166 @item -i filename
167 input file name
169 @item -y
170 overwrite output files
172 @item -t duration
173 set the recording time in seconds. @code{hh:mm:ss[.xxx]} syntax is also
174 supported.
176 @item -ss position
177 seek to given time position. @code{hh:mm:ss[.xxx]} syntax is also
178 supported.
180 @item -title string
181 set the title
183 @item -author string
184 set the author
186 @item -copyright string
187 set the copyright
189 @item -comment string
190 set the comment
192 @item -target type
193 specify target file type ("vcd", "svcd" or "dvd"). All the format
194 options (bitrate, codecs, buffer sizes) are automatically set by this
195 option. You can just type:
197 @example
198 ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
199 @end example
201 @item -hq
202 activate high quality settings
204 @item -itsoffset offset
205 set the input time offset in seconds. @code{[-]hh:mm:ss[.xxx]} syntax
206 is also supported. This option affects all the input files that
207 follow it. The offset is added to the input files' timestamps;
208 specifying a positive offset means that the corresponding streams are
209 delayed by 'offset' seconds.
211 @end table
213 @section Video Options
215 @table @option
216 @item -b bitrate
217 set the video bitrate in kbit/s (default = 200 kb/s)
218 @item -r fps
219 set frame rate (default = 25)
220 @item -s size
221 set frame size. The format is @samp{WxH} (default 160x128). The
222 following abbreviations are recognized:
223 @table @samp
224 @item sqcif
225 128x96
226 @item qcif
227 176x144
228 @item cif
229 352x288
230 @item 4cif
231 704x576
232 @end table
234 @item -aspect aspect
235 set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
236 @item -croptop size
237 set top crop band size (in pixels)
238 @item -cropbottom size
239 set bottom crop band size (in pixels)
240 @item -cropleft size
241 set left crop band size (in pixels)
242 @item -cropright size
243 set right crop band size (in pixels)
244 @item -padtop size
245 set top pad band size (in pixels)
246 @item -padbottom size
247 set bottom pad band size (in pixels)
248 @item -padleft size
249 set left pad band size (in pixels)
250 @item -padright size
251 set right pad band size (in pixels)
252 @item -padcolor color
253 set right pad band size (hex). The value for pad color is expressed
254 as a six digit hexidecimal number where the first two digits represent red,
255 middle two digits green and last two digits blue. Defaults to 000000 (black)
256 @item -vn
257 disable video recording
258 @item -bt tolerance
259 set video bitrate tolerance (in kbit/s)
260 @item -maxrate bitrate
261 set max video bitrate tolerance (in kbit/s)
262 @item -minrate bitrate
263 set min video bitrate tolerance (in kbit/s)
264 @item -bufsize size
265 set ratecontrol buffere size (in kbit)
266 @item -vcodec codec
267 force video codec to @var{codec}. Use the @code{copy} special value to
268 tell that the raw codec data must be copied as is.
269 @item -sameq
270 use same video quality as source (implies VBR)
272 @item -pass n
273 select the pass number (1 or 2). It is useful to do two pass
274 encoding. The statistics of the video are recorded in the first pass and
275 the video at the exact requested bit rate is generated in the second
276 pass.
278 @item -passlogfile file
279 select two pass log file name to @var{file}.
281 @end table
283 @section Advanced Video Options
285 @table @option
286 @item -g gop_size
287 set the group of picture size
288 @item -intra
289 use only intra frames
290 @item -qscale q
291 use fixed video quantiser scale (VBR)
292 @item -qmin q
293 min video quantiser scale (VBR)
294 @item -qmax q
295 max video quantiser scale (VBR)
296 @item -qdiff q
297 max difference between the quantiser scale (VBR)
298 @item -qblur blur
299 video quantiser scale blur (VBR)
300 @item -qcomp compression
301 video quantiser scale compression (VBR)
303 @item -rc_init_cplx complexity
304 initial complexity for 1-pass encoding
305 @item -b_qfactor factor
306 qp factor between p and b frames
307 @item -i_qfactor factor
308 qp factor between p and i frames
309 @item -b_qoffset offset
310 qp offset between p and b frames
311 @item -i_qoffset offset
312 qp offset between p and i frames
313 @item -rc_eq equation
314 set rate control equation (@pxref{FFmpeg formula
315 evaluator}). Default is @code{tex^qComp}.
316 @item -rc_override override
317 rate control override for specific intervals
318 @item -me method
319 set motion estimation method to @var{method}. Available methods are
320 (from lower to best quality):
321 @table @samp
322 @item zero
323 Try just the (0, 0) vector.
324 @item phods
325 @item log
326 @item x1
327 @item epzs
328 (default method)
329 @item full
330 exhaustive search (slow and marginally better than epzs)
331 @end table
333 @item -dct_algo algo
334 set dct algorithm to @var{algo}. Available values are:
335 @table @samp
336 @item 0
337 FF_DCT_AUTO (default)
338 @item 1
340 @item 2
342 @item 3
344 @item 4
346 @item 5
348 @end table
350 @item -idct_algo algo
351 set idct algorithm to @var{algo}. Available values are:
352 @table @samp
353 @item 0
354 FF_IDCT_AUTO (default)
355 @item 1
357 @item 2
359 @item 3
361 @item 4
363 @item 5
365 @item 6
367 @item 7
369 @item 8
371 @item 9
373 @item 10
375 @end table
377 @item -er n
378 set error resilience to @var{n}.
379 @table @samp
380 @item 1
381 FF_ER_CAREFULL (default)
382 @item 2
384 @item 3
386 @item 4
388 @end table
390 @item -ec bit_mask
391 set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
392 the following values:
393 @table @samp
394 @item 1
395 FF_EC_GUESS_MVS (default=enabled)
396 @item 2
397 FF_EC_DEBLOCK (default=enabled)
398 @end table
400 @item -bf frames
401 use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
402 @item -mbd mode
403 macroblock decision
404 @table @samp
405 @item 0
406 FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
407 @item 1
408 FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
409 @item 2
410 FF_MB_DECISION_RD: rate distoration
411 @end table
413 @item -4mv
414 use four motion vector by macroblock (only MPEG-4)
415 @item -part
416 use data partitioning (only MPEG-4)
417 @item -bug param
418 workaround not auto detected encoder bugs
419 @item -strict strictness
420 how strictly to follow the standarts
421 @item -aic
422 enable Advanced intra coding (h263+)
423 @item -umv
424 enable Unlimited Motion Vector (h263+)
426 @item -deinterlace
427 deinterlace pictures
428 @item -interlace
429 force interlacing support in encoder (only MPEG-2 and MPEG-4). Use this option
430 if your input file is interlaced and if you want to keep the interlaced
431 format for minimum losses. The alternative is to deinterlace the input
432 stream with @option{-deinterlace}, but deinterlacing introduces more
433 losses.
434 @item -psnr
435 calculate PSNR of compressed frames
436 @item -vstats
437 dump video coding statistics to @file{vstats_HHMMSS.log}.
438 @item -vhook module
439 insert video processing @var{module}. @var{module} contains the module
440 name and its parameters separated by spaces.
441 @end table
443 @section Audio Options
445 @table @option
446 @item -ab bitrate
447 set audio bitrate (in kbit/s)
448 @item -ar freq
449 set the audio sampling freq (default = 44100 Hz)
450 @item -ab bitrate
451 set the audio bitrate in kbit/s (default = 64)
452 @item -ac channels
453 set the number of audio channels (default = 1)
454 @item -an
455 disable audio recording
456 @item -acodec codec
457 force audio codec to @var{codec}. Use the @code{copy} special value to
458 tell that the raw codec data must be copied as is.
459 @end table
461 @section Audio/Video grab options
463 @table @option
464 @item -vd device
465 set video grab device (e.g. @file{/dev/video0})
466 @item -vc channel
467 set video grab channel (DV1394 only)
468 @item -tvstd standard
469 set television standard (NTSC, PAL (SECAM))
470 @item -dv1394
471 set DV1394 grab
472 @item -ad device
473 set audio device (e.g. @file{/dev/dsp})
474 @end table
476 @section Advanced options
478 @table @option
479 @item -map file:stream
480 set input stream mapping
481 @item -debug
482 print specific debug info
483 @item -benchmark
484 add timings for benchmarking
485 @item -hex
486 dump each input packet
487 @item -bitexact
488 only use bit exact algorithms (for codec testing)
489 @item -ps size
490 set packet size in bits
491 @item -re
492 read input at native frame rate. Mainly used to simulate a grab device.
493 @item -loop
494 loop over the input stream. Currently it works only for image
495 streams. This option is used for ffserver automatic testing.
496 @end table
498 @node FFmpeg formula evaluator
499 @section FFmpeg formula evaluator
501 When evaluating a rate control string, FFmpeg uses an internal formula
502 evaluator.
504 The following binary operators are available: @code{+}, @code{-},
505 @code{*}, @code{/}, @code{^}.
507 The following unary operators are available: @code{+}, @code{-},
508 @code{(...)}.
510 The following functions are available:
511 @table @var
512 @item sinh(x)
513 @item cosh(x)
514 @item tanh(x)
515 @item sin(x)
516 @item cos(x)
517 @item tan(x)
518 @item exp(x)
519 @item log(x)
520 @item squish(x)
521 @item gauss(x)
522 @item abs(x)
523 @item max(x, y)
524 @item min(x, y)
525 @item gt(x, y)
526 @item lt(x, y)
527 @item eq(x, y)
528 @item bits2qp(bits)
529 @item qp2bits(qp)
530 @end table
532 The following constants are available:
533 @table @var
534 @item PI
535 @item E
536 @item iTex
537 @item pTex
538 @item tex
539 @item mv
540 @item fCode
541 @item iCount
542 @item mcVar
543 @item var
544 @item isI
545 @item isP
546 @item isB
547 @item avgQP
548 @item qComp
549 @item avgIITex
550 @item avgPITex
551 @item avgPPTex
552 @item avgBPTex
553 @item avgTex
554 @end table
556 @c man end
558 @ignore
560 @setfilename ffmpeg
561 @settitle FFmpeg video converter
563 @c man begin SEEALSO
564 ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
565 @c man end
567 @c man begin AUTHOR
568 Fabrice Bellard
569 @c man end
571 @end ignore
573 @section Protocols
575 The filename can be @file{-} to read from the standard input or to write
576 to the standard output.
578 ffmpeg handles also many protocols specified with the URL syntax.
580 Use 'ffmpeg -formats' to have a list of the supported protocols.
582 The protocol @code{http:} is currently used only to communicate with
583 ffserver (see the ffserver documentation). When ffmpeg will be a
584 video player it will also be used for streaming :-)
586 @chapter Tips
588 @itemize
589 @item For streaming at very low bit rate application, use a low frame rate
590 and a small gop size. This is especially true for real video where
591 the Linux player does not seem to be very fast, so it can miss
592 frames. An example is:
594 @example
595 ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
596 @end example
598 @item The parameter 'q' which is displayed while encoding is the current
599 quantizer. The value of 1 indicates that a very good quality could
600 be achieved. The value of 31 indicates the worst quality. If q=31
601 too often, it means that the encoder cannot compress enough to meet
602 your bit rate. You must either increase the bit rate, decrease the
603 frame rate or decrease the frame size.
605 @item If your computer is not fast enough, you can speed up the
606 compression at the expense of the compression ratio. You can use
607 '-me zero' to speed up motion estimation, and '-intra' to disable
608 completely motion estimation (you have only I frames, which means it
609 is about as good as JPEG compression).
611 @item To have very low bitrates in audio, reduce the sampling frequency
612 (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
614 @item To have a constant quality (but a variable bitrate), use the option
615 '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
616 quality).
618 @item When converting video files, you can use the '-sameq' option which
619 uses in the encoder the same quality factor than in the decoder. It
620 allows to be almost lossless in encoding.
622 @end itemize
624 @chapter Supported File Formats and Codecs
626 You can use the @code{-formats} option to have an exhaustive list.
628 @section File Formats
630 FFmpeg supports the following file formats through the @code{libavformat}
631 library:
633 @multitable @columnfractions .4 .1 .1
634 @item Supported File Format @tab Encoding @tab Decoding @tab Comments
635 @item MPEG audio @tab X @tab X
636 @item MPEG1 systems @tab X @tab X
637 @tab muxed audio and video
638 @item MPEG2 PS @tab X @tab X
639 @tab also known as @code{VOB} file
640 @item MPEG2 TS @tab @tab X
641 @tab also known as DVB Transport Stream
642 @item ASF@tab X @tab X
643 @item AVI@tab X @tab X
644 @item WAV@tab X @tab X
645 @item Macromedia Flash@tab X @tab X
646 @tab Only embedded audio is decoded
647 @item FLV @tab X @tab X
648 @tab Macromedia Flash video files
649 @item Real Audio and Video @tab X @tab X
650 @item Raw AC3 @tab X @tab X
651 @item Raw MJPEG @tab X @tab X
652 @item Raw MPEG video @tab X @tab X
653 @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X
654 @item Raw CRI ADX audio @tab X @tab X
655 @item SUN AU format @tab X @tab X
656 @item NUT @tab X @tab X @tab NUT Open Container Format
657 @item Quicktime @tab X @tab X
658 @item MPEG4 @tab X @tab X
659 @tab MPEG4 is a variant of Quicktime
660 @item Raw MPEG4 video @tab X @tab X
661 @item DV @tab X @tab X
662 @item 4xm @tab @tab X
663 @tab 4X Technologies format, used in some games
664 @item Playstation STR @tab @tab X
665 @item Id RoQ @tab @tab X
666 @tab used in Quake III, Jedi Knight 2, other computer games
667 @item Interplay MVE @tab @tab X
668 @tab format used in various Interplay computer games
669 @item WC3 Movie @tab @tab X
670 @tab multimedia format used in Origin's Wing Commander III computer game
671 @item Sega FILM/CPK @tab @tab X
672 @tab used in many Sega Saturn console games
673 @item Westwood Studios VQA/AUD @tab @tab X
674 @tab Multimedia formats used in Westwood Studios games
675 @item Id Cinematic (.cin) @tab @tab X
676 @tab Used in Quake II
677 @item FLIC format @tab @tab X
678 @tab .fli/.flc files
679 @item Sierra VMD @tab @tab X
680 @tab used in Sierra CD-ROM games
681 @item Matroska @tab @tab X
682 @end multitable
684 @code{X} means that the encoding (resp. decoding) is supported.
686 @section Image Formats
688 FFmpeg can read and write images for each frame of a video sequence. The
689 following image formats are supported:
691 @multitable @columnfractions .4 .1 .1
692 @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
693 @item PGM, PPM @tab X @tab X
694 @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support
695 @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
696 @item JPEG @tab X @tab X @tab Progressive JPEG is not supported
697 @item .Y.U.V @tab X @tab X @tab One raw file per component
698 @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
699 @item PNG @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
700 @item SGI @tab X @tab X @tab SGI RGB image format
701 @end multitable
703 @code{X} means that the encoding (resp. decoding) is supported.
705 @section Video Codecs
707 @multitable @columnfractions .4 .1 .1 .7
708 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
709 @item MPEG1 video @tab X @tab X
710 @item MPEG2 video @tab X @tab X
711 @item MPEG4 @tab X @tab X @tab Also known as DIVX4/5
712 @item MSMPEG4 V1 @tab X @tab X
713 @item MSMPEG4 V2 @tab X @tab X
714 @item MSMPEG4 V3 @tab X @tab X @tab Also known as DIVX3
715 @item WMV7 @tab X @tab X
716 @item WMV8 @tab X @tab X @tab Not completely working
717 @item H263(+) @tab X @tab X @tab Also known as Real Video 1.0
718 @item MJPEG @tab X @tab X
719 @item Lossless MJPEG @tab X @tab X
720 @item Apple MJPEG-B @tab @tab X
721 @item Sunplus MJPEG @tab @tab X @tab fourcc: SP5X
722 @item DV @tab X @tab X
723 @item Huff YUV @tab X @tab X
724 @item FFmpeg Video 1 @tab X @tab X @tab Lossless codec (fourcc: FFV1)
725 @item Asus v1 @tab X @tab X @tab fourcc: ASV1
726 @item Asus v2 @tab X @tab X @tab fourcc: ASV2
727 @item Creative YUV @tab @tab X @tab fourcc: CYUV
728 @item H.264 @tab @tab X
729 @item Sorenson Video 1 @tab X @tab X @tab fourcc: SVQ1
730 @item Sorenson Video 3 @tab @tab X @tab fourcc: SVQ3
731 @item On2 VP3 @tab @tab X @tab still experimental
732 @item Theora @tab @tab X @tab still experimental
733 @item Intel Indeo 3 @tab @tab X @tab only works on i386 right now
734 @item FLV @tab X @tab X @tab Flash H263 variant
735 @item ATI VCR1 @tab @tab X @tab fourcc: VCR1
736 @item ATI VCR2 @tab @tab X @tab fourcc: VCR2
737 @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR
738 @item 4X Video @tab @tab X @tab used in certain computer games
739 @item Sony Playstation MDEC @tab @tab X
740 @item Id RoQ @tab @tab X @tab used in Quake III, Jedi Knight 2, other computer games
741 @item Xan/WC3 @tab @tab X @tab used in Wing Commander III .MVE files
742 @item Interplay Video @tab @tab X @tab used in Interplay .MVE files
743 @item Apple Animation @tab @tab X @tab fourcc: 'rle '
744 @item Apple Graphics @tab @tab X @tab fourcc: 'smc '
745 @item Apple Video @tab @tab X @tab fourcc: rpza
746 @item Cinepak @tab @tab X
747 @item Microsoft RLE @tab @tab X
748 @item Microsoft Video-1 @tab @tab X
749 @item Westwood VQA @tab @tab X
750 @item Id Cinematic Video @tab @tab X @tab used in Quake II
751 @item Planar RGB @tab @tab X @tab fourcc: 8BPS
752 @item FLIC video @tab @tab X
753 @item Duck TrueMotion v1 @tab @tab X @tab fourcc: DUCK
754 @item VMD Video @tab @tab X @tab used in Sierra VMD files
755 @item MSZH @tab @tab X @tab Part of LCL
756 @item ZLIB @tab X @tab X @tab Part of LCL, encoder experimental
757 @end multitable
759 @code{X} means that the encoding (resp. decoding) is supported.
761 Check at @url{} to
762 get a precise comparison of FFmpeg MPEG4 codec compared to the other
763 solutions.
765 @section Audio Codecs
767 @multitable @columnfractions .4 .1 .1 .1 .7
768 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
769 @item MPEG audio layer 2 @tab IX @tab IX
770 @item MPEG audio layer 1/3 @tab IX @tab IX
771 @tab MP3 encoding is supported through the external library LAME
772 @item AC3 @tab IX @tab X
773 @tab liba52 is used internally for decoding
774 @item Vorbis @tab X @tab X
775 @tab supported through the external library libvorbis
776 @item WMA V1/V2 @tab @tab X
777 @item Microsoft ADPCM @tab X @tab X
778 @item MS IMA ADPCM @tab X @tab X
779 @item QT IMA ADPCM @tab @tab X
780 @item 4X IMA ADPCM @tab @tab X
781 @item G.726 ADPCM @tab X @tab X
782 @item Duck DK3 IMA ADPCM @tab @tab X
783 @tab used in some Sega Saturn console games
784 @item Duck DK4 IMA ADPCM @tab @tab X
785 @tab used in some Sega Saturn console games
786 @item Westwood Studios IMA ADPCM @tab @tab X
787 @tab used in Westwood Studios games like Command and Conquer
788 @item SMJPEG IMA ADPCM @tab @tab X
789 @tab used in certain Loki game ports
790 @item CD-ROM XA ADPCM @tab @tab X
791 @item CRI ADX ADPCM @tab X @tab X
792 @tab used in Sega Dreamcast games
793 @item Electronic Arts ADPCM @tab @tab X
794 @tab used in various EA titles
795 @item RA144 @tab @tab X
796 @tab Real 14400 bit/s codec
797 @item RA288 @tab @tab X
798 @tab Real 28800 bit/s codec
799 @item AMR-NB @tab X @tab X
800 @tab supported through an external library
801 @item AMR-WB @tab X @tab X
802 @tab supported through an external library
803 @item DV audio @tab @tab X
804 @item Id RoQ DPCM @tab @tab X
805 @tab used in Quake III, Jedi Knight 2, other computer games
806 @item Interplay MVE DPCM @tab @tab X
807 @tab used in various Interplay computer games
808 @item Xan DPCM @tab @tab X
809 @tab used in Origin's Wing Commander IV AVI files
810 @item Apple MACE 3 @tab @tab X
811 @item Apple MACE 6 @tab @tab X
812 @item FLAC @tab @tab X
813 @end multitable
815 @code{X} means that the encoding (resp. decoding) is supported.
817 @code{I} means that an integer only version is available too (ensures highest
818 performances on systems without hardware floating point support).
820 @chapter Platform Specific information
822 @section Linux
824 ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
825 preferred compiler now for ffmpeg. All future optimizations will depend on
826 features only found in GCC 3.2.
828 @section BSD
830 @section Windows
832 @subsection Native Windows compilation
834 @itemize
835 @item Install the current versions of MSYS and MinGW from
836 @url{}. You can find detailed installation
837 instructions in the download section and the FAQ.
839 @item If you want to test the FFmpeg Simple Media Player, also download
840 the MinGW development library of SDL 1.2.x
841 (@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
842 @url{}. Unpack it in a temporary place, and
843 unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
844 directory. Edit the @file{sdl-config} script so that it gives the
845 correct SDL directory when invoked.
847 @item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
849 @item Start the MSYS shell (file @file{msys.bat}).
851 @item Change to the FFMPEG directory and follow
852 the instructions of how to compile ffmpeg (file
853 @file{INSTALL}). Usually, launching @file{./configure} and @file{make}
854 suffices. If you have problems using SDL, verify that
855 @file{sdl-config} can be launched from the MSYS command line.
857 @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
858 @file{ffplay}.
860 @end itemize
862 Notes:
863 @itemize
865 @item The target @file{make wininstaller} can be used to create a
866 Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
867 must be copied in the ffmpeg directory in order to build the
868 installer.
870 @item By using @code{./configure --enable-shared} when configuring ffmpeg,
871 you can build @file{avcodec.dll} and @file{avformat.dll}. With
872 @code{make install} you install the FFmpeg DLLs and the associated
873 headers in @file{Program Files/FFmpeg}.
875 @item Visual C++ compatibility: if you used @code{./configure --enable-shared}
876 when configuring FFmpeg, then FFmpeg tries to use the Microsoft Visual
877 C++ @code{lib} tool to build @code{avcodec.lib} and
878 @code{avformat.lib}. With these libraries, you can link your Visual C++
879 code directly with the FFmpeg DLLs.
881 @end itemize
883 @subsection Cross compilation for Windows with Linux
885 You must use the MinGW cross compilation tools available at
886 @url{}.
888 Then configure ffmpeg with the following options:
889 @example
890 ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
891 @end example
892 (you can change the cross-prefix according to the prefix choosen for the
893 MinGW tools).
895 Then you can easily test ffmpeg with wine
896 (@url{}).
898 @section MacOS X
900 @section BeOS
902 The configure script should guess the configuration itself.
903 Networking support is currently not finished.
904 errno issues fixed by Andrew Bachmann.
906 Old stuff:
908 Fran├žois Revol - revol at free dot fr - April 2002
910 The configure script should guess the configuration itself,
911 however I still didn't tested building on net_server version of BeOS.
913 ffserver is broken (needs poll() implementation).
915 There is still issues with errno codes, which are negative in BeOs, and
916 that ffmpeg negates when returning. This ends up turning errors into
917 valid results, then crashes.
918 (To be fixed)
920 @chapter Developers Guide
922 @section API
923 @itemize
924 @item libavcodec is the library containing the codecs (both encoding and
925 decoding). See @file{libavcodec/apiexample.c} to see how to use it.
927 @item libavformat is the library containing the file formats handling (mux and
928 demux code for several formats). See @file{ffplay.c} to use it in a
929 player. See @file{output_example.c} to use it to generate audio or video
930 streams.
932 @end itemize
934 @section Integrating libavcodec or libavformat in your program
936 You can integrate all the source code of the libraries to link them
937 statically to avoid any version problem. All you need is to provide a
938 'config.mak' and a 'config.h' in the parent directory. See the defines
939 generated by ./configure to understand what is needed.
941 You can use libavcodec or libavformat in your commercial program, but
942 @emph{any patch you make must be published}. The best way to proceed is
943 to send your patches to the ffmpeg mailing list.
945 @section Coding Rules
947 ffmpeg is programmed in the ISO C90 language with a few additional
948 features from ISO C99, namely:
949 @itemize @bullet
950 @item
951 the @samp{inline} keyword;
952 @item
953 @samp{//} comments;
954 @item
955 designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
956 @item
957 compound literals (@samp{x = (struct s) { 17, 23 @};})
958 @end itemize
960 These features are supported by all compilers we care about, so we won't
961 accept patches to remove their use unless they absolutely don't impair
962 clarity and performance.
964 All code must compile with gcc 2.95 and gcc 3.3. Currently, ffmpeg also
965 compiles with several other compilers, such as the Compaq ccc compiler
966 or Sun Studio 9, and we would like to keep it that way unless it would
967 be exceedingly involved. To ensure compatibility, please don't use any
968 additional C99 features or gcc extensions. Watch out especially for:
969 @itemize @bullet
970 @item
971 mixing statements and declarations;
972 @item
973 @samp{long long} (use @samp{int64_t} instead);
974 @item
975 @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
976 @item
977 gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
978 @end itemize
980 Indent size is 4. The TAB character should not be used.
981 The presentation is the one specified by 'indent -i4 -kr'.
983 Main priority in ffmpeg is simplicity and small code size (=less
984 bugs).
986 Comments: for functions visible from other modules, use the JavaDoc
987 format (see examples in @file{libav/utils.c}) so that a documentation
988 can be generated automatically.
990 fprintf and printf are forbidden in libavformat and libavcodec,
991 please use av_log() instead.
993 @section Submitting patches
995 When you submit your patch, try to send a unified diff (diff '-up'
996 option). I cannot read other diffs :-)
998 Run the regression tests before submitting a patch so that you can
999 verify that there are no big problems.
1001 Patches should be posted as base64 encoded attachments (or any other
1002 encoding which ensures that the patch wont be trashed during
1003 transmission) to the ffmpeg-devel mailinglist, see
1004 @url{}
1006 It also helps quite a bit if you tell us what the patch does (for example
1007 'replaces lrint by lrintf') , and why (for example '*bsd isnt c99 compliant
1008 and has no lrint()')
1010 @section Regression tests
1012 Before submitting a patch (or committing with CVS), you should at least
1013 test that you did not break anything.
1015 The regression test build a synthetic video stream and a synthetic
1016 audio stream. Then these are encoded then decoded with all codecs or
1017 formats. The CRC (or MD5) of each generated file is recorded in a
1018 result file. Then a 'diff' is launched with the reference results and
1019 the result file.
1021 The regression test then goes on to test the ffserver code with a
1022 limited set of streams. It is important that this step runs correctly
1023 as well.
1025 Run 'make test' to test all the codecs and formats.
1027 Run 'make fulltest' to test all the codecs, formats and ffserver.
1029 [Of course, some patches may change the regression tests results. In
1030 this case, the regression tests reference results shall be modified
1031 accordingly].
1033 @bye