Split FFmpeg documentation into general documentation and the documentation
[libav.git] / doc / ffmpeg-doc.texi
CommitLineData
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
13FFmpeg is a very fast video and audio converter. It can also grab from
14a live audio/video source.
115329f1 15
9181577c 16The command line interface is designed to be intuitive, in the sense
4c5f7207
DB
17that FFmpeg tries to figure out all parameters that can possibly be
18derived automatically. You usually only have to specify the target
19bitrate you want.
9181577c
FB
20
21FFmpeg can also convert from any sample rate to any other, and resize
22video 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
29FFmpeg can grab video and audio from devices given that you specify the input
30format and device.
e99c4e10 31
9181577c 32@example
cc58300e 33ffmpeg -f audio_device -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
9181577c
FB
34@end example
35
e99c4e10 36Note that you must activate the right video source and channel before
4c5f7207
DB
37launching FFmpeg with any TV viewer such as xawtv
38(@url{http://bytesex.org/xawtv/}) by Gerd Knorr. You also
39have to set the audio recording levels correctly with a
e99c4e10 40standard mixer.
9181577c 41
76d2efda
BC
42@section X11 grabbing
43
913e4081 44FFmpeg can grab the X11 display.
76d2efda
BC
45
46@example
9e0ab666 47ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
76d2efda
BC
48@end example
49
913e4081
DB
500.0 is display.screen number of your X11 server, same as
51the DISPLAY environment variable.
76d2efda 52
0cd4faf9 53@example
9e0ab666 54ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
0cd4faf9
PI
55@end example
56
570.0 is display.screen number of your X11 server, same as the DISPLAY environment
58variable. 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
64Examples:
65
4c5f7207 66* You can use YUV files as input:
9181577c
FB
67
68@example
115329f1 69ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
9181577c
FB
70@end example
71
115329f1 72It 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
78The Y files use twice the resolution of the U and V files. They are
79raw files, without header. They can be generated by all decent video
80decoders. You must specify the size of the image with the @option{-s} option
4c5f7207 81if FFmpeg cannot guess it.
9181577c 82
4c5f7207 83* You can input from a raw YUV420P file:
9181577c
FB
84
85@example
e99c4e10 86ffmpeg -i /tmp/test.yuv /tmp/out.avi
9181577c
FB
87@end example
88
4c5f7207
DB
89test.yuv is a file containing raw YUV planar data. Each frame is composed
90of the Y plane followed by the U and V planes at half vertical and
e99c4e10 91horizontal resolution.
9181577c 92
4c5f7207 93* You can output to a raw YUV420P file:
9181577c
FB
94
95@example
f926cbe7 96ffmpeg -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 102ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
9181577c
FB
103@end example
104
4c5f7207
DB
105Converts the audio file a.wav and the raw YUV video file a.yuv
106to 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 111ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
9181577c
FB
112@end example
113
4c5f7207 114Converts 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 117mapping from input stream to output streams:
9181577c
FB
118
119@example
5438308f 120ffmpeg -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
123Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
124file:index' specifies which input stream is used for each output
e99c4e10 125stream, in the order of the definition of output streams.
9181577c
FB
126
127* You can transcode decrypted VOBs
128
129@example
7b900f2d 130ffmpeg -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
133This is a typical DVD ripping example; the input is a VOB file, the
134output an AVI file with MPEG-4 video and MP3 audio. Note that in this
135command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
136GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
137input video. Furthermore, the audio stream is MP3-encoded so you need
1cc60c47 138to enable LAME support by passing @code{--enable-libmp3lame} to configure.
4c5f7207 139The mapping is particularly useful for DVD transcoding
e99c4e10 140to get the desired audio language.
9181577c 141
4c5f7207 142NOTE: 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 149The generic syntax is:
9181577c 150
115329f1 151@example
e99c4e10 152@c man begin SYNOPSIS
28f88dc8 153ffmpeg [[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 157As a general rule, options are applied to the next specified
699e77b1 158file. Therefore, order is important, and you can have the same
8cc62264 159option on the command line multiple times. Each occurrence is
699e77b1
VP
160then 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
164ffmpeg -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
169ffmpeg -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
174ffmpeg -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
179ffmpeg -r 1 -i input.avi -r 24 output.avi
180@end example
181
182The format option may be needed for raw input files.
9181577c 183
4c5f7207
DB
184By default, FFmpeg tries to convert as losslessly as possible: It
185uses the same audio and video parameters for the outputs as the one
e99c4e10
FB
186specified 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 194Show license.
18bff752 195
9181577c 196@item -h
4c5f7207 197Show help.
18bff752 198
4386f941
DB
199@item -version
200Show version.
201
e99c4e10 202@item -formats
4c5f7207 203Show available formats, codecs, protocols, ...
18bff752 204
115329f1 205@item -f fmt
4c5f7207 206Force format.
18bff752 207
115329f1 208@item -i filename
4c5f7207 209input filename
9181577c 210
115329f1 211@item -y
4c5f7207 212Overwrite output files.
9181577c 213
115329f1 214@item -t duration
250c5317
GS
215Restrict the transcoded/captured video sequence
216to 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
220Set the file size limit.
221
e83a84ac 222@item -ss position
4c5f7207
DB
223Seek to given time position in seconds.
224@code{hh:mm:ss[.xxx]} syntax is also supported.
e83a84ac 225
4386f941
DB
226@item -itsoffset offset
227Set the input time offset in seconds.
228@code{[-]hh:mm:ss[.xxx]} syntax is also supported.
229This option affects all the input files that follow it.
230The offset is added to the timestamps of the input files.
231Specifying a positive offset means that the corresponding
232streams are delayed by 'offset' seconds.
233
115329f1 234@item -title string
4c5f7207 235Set the title.
9181577c 236
4386f941
DB
237@item -timestamp time
238Set the timestamp.
239
115329f1 240@item -author string
4c5f7207 241Set the author.
9181577c 242
115329f1 243@item -copyright string
4c5f7207 244Set the copyright.
9181577c 245
115329f1 246@item -comment string
4c5f7207 247Set the comment.
9181577c 248
4386f941
DB
249@item -album string
250Set the album.
251
ec1b10f4
PI
252@item -track number
253Set the track.
254
255@item -year number
256Set the year.
257
4386f941
DB
258@item -v verbose
259Control amount of logging.
260
99db6420 261@item -target type
4386f941 262Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
4c5f7207
DB
263"ntsc-svcd", ... ). All the format options (bitrate, codecs,
264buffer sizes) are then set automatically. You can just type:
99db6420
FB
265
266@example
267ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
268@end example
269
4c5f7207
DB
270Nevertheless you can specify additional options as long as you know
271they do not conflict with the standard, as in:
791d8d1d
MB
272
273@example
274ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
275@end example
276
4386f941
DB
277@item -dframes number
278Set the number of data frames to record.
279
280@item -scodec codec
281Force subtitle codec ('copy' to copy stream).
282
283@item -newsubtitle
284Add a new subtitle stream to the current output stream.
285
286@item -slang code
287Set 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 295Set the video bitrate in bit/s (default = 200 kb/s).
4386f941
DB
296@item -vframes number
297Set the number of video frames to record.
115329f1 298@item -r fps
4386f941 299Set frame rate (Hz value, fraction or abbreviation), (default = 25).
115329f1 300@item -s size
67053c30 301Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
4c5f7207 302The following abbreviations are recognized:
5ee03c86 303@table @samp
18bff752
FB
304@item sqcif
305128x96
306@item qcif
307176x144
308@item cif
309352x288
310@item 4cif
311704x576
7d88b5ca
BF
312@item qqvga
313160x120
314@item qvga
315320x240
316@item vga
317640x480
318@item svga
319800x600
320@item xga
3211024x768
322@item uxga
3231600x1200
324@item qxga
3252048x1536
326@item sxga
3271280x1024
328@item qsxga
3292560x2048
330@item hsxga
3315120x4096
332@item wvga
333852x480
334@item wxga
3351366x768
336@item wsxga
3371600x1024
338@item wuxga
3391920x1200
340@item woxga
3412560x1600
342@item wqsxga
3433200x2048
344@item wquxga
3453840x2400
346@item whsxga
3476400x4096
348@item whuxga
3497680x4800
350@item cga
351320x200
352@item ega
353640x350
354@item hd480
355852x480
356@item hd720
3571280x720
358@item hd1080
3591920x1080
18bff752
FB
360@end table
361
362@item -aspect aspect
4c5f7207 363Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
18bff752 364@item -croptop size
4c5f7207 365Set top crop band size (in pixels).
18bff752 366@item -cropbottom size
4c5f7207 367Set bottom crop band size (in pixels).
18bff752 368@item -cropleft size
4c5f7207 369Set left crop band size (in pixels).
18bff752 370@item -cropright size
4c5f7207 371Set right crop band size (in pixels).
1ff93ffc 372@item -padtop size
4c5f7207 373Set top pad band size (in pixels).
1ff93ffc 374@item -padbottom size
4c5f7207 375Set bottom pad band size (in pixels).
1ff93ffc 376@item -padleft size
4c5f7207 377Set left pad band size (in pixels).
1ff93ffc 378@item -padright size
4c5f7207 379Set right pad band size (in pixels).
5b79a73e 380@item -padcolor (hex color)
4c5f7207
DB
381Set color of padded bands. The value for padcolor is expressed
382as a six digit hexadecimal number where the first two digits
383represent red, the middle two digits green and last two digits
384blue (default = 000000 (black)).
9181577c 385@item -vn
4c5f7207 386Disable video recording.
115329f1 387@item -bt tolerance
dc5ee8bc 388Set video bitrate tolerance (in bit/s).
18bff752 389@item -maxrate bitrate
f754bfb9 390Set max video bitrate (in bit/s).
18bff752 391@item -minrate bitrate
f754bfb9 392Set min video bitrate (in bit/s).
18bff752 393@item -bufsize size
fa78d895 394Set video buffer verifier buffer size (in bits).
115329f1 395@item -vcodec codec
4c5f7207 396Force video codec to @var{codec}. Use the @code{copy} special value to
5ee03c86 397tell that the raw codec data must be copied as is.
18bff752 398@item -sameq
4c5f7207 399Use same video quality as source (implies VBR).
9181577c 400
115329f1 401@item -pass n
4c5f7207
DB
402Select the pass number (1 or 2). It is useful to do two pass
403encoding. The statistics of the video are recorded in the first
404pass and the video is generated at the exact requested bitrate
405in the second pass.
9181577c 406
115329f1 407@item -passlogfile file
4c5f7207 408Set two pass logfile name to @var{file}.
9181577c 409
4386f941
DB
410@item -newvideo
411Add 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
419Set pixel format. Use 'list' as parameter to show all the supported
420pixel formats.
35926489
IP
421@item -sws_flags flags
422Set SwScaler flags (only available when compiled with SwScaler support).
115329f1 423@item -g gop_size
4c5f7207 424Set the group of pictures size.
115329f1 425@item -intra
4c5f7207 426Use only intra frames.
4386f941
DB
427@item -vdt n
428Discard threshold.
115329f1 429@item -qscale q
4bef236b 430Use fixed video quantizer scale (VBR).
115329f1 431@item -qmin q
4bef236b 432minimum video quantizer scale (VBR)
115329f1 433@item -qmax q
4bef236b 434maximum video quantizer scale (VBR)
115329f1 435@item -qdiff q
4bef236b 436maximum difference between the quantizer scales (VBR)
115329f1 437@item -qblur blur
4bef236b 438video quantizer scale blur (VBR)
115329f1 439@item -qcomp compression
4bef236b 440video quantizer scale compression (VBR)
18bff752 441
9ae711e1
VP
442@item -lmin lambda
443minimum video lagrange factor (VBR)
444@item -lmax lambda
445max video lagrange factor (VBR)
446@item -mblmin lambda
447minimum macroblock quantizer scale (VBR)
448@item -mblmax lambda
449maximum macroblock quantizer scale (VBR)
450
451These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
452but you may use the QP2LAMBDA constant to easily convert from 'q' units:
453@example
454ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
455@end example
456
18bff752 457@item -rc_init_cplx complexity
4c5f7207 458initial complexity for single pass encoding
18bff752 459@item -b_qfactor factor
4c5f7207 460qp factor between P- and B-frames
18bff752 461@item -i_qfactor factor
4c5f7207 462qp factor between P- and I-frames
18bff752 463@item -b_qoffset offset
4c5f7207 464qp offset between P- and B-frames
18bff752 465@item -i_qoffset offset
4c5f7207 466qp offset between P- and I-frames
18bff752 467@item -rc_eq equation
4c5f7207
DB
468Set rate control equation (@pxref{FFmpeg formula
469evaluator}) (default = @code{tex^qComp}).
5ee03c86
FB
470@item -rc_override override
471rate control override for specific intervals
c0de00da 472@item -me_method method
4c5f7207
DB
473Set motion estimation method to @var{method}.
474Available methods are (from lowest to best quality):
18bff752
FB
475@table @samp
476@item zero
5ee03c86 477Try 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
486exhaustive search (slow and marginally better than epzs)
487@end table
488
489@item -dct_algo algo
4c5f7207 490Set DCT algorithm to @var{algo}. Available values are:
18bff752
FB
491@table @samp
492@item 0
493FF_DCT_AUTO (default)
494@item 1
495FF_DCT_FASTINT
496@item 2
497FF_DCT_INT
498@item 3
499FF_DCT_MMX
500@item 4
501FF_DCT_MLIB
502@item 5
503FF_DCT_ALTIVEC
504@end table
505
506@item -idct_algo algo
4c5f7207 507Set IDCT algorithm to @var{algo}. Available values are:
18bff752
FB
508@table @samp
509@item 0
510FF_IDCT_AUTO (default)
511@item 1
115329f1 512FF_IDCT_INT
18bff752 513@item 2
115329f1 514FF_IDCT_SIMPLE
18bff752 515@item 3
115329f1 516FF_IDCT_SIMPLEMMX
18bff752 517@item 4
115329f1 518FF_IDCT_LIBMPEG2MMX
18bff752 519@item 5
115329f1 520FF_IDCT_PS2
18bff752 521@item 6
115329f1 522FF_IDCT_MLIB
18bff752 523@item 7
115329f1 524FF_IDCT_ARM
18bff752 525@item 8
115329f1 526FF_IDCT_ALTIVEC
18bff752 527@item 9
115329f1 528FF_IDCT_SH4
18bff752 529@item 10
115329f1 530FF_IDCT_SIMPLEARM
18bff752
FB
531@end table
532
533@item -er n
4c5f7207 534Set error resilience to @var{n}.
18bff752 535@table @samp
115329f1 536@item 1
1471c6c2 537FF_ER_CAREFUL (default)
18bff752 538@item 2
5ee03c86 539FF_ER_COMPLIANT
18bff752
FB
540@item 3
541FF_ER_AGGRESSIVE
542@item 4
543FF_ER_VERY_AGGRESSIVE
544@end table
545
5ee03c86 546@item -ec bit_mask
4c5f7207 547Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
5ee03c86 548the following values:
18bff752
FB
549@table @samp
550@item 1
4c5f7207 551FF_EC_GUESS_MVS (default = enabled)
18bff752 552@item 2
4c5f7207 553FF_EC_DEBLOCK (default = enabled)
18bff752
FB
554@end table
555
556@item -bf frames
4c5f7207 557Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
18bff752
FB
558@item -mbd mode
559macroblock decision
560@table @samp
561@item 0
4c5f7207 562FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
18bff752 563@item 1
4c5f7207 564FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
18bff752 565@item 2
019c8838 566FF_MB_DECISION_RD: rate distortion
18bff752
FB
567@end table
568
569@item -4mv
4c5f7207 570Use four motion vector by macroblock (MPEG-4 only).
18bff752 571@item -part
4c5f7207 572Use data partitioning (MPEG-4 only).
18bff752 573@item -bug param
4c5f7207 574Work around encoder bugs that are not auto-detected.
18bff752 575@item -strict strictness
4c5f7207 576How strictly to follow the standards.
5ee03c86 577@item -aic
4c5f7207 578Enable Advanced intra coding (h263+).
5ee03c86 579@item -umv
4c5f7207 580Enable Unlimited Motion Vector (h263+)
18bff752
FB
581
582@item -deinterlace
4c5f7207 583Deinterlace pictures.
3841e813 584@item -ilme
4c5f7207
DB
585Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
586Use this option if your input file is interlaced and you want
587to keep the interlaced format for minimum losses.
588The alternative is to deinterlace the input stream with
589@option{-deinterlace}, but deinterlacing introduces losses.
18bff752 590@item -psnr
4c5f7207 591Calculate PSNR of compressed frames.
18bff752 592@item -vstats
4c5f7207 593Dump video coding statistics to @file{vstats_HHMMSS.log}.
b60d1379
SS
594@item -vstats_file file
595Dump video coding statistics to @var{file}.
18bff752 596@item -vhook module
4c5f7207 597Insert video processing @var{module}. @var{module} contains the module
18bff752 598name and its parameters separated by spaces.
4386f941
DB
599@item -top n
600top=1/bottom=0/auto=-1 field first
601@item -dc precision
602Intra_dc_precision.
603@item -vtag fourcc/tag
604Force video tag/fourcc.
605@item -qphist
606Show QP histogram.
607@item -vbsf bitstream filter
608Bitstream 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
615Set the number of audio frames to record.
115329f1 616@item -ar freq
4c5f7207 617Set the audio sampling frequency (default = 44100 Hz).
115329f1 618@item -ab bitrate
5438308f 619Set the audio bitrate in bit/s (default = 64k).
18bff752 620@item -ac channels
4c5f7207 621Set the number of audio channels (default = 1).
5ee03c86 622@item -an
4c5f7207 623Disable audio recording.
5ee03c86 624@item -acodec codec
4c5f7207
DB
625Force audio codec to @var{codec}. Use the @code{copy} special value to
626specify that the raw codec data must be copied as is.
de62a89d 627@item -newaudio
18fd519f
DB
628Add a new audio track to the output file. If you want to specify parameters,
629do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
de62a89d 630
18fd519f
DB
631Mapping will be done automatically, if the number of output streams is equal to
632the number of input streams, else it will pick the first one that matches. You
de62a89d
VP
633can override the mapping using @code{-map} as usual.
634
635Example:
636@example
5438308f 637ffmpeg -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
640Set 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
647Force audio tag/fourcc.
648@item -absf bitstream filter
649Bitstream 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
656Force subtitle codec ('copy' to copy stream).
657@item -newsubtitle
658Add a new subtitle stream to the current output stream.
659@item -slang code
660Set 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 667Set video grab channel (DV1394 only).
18bff752 668@item -tvstd standard
4c5f7207 669Set television standard (NTSC, PAL (SECAM)).
cc58300e
RP
670@item -isync
671Synchronize 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]
678Set stream mapping from input streams to output streams.
679Just 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
682Set meta data information of outfile from infile.
18bff752 683@item -debug
4c5f7207 684Print specific debug info.
115329f1 685@item -benchmark
4c5f7207 686Add timings for benchmarking.
4386f941 687@item -dump
4c5f7207 688Dump each input packet.
4386f941
DB
689@item -hex
690When dumping packets, also dump the payload.
18bff752 691@item -bitexact
4c5f7207 692Only use bit exact algorithms (for codec testing).
18bff752 693@item -ps size
4c5f7207 694Set packet size in bits.
5ee03c86 695@item -re
4c5f7207 696Read input at native frame rate. Mainly used to simulate a grab device.
4386f941 697@item -loop_input
4c5f7207
DB
698Loop over the input stream. Currently it works only for image
699streams. This option is used for automatic FFserver testing.
8108551a 700@item -loop_output number_of_times
019c8838 701Repeatedly 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
704Thread count.
c52e13f1 705@item -vsync parameter
29c9183c
DB
706Video sync method. Video will be stretched/squeezed to match the timestamps,
707it is done by duplicating and dropping frames. With -map you can select from
708which stream the timestamps should be taken. You can leave either video or
c52e13f1
BL
709audio unchanged and sync the remaining stream(s) to the unchanged one.
710@item -async samples_per_second
29c9183c 711Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
c52e13f1
BL
712the 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
714without any later correction.
43399718
VP
715@item -copyts
716Copy timestamps from input to output.
717@item -shortest
718Finish encoding when the shortest input stream ends.
719@item -dts_delta_threshold
720Timestamp discontinuity delta threshold.
721@item -muxdelay seconds
722Set the maximum demux-decode delay.
723@item -muxpreload seconds
724Set the initial demux-decode delay.
9181577c 725@end table
18bff752
FB
726
727@node FFmpeg formula evaluator
728@section FFmpeg formula evaluator
729
730When evaluating a rate control string, FFmpeg uses an internal formula
115329f1 731evaluator.
18bff752
FB
732
733The following binary operators are available: @code{+}, @code{-},
734@code{*}, @code{/}, @code{^}.
735
736The following unary operators are available: @code{+}, @code{-},
737@code{(...)}.
738
739The 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
761The 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 793ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
e99c4e10
FB
794@c man end
795
796@c man begin AUTHOR
797Fabrice Bellard
798@c man end
799
800@end ignore
9181577c
FB
801
802@section Protocols
803
4c5f7207
DB
804The filename can be @file{-} to read from standard input or to write
805to standard output.
9181577c 806
4c5f7207 807FFmpeg also handles many protocols specified with an URL syntax.
9181577c 808
4c5f7207 809Use 'ffmpeg -formats' to see a list of the supported protocols.
9181577c 810
e99c4e10 811The protocol @code{http:} is currently used only to communicate with
4c5f7207 812FFserver (see the FFserver documentation). When FFmpeg will be a
e99c4e10 813video 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
819and a small GOP size. This is especially true for RealVideo where
e99c4e10
FB
820the Linux player does not seem to be very fast, so it can miss
821frames. An example is:
9181577c
FB
822
823@example
3c0ba870 824ffmpeg -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
828quantizer. The value 1 indicates that a very good quality could
829be achieved. The value 31 indicates the worst quality. If q=31 appears
e99c4e10 830too often, it means that the encoder cannot compress enough to meet
4c5f7207 831your bitrate. You must either increase the bitrate, decrease the
e99c4e10 832frame 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
835compression at the expense of the compression ratio. You can use
836'-me zero' to speed up motion estimation, and '-intra' to disable
4c5f7207 837motion estimation completely (you have only I-frames, which means it
e99c4e10 838is 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
845quality).
9181577c
FB
846
847@item When converting video files, you can use the '-sameq' option which
4c5f7207
DB
848uses the same quality factor in the encoder as in the decoder.
849It allows almost lossless encoding.
9181577c
FB
850
851@end itemize
852
9181577c 853@bye