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