Statistics
| Branch: | Revision:

ffmpeg / doc / ffmpeg-doc.texi @ d2bfadc0

History | View | Annotate | Download (31 KB)

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 -ss position
177
seek to given time position. @code{hh:mm:ss[.xxx]} syntax is also
178
supported.
179

    
180
@item -title string       
181
set the title
182

    
183
@item -author string      
184
set the author
185

    
186
@item -copyright string   
187
set the copyright
188

    
189
@item -comment string     
190
set the comment
191

    
192
@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:
196

    
197
@example
198
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
199
@end example
200

    
201
@item -hq
202
activate high quality settings
203

    
204
@end table
205

    
206
@section Video Options
207

    
208
@table @option
209
@item -b bitrate
210
set the video bitrate in kbit/s (default = 200 kb/s)
211
@item -r fps           
212
set frame rate (default = 25)
213
@item -s size             
214
set frame size. The format is @samp{WxH} (default 160x128).  The
215
following abbreviations are recognized:
216
@table @samp
217
@item sqcif
218
128x96
219
@item qcif
220
176x144
221
@item cif
222
352x288
223
@item 4cif
224
704x576
225
@end table
226

    
227
@item -aspect aspect
228
set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
229
@item -croptop size
230
set top crop band size (in pixels)
231
@item -cropbottom size
232
set bottom crop band size (in pixels)
233
@item -cropleft size
234
set left crop band size (in pixels)
235
@item -cropright size
236
set right crop band size (in pixels)
237
@item -padtop size
238
set top pad band size (in pixels)
239
@item -padbottom size
240
set bottom pad band size (in pixels)
241
@item -padleft size
242
set left pad band size (in pixels)
243
@item -padright size
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)
249
@item -vn
250
disable video recording
251
@item -bt tolerance       
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)
257
@item -bufsize size
258
set ratecontrol buffere size (in kbit)
259
@item -vcodec codec       
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.
262
@item -sameq
263
use same video quality as source (implies VBR)
264

    
265
@item -pass n  
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
269
pass.
270

    
271
@item -passlogfile file   
272
select two pass log file name to @var{file}.
273

    
274
@end table
275

    
276
@section Advanced Video Options
277

    
278
@table @option
279
@item -g gop_size         
280
set the group of picture size
281
@item -intra              
282
use only intra frames
283
@item -qscale q           
284
use fixed video quantiser scale (VBR)
285
@item -qmin q             
286
min video quantiser scale (VBR)
287
@item -qmax q             
288
max video quantiser scale (VBR)
289
@item -qdiff q            
290
max difference between the quantiser scale (VBR)
291
@item -qblur blur         
292
video quantiser scale blur (VBR)
293
@item -qcomp compression  
294
video quantiser scale compression (VBR)
295

    
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
311
@item -me method
312
set motion estimation method to @var{method}. Available methods are
313
(from lower to best quality):
314
@table @samp
315
@item zero
316
Try just the (0, 0) vector.
317
@item phods
318
@item log
319
@item x1
320
@item epzs
321
(default method)
322
@item full
323
exhaustive search (slow and marginally better than epzs)
324
@end table
325

    
326
@item -dct_algo algo
327
set dct algorithm to @var{algo}. Available values are:
328
@table @samp
329
@item 0
330
FF_DCT_AUTO (default)
331
@item 1
332
FF_DCT_FASTINT
333
@item 2
334
FF_DCT_INT
335
@item 3
336
FF_DCT_MMX
337
@item 4
338
FF_DCT_MLIB
339
@item 5
340
FF_DCT_ALTIVEC
341
@end table
342

    
343
@item -idct_algo algo
344
set idct algorithm to @var{algo}. Available values are:
345
@table @samp
346
@item 0
347
FF_IDCT_AUTO (default)
348
@item 1
349
FF_IDCT_INT          
350
@item 2
351
FF_IDCT_SIMPLE       
352
@item 3
353
FF_IDCT_SIMPLEMMX    
354
@item 4
355
FF_IDCT_LIBMPEG2MMX  
356
@item 5
357
FF_IDCT_PS2          
358
@item 6
359
FF_IDCT_MLIB         
360
@item 7
361
FF_IDCT_ARM          
362
@item 8
363
FF_IDCT_ALTIVEC      
364
@item 9
365
FF_IDCT_SH4          
366
@item 10
367
FF_IDCT_SIMPLEARM    
368
@end table
369

    
370
@item -er n
371
set error resilience to @var{n}.
372
@table @samp
373
@item 1 
374
FF_ER_CAREFULL (default)
375
@item 2
376
FF_ER_COMPLIANT
377
@item 3
378
FF_ER_AGGRESSIVE
379
@item 4
380
FF_ER_VERY_AGGRESSIVE
381
@end table
382

    
383
@item -ec bit_mask
384
set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
385
the following values:
386
@table @samp
387
@item 1
388
FF_EC_GUESS_MVS (default=enabled)
389
@item 2
390
FF_EC_DEBLOCK (default=enabled)
391
@end table
392

    
393
@item -bf frames
394
use 'frames' B frames (supported for MPEG-1, MPEG-2 and MPEG-4)
395
@item -mbd mode
396
macroblock decision
397
@table @samp
398
@item 0
399
FF_MB_DECISION_SIMPLE: use mb_cmp (cannot change it yet in ffmpeg)
400
@item 1
401
FF_MB_DECISION_BITS: chooses the one which needs the fewest bits
402
@item 2
403
FF_MB_DECISION_RD: rate distoration
404
@end table
405

    
406
@item -4mv
407
use four motion vector by macroblock (only MPEG-4)
408
@item -part
409
use data partitioning (only MPEG-4)
410
@item -bug param
411
workaround not auto detected encoder bugs
412
@item -strict strictness
413
how strictly to follow the standarts
414
@item -aic
415
enable Advanced intra coding (h263+)
416
@item -umv
417
enable Unlimited Motion Vector (h263+)
418

    
419
@item -deinterlace
420
deinterlace pictures
421
@item -interlace
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
426
losses.
427
@item -psnr
428
calculate PSNR of compressed frames
429
@item -vstats
430
dump video coding statistics to @file{vstats_HHMMSS.log}.
431
@item -vhook module
432
insert video processing @var{module}. @var{module} contains the module
433
name and its parameters separated by spaces.
434
@end table
435

    
436
@section Audio Options
437

    
438
@table @option
439
@item -ab bitrate         
440
set audio bitrate (in kbit/s)
441
@item -ar freq    
442
set the audio sampling freq (default = 44100 Hz)
443
@item -ab bitrate 
444
set the audio bitrate in kbit/s (default = 64)
445
@item -ac channels
446
set the number of audio channels (default = 1)
447
@item -an
448
disable audio recording
449
@item -acodec codec
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.
452
@end table
453

    
454
@section Audio/Video grab options
455

    
456
@table @option
457
@item -vd device
458
set video grab device (e.g. @file{/dev/video0})
459
@item -vc channel
460
set video grab channel (DV1394 only)
461
@item -tvstd standard
462
set television standard (NTSC, PAL (SECAM))
463
@item -dv1394
464
set DV1394 grab
465
@item -ad device
466
set audio device (e.g. @file{/dev/dsp})
467
@end table
468

    
469
@section Advanced options
470

    
471
@table @option
472
@item -map file:stream    
473
set input stream mapping
474
@item -debug
475
print specific debug info
476
@item -benchmark          
477
add timings for benchmarking
478
@item -hex                
479
dump each input packet
480
@item -bitexact
481
only use bit exact algorithms (for codec testing)
482
@item -ps size
483
set packet size in bits
484
@item -re
485
read input at native frame rate. Mainly used to simulate a grab device.
486
@item -loop
487
loop over the input stream. Currently it works only for image
488
streams. This option is used for ffserver automatic testing.
489
@end table
490

    
491
@node FFmpeg formula evaluator
492
@section FFmpeg formula evaluator
493

    
494
When evaluating a rate control string, FFmpeg uses an internal formula
495
evaluator. 
496

    
497
The following binary operators are available: @code{+}, @code{-},
498
@code{*}, @code{/}, @code{^}.
499

    
500
The following unary operators are available: @code{+}, @code{-},
501
@code{(...)}.
502

    
503
The following functions are available:
504
@table @var
505
@item sinh(x)
506
@item cosh(x)
507
@item tanh(x)
508
@item sin(x)
509
@item cos(x)
510
@item tan(x)
511
@item exp(x)
512
@item log(x)
513
@item squish(x)
514
@item gauss(x)
515
@item abs(x)
516
@item max(x, y)
517
@item min(x, y)
518
@item gt(x, y)
519
@item lt(x, y)
520
@item eq(x, y)
521
@item bits2qp(bits)
522
@item qp2bits(qp)
523
@end table
524

    
525
The following constants are available:
526
@table @var
527
@item PI
528
@item E
529
@item iTex
530
@item pTex
531
@item tex
532
@item mv
533
@item fCode
534
@item iCount
535
@item mcVar
536
@item var
537
@item isI
538
@item isP
539
@item isB
540
@item avgQP
541
@item qComp
542
@item avgIITex
543
@item avgPITex
544
@item avgPPTex
545
@item avgBPTex
546
@item avgTex
547
@end table
548

    
549
@c man end
550

    
551
@ignore
552

    
553
@setfilename ffmpeg
554
@settitle FFmpeg video converter
555

    
556
@c man begin SEEALSO
557
ffserver(1), ffplay(1) and the html documentation of @file{ffmpeg}.
558
@c man end
559

    
560
@c man begin AUTHOR
561
Fabrice Bellard
562
@c man end
563

    
564
@end ignore
565

    
566
@section Protocols
567

    
568
The filename can be @file{-} to read from the standard input or to write
569
to the standard output.
570

    
571
ffmpeg handles also many protocols specified with the URL syntax.
572

    
573
Use 'ffmpeg -formats' to have a list of the supported protocols.
574

    
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 :-)
578

    
579
@chapter Tips
580

    
581
@itemize
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:
586

    
587
@example
588
ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
589
@end example
590

    
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.
597

    
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).
603

    
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).
606

    
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
609
quality).
610

    
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.
614

    
615
@end itemize
616

    
617
@chapter Supported File Formats and Codecs
618

    
619
You can use the @code{-formats} option to have an exhaustive list.
620

    
621
@section File Formats
622

    
623
FFmpeg supports the following file formats through the @code{libavformat}
624
library:
625

    
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
671
@tab .fli/.flc files
672
@item Sierra VMD       @tab    @tab X
673
@tab used in Sierra CD-ROM games
674
@item Matroska         @tab    @tab X
675
@end multitable
676

    
677
@code{X} means that the encoding (resp. decoding) is supported.
678

    
679
@section Image Formats
680

    
681
FFmpeg can read and write images for each frame of a video sequence. The
682
following image formats are supported:
683

    
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
694
@end multitable
695

    
696
@code{X} means that the encoding (resp. decoding) is supported.
697

    
698
@section Video Codecs
699

    
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
750
@end multitable
751

    
752
@code{X} means that the encoding (resp. decoding) is supported.
753

    
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
756
solutions.
757

    
758
@section Audio Codecs
759

    
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
806
@end multitable
807

    
808
@code{X} means that the encoding (resp. decoding) is supported.
809

    
810
@code{I} means that an integer only version is available too (ensures highest
811
performances on systems without hardware floating point support).
812

    
813
@chapter Platform Specific information
814

    
815
@section Linux
816

    
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.
820

    
821
@section BSD
822

    
823
@section Windows
824

    
825
@subsection Native Windows compilation
826

    
827
@itemize
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.
831

    
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.
839

    
840
@item Extract the current version of FFmpeg (the latest release version or the current CVS snapshot whichever is recommended).
841
 
842
@item Start the MSYS shell (file @file{msys.bat}).
843

    
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.
849

    
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 
851
@file{ffplay}.
852

    
853
@end itemize
854

    
855
Notes: 
856
@itemize
857

    
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
861
installer.
862

    
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}. 
867

    
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.
873

    
874
@end itemize
875

    
876
@subsection Cross compilation for Windows with Linux
877

    
878
You must use the MinGW cross compilation tools available at
879
@url{http://www.mingw.org/}.
880

    
881
Then configure ffmpeg with the following options:
882
@example
883
./configure --enable-mingw32 --cross-prefix=i386-mingw32msvc-
884
@end example
885
(you can change the cross-prefix according to the prefix choosen for the
886
MinGW tools).
887

    
888
Then you can easily test ffmpeg with wine
889
(@url{http://www.winehq.com/}).
890

    
891
@section MacOS X
892

    
893
@section BeOS
894

    
895
The configure script should guess the configuration itself.
896
Networking support is currently not finished.
897
errno issues fixed by Andrew Bachmann.
898

    
899
Old stuff:
900

    
901
Fran?ois Revol - revol at free dot fr - April 2002
902

    
903
The configure script should guess the configuration itself, 
904
however I still didn't tested building on net_server version of BeOS.
905

    
906
ffserver is broken (needs poll() implementation).
907

    
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.
911
(To be fixed)
912

    
913
@chapter Developers Guide
914

    
915
@section API
916
@itemize
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.
919

    
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
923
streams.
924

    
925
@end itemize
926

    
927
@section Integrating libavcodec or libavformat in your program
928

    
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.
933

    
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.
937

    
938
@section Coding Rules
939

    
940
ffmpeg is programmed in the ISO C90 language with a few additional
941
features from ISO C99, namely:
942
@itemize @bullet
943
@item
944
the @samp{inline} keyword;
945
@item
946
@samp{//} comments;
947
@item
948
designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
949
@item
950
compound literals (@samp{x = (struct s) { 17, 23 @};})
951
@end itemize
952

    
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.
956

    
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:
962
@itemize @bullet
963
@item
964
mixing statements and declarations;
965
@item
966
@samp{long long} (use @samp{int64_t} instead);
967
@item
968
@samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
969
@item
970
gcc statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
971
@end itemize
972

    
973
Indent size is 4. The TAB character should not be used.
974
The presentation is the one specified by 'indent -i4 -kr'.
975

    
976
Main priority in ffmpeg is simplicity and small code size (=less
977
bugs).
978

    
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.
982

    
983
fprintf and printf are forbidden in libavformat and libavcodec, 
984
please use av_log() instead.
985

    
986
@section Submitting patches
987

    
988
When you submit your patch, try to send a unified diff (diff '-up'
989
option). I cannot read other diffs :-)
990

    
991
Run the regression tests before submitting a patch so that you can
992
verify that there are no big problems.
993

    
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}
998

    
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()')
1002

    
1003
@section Regression tests
1004

    
1005
Before submitting a patch (or committing with CVS), you should at least
1006
test that you did not break anything.
1007

    
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
1012
the result file.
1013

    
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
1016
as well.
1017

    
1018
Run 'make test' to test all the codecs and formats.
1019

    
1020
Run 'make fulltest' to test all the codecs, formats and ffserver.
1021

    
1022
[Of course, some patches may change the regression tests results. In
1023
this case, the regression tests reference results shall be modified
1024
accordingly].
1025

    
1026
@bye