Modify the Ogg/Speex demuxer and the libspeex decoder so that they always treat
[FFMpeg-mirror/lagarith.git] / doc / ffmpeg-doc.texi
blobad0af0747e253c66c03742f390faac5a714d64f3
1 \input texinfo @c -*- texinfo -*-
3 @settitle FFmpeg Documentation
4 @titlepage
5 @sp 7
6 @center @titlefont{FFmpeg Documentation}
7 @sp 3
8 @end titlepage
11 @chapter Introduction
13 FFmpeg is a very fast video and audio converter. It can also grab from
14 a live audio/video source.
16 The command line interface is designed to be intuitive, in the sense
17 that FFmpeg tries to figure out all parameters that can possibly be
18 derived automatically. You usually only have to specify the target
19 bitrate you want.
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.
24 @chapter Quick Start
26 @c man begin EXAMPLES
27 @section Video and Audio grabbing
29 FFmpeg can grab video and audio from devices given that you specify the input
30 format and device.
32 @example
33 ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
34 @end example
36 Note that you must activate the right video source and channel before
37 launching FFmpeg with any TV viewer such as xawtv
38 (@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
39 have to set the audio recording levels correctly with a
40 standard mixer.
42 @section X11 grabbing
44 FFmpeg can grab the X11 display.
46 @example
47 ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
48 @end example
50 0.0 is display.screen number of your X11 server, same as
51 the DISPLAY environment variable.
53 @example
54 ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
55 @end example
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.
60 @section Video and Audio file format conversion
62 * FFmpeg can use any supported file format and protocol as input:
64 Examples:
66 * You can use YUV files as input:
68 @example
69 ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
70 @end example
72 It will use the files:
73 @example
74 /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
75 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
76 @end example
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
81 if FFmpeg cannot guess it.
83 * You can input from a raw YUV420P file:
85 @example
86 ffmpeg -i /tmp/test.yuv /tmp/out.avi
87 @end example
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
91 horizontal resolution.
93 * You can output to a raw YUV420P file:
95 @example
96 ffmpeg -i mydivx.avi hugefile.yuv
97 @end example
99 * You can set several input files and output files:
101 @example
102 ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
103 @end example
105 Converts the audio file a.wav and the raw YUV video file a.yuv
106 to MPEG file a.mpg.
108 * You can also do audio and video conversions at the same time:
110 @example
111 ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
112 @end example
114 Converts a.wav to MPEG audio at 22050 Hz sample rate.
116 * You can encode to several formats at the same time and define a
117 mapping from input stream to output streams:
119 @example
120 ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
121 @end example
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
125 stream, in the order of the definition of output streams.
127 * You can transcode decrypted VOBs:
129 @example
130 ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
131 @end example
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
138 to enable LAME support by passing @code{--enable-libmp3lame} to configure.
139 The mapping is particularly useful for DVD transcoding
140 to get the desired audio language.
142 NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
144 * You can extract images from a video, or create a video from many images:
146 For extracting images from a video:
147 @example
148 ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
149 @end example
151 This will extract one video frame per second from the video and will
152 output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
153 etc. Images will be rescaled to fit the new WxH values.
155 If you want to extract just a limited number of frames, you can use the
156 above command in combination with the -vframes or -t option, or in
157 combination with -ss to start extracting from a certain point in time.
159 For creating a video from many images:
160 @example
161 ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
162 @end example
164 The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
165 composed of three digits padded with zeroes to express the sequence
166 number. It is the same syntax supported by the C printf function, but
167 only formats accepting a normal integer are suitable.
169 * You can put many streams of the same type in the output:
171 @example
172 ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
173 @end example
175 In addition to the first video and audio streams, the resulting
176 output file @file{test12.avi} will contain the second video
177 and the second audio stream found in the input streams list.
179 The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
180 options have to be specified immediately after the name of the output
181 file to which you want to add them.
182 @c man end
184 @chapter Invocation
186 @section Syntax
188 The generic syntax is:
190 @example
191 @c man begin SYNOPSIS
192 ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
193 @c man end
194 @end example
195 @c man begin DESCRIPTION
196 As a general rule, options are applied to the next specified
197 file. Therefore, order is important, and you can have the same
198 option on the command line multiple times. Each occurrence is
199 then applied to the next input or output file.
201 * To set the video bitrate of the output file to 64kbit/s:
202 @example
203 ffmpeg -i input.avi -b 64k output.avi
204 @end example
206 * To force the frame rate of the output file to 24 fps:
207 @example
208 ffmpeg -i input.avi -r 24 output.avi
209 @end example
211 * To force the frame rate of the input file (valid for raw formats only)
212 to 1 fps and the frame rate of the output file to 24 fps:
213 @example
214 ffmpeg -r 1 -i input.m2v -r 24 output.avi
215 @end example
217 The format option may be needed for raw input files.
219 By default, FFmpeg tries to convert as losslessly as possible: It
220 uses the same audio and video parameters for the outputs as the one
221 specified for the inputs.
222 @c man end
224 @c man begin OPTIONS
225 @section Main options
227 @table @option
228 @item -L
229 Show license.
231 @item -h
232 Show help.
234 @item -version
235 Show version.
237 @item -formats
238 Show available formats, codecs, bitstream filters, protocols, and frame size and frame rate abbreviations.
240 The fields preceding the format and codec names have the following meanings:
241 @table @samp
242 @item D
243 Decoding available
244 @item E
245 Encoding available
246 @item V/A/S
247 Video/audio/subtitle codec
248 @item S
249 Codec supports slices
250 @item D
251 Codec supports direct rendering
252 @item T
253 Codec can handle input truncated at random locations instead of only at frame boundaries
254 @end table
256 @item -f @var{fmt}
257 Force format.
259 @item -i @var{filename}
260 input file name
262 @item -y
263 Overwrite output files.
265 @item -t @var{duration}
266 Restrict the transcoded/captured video sequence
267 to the duration specified in seconds.
268 @code{hh:mm:ss[.xxx]} syntax is also supported.
270 @item -fs @var{limit_size}
271 Set the file size limit.
273 @item -ss @var{position}
274 Seek to given time position in seconds.
275 @code{hh:mm:ss[.xxx]} syntax is also supported.
277 @item -itsoffset @var{offset}
278 Set the input time offset in seconds.
279 @code{[-]hh:mm:ss[.xxx]} syntax is also supported.
280 This option affects all the input files that follow it.
281 The offset is added to the timestamps of the input files.
282 Specifying a positive offset means that the corresponding
283 streams are delayed by 'offset' seconds.
285 @item -timestamp @var{time}
286 Set the timestamp.
288 @item -metadata @var{key}=@var{value}
289 Set a metadata key/value pair.
291 For example, for setting the title in the output file:
292 @example
293 ffmpeg -i in.avi -metadata title="my title" out.flv
294 @end example
296 @item -v @var{number}
297 Set the logging verbosity level.
299 @item -target @var{type}
300 Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
301 "ntsc-svcd", ... ). All the format options (bitrate, codecs,
302 buffer sizes) are then set automatically. You can just type:
304 @example
305 ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
306 @end example
308 Nevertheless you can specify additional options as long as you know
309 they do not conflict with the standard, as in:
311 @example
312 ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
313 @end example
315 @item -dframes @var{number}
316 Set the number of data frames to record.
318 @item -scodec @var{codec}
319 Force subtitle codec ('copy' to copy stream).
321 @item -newsubtitle
322 Add a new subtitle stream to the current output stream.
324 @item -slang @var{code}
325 Set the ISO 639 language code (3 letters) of the current subtitle stream.
327 @end table
329 @section Video Options
331 @table @option
332 @item -b @var{bitrate}
333 Set the video bitrate in bit/s (default = 200 kb/s).
334 @item -vframes @var{number}
335 Set the number of video frames to record.
336 @item -r @var{fps}
337 Set frame rate (Hz value, fraction or abbreviation), (default = 25).
338 @item -s @var{size}
339 Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
340 The following abbreviations are recognized:
341 @table @samp
342 @item sqcif
343 128x96
344 @item qcif
345 176x144
346 @item cif
347 352x288
348 @item 4cif
349 704x576
350 @item 16cif
351 1408x1152
352 @item qqvga
353 160x120
354 @item qvga
355 320x240
356 @item vga
357 640x480
358 @item svga
359 800x600
360 @item xga
361 1024x768
362 @item uxga
363 1600x1200
364 @item qxga
365 2048x1536
366 @item sxga
367 1280x1024
368 @item qsxga
369 2560x2048
370 @item hsxga
371 5120x4096
372 @item wvga
373 852x480
374 @item wxga
375 1366x768
376 @item wsxga
377 1600x1024
378 @item wuxga
379 1920x1200
380 @item woxga
381 2560x1600
382 @item wqsxga
383 3200x2048
384 @item wquxga
385 3840x2400
386 @item whsxga
387 6400x4096
388 @item whuxga
389 7680x4800
390 @item cga
391 320x200
392 @item ega
393 640x350
394 @item hd480
395 852x480
396 @item hd720
397 1280x720
398 @item hd1080
399 1920x1080
400 @end table
402 @item -aspect @var{aspect}
403 Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
404 @item -croptop @var{size}
405 Set top crop band size (in pixels).
406 @item -cropbottom @var{size}
407 Set bottom crop band size (in pixels).
408 @item -cropleft @var{size}
409 Set left crop band size (in pixels).
410 @item -cropright @var{size}
411 Set right crop band size (in pixels).
412 @item -padtop @var{size}
413 Set top pad band size (in pixels).
414 @item -padbottom @var{size}
415 Set bottom pad band size (in pixels).
416 @item -padleft @var{size}
417 Set left pad band size (in pixels).
418 @item -padright @var{size}
419 Set right pad band size (in pixels).
420 @item -padcolor @var{hex_color}
421 Set color of padded bands. The value for padcolor is expressed
422 as a six digit hexadecimal number where the first two digits
423 represent red, the middle two digits green and last two digits
424 blue (default = 000000 (black)).
425 @item -vn
426 Disable video recording.
427 @item -bt @var{tolerance}
428 Set video bitrate tolerance (in bits, default 4000k).
429 Has a minimum value of: (target_bitrate/target_framerate).
430 In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
431 willing to deviate from the target average bitrate value. This is
432 not related to min/max bitrate. Lowering tolerance too much has
433 an adverse effect on quality.
434 @item -maxrate @var{bitrate}
435 Set max video bitrate (in bit/s).
436 Requires -bufsize to be set.
437 @item -minrate @var{bitrate}
438 Set min video bitrate (in bit/s).
439 Most useful in setting up a CBR encode:
440 @example
441 ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
442 @end example
443 It is of little use elsewise.
444 @item -bufsize @var{size}
445 Set video buffer verifier buffer size (in bits).
446 @item -vcodec @var{codec}
447 Force video codec to @var{codec}. Use the @code{copy} special value to
448 tell that the raw codec data must be copied as is.
449 @item -sameq
450 Use same video quality as source (implies VBR).
452 @item -pass @var{n}
453 Select the pass number (1 or 2). It is used to do two-pass
454 video encoding. The statistics of the video are recorded in the first
455 pass into a log file (see also the option -passlogfile),
456 and in the second pass that log file is used to generate the video
457 at the exact requested bitrate.
458 On pass 1, you may just deactivate audio and set output to null,
459 examples for Windows and Unix:
460 @example
461 ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
462 ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
463 @end example
465 @item -passlogfile @var{prefix}
466 Set two-pass log file name prefix to @var{prefix}, the default file name
467 prefix is ``ffmpeg2pass''. The complete file name will be
468 @file{PREFIX-N.log}, where N is a number specific to the output
469 stream.
471 @item -newvideo
472 Add a new video stream to the current output stream.
474 @end table
476 @section Advanced Video Options
478 @table @option
479 @item -pix_fmt @var{format}
480 Set pixel format. Use 'list' as parameter to show all the supported
481 pixel formats.
482 @item -sws_flags @var{flags}
483 Set SwScaler flags (only available when compiled with swscale support).
484 @item -g @var{gop_size}
485 Set the group of pictures size.
486 @item -intra
487 Use only intra frames.
488 @item -vdt @var{n}
489 Discard threshold.
490 @item -qscale @var{q}
491 Use fixed video quantizer scale (VBR).
492 @item -qmin @var{q}
493 minimum video quantizer scale (VBR)
494 @item -qmax @var{q}
495 maximum video quantizer scale (VBR)
496 @item -qdiff @var{q}
497 maximum difference between the quantizer scales (VBR)
498 @item -qblur @var{blur}
499 video quantizer scale blur (VBR) (range 0.0 - 1.0)
500 @item -qcomp @var{compression}
501 video quantizer scale compression (VBR) (default 0.5).
502 Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
504 @item -lmin @var{lambda}
505 minimum video lagrange factor (VBR)
506 @item -lmax @var{lambda}
507 max video lagrange factor (VBR)
508 @item -mblmin @var{lambda}
509 minimum macroblock quantizer scale (VBR)
510 @item -mblmax @var{lambda}
511 maximum macroblock quantizer scale (VBR)
513 These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
514 but you may use the QP2LAMBDA constant to easily convert from 'q' units:
515 @example
516 ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
517 @end example
519 @item -rc_init_cplx @var{complexity}
520 initial complexity for single pass encoding
521 @item -b_qfactor @var{factor}
522 qp factor between P- and B-frames
523 @item -i_qfactor @var{factor}
524 qp factor between P- and I-frames
525 @item -b_qoffset @var{offset}
526 qp offset between P- and B-frames
527 @item -i_qoffset @var{offset}
528 qp offset between P- and I-frames
529 @item -rc_eq @var{equation}
530 Set rate control equation (@pxref{FFmpeg formula
531 evaluator}) (default = @code{tex^qComp}).
532 @item -rc_override @var{override}
533 rate control override for specific intervals
534 @item -me_method @var{method}
535 Set motion estimation method to @var{method}.
536 Available methods are (from lowest to best quality):
537 @table @samp
538 @item zero
539 Try just the (0, 0) vector.
540 @item phods
541 @item log
542 @item x1
543 @item hex
544 @item umh
545 @item epzs
546 (default method)
547 @item full
548 exhaustive search (slow and marginally better than epzs)
549 @end table
551 @item -dct_algo @var{algo}
552 Set DCT algorithm to @var{algo}. Available values are:
553 @table @samp
554 @item 0
555 FF_DCT_AUTO (default)
556 @item 1
557 FF_DCT_FASTINT
558 @item 2
559 FF_DCT_INT
560 @item 3
561 FF_DCT_MMX
562 @item 4
563 FF_DCT_MLIB
564 @item 5
565 FF_DCT_ALTIVEC
566 @end table
568 @item -idct_algo @var{algo}
569 Set IDCT algorithm to @var{algo}. Available values are:
570 @table @samp
571 @item 0
572 FF_IDCT_AUTO (default)
573 @item 1
574 FF_IDCT_INT
575 @item 2
576 FF_IDCT_SIMPLE
577 @item 3
578 FF_IDCT_SIMPLEMMX
579 @item 4
580 FF_IDCT_LIBMPEG2MMX
581 @item 5
582 FF_IDCT_PS2
583 @item 6
584 FF_IDCT_MLIB
585 @item 7
586 FF_IDCT_ARM
587 @item 8
588 FF_IDCT_ALTIVEC
589 @item 9
590 FF_IDCT_SH4
591 @item 10
592 FF_IDCT_SIMPLEARM
593 @end table
595 @item -er @var{n}
596 Set error resilience to @var{n}.
597 @table @samp
598 @item 1
599 FF_ER_CAREFUL (default)
600 @item 2
601 FF_ER_COMPLIANT
602 @item 3
603 FF_ER_AGGRESSIVE
604 @item 4
605 FF_ER_VERY_AGGRESSIVE
606 @end table
608 @item -ec @var{bit_mask}
609 Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
610 the following values:
611 @table @samp
612 @item 1
613 FF_EC_GUESS_MVS (default = enabled)
614 @item 2
615 FF_EC_DEBLOCK (default = enabled)
616 @end table
618 @item -bf @var{frames}
619 Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
620 @item -mbd @var{mode}
621 macroblock decision
622 @table @samp
623 @item 0
624 FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
625 @item 1
626 FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
627 @item 2
628 FF_MB_DECISION_RD: rate distortion
629 @end table
631 @item -4mv
632 Use four motion vector by macroblock (MPEG-4 only).
633 @item -part
634 Use data partitioning (MPEG-4 only).
635 @item -bug @var{param}
636 Work around encoder bugs that are not auto-detected.
637 @item -strict @var{strictness}
638 How strictly to follow the standards.
639 @item -aic
640 Enable Advanced intra coding (h263+).
641 @item -umv
642 Enable Unlimited Motion Vector (h263+)
644 @item -deinterlace
645 Deinterlace pictures.
646 @item -ilme
647 Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
648 Use this option if your input file is interlaced and you want
649 to keep the interlaced format for minimum losses.
650 The alternative is to deinterlace the input stream with
651 @option{-deinterlace}, but deinterlacing introduces losses.
652 @item -psnr
653 Calculate PSNR of compressed frames.
654 @item -vstats
655 Dump video coding statistics to @file{vstats_HHMMSS.log}.
656 @item -vstats_file @var{file}
657 Dump video coding statistics to @var{file}.
658 @item -top @var{n}
659 top=1/bottom=0/auto=-1 field first
660 @item -dc @var{precision}
661 Intra_dc_precision.
662 @item -vtag @var{fourcc/tag}
663 Force video tag/fourcc.
664 @item -qphist
665 Show QP histogram.
666 @item -vbsf @var{bitstream_filter}
667 Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump".
668 @example
669 ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
670 @end example
671 @end table
673 @section Audio Options
675 @table @option
676 @item -aframes @var{number}
677 Set the number of audio frames to record.
678 @item -ar @var{freq}
679 Set the audio sampling frequency (default = 44100 Hz).
680 @item -ab @var{bitrate}
681 Set the audio bitrate in bit/s (default = 64k).
682 @item -ac @var{channels}
683 Set the number of audio channels (default = 1).
684 @item -an
685 Disable audio recording.
686 @item -acodec @var{codec}
687 Force audio codec to @var{codec}. Use the @code{copy} special value to
688 specify that the raw codec data must be copied as is.
689 @item -newaudio
690 Add a new audio track to the output file. If you want to specify parameters,
691 do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
693 Mapping will be done automatically, if the number of output streams is equal to
694 the number of input streams, else it will pick the first one that matches. You
695 can override the mapping using @code{-map} as usual.
697 Example:
698 @example
699 ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
700 @end example
701 @item -alang @var{code}
702 Set the ISO 639 language code (3 letters) of the current audio stream.
703 @end table
705 @section Advanced Audio options:
707 @table @option
708 @item -atag @var{fourcc/tag}
709 Force audio tag/fourcc.
710 @item -absf @var{bitstream_filter}
711 Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
712 @end table
714 @section Subtitle options:
716 @table @option
717 @item -scodec @var{codec}
718 Force subtitle codec ('copy' to copy stream).
719 @item -newsubtitle
720 Add a new subtitle stream to the current output stream.
721 @item -slang @var{code}
722 Set the ISO 639 language code (3 letters) of the current subtitle stream.
723 @item -sbsf @var{bitstream_filter}
724 Bitstream filters available are "mov2textsub", "text2movsub".
725 @example
726 ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
727 @end example
728 @end table
730 @section Audio/Video grab options
732 @table @option
733 @item -vc @var{channel}
734 Set video grab channel (DV1394 only).
735 @item -tvstd @var{standard}
736 Set television standard (NTSC, PAL (SECAM)).
737 @item -isync
738 Synchronize read on input.
739 @end table
741 @section Advanced options
743 @table @option
744 @item -map @var{input_stream_id}[:@var{sync_stream_id}]
745 Set stream mapping from input streams to output streams.
746 Just enumerate the input streams in the order you want them in the output.
747 @var{sync_stream_id} if specified sets the input stream to sync
748 against.
749 @item -map_meta_data @var{outfile}:@var{infile}
750 Set meta data information of @var{outfile} from @var{infile}.
751 @item -debug
752 Print specific debug info.
753 @item -benchmark
754 Add timings for benchmarking.
755 @item -dump
756 Dump each input packet.
757 @item -hex
758 When dumping packets, also dump the payload.
759 @item -bitexact
760 Only use bit exact algorithms (for codec testing).
761 @item -ps @var{size}
762 Set RTP payload size in bytes.
763 @item -re
764 Read input at native frame rate. Mainly used to simulate a grab device.
765 @item -loop_input
766 Loop over the input stream. Currently it works only for image
767 streams. This option is used for automatic FFserver testing.
768 @item -loop_output @var{number_of_times}
769 Repeatedly loop output for formats that support looping such as animated GIF
770 (0 will loop the output infinitely).
771 @item -threads @var{count}
772 Thread count.
773 @item -vsync @var{parameter}
774 Video sync method. Video will be stretched/squeezed to match the timestamps,
775 it is done by duplicating and dropping frames. With -map you can select from
776 which stream the timestamps should be taken. You can leave either video or
777 audio unchanged and sync the remaining stream(s) to the unchanged one.
778 @item -async @var{samples_per_second}
779 Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
780 the parameter is the maximum samples per second by which the audio is changed.
781 -async 1 is a special case where only the start of the audio stream is corrected
782 without any later correction.
783 @item -copyts
784 Copy timestamps from input to output.
785 @item -shortest
786 Finish encoding when the shortest input stream ends.
787 @item -dts_delta_threshold
788 Timestamp discontinuity delta threshold.
789 @item -muxdelay @var{seconds}
790 Set the maximum demux-decode delay.
791 @item -muxpreload @var{seconds}
792 Set the initial demux-decode delay.
793 @end table
795 @section Preset files
797 A preset file contains a sequence of @var{option}=@var{value} pairs,
798 one for each line, specifying a sequence of options which would be
799 awkward to specify on the command line. Lines starting with the hash
800 ('#') character are ignored and are used to provide comments. Check
801 the @file{ffpresets} directory in the FFmpeg source tree for examples.
803 Preset files are specified with the @code{vpre}, @code{apre} and
804 @code{spre} options. The options specified in a preset file are
805 applied to the currently selected codec of the same type as the preset
806 option.
808 The argument passed to the preset options identifies the preset file
809 to use according to the following rules.
811 First ffmpeg searches for a file named @var{arg}.ffpreset in the
812 directories @file{$HOME/.ffmpeg}, and in the datadir defined at
813 configuration time (usually @file{PREFIX/share/ffmpeg}) in that
814 order. For example, if the argument is @code{libx264-max}, it will
815 search for the file @file{libx264-max.ffpreset}.
817 If no such file is found, then ffmpeg will search for a file named
818 @var{codec_name}-@var{arg}.ffpreset in the above-mentioned
819 directories, where @var{codec_name} is the name of the codec to which
820 the preset file options will be applied. For example, if you select
821 the video codec with @code{-vcodec libx264} and use @code{-vpre max},
822 then it will search for the file @file{libx264-max.ffpreset}.
824 Finally, if the above rules failed and the argument specifies an
825 absolute pathname, ffmpeg will search for that filename. This way you
826 can specify the absolute and complete filename of the preset file, for
827 example @file{./ffpresets/libx264-max.ffpreset}.
829 @node FFmpeg formula evaluator
830 @section FFmpeg formula evaluator
832 When evaluating a rate control string, FFmpeg uses an internal formula
833 evaluator.
835 The following binary operators are available: @code{+}, @code{-},
836 @code{*}, @code{/}, @code{^}.
838 The following unary operators are available: @code{+}, @code{-},
839 @code{(...)}.
841 The following statements are available: @code{ld}, @code{st},
842 @code{while}.
844 The following functions are available:
845 @table @var
846 @item sinh(x)
847 @item cosh(x)
848 @item tanh(x)
849 @item sin(x)
850 @item cos(x)
851 @item tan(x)
852 @item atan(x)
853 @item asin(x)
854 @item acos(x)
855 @item exp(x)
856 @item log(x)
857 @item abs(x)
858 @item squish(x)
859 @item gauss(x)
860 @item mod(x, y)
861 @item max(x, y)
862 @item min(x, y)
863 @item eq(x, y)
864 @item gte(x, y)
865 @item gt(x, y)
866 @item lte(x, y)
867 @item lt(x, y)
868 @item bits2qp(bits)
869 @item qp2bits(qp)
870 @end table
872 The following constants are available:
873 @table @var
874 @item PI
875 @item E
876 @item iTex
877 @item pTex
878 @item tex
879 @item mv
880 @item fCode
881 @item iCount
882 @item mcVar
883 @item var
884 @item isI
885 @item isP
886 @item isB
887 @item avgQP
888 @item qComp
889 @item avgIITex
890 @item avgPITex
891 @item avgPPTex
892 @item avgBPTex
893 @item avgTex
894 @end table
896 @c man end
898 @ignore
900 @setfilename ffmpeg
901 @settitle FFmpeg video converter
903 @c man begin SEEALSO
904 ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
905 @c man end
907 @c man begin AUTHOR
908 Fabrice Bellard
909 @c man end
911 @end ignore
913 @section Protocols
915 The file name can be @file{-} to read from standard input or to write
916 to standard output.
918 FFmpeg also handles many protocols specified with an URL syntax.
920 Use 'ffmpeg -formats' to see a list of the supported protocols.
922 The protocol @code{http:} is currently used only to communicate with
923 FFserver (see the FFserver documentation). When FFmpeg will be a
924 video player it will also be used for streaming :-)
926 @chapter Tips
928 @itemize
929 @item For streaming at very low bitrate application, use a low frame rate
930 and a small GOP size. This is especially true for RealVideo where
931 the Linux player does not seem to be very fast, so it can miss
932 frames. An example is:
934 @example
935 ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
936 @end example
938 @item  The parameter 'q' which is displayed while encoding is the current
939 quantizer. The value 1 indicates that a very good quality could
940 be achieved. The value 31 indicates the worst quality. If q=31 appears
941 too often, it means that the encoder cannot compress enough to meet
942 your bitrate. You must either increase the bitrate, decrease the
943 frame rate or decrease the frame size.
945 @item If your computer is not fast enough, you can speed up the
946 compression at the expense of the compression ratio. You can use
947 '-me zero' to speed up motion estimation, and '-intra' to disable
948 motion estimation completely (you have only I-frames, which means it
949 is about as good as JPEG compression).
951 @item To have very low audio bitrates, reduce the sampling frequency
952 (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
954 @item To have a constant quality (but a variable bitrate), use the option
955 '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
956 quality).
958 @item When converting video files, you can use the '-sameq' option which
959 uses the same quality factor in the encoder as in the decoder.
960 It allows almost lossless encoding.
962 @end itemize
964 @bye