Statistics
| Branch: | Revision:

ffmpeg / doc / ffmpeg-doc.texi @ ca1c3f52

History | View | Annotate | Download (28.6 KB)

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