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. | |
115329f1 | 15 | |
9181577c | 16 | The command line interface is designed to be intuitive, in the sense |
4c5f7207 DB |
17 | that FFmpeg tries to figure out all parameters that can possibly be |
18 | derived automatically. You usually only have to specify the target | |
19 | bitrate you want. | |
9181577c FB |
20 | |
21 | FFmpeg can also convert from any sample rate to any other, and resize | |
22 | video on the fly with a high quality polyphase filter. | |
23 | ||
24 | @chapter Quick Start | |
25 | ||
e99c4e10 | 26 | @c man begin EXAMPLES |
9181577c FB |
27 | @section Video and Audio grabbing |
28 | ||
cc58300e RP |
29 | FFmpeg can grab video and audio from devices given that you specify the input |
30 | format and device. | |
e99c4e10 | 31 | |
9181577c | 32 | @example |
cc58300e | 33 | ffmpeg -f audio_device -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg |
9181577c FB |
34 | @end example |
35 | ||
e99c4e10 | 36 | Note that you must activate the right video source and channel before |
4c5f7207 DB |
37 | launching FFmpeg with any TV viewer such as xawtv |
38 | (@url{http://bytesex.org/xawtv/}) by Gerd Knorr. You also | |
39 | have to set the audio recording levels correctly with a | |
e99c4e10 | 40 | standard mixer. |
9181577c | 41 | |
76d2efda BC |
42 | @section X11 grabbing |
43 | ||
913e4081 | 44 | FFmpeg can grab the X11 display. |
76d2efda BC |
45 | |
46 | @example | |
9e0ab666 | 47 | ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg |
76d2efda BC |
48 | @end example |
49 | ||
913e4081 DB |
50 | 0.0 is display.screen number of your X11 server, same as |
51 | the DISPLAY environment variable. | |
76d2efda | 52 | |
0cd4faf9 | 53 | @example |
9e0ab666 | 54 | ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg |
0cd4faf9 PI |
55 | @end example |
56 | ||
57 | 0.0 is display.screen number of your X11 server, same as the DISPLAY environment | |
58 | variable. 10 is the x-offset and 20 the y-offset for the grabbing. | |
59 | ||
6bf40f39 | 60 | @section Video and Audio file format conversion |
9181577c | 61 | |
4c5f7207 | 62 | * FFmpeg can use any supported file format and protocol as input: |
9181577c FB |
63 | |
64 | Examples: | |
65 | ||
4c5f7207 | 66 | * You can use YUV files as input: |
9181577c FB |
67 | |
68 | @example | |
115329f1 | 69 | ffmpeg -i /tmp/test%d.Y /tmp/out.mpg |
9181577c FB |
70 | @end example |
71 | ||
115329f1 | 72 | It will use the files: |
9181577c | 73 | @example |
e99c4e10 FB |
74 | /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V, |
75 | /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc... | |
9181577c FB |
76 | @end example |
77 | ||
e99c4e10 FB |
78 | The Y files use twice the resolution of the U and V files. They are |
79 | raw files, without header. They can be generated by all decent video | |
80 | decoders. You must specify the size of the image with the @option{-s} option | |
4c5f7207 | 81 | if FFmpeg cannot guess it. |
9181577c | 82 | |
4c5f7207 | 83 | * You can input from a raw YUV420P file: |
9181577c FB |
84 | |
85 | @example | |
e99c4e10 | 86 | ffmpeg -i /tmp/test.yuv /tmp/out.avi |
9181577c FB |
87 | @end example |
88 | ||
4c5f7207 DB |
89 | test.yuv is a file containing raw YUV planar data. Each frame is composed |
90 | of the Y plane followed by the U and V planes at half vertical and | |
e99c4e10 | 91 | horizontal resolution. |
9181577c | 92 | |
4c5f7207 | 93 | * You can output to a raw YUV420P file: |
9181577c FB |
94 | |
95 | @example | |
f926cbe7 | 96 | ffmpeg -i mydivx.avi hugefile.yuv |
9181577c FB |
97 | @end example |
98 | ||
99 | * You can set several input files and output files: | |
100 | ||
101 | @example | |
e99c4e10 | 102 | ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg |
9181577c FB |
103 | @end example |
104 | ||
4c5f7207 DB |
105 | Converts the audio file a.wav and the raw YUV video file a.yuv |
106 | to MPEG file a.mpg. | |
9181577c | 107 | |
6bf40f39 | 108 | * You can also do audio and video conversions at the same time: |
9181577c FB |
109 | |
110 | @example | |
e99c4e10 | 111 | ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2 |
9181577c FB |
112 | @end example |
113 | ||
4c5f7207 | 114 | Converts a.wav to MPEG audio at 22050Hz sample rate. |
9181577c FB |
115 | |
116 | * You can encode to several formats at the same time and define a | |
e99c4e10 | 117 | mapping from input stream to output streams: |
9181577c FB |
118 | |
119 | @example | |
5438308f | 120 | ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0 |
9181577c FB |
121 | @end example |
122 | ||
4c5f7207 DB |
123 | Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map |
124 | file:index' specifies which input stream is used for each output | |
e99c4e10 | 125 | stream, in the order of the definition of output streams. |
9181577c FB |
126 | |
127 | * You can transcode decrypted VOBs | |
128 | ||
129 | @example | |
7b900f2d | 130 | ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi |
9181577c FB |
131 | @end example |
132 | ||
4c5f7207 DB |
133 | This is a typical DVD ripping example; the input is a VOB file, the |
134 | output an AVI file with MPEG-4 video and MP3 audio. Note that in this | |
135 | command we use B-frames so the MPEG-4 stream is DivX5 compatible, and | |
136 | GOP size is 300 which means one intra frame every 10 seconds for 29.97fps | |
137 | input video. Furthermore, the audio stream is MP3-encoded so you need | |
1cc60c47 | 138 | to enable LAME support by passing @code{--enable-libmp3lame} to configure. |
4c5f7207 | 139 | The mapping is particularly useful for DVD transcoding |
e99c4e10 | 140 | to get the desired audio language. |
9181577c | 141 | |
4c5f7207 | 142 | NOTE: To see the supported input formats, use @code{ffmpeg -formats}. |
e99c4e10 | 143 | @c man end |
9181577c FB |
144 | |
145 | @chapter Invocation | |
146 | ||
147 | @section Syntax | |
148 | ||
e99c4e10 | 149 | The generic syntax is: |
9181577c | 150 | |
115329f1 | 151 | @example |
e99c4e10 | 152 | @c man begin SYNOPSIS |
28f88dc8 | 153 | ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}... |
e99c4e10 | 154 | @c man end |
9181577c | 155 | @end example |
e99c4e10 | 156 | @c man begin DESCRIPTION |
e99c4e10 | 157 | As a general rule, options are applied to the next specified |
699e77b1 | 158 | file. Therefore, order is important, and you can have the same |
8cc62264 | 159 | option on the command line multiple times. Each occurrence is |
699e77b1 VP |
160 | then applied to the next input or output file. |
161 | ||
eb10acec | 162 | * To set the video bitrate of the output file to 64kbit/s: |
699e77b1 VP |
163 | @example |
164 | ffmpeg -i input.avi -b 64k output.avi | |
165 | @end example | |
166 | ||
167 | * To force the frame rate of the input and output file to 24 fps: | |
168 | @example | |
169 | ffmpeg -r 24 -i input.avi output.avi | |
170 | @end example | |
171 | ||
172 | * To force the frame rate of the output file to 24 fps: | |
173 | @example | |
174 | ffmpeg -i input.avi -r 24 output.avi | |
175 | @end example | |
176 | ||
177 | * To force the frame rate of input file to 1 fps and the output file to 24 fps: | |
178 | @example | |
179 | ffmpeg -r 1 -i input.avi -r 24 output.avi | |
180 | @end example | |
181 | ||
182 | The format option may be needed for raw input files. | |
9181577c | 183 | |
4c5f7207 DB |
184 | By default, FFmpeg tries to convert as losslessly as possible: It |
185 | uses the same audio and video parameters for the outputs as the one | |
e99c4e10 FB |
186 | specified for the inputs. |
187 | @c man end | |
9181577c | 188 | |
e99c4e10 | 189 | @c man begin OPTIONS |
9181577c FB |
190 | @section Main options |
191 | ||
e99c4e10 | 192 | @table @option |
9181577c | 193 | @item -L |
4c5f7207 | 194 | Show license. |
18bff752 | 195 | |
9181577c | 196 | @item -h |
4c5f7207 | 197 | Show help. |
18bff752 | 198 | |
4386f941 DB |
199 | @item -version |
200 | Show version. | |
201 | ||
e99c4e10 | 202 | @item -formats |
4c5f7207 | 203 | Show available formats, codecs, protocols, ... |
18bff752 | 204 | |
115329f1 | 205 | @item -f fmt |
4c5f7207 | 206 | Force format. |
18bff752 | 207 | |
115329f1 | 208 | @item -i filename |
4c5f7207 | 209 | input filename |
9181577c | 210 | |
115329f1 | 211 | @item -y |
4c5f7207 | 212 | Overwrite output files. |
9181577c | 213 | |
115329f1 | 214 | @item -t duration |
250c5317 GS |
215 | Restrict the transcoded/captured video sequence |
216 | to the duration specified in seconds. | |
4c5f7207 | 217 | @code{hh:mm:ss[.xxx]} syntax is also supported. |
9181577c | 218 | |
4386f941 DB |
219 | @item -fs limit_size |
220 | Set the file size limit. | |
221 | ||
e83a84ac | 222 | @item -ss position |
4c5f7207 DB |
223 | Seek to given time position in seconds. |
224 | @code{hh:mm:ss[.xxx]} syntax is also supported. | |
e83a84ac | 225 | |
4386f941 DB |
226 | @item -itsoffset offset |
227 | Set the input time offset in seconds. | |
228 | @code{[-]hh:mm:ss[.xxx]} syntax is also supported. | |
229 | This option affects all the input files that follow it. | |
230 | The offset is added to the timestamps of the input files. | |
231 | Specifying a positive offset means that the corresponding | |
232 | streams are delayed by 'offset' seconds. | |
233 | ||
115329f1 | 234 | @item -title string |
4c5f7207 | 235 | Set the title. |
9181577c | 236 | |
4386f941 DB |
237 | @item -timestamp time |
238 | Set the timestamp. | |
239 | ||
115329f1 | 240 | @item -author string |
4c5f7207 | 241 | Set the author. |
9181577c | 242 | |
115329f1 | 243 | @item -copyright string |
4c5f7207 | 244 | Set the copyright. |
9181577c | 245 | |
115329f1 | 246 | @item -comment string |
4c5f7207 | 247 | Set the comment. |
9181577c | 248 | |
4386f941 DB |
249 | @item -album string |
250 | Set the album. | |
251 | ||
ec1b10f4 PI |
252 | @item -track number |
253 | Set the track. | |
254 | ||
255 | @item -year number | |
256 | Set the year. | |
257 | ||
4386f941 DB |
258 | @item -v verbose |
259 | Control amount of logging. | |
260 | ||
99db6420 | 261 | @item -target type |
4386f941 | 262 | Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", |
4c5f7207 DB |
263 | "ntsc-svcd", ... ). All the format options (bitrate, codecs, |
264 | buffer sizes) are then set automatically. You can just type: | |
99db6420 FB |
265 | |
266 | @example | |
267 | ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg | |
268 | @end example | |
269 | ||
4c5f7207 DB |
270 | Nevertheless you can specify additional options as long as you know |
271 | they do not conflict with the standard, as in: | |
791d8d1d MB |
272 | |
273 | @example | |
274 | ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg | |
275 | @end example | |
276 | ||
4386f941 DB |
277 | @item -dframes number |
278 | Set the number of data frames to record. | |
279 | ||
280 | @item -scodec codec | |
281 | Force subtitle codec ('copy' to copy stream). | |
282 | ||
283 | @item -newsubtitle | |
284 | Add a new subtitle stream to the current output stream. | |
285 | ||
286 | @item -slang code | |
287 | Set the ISO 639 language code (3 letters) of the current subtitle stream. | |
401fbdde | 288 | |
9181577c FB |
289 | @end table |
290 | ||
291 | @section Video Options | |
292 | ||
e99c4e10 | 293 | @table @option |
9181577c | 294 | @item -b bitrate |
3c0ba870 | 295 | Set the video bitrate in bit/s (default = 200 kb/s). |
4386f941 DB |
296 | @item -vframes number |
297 | Set the number of video frames to record. | |
115329f1 | 298 | @item -r fps |
4386f941 | 299 | Set frame rate (Hz value, fraction or abbreviation), (default = 25). |
115329f1 | 300 | @item -s size |
67053c30 | 301 | Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source). |
4c5f7207 | 302 | The following abbreviations are recognized: |
5ee03c86 | 303 | @table @samp |
18bff752 FB |
304 | @item sqcif |
305 | 128x96 | |
306 | @item qcif | |
307 | 176x144 | |
308 | @item cif | |
309 | 352x288 | |
310 | @item 4cif | |
311 | 704x576 | |
7d88b5ca BF |
312 | @item qqvga |
313 | 160x120 | |
314 | @item qvga | |
315 | 320x240 | |
316 | @item vga | |
317 | 640x480 | |
318 | @item svga | |
319 | 800x600 | |
320 | @item xga | |
321 | 1024x768 | |
322 | @item uxga | |
323 | 1600x1200 | |
324 | @item qxga | |
325 | 2048x1536 | |
326 | @item sxga | |
327 | 1280x1024 | |
328 | @item qsxga | |
329 | 2560x2048 | |
330 | @item hsxga | |
331 | 5120x4096 | |
332 | @item wvga | |
333 | 852x480 | |
334 | @item wxga | |
335 | 1366x768 | |
336 | @item wsxga | |
337 | 1600x1024 | |
338 | @item wuxga | |
339 | 1920x1200 | |
340 | @item woxga | |
341 | 2560x1600 | |
342 | @item wqsxga | |
343 | 3200x2048 | |
344 | @item wquxga | |
345 | 3840x2400 | |
346 | @item whsxga | |
347 | 6400x4096 | |
348 | @item whuxga | |
349 | 7680x4800 | |
350 | @item cga | |
351 | 320x200 | |
352 | @item ega | |
353 | 640x350 | |
354 | @item hd480 | |
355 | 852x480 | |
356 | @item hd720 | |
357 | 1280x720 | |
358 | @item hd1080 | |
359 | 1920x1080 | |
18bff752 FB |
360 | @end table |
361 | ||
362 | @item -aspect aspect | |
4c5f7207 | 363 | Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777). |
18bff752 | 364 | @item -croptop size |
4c5f7207 | 365 | Set top crop band size (in pixels). |
18bff752 | 366 | @item -cropbottom size |
4c5f7207 | 367 | Set bottom crop band size (in pixels). |
18bff752 | 368 | @item -cropleft size |
4c5f7207 | 369 | Set left crop band size (in pixels). |
18bff752 | 370 | @item -cropright size |
4c5f7207 | 371 | Set right crop band size (in pixels). |
1ff93ffc | 372 | @item -padtop size |
4c5f7207 | 373 | Set top pad band size (in pixels). |
1ff93ffc | 374 | @item -padbottom size |
4c5f7207 | 375 | Set bottom pad band size (in pixels). |
1ff93ffc | 376 | @item -padleft size |
4c5f7207 | 377 | Set left pad band size (in pixels). |
1ff93ffc | 378 | @item -padright size |
4c5f7207 | 379 | Set right pad band size (in pixels). |
5b79a73e | 380 | @item -padcolor (hex color) |
4c5f7207 DB |
381 | Set color of padded bands. The value for padcolor is expressed |
382 | as a six digit hexadecimal number where the first two digits | |
383 | represent red, the middle two digits green and last two digits | |
384 | blue (default = 000000 (black)). | |
9181577c | 385 | @item -vn |
4c5f7207 | 386 | Disable video recording. |
115329f1 | 387 | @item -bt tolerance |
dc5ee8bc | 388 | Set video bitrate tolerance (in bit/s). |
18bff752 | 389 | @item -maxrate bitrate |
f754bfb9 | 390 | Set max video bitrate (in bit/s). |
18bff752 | 391 | @item -minrate bitrate |
f754bfb9 | 392 | Set min video bitrate (in bit/s). |
18bff752 | 393 | @item -bufsize size |
fa78d895 | 394 | Set video buffer verifier buffer size (in bits). |
115329f1 | 395 | @item -vcodec codec |
4c5f7207 | 396 | Force video codec to @var{codec}. Use the @code{copy} special value to |
5ee03c86 | 397 | tell that the raw codec data must be copied as is. |
18bff752 | 398 | @item -sameq |
4c5f7207 | 399 | Use same video quality as source (implies VBR). |
9181577c | 400 | |
115329f1 | 401 | @item -pass n |
4c5f7207 DB |
402 | Select the pass number (1 or 2). It is useful to do two pass |
403 | encoding. The statistics of the video are recorded in the first | |
404 | pass and the video is generated at the exact requested bitrate | |
405 | in the second pass. | |
9181577c | 406 | |
115329f1 | 407 | @item -passlogfile file |
4c5f7207 | 408 | Set two pass logfile name to @var{file}. |
9181577c | 409 | |
4386f941 DB |
410 | @item -newvideo |
411 | Add a new video stream to the current output stream. | |
412 | ||
9181577c FB |
413 | @end table |
414 | ||
18bff752 | 415 | @section Advanced Video Options |
9181577c | 416 | |
e99c4e10 | 417 | @table @option |
4386f941 | 418 | @item -pix_fmt format |
c3b95b1d SS |
419 | Set pixel format. Use 'list' as parameter to show all the supported |
420 | pixel formats. | |
35926489 IP |
421 | @item -sws_flags flags |
422 | Set SwScaler flags (only available when compiled with SwScaler support). | |
115329f1 | 423 | @item -g gop_size |
4c5f7207 | 424 | Set the group of pictures size. |
115329f1 | 425 | @item -intra |
4c5f7207 | 426 | Use only intra frames. |
4386f941 DB |
427 | @item -vdt n |
428 | Discard threshold. | |
115329f1 | 429 | @item -qscale q |
4bef236b | 430 | Use fixed video quantizer scale (VBR). |
115329f1 | 431 | @item -qmin q |
4bef236b | 432 | minimum video quantizer scale (VBR) |
115329f1 | 433 | @item -qmax q |
4bef236b | 434 | maximum video quantizer scale (VBR) |
115329f1 | 435 | @item -qdiff q |
4bef236b | 436 | maximum difference between the quantizer scales (VBR) |
115329f1 | 437 | @item -qblur blur |
4bef236b | 438 | video quantizer scale blur (VBR) |
115329f1 | 439 | @item -qcomp compression |
4bef236b | 440 | video quantizer scale compression (VBR) |
18bff752 | 441 | |
9ae711e1 VP |
442 | @item -lmin lambda |
443 | minimum video lagrange factor (VBR) | |
444 | @item -lmax lambda | |
445 | max video lagrange factor (VBR) | |
446 | @item -mblmin lambda | |
447 | minimum macroblock quantizer scale (VBR) | |
448 | @item -mblmax lambda | |
449 | maximum macroblock quantizer scale (VBR) | |
450 | ||
451 | These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units, | |
452 | but you may use the QP2LAMBDA constant to easily convert from 'q' units: | |
453 | @example | |
454 | ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext | |
455 | @end example | |
456 | ||
18bff752 | 457 | @item -rc_init_cplx complexity |
4c5f7207 | 458 | initial complexity for single pass encoding |
18bff752 | 459 | @item -b_qfactor factor |
4c5f7207 | 460 | qp factor between P- and B-frames |
18bff752 | 461 | @item -i_qfactor factor |
4c5f7207 | 462 | qp factor between P- and I-frames |
18bff752 | 463 | @item -b_qoffset offset |
4c5f7207 | 464 | qp offset between P- and B-frames |
18bff752 | 465 | @item -i_qoffset offset |
4c5f7207 | 466 | qp offset between P- and I-frames |
18bff752 | 467 | @item -rc_eq equation |
4c5f7207 DB |
468 | Set rate control equation (@pxref{FFmpeg formula |
469 | evaluator}) (default = @code{tex^qComp}). | |
5ee03c86 FB |
470 | @item -rc_override override |
471 | rate control override for specific intervals | |
c0de00da | 472 | @item -me_method method |
4c5f7207 DB |
473 | Set motion estimation method to @var{method}. |
474 | Available methods are (from lowest to best quality): | |
18bff752 FB |
475 | @table @samp |
476 | @item zero | |
5ee03c86 | 477 | Try just the (0, 0) vector. |
18bff752 FB |
478 | @item phods |
479 | @item log | |
480 | @item x1 | |
c0de00da SS |
481 | @item hex |
482 | @item umh | |
18bff752 FB |
483 | @item epzs |
484 | (default method) | |
485 | @item full | |
486 | exhaustive search (slow and marginally better than epzs) | |
487 | @end table | |
488 | ||
489 | @item -dct_algo algo | |
4c5f7207 | 490 | Set DCT algorithm to @var{algo}. Available values are: |
18bff752 FB |
491 | @table @samp |
492 | @item 0 | |
493 | FF_DCT_AUTO (default) | |
494 | @item 1 | |
495 | FF_DCT_FASTINT | |
496 | @item 2 | |
497 | FF_DCT_INT | |
498 | @item 3 | |
499 | FF_DCT_MMX | |
500 | @item 4 | |
501 | FF_DCT_MLIB | |
502 | @item 5 | |
503 | FF_DCT_ALTIVEC | |
504 | @end table | |
505 | ||
506 | @item -idct_algo algo | |
4c5f7207 | 507 | Set IDCT algorithm to @var{algo}. Available values are: |
18bff752 FB |
508 | @table @samp |
509 | @item 0 | |
510 | FF_IDCT_AUTO (default) | |
511 | @item 1 | |
115329f1 | 512 | FF_IDCT_INT |
18bff752 | 513 | @item 2 |
115329f1 | 514 | FF_IDCT_SIMPLE |
18bff752 | 515 | @item 3 |
115329f1 | 516 | FF_IDCT_SIMPLEMMX |
18bff752 | 517 | @item 4 |
115329f1 | 518 | FF_IDCT_LIBMPEG2MMX |
18bff752 | 519 | @item 5 |
115329f1 | 520 | FF_IDCT_PS2 |
18bff752 | 521 | @item 6 |
115329f1 | 522 | FF_IDCT_MLIB |
18bff752 | 523 | @item 7 |
115329f1 | 524 | FF_IDCT_ARM |
18bff752 | 525 | @item 8 |
115329f1 | 526 | FF_IDCT_ALTIVEC |
18bff752 | 527 | @item 9 |
115329f1 | 528 | FF_IDCT_SH4 |
18bff752 | 529 | @item 10 |
115329f1 | 530 | FF_IDCT_SIMPLEARM |
18bff752 FB |
531 | @end table |
532 | ||
533 | @item -er n | |
4c5f7207 | 534 | Set error resilience to @var{n}. |
18bff752 | 535 | @table @samp |
115329f1 | 536 | @item 1 |
1471c6c2 | 537 | FF_ER_CAREFUL (default) |
18bff752 | 538 | @item 2 |
5ee03c86 | 539 | FF_ER_COMPLIANT |
18bff752 FB |
540 | @item 3 |
541 | FF_ER_AGGRESSIVE | |
542 | @item 4 | |
543 | FF_ER_VERY_AGGRESSIVE | |
544 | @end table | |
545 | ||
5ee03c86 | 546 | @item -ec bit_mask |
4c5f7207 | 547 | Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of |
5ee03c86 | 548 | the following values: |
18bff752 FB |
549 | @table @samp |
550 | @item 1 | |
4c5f7207 | 551 | FF_EC_GUESS_MVS (default = enabled) |
18bff752 | 552 | @item 2 |
4c5f7207 | 553 | FF_EC_DEBLOCK (default = enabled) |
18bff752 FB |
554 | @end table |
555 | ||
556 | @item -bf frames | |
4c5f7207 | 557 | Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4). |
18bff752 FB |
558 | @item -mbd mode |
559 | macroblock decision | |
560 | @table @samp | |
561 | @item 0 | |
4c5f7207 | 562 | FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg). |
18bff752 | 563 | @item 1 |
4c5f7207 | 564 | FF_MB_DECISION_BITS: Choose the one which needs the fewest bits. |
18bff752 | 565 | @item 2 |
019c8838 | 566 | FF_MB_DECISION_RD: rate distortion |
18bff752 FB |
567 | @end table |
568 | ||
569 | @item -4mv | |
4c5f7207 | 570 | Use four motion vector by macroblock (MPEG-4 only). |
18bff752 | 571 | @item -part |
4c5f7207 | 572 | Use data partitioning (MPEG-4 only). |
18bff752 | 573 | @item -bug param |
4c5f7207 | 574 | Work around encoder bugs that are not auto-detected. |
18bff752 | 575 | @item -strict strictness |
4c5f7207 | 576 | How strictly to follow the standards. |
5ee03c86 | 577 | @item -aic |
4c5f7207 | 578 | Enable Advanced intra coding (h263+). |
5ee03c86 | 579 | @item -umv |
4c5f7207 | 580 | Enable Unlimited Motion Vector (h263+) |
18bff752 FB |
581 | |
582 | @item -deinterlace | |
4c5f7207 | 583 | Deinterlace pictures. |
3841e813 | 584 | @item -ilme |
4c5f7207 DB |
585 | Force interlacing support in encoder (MPEG-2 and MPEG-4 only). |
586 | Use this option if your input file is interlaced and you want | |
587 | to keep the interlaced format for minimum losses. | |
588 | The alternative is to deinterlace the input stream with | |
589 | @option{-deinterlace}, but deinterlacing introduces losses. | |
18bff752 | 590 | @item -psnr |
4c5f7207 | 591 | Calculate PSNR of compressed frames. |
18bff752 | 592 | @item -vstats |
4c5f7207 | 593 | Dump video coding statistics to @file{vstats_HHMMSS.log}. |
b60d1379 SS |
594 | @item -vstats_file file |
595 | Dump video coding statistics to @var{file}. | |
18bff752 | 596 | @item -vhook module |
4c5f7207 | 597 | Insert video processing @var{module}. @var{module} contains the module |
18bff752 | 598 | name and its parameters separated by spaces. |
4386f941 DB |
599 | @item -top n |
600 | top=1/bottom=0/auto=-1 field first | |
601 | @item -dc precision | |
602 | Intra_dc_precision. | |
603 | @item -vtag fourcc/tag | |
604 | Force video tag/fourcc. | |
605 | @item -qphist | |
606 | Show QP histogram. | |
607 | @item -vbsf bitstream filter | |
608 | Bitstream filters available are "dump_extra", "remove_extra", "noise". | |
18bff752 FB |
609 | @end table |
610 | ||
611 | @section Audio Options | |
612 | ||
613 | @table @option | |
4386f941 DB |
614 | @item -aframes number |
615 | Set the number of audio frames to record. | |
115329f1 | 616 | @item -ar freq |
4c5f7207 | 617 | Set the audio sampling frequency (default = 44100 Hz). |
115329f1 | 618 | @item -ab bitrate |
5438308f | 619 | Set the audio bitrate in bit/s (default = 64k). |
18bff752 | 620 | @item -ac channels |
4c5f7207 | 621 | Set the number of audio channels (default = 1). |
5ee03c86 | 622 | @item -an |
4c5f7207 | 623 | Disable audio recording. |
5ee03c86 | 624 | @item -acodec codec |
4c5f7207 DB |
625 | Force audio codec to @var{codec}. Use the @code{copy} special value to |
626 | specify that the raw codec data must be copied as is. | |
de62a89d | 627 | @item -newaudio |
18fd519f DB |
628 | Add a new audio track to the output file. If you want to specify parameters, |
629 | do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..). | |
de62a89d | 630 | |
18fd519f DB |
631 | Mapping will be done automatically, if the number of output streams is equal to |
632 | the number of input streams, else it will pick the first one that matches. You | |
de62a89d VP |
633 | can override the mapping using @code{-map} as usual. |
634 | ||
635 | Example: | |
636 | @example | |
5438308f | 637 | ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio |
de62a89d | 638 | @end example |
4386f941 DB |
639 | @item -alang code |
640 | Set the ISO 639 language code (3 letters) of the current audio stream. | |
641 | @end table | |
642 | ||
643 | @section Advanced Audio options: | |
644 | ||
645 | @table @option | |
646 | @item -atag fourcc/tag | |
647 | Force audio tag/fourcc. | |
648 | @item -absf bitstream filter | |
649 | Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp". | |
650 | @end table | |
651 | ||
652 | @section Subtitle options: | |
653 | ||
654 | @table @option | |
655 | @item -scodec codec | |
656 | Force subtitle codec ('copy' to copy stream). | |
657 | @item -newsubtitle | |
658 | Add a new subtitle stream to the current output stream. | |
659 | @item -slang code | |
660 | Set the ISO 639 language code (3 letters) of the current subtitle stream. | |
18bff752 FB |
661 | @end table |
662 | ||
663 | @section Audio/Video grab options | |
664 | ||
665 | @table @option | |
18bff752 | 666 | @item -vc channel |
4c5f7207 | 667 | Set video grab channel (DV1394 only). |
18bff752 | 668 | @item -tvstd standard |
4c5f7207 | 669 | Set television standard (NTSC, PAL (SECAM)). |
cc58300e RP |
670 | @item -isync |
671 | Synchronize read on input. | |
18bff752 FB |
672 | @end table |
673 | ||
674 | @section Advanced options | |
675 | ||
676 | @table @option | |
e645a733 BL |
677 | @item -map input stream id[:input stream id] |
678 | Set stream mapping from input streams to output streams. | |
679 | Just enumerate the input streams in the order you want them in the output. | |
680 | [input stream id] sets the (input) stream to sync against. | |
4386f941 DB |
681 | @item -map_meta_data outfile:infile |
682 | Set meta data information of outfile from infile. | |
18bff752 | 683 | @item -debug |
4c5f7207 | 684 | Print specific debug info. |
115329f1 | 685 | @item -benchmark |
4c5f7207 | 686 | Add timings for benchmarking. |
4386f941 | 687 | @item -dump |
4c5f7207 | 688 | Dump each input packet. |
4386f941 DB |
689 | @item -hex |
690 | When dumping packets, also dump the payload. | |
18bff752 | 691 | @item -bitexact |
4c5f7207 | 692 | Only use bit exact algorithms (for codec testing). |
18bff752 | 693 | @item -ps size |
4c5f7207 | 694 | Set packet size in bits. |
5ee03c86 | 695 | @item -re |
4c5f7207 | 696 | Read input at native frame rate. Mainly used to simulate a grab device. |
4386f941 | 697 | @item -loop_input |
4c5f7207 DB |
698 | Loop over the input stream. Currently it works only for image |
699 | streams. This option is used for automatic FFserver testing. | |
8108551a | 700 | @item -loop_output number_of_times |
019c8838 | 701 | Repeatedly loop output for formats that support looping such as animated GIF |
4c5f7207 | 702 | (0 will loop the output infinitely). |
4386f941 DB |
703 | @item -threads count |
704 | Thread count. | |
c52e13f1 | 705 | @item -vsync parameter |
29c9183c DB |
706 | Video sync method. Video will be stretched/squeezed to match the timestamps, |
707 | it is done by duplicating and dropping frames. With -map you can select from | |
708 | which stream the timestamps should be taken. You can leave either video or | |
c52e13f1 BL |
709 | audio unchanged and sync the remaining stream(s) to the unchanged one. |
710 | @item -async samples_per_second | |
29c9183c | 711 | Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, |
c52e13f1 BL |
712 | the parameter is the maximum samples per second by which the audio is changed. |
713 | -async 1 is a special case where only the start of the audio stream is corrected | |
714 | without any later correction. | |
43399718 VP |
715 | @item -copyts |
716 | Copy timestamps from input to output. | |
717 | @item -shortest | |
718 | Finish encoding when the shortest input stream ends. | |
719 | @item -dts_delta_threshold | |
720 | Timestamp discontinuity delta threshold. | |
721 | @item -muxdelay seconds | |
722 | Set the maximum demux-decode delay. | |
723 | @item -muxpreload seconds | |
724 | Set the initial demux-decode delay. | |
9181577c | 725 | @end table |
18bff752 FB |
726 | |
727 | @node FFmpeg formula evaluator | |
728 | @section FFmpeg formula evaluator | |
729 | ||
730 | When evaluating a rate control string, FFmpeg uses an internal formula | |
115329f1 | 731 | evaluator. |
18bff752 FB |
732 | |
733 | The following binary operators are available: @code{+}, @code{-}, | |
734 | @code{*}, @code{/}, @code{^}. | |
735 | ||
736 | The following unary operators are available: @code{+}, @code{-}, | |
737 | @code{(...)}. | |
738 | ||
739 | The following functions are available: | |
740 | @table @var | |
741 | @item sinh(x) | |
742 | @item cosh(x) | |
743 | @item tanh(x) | |
744 | @item sin(x) | |
745 | @item cos(x) | |
746 | @item tan(x) | |
747 | @item exp(x) | |
748 | @item log(x) | |
749 | @item squish(x) | |
750 | @item gauss(x) | |
751 | @item abs(x) | |
752 | @item max(x, y) | |
753 | @item min(x, y) | |
754 | @item gt(x, y) | |
755 | @item lt(x, y) | |
756 | @item eq(x, y) | |
757 | @item bits2qp(bits) | |
758 | @item qp2bits(qp) | |
759 | @end table | |
760 | ||
761 | The following constants are available: | |
762 | @table @var | |
763 | @item PI | |
764 | @item E | |
765 | @item iTex | |
766 | @item pTex | |
767 | @item tex | |
768 | @item mv | |
769 | @item fCode | |
770 | @item iCount | |
771 | @item mcVar | |
772 | @item var | |
773 | @item isI | |
774 | @item isP | |
775 | @item isB | |
776 | @item avgQP | |
777 | @item qComp | |
778 | @item avgIITex | |
779 | @item avgPITex | |
780 | @item avgPPTex | |
781 | @item avgBPTex | |
782 | @item avgTex | |
783 | @end table | |
784 | ||
e99c4e10 FB |
785 | @c man end |
786 | ||
787 | @ignore | |
788 | ||
789 | @setfilename ffmpeg | |
790 | @settitle FFmpeg video converter | |
791 | ||
792 | @c man begin SEEALSO | |
019c8838 | 793 | ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}. |
e99c4e10 FB |
794 | @c man end |
795 | ||
796 | @c man begin AUTHOR | |
797 | Fabrice Bellard | |
798 | @c man end | |
799 | ||
800 | @end ignore | |
9181577c FB |
801 | |
802 | @section Protocols | |
803 | ||
4c5f7207 DB |
804 | The filename can be @file{-} to read from standard input or to write |
805 | to standard output. | |
9181577c | 806 | |
4c5f7207 | 807 | FFmpeg also handles many protocols specified with an URL syntax. |
9181577c | 808 | |
4c5f7207 | 809 | Use 'ffmpeg -formats' to see a list of the supported protocols. |
9181577c | 810 | |
e99c4e10 | 811 | The protocol @code{http:} is currently used only to communicate with |
4c5f7207 | 812 | FFserver (see the FFserver documentation). When FFmpeg will be a |
e99c4e10 | 813 | video player it will also be used for streaming :-) |
9181577c FB |
814 | |
815 | @chapter Tips | |
816 | ||
817 | @itemize | |
4c5f7207 DB |
818 | @item For streaming at very low bitrate application, use a low frame rate |
819 | and a small GOP size. This is especially true for RealVideo where | |
e99c4e10 FB |
820 | the Linux player does not seem to be very fast, so it can miss |
821 | frames. An example is: | |
9181577c FB |
822 | |
823 | @example | |
3c0ba870 | 824 | ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm |
9181577c FB |
825 | @end example |
826 | ||
827 | @item The parameter 'q' which is displayed while encoding is the current | |
4c5f7207 DB |
828 | quantizer. The value 1 indicates that a very good quality could |
829 | be achieved. The value 31 indicates the worst quality. If q=31 appears | |
e99c4e10 | 830 | too often, it means that the encoder cannot compress enough to meet |
4c5f7207 | 831 | your bitrate. You must either increase the bitrate, decrease the |
e99c4e10 | 832 | frame rate or decrease the frame size. |
9181577c FB |
833 | |
834 | @item If your computer is not fast enough, you can speed up the | |
e99c4e10 FB |
835 | compression at the expense of the compression ratio. You can use |
836 | '-me zero' to speed up motion estimation, and '-intra' to disable | |
4c5f7207 | 837 | motion estimation completely (you have only I-frames, which means it |
e99c4e10 | 838 | is about as good as JPEG compression). |
9181577c | 839 | |
4c5f7207 | 840 | @item To have very low audio bitrates, reduce the sampling frequency |
019c8838 | 841 | (down to 22050 kHz for MPEG audio, 22050 or 11025 for AC3). |
9181577c FB |
842 | |
843 | @item To have a constant quality (but a variable bitrate), use the option | |
e99c4e10 FB |
844 | '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst |
845 | quality). | |
9181577c FB |
846 | |
847 | @item When converting video files, you can use the '-sameq' option which | |
4c5f7207 DB |
848 | uses the same quality factor in the encoder as in the decoder. |
849 | It allows almost lossless encoding. | |
9181577c FB |
850 | |
851 | @end itemize | |
852 | ||
9181577c | 853 | @bye |