1 \input texinfo @c -*- texinfo -*-
3 @settitle FFmpeg Documentation
6 @center @titlefont{FFmpeg Documentation}
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.
26 @section Video and Audio grabbing
28 FFmpeg can use a video4linux compatible video source and any Open Sound
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
41 @section Video and Audio file format conversion
43 * ffmpeg can use any supported file format and protocol as input:
47 * You can input from YUV files:
50 ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
53 It will use the files:
55 /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
56 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
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:
67 ffmpeg -i /tmp/test.yuv /tmp/out.avi
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:
77 ffmpeg -i mydivx.avi -o hugefile.yuv
80 * You can set several input files and output files:
83 ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
86 Convert the audio file a.wav and the raw yuv video file a.yuv
89 * You can also do audio and video conversions at the same time:
92 ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
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:
101 ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
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
111 ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
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}.
130 The generic syntax is:
133 @c man begin SYNOPSIS
134 ffmpeg [[options][@option{-i} @var{input_file}]]... @{[options] @var{output_file}@}...
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
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.
151 @section Main options
161 show available formats, codecs, protocols, ...
170 overwrite output files
173 set the recording time in seconds. @code{hh:mm:ss[.xxx]} syntax is also
177 seek to given time position. @code{hh:mm:ss[.xxx]} syntax is also
186 @item -copyright string
189 @item -comment string
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:
198 ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
202 activate high quality settings
206 @section Video Options
210 set the video bitrate in kbit/s (default = 200 kb/s)
212 set frame rate (default = 25)
214 set frame size. The format is @samp{WxH} (default 160x128). The
215 following abbreviations are recognized:
228 set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
230 set top crop band size (in pixels)
231 @item -cropbottom size
232 set bottom crop band size (in pixels)
234 set left crop band size (in pixels)
235 @item -cropright size
236 set right crop band size (in pixels)
238 set top pad band size (in pixels)
239 @item -padbottom size
240 set bottom pad band size (in pixels)
242 set left pad band size (in pixels)
244 set right pad band size (in pixels)
245 @item -padcolor color
246 set right pad band size (hex). The value for pad color is expressed
247 as a six digit hexidecimal number where the first two digits represent red,
248 middle two digits green and last two digits blue. Defaults to 000000 (black)
250 disable video recording
252 set video bitrate tolerance (in kbit/s)
253 @item -maxrate bitrate
254 set max video bitrate tolerance (in kbit/s)
255 @item -minrate bitrate
256 set min video bitrate tolerance (in kbit/s)
258 set ratecontrol buffere size (in kbit)
260 force video codec to @var{codec}. Use the @code{copy} special value to
261 tell that the raw codec data must be copied as is.
263 use same video quality as source (implies VBR)
266 select the pass number (1 or 2). It is useful to do two pass
267 encoding. The statistics of the video are recorded in the first pass and
268 the video at the exact requested bit rate is generated in the second
271 @item -passlogfile file
272 select two pass log file name to @var{file}.
276 @section Advanced Video Options
280 set the group of picture size
282 use only intra frames
284 use fixed video quantiser scale (VBR)
286 min video quantiser scale (VBR)
288 max video quantiser scale (VBR)
290 max difference between the quantiser scale (VBR)
292 video quantiser scale blur (VBR)
293 @item -qcomp compression
294 video quantiser scale compression (VBR)
296 @item -rc_init_cplx complexity
297 initial complexity for 1-pass encoding
298 @item -b_qfactor factor
299 qp factor between p and b frames
300 @item -i_qfactor factor
301 qp factor between p and i frames
302 @item -b_qoffset offset
303 qp offset between p and b frames
304 @item -i_qoffset offset
305 qp offset between p and i frames
306 @item -rc_eq equation
307 set rate control equation (@pxref{FFmpeg formula
308 evaluator}). Default is @code{tex^qComp}.
309 @item -rc_override override
310 rate control override for specific intervals
312 set motion estimation method to @var{method}. Available methods are
313 (from lower to best quality):
316 Try just the (0, 0) vector.
323 exhaustive search (slow and marginally better than epzs)
327 set dct algorithm to @var{algo}. Available values are:
330 FF_DCT_AUTO (default)
343 @item -idct_algo algo
344 set idct algorithm to @var{algo}. Available values are:
347 FF_IDCT_AUTO (default)
371 set error resilience to @var{n}.
374 FF_ER_CAREFULL (default)
380 FF_ER_VERY_AGGRESSIVE
384 set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
385 the following values:
388 FF_EC_GUESS_MVS (default=enabled)
390 FF_EC_DEBLOCK (default=enabled)
394 use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
399 FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
401 FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
403 FF_MB_DECISION_RD: rate distoration
407 use four motion vector by macroblock (only MPEG-4)
409 use data partitioning (only MPEG-4)
411 workaround not auto detected encoder bugs
412 @item -strict strictness
413 how strictly to follow the standarts
415 enable Advanced intra coding (h263+)
417 enable Unlimited Motion Vector (h263+)
422 force interlacing support in encoder (only MPEG-2 and MPEG-4). Use this option
423 if your input file is interlaced and if you want to keep the interlaced
424 format for minimum losses. The alternative is to deinterlace the input
425 stream with @option{-deinterlace}, but deinterlacing introduces more
428 calculate PSNR of compressed frames
430 dump video coding statistics to @file{vstats_HHMMSS.log}.
432 insert video processing @var{module}. @var{module} contains the module
433 name and its parameters separated by spaces.
436 @section Audio Options
440 set audio bitrate (in kbit/s)
442 set the audio sampling freq (default = 44100 Hz)
444 set the audio bitrate in kbit/s (default = 64)
446 set the number of audio channels (default = 1)
448 disable audio recording
450 force audio codec to @var{codec}. Use the @code{copy} special value to
451 tell that the raw codec data must be copied as is.
454 @section Audio/Video grab options
458 set video grab device (e.g. @file{/dev/video0})
460 set video grab channel (DV1394 only)
461 @item -tvstd standard
462 set television standard (NTSC, PAL (SECAM))
466 set audio device (e.g. @file{/dev/dsp})
469 @section Advanced options
472 @item -map file:stream
473 set input stream mapping
475 print specific debug info
477 add timings for benchmarking
479 dump each input packet
481 only use bit exact algorithms (for codec testing)
483 set packet size in bits
485 read input at native frame rate. Mainly used to simulate a grab device.
487 loop over the input stream. Currently it works only for image
488 streams. This option is used for ffserver automatic testing.
491 @node FFmpeg formula evaluator
492 @section FFmpeg formula evaluator
494 When evaluating a rate control string, FFmpeg uses an internal formula
497 The following binary operators are available: @code{+}, @code{-},
498 @code{*}, @code{/}, @code{^}.
500 The following unary operators are available: @code{+}, @code{-},
503 The following functions are available:
525 The following constants are available:
554 @settitle FFmpeg video converter
557 ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
568 The filename can be @file{-} to read from the standard input or to write
569 to the standard output.
571 ffmpeg handles also many protocols specified with the URL syntax.
573 Use 'ffmpeg -formats' to have a list of the supported protocols.
575 The protocol @code{http:} is currently used only to communicate with
576 ffserver (see the ffserver documentation). When ffmpeg will be a
577 video player it will also be used for streaming :-)
582 @item For streaming at very low bit rate application, use a low frame rate
583 and a small gop size. This is especially true for real video where
584 the Linux player does not seem to be very fast, so it can miss
585 frames. An example is:
588 ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
591 @item The parameter 'q' which is displayed while encoding is the current
592 quantizer. The value of 1 indicates that a very good quality could
593 be achieved. The value of 31 indicates the worst quality. If q=31
594 too often, it means that the encoder cannot compress enough to meet
595 your bit rate. You must either increase the bit rate, decrease the
596 frame rate or decrease the frame size.
598 @item If your computer is not fast enough, you can speed up the
599 compression at the expense of the compression ratio. You can use
600 '-me zero' to speed up motion estimation, and '-intra' to disable
601 completely motion estimation (you have only I frames, which means it
602 is about as good as JPEG compression).
604 @item To have very low bitrates in audio, reduce the sampling frequency
605 (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
607 @item To have a constant quality (but a variable bitrate), use the option
608 '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
611 @item When converting video files, you can use the '-sameq' option which
612 uses in the encoder the same quality factor than in the decoder. It
613 allows to be almost lossless in encoding.
617 @chapter Supported File Formats and Codecs
619 You can use the @code{-formats} option to have an exhaustive list.
621 @section File Formats
623 FFmpeg supports the following file formats through the @code{libavformat}
626 @multitable @columnfractions .4 .1 .1
627 @item Supported File Format @tab Encoding @tab Decoding @tab Comments
628 @item MPEG audio @tab X @tab X
629 @item MPEG1 systems @tab X @tab X
630 @tab muxed audio and video
631 @item MPEG2 PS @tab X @tab X
632 @tab also known as @code{VOB} file
633 @item MPEG2 TS @tab @tab X
634 @tab also known as DVB Transport Stream
635 @item ASF@tab X @tab X
636 @item AVI@tab X @tab X
637 @item WAV@tab X @tab X
638 @item Macromedia Flash@tab X @tab X
639 @tab Only embedded audio is decoded
640 @item FLV @tab X @tab X
641 @tab Macromedia Flash video files
642 @item Real Audio and Video @tab X @tab X
643 @item Raw AC3 @tab X @tab X
644 @item Raw MJPEG @tab X @tab X
645 @item Raw MPEG video @tab X @tab X
646 @item Raw PCM8/16 bits, mulaw/Alaw@tab X @tab X
647 @item Raw CRI ADX audio @tab X @tab X
648 @item SUN AU format @tab X @tab X
649 @item NUT @tab X @tab X @tab NUT Open Container Format
650 @item Quicktime @tab X @tab X
651 @item MPEG4 @tab X @tab X
652 @tab MPEG4 is a variant of Quicktime
653 @item Raw MPEG4 video @tab X @tab X
654 @item DV @tab X @tab X
655 @item 4xm @tab @tab X
656 @tab 4X Technologies format, used in some games
657 @item Playstation STR @tab @tab X
658 @item Id RoQ @tab @tab X
659 @tab used in Quake III, Jedi Knight 2, other computer games
660 @item Interplay MVE @tab @tab X
661 @tab format used in various Interplay computer games
662 @item WC3 Movie @tab @tab X
663 @tab multimedia format used in Origin's Wing Commander III computer game
664 @item Sega FILM/CPK @tab @tab X
665 @tab used in many Sega Saturn console games
666 @item Westwood Studios VQA/AUD @tab @tab X
667 @tab Multimedia formats used in Westwood Studios games
668 @item Id Cinematic (.cin) @tab @tab X
669 @tab Used in Quake II
670 @item FLIC format @tab @tab X
672 @item Sierra VMD @tab @tab X
673 @tab used in Sierra CD-ROM games
674 @item Matroska @tab @tab X
677 @code{X} means that the encoding (resp. decoding) is supported.
679 @section Image Formats
681 FFmpeg can read and write images for each frame of a video sequence. The
682 following image formats are supported:
684 @multitable @columnfractions .4 .1 .1
685 @item Supported Image Format @tab Encoding @tab Decoding @tab Comments
686 @item PGM, PPM @tab X @tab X
687 @item PAM @tab X @tab X @tab PAM is a PNM extension with alpha support
688 @item PGMYUV @tab X @tab X @tab PGM with U and V components in YUV 4:2:0
689 @item JPEG @tab X @tab X @tab Progressive JPEG is not supported
690 @item .Y.U.V @tab X @tab X @tab One raw file per component
691 @item Animated GIF @tab X @tab X @tab Only uncompressed GIFs are generated
692 @item PNG @tab X @tab X @tab 2 bit and 4 bit/pixel not supported yet
693 @item SGI @tab X @tab X @tab SGI RGB image format
696 @code{X} means that the encoding (resp. decoding) is supported.
698 @section Video Codecs
700 @multitable @columnfractions .4 .1 .1 .7
701 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
702 @item MPEG1 video @tab X @tab X
703 @item MPEG2 video @tab X @tab X
704 @item MPEG4 @tab X @tab X @tab Also known as DIVX4/5
705 @item MSMPEG4 V1 @tab X @tab X
706 @item MSMPEG4 V2 @tab X @tab X
707 @item MSMPEG4 V3 @tab X @tab X @tab Also known as DIVX3
708 @item WMV7 @tab X @tab X
709 @item WMV8 @tab X @tab X @tab Not completely working
710 @item H263(+) @tab X @tab X @tab Also known as Real Video 1.0
711 @item MJPEG @tab X @tab X
712 @item Lossless MJPEG @tab X @tab X
713 @item Apple MJPEG-B @tab @tab X
714 @item Sunplus MJPEG @tab @tab X @tab fourcc: SP5X
715 @item DV @tab X @tab X
716 @item Huff YUV @tab X @tab X
717 @item FFmpeg Video 1 @tab X @tab X @tab Lossless codec (fourcc: FFV1)
718 @item Asus v1 @tab X @tab X @tab fourcc: ASV1
719 @item Asus v2 @tab X @tab X @tab fourcc: ASV2
720 @item Creative YUV @tab @tab X @tab fourcc: CYUV
721 @item H.264 @tab @tab X
722 @item Sorenson Video 1 @tab X @tab X @tab fourcc: SVQ1
723 @item Sorenson Video 3 @tab @tab X @tab fourcc: SVQ3
724 @item On2 VP3 @tab @tab X @tab still experimental
725 @item Theora @tab @tab X @tab still experimental
726 @item Intel Indeo 3 @tab @tab X @tab only works on i386 right now
727 @item FLV @tab X @tab X @tab Flash H263 variant
728 @item ATI VCR1 @tab @tab X @tab fourcc: VCR1
729 @item ATI VCR2 @tab @tab X @tab fourcc: VCR2
730 @item Cirrus Logic AccuPak @tab @tab X @tab fourcc: CLJR
731 @item 4X Video @tab @tab X @tab used in certain computer games
732 @item Sony Playstation MDEC @tab @tab X
733 @item Id RoQ @tab @tab X @tab used in Quake III, Jedi Knight 2, other computer games
734 @item Xan/WC3 @tab @tab X @tab used in Wing Commander III .MVE files
735 @item Interplay Video @tab @tab X @tab used in Interplay .MVE files
736 @item Apple Animation @tab @tab X @tab fourcc: 'rle '
737 @item Apple Graphics @tab @tab X @tab fourcc: 'smc '
738 @item Apple Video @tab @tab X @tab fourcc: rpza
739 @item Cinepak @tab @tab X
740 @item Microsoft RLE @tab @tab X
741 @item Microsoft Video-1 @tab @tab X
742 @item Westwood VQA @tab @tab X
743 @item Id Cinematic Video @tab @tab X @tab used in Quake II
744 @item Planar RGB @tab @tab X @tab fourcc: 8BPS
745 @item FLIC video @tab @tab X
746 @item Duck TrueMotion v1 @tab @tab X @tab fourcc: DUCK
747 @item VMD Video @tab @tab X @tab used in Sierra VMD files
748 @item MSZH @tab @tab X @tab Part of LCL
749 @item ZLIB @tab X @tab X @tab Part of LCL, encoder experimental
752 @code{X} means that the encoding (resp. decoding) is supported.
754 Check at @url{http://www.mplayerhq.hu/~michael/codec-features.html} to
755 get a precise comparison of FFmpeg MPEG4 codec compared to the other
758 @section Audio Codecs
760 @multitable @columnfractions .4 .1 .1 .1 .7
761 @item Supported Codec @tab Encoding @tab Decoding @tab Comments
762 @item MPEG audio layer 2 @tab IX @tab IX
763 @item MPEG audio layer 1/3 @tab IX @tab IX
764 @tab MP3 encoding is supported through the external library LAME
765 @item AC3 @tab IX @tab X
766 @tab liba52 is used internally for decoding
767 @item Vorbis @tab X @tab X
768 @tab supported through the external library libvorbis
769 @item WMA V1/V2 @tab @tab X
770 @item Microsoft ADPCM @tab X @tab X
771 @item MS IMA ADPCM @tab X @tab X
772 @item QT IMA ADPCM @tab @tab X
773 @item 4X IMA ADPCM @tab @tab X
774 @item G.726 ADPCM @tab X @tab X
775 @item Duck DK3 IMA ADPCM @tab @tab X
776 @tab used in some Sega Saturn console games
777 @item Duck DK4 IMA ADPCM @tab @tab X
778 @tab used in some Sega Saturn console games
779 @item Westwood Studios IMA ADPCM @tab @tab X
780 @tab used in Westwood Studios games like Command and Conquer
781 @item SMJPEG IMA ADPCM @tab @tab X
782 @tab used in certain Loki game ports
783 @item CD-ROM XA ADPCM @tab @tab X
784 @item CRI ADX ADPCM @tab X @tab X
785 @tab used in Sega Dreamcast games
786 @item Electronic Arts ADPCM @tab @tab X
787 @tab used in various EA titles
788 @item RA144 @tab @tab X
789 @tab Real 14400 bit/s codec
790 @item RA288 @tab @tab X
791 @tab Real 28800 bit/s codec
792 @item AMR-NB @tab X @tab X
793 @tab supported through an external library
794 @item AMR-WB @tab X @tab X
795 @tab supported through an external library
796 @item DV audio @tab @tab X
797 @item Id RoQ DPCM @tab @tab X
798 @tab used in Quake III, Jedi Knight 2, other computer games
799 @item Interplay MVE DPCM @tab @tab X
800 @tab used in various Interplay computer games
801 @item Xan DPCM @tab @tab X
802 @tab used in Origin's Wing Commander IV AVI files
803 @item Apple MACE 3 @tab @tab X
804 @item Apple MACE 6 @tab @tab X
805 @item FLAC @tab @tab X
808 @code{X} means that the encoding (resp. decoding) is supported.
810 @code{I} means that an integer only version is available too (ensures highest
811 performances on systems without hardware floating point support).
813 @chapter Platform Specific information
817 ffmpeg should be compiled with at least GCC 2.95.3. GCC 3.2 is the
818 preferred compiler now for ffmpeg. All future optimizations will depend on
819 features only found in GCC 3.2.
825 @subsection Native Windows compilation
828 @item Install the current versions of MSYS and MinGW from
829 @url{http://www.mingw.org/}. You can find detailed installation
830 instructions in the download section and the FAQ.
832 @item If you want to test the FFmpeg Simple Media Player, also download
833 the MinGW development library of SDL 1.2.x
834 (@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
835 @url{http://www.libsdl.org}. Unpack it in a temporary place, and
836 unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
837 directory. Edit the @file{sdl-config} script so that it gives the
838 correct SDL directory when invoked.
840 @item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
842 @item Start the MSYS shell (file @file{msys.bat}).
844 @item Change to the FFMPEG directory and follow
845 the instructions of how to compile ffmpeg (file
846 @file{INSTALL}). Usually, launching @file{./configure} and @file{make}
847 suffices. If you have problems using SDL, verify that
848 @file{sdl-config} can be launched from the MSYS command line.
850 @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 @item The target @file{make wininstaller} can be used to create a
859 Nullsoft based Windows installer for FFmpeg and FFplay. @file{SDL.dll}
860 must be copied in the ffmpeg directory in order to build the
863 @item By using @code{./configure --enable-shared} when configuring ffmpeg,
864 you can build @file{avcodec.dll} and @file{avformat.dll}. With
865 @code{make install} you install the FFmpeg DLLs and the associated
866 headers in @file{Program Files/FFmpeg}.
868 @item Visual C++ compatibility: if you used @code{./configure --enable-shared}
869 when configuring FFmpeg, then FFmpeg tries to use the Microsoft Visual
870 C++ @code{lib} tool to build @code{avcodec.lib} and
871 @code{avformat.lib}. With these libraries, you can link your Visual C++
872 code directly with the FFmpeg DLLs.
876 @subsection Cross compilation for Windows with Linux
878 You must use the MinGW cross compilation tools available at
879 @url{http://www.mingw.org/}.
881 Then configure ffmpeg with the following options:
883 ./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
885 (you can change the cross-prefix according to the prefix choosen for the
888 Then you can easily test ffmpeg with wine
889 (@url{http://www.winehq.com/}).
895 The configure script should guess the configuration itself.
896 Networking support is currently not finished.
897 errno issues fixed by Andrew Bachmann.
901 François Revol - revol at free dot fr - April 2002
903 The configure script should guess the configuration itself,
904 however I still didn't tested building on net_server version of BeOS.
906 ffserver is broken (needs poll() implementation).
908 There is still issues with errno codes, which are negative in BeOs, and
909 that ffmpeg negates when returning. This ends up turning errors into
910 valid results, then crashes.
913 @chapter Developers Guide
917 @item libavcodec is the library containing the codecs (both encoding and
918 decoding). See @file{libavcodec/apiexample.c} to see how to use it.
920 @item libavformat is the library containing the file formats handling (mux and
921 demux code for several formats). See @file{ffplay.c} to use it in a
922 player. See @file{output_example.c} to use it to generate audio or video
927 @section Integrating libavcodec or libavformat in your program
929 You can integrate all the source code of the libraries to link them
930 statically to avoid any version problem. All you need is to provide a
931 'config.mak' and a 'config.h' in the parent directory. See the defines
932 generated by ./configure to understand what is needed.
934 You can use libavcodec or libavformat in your commercial program, but
935 @emph{any patch you make must be published}. The best way to proceed is
936 to send your patches to the ffmpeg mailing list.
938 @section Coding Rules
940 ffmpeg is programmed in the ISO C90 language with a few additional
941 features from ISO C99, namely:
944 the @samp{inline} keyword;
948 designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
950 compound literals (@samp{x = (struct s) { 17, 23 @};})
953 These features are supported by all compilers we care about, so we won't
954 accept patches to remove their use unless they absolutely don't impair
955 clarity and performance.
957 All code must compile with gcc 2.95 and gcc 3.3. Currently, ffmpeg also
958 compiles with several other compilers, such as the Compaq ccc compiler
959 or Sun Studio 9, and we would like to keep it that way unless it would
960 be exceedingly involved. To ensure compatibility, please don't use any
961 additional C99 features or gcc extensions. Watch out especially for:
964 mixing statements and declarations;
966 @samp{long long} (use @samp{int64_t} instead);
968 @samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
970 gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
973 Indent size is 4. The TAB character should not be used.
974 The presentation is the one specified by 'indent -i4 -kr'.
976 Main priority in ffmpeg is simplicity and small code size (=less
979 Comments: for functions visible from other modules, use the JavaDoc
980 format (see examples in @file{libav/utils.c}) so that a documentation
981 can be generated automatically.
983 fprintf and printf are forbidden in libavformat and libavcodec,
984 please use av_log() instead.
986 @section Submitting patches
988 When you submit your patch, try to send a unified diff (diff '-up'
989 option). I cannot read other diffs :-)
991 Run the regression tests before submitting a patch so that you can
992 verify that there are no big problems.
994 Patches should be posted as base64 encoded attachments (or any other
995 encoding which ensures that the patch wont be trashed during
996 transmission) to the ffmpeg-devel mailinglist, see
997 @url{http://lists.sourceforge.net/lists/listinfo/ffmpeg-devel}
999 It also helps quite a bit if you tell us what the patch does (for example
1000 'replaces lrint by lrintf') , and why (for example '*bsd isnt c99 compliant
1001 and has no lrint()')
1003 @section Regression tests
1005 Before submitting a patch (or committing with CVS), you should at least
1006 test that you did not break anything.
1008 The regression test build a synthetic video stream and a synthetic
1009 audio stream. Then these are encoded then decoded with all codecs or
1010 formats. The CRC (or MD5) of each generated file is recorded in a
1011 result file. Then a 'diff' is launched with the reference results and
1014 The regression test then goes on to test the ffserver code with a
1015 limited set of streams. It is important that this step runs correctly
1018 Run 'make test' to test all the codecs and formats.
1020 Run 'make fulltest' to test all the codecs, formats and ffserver.
1022 [Of course, some patches may change the regression tests results. In
1023 this case, the regression tests reference results shall be modified