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