Statistics
| Branch: | Revision:

ffmpeg / doc / ffmpeg-doc.texi @ 0fc2c0f6

History | View | Annotate | Download (27.1 KB)

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 -filters
274
Show available libavfilter filters.
275

    
276
@item -f @var{fmt}
277
Force format.
278

    
279
@item -i @var{filename}
280
input file name
281

    
282
@item -y
283
Overwrite output files.
284

    
285
@item -t @var{duration}
286
Restrict the transcoded/captured video sequence
287
to the duration specified in seconds.
288
@code{hh:mm:ss[.xxx]} syntax is also supported.
289

    
290
@item -fs @var{limit_size}
291
Set the file size limit.
292

    
293
@item -ss @var{position}
294
Seek to given time position in seconds.
295
@code{hh:mm:ss[.xxx]} syntax is also supported.
296

    
297
@item -itsoffset @var{offset}
298
Set the input time offset in seconds.
299
@code{[-]hh:mm:ss[.xxx]} syntax is also supported.
300
This option affects all the input files that follow it.
301
The offset is added to the timestamps of the input files.
302
Specifying a positive offset means that the corresponding
303
streams are delayed by 'offset' seconds.
304

    
305
@item -timestamp @var{time}
306
Set the timestamp.
307

    
308
@item -metadata @var{key}=@var{value}
309
Set a metadata key/value pair.
310

    
311
For example, for setting the title in the output file:
312
@example
313
ffmpeg -i in.avi -metadata title="my title" out.flv
314
@end example
315

    
316
@item -v @var{number}
317
Set the logging verbosity level.
318

    
319
@item -loglevel @var{loglevel}
320
Set the logging level used by the library.
321
@var{loglevel} is a number or a string containing one of the following values:
322
@table @samp
323
@item quiet
324
@item panic
325
@item fatal
326
@item error
327
@item warning
328
@item info
329
@item verbose
330
@item debug
331
@end table
332

    
333
@item -target @var{type}
334
Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
335
"ntsc-svcd", ... ). All the format options (bitrate, codecs,
336
buffer sizes) are then set automatically. You can just type:
337

    
338
@example
339
ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
340
@end example
341

    
342
Nevertheless you can specify additional options as long as you know
343
they do not conflict with the standard, as in:
344

    
345
@example
346
ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
347
@end example
348

    
349
@item -dframes @var{number}
350
Set the number of data frames to record.
351

    
352
@item -scodec @var{codec}
353
Force subtitle codec ('copy' to copy stream).
354

    
355
@item -newsubtitle
356
Add a new subtitle stream to the current output stream.
357

    
358
@item -slang @var{code}
359
Set the ISO 639 language code (3 letters) of the current subtitle stream.
360

    
361
@end table
362

    
363
@section Video Options
364

    
365
@table @option
366
@item -b @var{bitrate}
367
Set the video bitrate in bit/s (default = 200 kb/s).
368
@item -vframes @var{number}
369
Set the number of video frames to record.
370
@item -r @var{fps}
371
Set frame rate (Hz value, fraction or abbreviation), (default = 25).
372
@item -s @var{size}
373
Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
374
The following abbreviations are recognized:
375
@table @samp
376
@item sqcif
377
128x96
378
@item qcif
379
176x144
380
@item cif
381
352x288
382
@item 4cif
383
704x576
384
@item 16cif
385
1408x1152
386
@item qqvga
387
160x120
388
@item qvga
389
320x240
390
@item vga
391
640x480
392
@item svga
393
800x600
394
@item xga
395
1024x768
396
@item uxga
397
1600x1200
398
@item qxga
399
2048x1536
400
@item sxga
401
1280x1024
402
@item qsxga
403
2560x2048
404
@item hsxga
405
5120x4096
406
@item wvga
407
852x480
408
@item wxga
409
1366x768
410
@item wsxga
411
1600x1024
412
@item wuxga
413
1920x1200
414
@item woxga
415
2560x1600
416
@item wqsxga
417
3200x2048
418
@item wquxga
419
3840x2400
420
@item whsxga
421
6400x4096
422
@item whuxga
423
7680x4800
424
@item cga
425
320x200
426
@item ega
427
640x350
428
@item hd480
429
852x480
430
@item hd720
431
1280x720
432
@item hd1080
433
1920x1080
434
@end table
435

    
436
@item -aspect @var{aspect}
437
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
438
@item -croptop @var{size}
439
Set top crop band size (in pixels).
440
@item -cropbottom @var{size}
441
Set bottom crop band size (in pixels).
442
@item -cropleft @var{size}
443
Set left crop band size (in pixels).
444
@item -cropright @var{size}
445
Set right crop band size (in pixels).
446
@item -padtop @var{size}
447
Set top pad band size (in pixels).
448
@item -padbottom @var{size}
449
Set bottom pad band size (in pixels).
450
@item -padleft @var{size}
451
Set left pad band size (in pixels).
452
@item -padright @var{size}
453
Set right pad band size (in pixels).
454
@item -padcolor @var{hex_color}
455
Set color of padded bands. The value for padcolor is expressed
456
as a six digit hexadecimal number where the first two digits
457
represent red, the middle two digits green and last two digits
458
blue (default = 000000 (black)).
459
@item -vn
460
Disable video recording.
461
@item -bt @var{tolerance}
462
Set video bitrate tolerance (in bits, default 4000k).
463
Has a minimum value of: (target_bitrate/target_framerate).
464
In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
465
willing to deviate from the target average bitrate value. This is
466
not related to min/max bitrate. Lowering tolerance too much has
467
an adverse effect on quality.
468
@item -maxrate @var{bitrate}
469
Set max video bitrate (in bit/s).
470
Requires -bufsize to be set.
471
@item -minrate @var{bitrate}
472
Set min video bitrate (in bit/s).
473
Most useful in setting up a CBR encode:
474
@example
475
ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
476
@end example
477
It is of little use elsewise.
478
@item -bufsize @var{size}
479
Set video buffer verifier buffer size (in bits).
480
@item -vcodec @var{codec}
481
Force video codec to @var{codec}. Use the @code{copy} special value to
482
tell that the raw codec data must be copied as is.
483
@item -sameq
484
Use same video quality as source (implies VBR).
485

    
486
@item -pass @var{n}
487
Select the pass number (1 or 2). It is used to do two-pass
488
video encoding. The statistics of the video are recorded in the first
489
pass into a log file (see also the option -passlogfile),
490
and in the second pass that log file is used to generate the video
491
at the exact requested bitrate.
492
On pass 1, you may just deactivate audio and set output to null,
493
examples for Windows and Unix:
494
@example
495
ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
496
ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
497
@end example
498

    
499
@item -passlogfile @var{prefix}
500
Set two-pass log file name prefix to @var{prefix}, the default file name
501
prefix is ``ffmpeg2pass''. The complete file name will be
502
@file{PREFIX-N.log}, where N is a number specific to the output
503
stream.
504

    
505
@item -newvideo
506
Add a new video stream to the current output stream.
507

    
508
@item -vlang @var{code}
509
Set the ISO 639 language code (3 letters) of the current video stream.
510

    
511
@end table
512

    
513
@section Advanced Video Options
514

    
515
@table @option
516
@item -pix_fmt @var{format}
517
Set pixel format. Use 'list' as parameter to show all the supported
518
pixel formats.
519
@item -sws_flags @var{flags}
520
Set SwScaler flags (only available when compiled with swscale support).
521
@item -g @var{gop_size}
522
Set the group of pictures size.
523
@item -intra
524
Use only intra frames.
525
@item -vdt @var{n}
526
Discard threshold.
527
@item -qscale @var{q}
528
Use fixed video quantizer scale (VBR).
529
@item -qmin @var{q}
530
minimum video quantizer scale (VBR)
531
@item -qmax @var{q}
532
maximum video quantizer scale (VBR)
533
@item -qdiff @var{q}
534
maximum difference between the quantizer scales (VBR)
535
@item -qblur @var{blur}
536
video quantizer scale blur (VBR) (range 0.0 - 1.0)
537
@item -qcomp @var{compression}
538
video quantizer scale compression (VBR) (default 0.5).
539
Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
540

    
541
@item -lmin @var{lambda}
542
minimum video lagrange factor (VBR)
543
@item -lmax @var{lambda}
544
max video lagrange factor (VBR)
545
@item -mblmin @var{lambda}
546
minimum macroblock quantizer scale (VBR)
547
@item -mblmax @var{lambda}
548
maximum macroblock quantizer scale (VBR)
549

    
550
These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
551
but you may use the QP2LAMBDA constant to easily convert from 'q' units:
552
@example
553
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
554
@end example
555

    
556
@item -rc_init_cplx @var{complexity}
557
initial complexity for single pass encoding
558
@item -b_qfactor @var{factor}
559
qp factor between P- and B-frames
560
@item -i_qfactor @var{factor}
561
qp factor between P- and I-frames
562
@item -b_qoffset @var{offset}
563
qp offset between P- and B-frames
564
@item -i_qoffset @var{offset}
565
qp offset between P- and I-frames
566
@item -rc_eq @var{equation}
567
Set rate control equation (@pxref{FFmpeg formula
568
evaluator}) (default = @code{tex^qComp}).
569
@item -rc_override @var{override}
570
rate control override for specific intervals
571
@item -me_method @var{method}
572
Set motion estimation method to @var{method}.
573
Available methods are (from lowest to best quality):
574
@table @samp
575
@item zero
576
Try just the (0, 0) vector.
577
@item phods
578
@item log
579
@item x1
580
@item hex
581
@item umh
582
@item epzs
583
(default method)
584
@item full
585
exhaustive search (slow and marginally better than epzs)
586
@end table
587

    
588
@item -dct_algo @var{algo}
589
Set DCT algorithm to @var{algo}. Available values are:
590
@table @samp
591
@item 0
592
FF_DCT_AUTO (default)
593
@item 1
594
FF_DCT_FASTINT
595
@item 2
596
FF_DCT_INT
597
@item 3
598
FF_DCT_MMX
599
@item 4
600
FF_DCT_MLIB
601
@item 5
602
FF_DCT_ALTIVEC
603
@end table
604

    
605
@item -idct_algo @var{algo}
606
Set IDCT algorithm to @var{algo}. Available values are:
607
@table @samp
608
@item 0
609
FF_IDCT_AUTO (default)
610
@item 1
611
FF_IDCT_INT
612
@item 2
613
FF_IDCT_SIMPLE
614
@item 3
615
FF_IDCT_SIMPLEMMX
616
@item 4
617
FF_IDCT_LIBMPEG2MMX
618
@item 5
619
FF_IDCT_PS2
620
@item 6
621
FF_IDCT_MLIB
622
@item 7
623
FF_IDCT_ARM
624
@item 8
625
FF_IDCT_ALTIVEC
626
@item 9
627
FF_IDCT_SH4
628
@item 10
629
FF_IDCT_SIMPLEARM
630
@end table
631

    
632
@item -er @var{n}
633
Set error resilience to @var{n}.
634
@table @samp
635
@item 1
636
FF_ER_CAREFUL (default)
637
@item 2
638
FF_ER_COMPLIANT
639
@item 3
640
FF_ER_AGGRESSIVE
641
@item 4
642
FF_ER_VERY_AGGRESSIVE
643
@end table
644

    
645
@item -ec @var{bit_mask}
646
Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
647
the following values:
648
@table @samp
649
@item 1
650
FF_EC_GUESS_MVS (default = enabled)
651
@item 2
652
FF_EC_DEBLOCK (default = enabled)
653
@end table
654

    
655
@item -bf @var{frames}
656
Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
657
@item -mbd @var{mode}
658
macroblock decision
659
@table @samp
660
@item 0
661
FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
662
@item 1
663
FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
664
@item 2
665
FF_MB_DECISION_RD: rate distortion
666
@end table
667

    
668
@item -4mv
669
Use four motion vector by macroblock (MPEG-4 only).
670
@item -part
671
Use data partitioning (MPEG-4 only).
672
@item -bug @var{param}
673
Work around encoder bugs that are not auto-detected.
674
@item -strict @var{strictness}
675
How strictly to follow the standards.
676
@item -aic
677
Enable Advanced intra coding (h263+).
678
@item -umv
679
Enable Unlimited Motion Vector (h263+)
680

    
681
@item -deinterlace
682
Deinterlace pictures.
683
@item -ilme
684
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
685
Use this option if your input file is interlaced and you want
686
to keep the interlaced format for minimum losses.
687
The alternative is to deinterlace the input stream with
688
@option{-deinterlace}, but deinterlacing introduces losses.
689
@item -psnr
690
Calculate PSNR of compressed frames.
691
@item -vstats
692
Dump video coding statistics to @file{vstats_HHMMSS.log}.
693
@item -vstats_file @var{file}
694
Dump video coding statistics to @var{file}.
695
@item -top @var{n}
696
top=1/bottom=0/auto=-1 field first
697
@item -dc @var{precision}
698
Intra_dc_precision.
699
@item -vtag @var{fourcc/tag}
700
Force video tag/fourcc.
701
@item -qphist
702
Show QP histogram.
703
@item -vbsf @var{bitstream_filter}
704
Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump".
705
@example
706
ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
707
@end example
708
@end table
709

    
710
@section Audio Options
711

    
712
@table @option
713
@item -aframes @var{number}
714
Set the number of audio frames to record.
715
@item -ar @var{freq}
716
Set the audio sampling frequency (default = 44100 Hz).
717
@item -ab @var{bitrate}
718
Set the audio bitrate in bit/s (default = 64k).
719
@item -ac @var{channels}
720
Set the number of audio channels (default = 1).
721
@item -an
722
Disable audio recording.
723
@item -acodec @var{codec}
724
Force audio codec to @var{codec}. Use the @code{copy} special value to
725
specify that the raw codec data must be copied as is.
726
@item -newaudio
727
Add a new audio track to the output file. If you want to specify parameters,
728
do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
729

    
730
Mapping will be done automatically, if the number of output streams is equal to
731
the number of input streams, else it will pick the first one that matches. You
732
can override the mapping using @code{-map} as usual.
733

    
734
Example:
735
@example
736
ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
737
@end example
738
@item -alang @var{code}
739
Set the ISO 639 language code (3 letters) of the current audio stream.
740
@end table
741

    
742
@section Advanced Audio options:
743

    
744
@table @option
745
@item -atag @var{fourcc/tag}
746
Force audio tag/fourcc.
747
@item -absf @var{bitstream_filter}
748
Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
749
@end table
750

    
751
@section Subtitle options:
752

    
753
@table @option
754
@item -scodec @var{codec}
755
Force subtitle codec ('copy' to copy stream).
756
@item -newsubtitle
757
Add a new subtitle stream to the current output stream.
758
@item -slang @var{code}
759
Set the ISO 639 language code (3 letters) of the current subtitle stream.
760
@item -sn
761
Disable subtitle recording.
762
@item -sbsf @var{bitstream_filter}
763
Bitstream filters available are "mov2textsub", "text2movsub".
764
@example
765
ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
766
@end example
767
@end table
768

    
769
@section Audio/Video grab options
770

    
771
@table @option
772
@item -vc @var{channel}
773
Set video grab channel (DV1394 only).
774
@item -tvstd @var{standard}
775
Set television standard (NTSC, PAL (SECAM)).
776
@item -isync
777
Synchronize read on input.
778
@end table
779

    
780
@section Advanced options
781

    
782
@table @option
783
@item -map @var{input_stream_id}[:@var{sync_stream_id}]
784
Set stream mapping from input streams to output streams.
785
Just enumerate the input streams in the order you want them in the output.
786
@var{sync_stream_id} if specified sets the input stream to sync
787
against.
788
@item -map_meta_data @var{outfile}:@var{infile}
789
Set meta data information of @var{outfile} from @var{infile}.
790
@item -debug
791
Print specific debug info.
792
@item -benchmark
793
Add timings for benchmarking.
794
@item -dump
795
Dump each input packet.
796
@item -hex
797
When dumping packets, also dump the payload.
798
@item -bitexact
799
Only use bit exact algorithms (for codec testing).
800
@item -ps @var{size}
801
Set RTP payload size in bytes.
802
@item -re
803
Read input at native frame rate. Mainly used to simulate a grab device.
804
@item -loop_input
805
Loop over the input stream. Currently it works only for image
806
streams. This option is used for automatic FFserver testing.
807
@item -loop_output @var{number_of_times}
808
Repeatedly loop output for formats that support looping such as animated GIF
809
(0 will loop the output infinitely).
810
@item -threads @var{count}
811
Thread count.
812
@item -vsync @var{parameter}
813
Video sync method. Video will be stretched/squeezed to match the timestamps,
814
it is done by duplicating and dropping frames. With -map you can select from
815
which stream the timestamps should be taken. You can leave either video or
816
audio unchanged and sync the remaining stream(s) to the unchanged one.
817
@item -async @var{samples_per_second}
818
Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
819
the parameter is the maximum samples per second by which the audio is changed.
820
-async 1 is a special case where only the start of the audio stream is corrected
821
without any later correction.
822
@item -copyts
823
Copy timestamps from input to output.
824
@item -shortest
825
Finish encoding when the shortest input stream ends.
826
@item -dts_delta_threshold
827
Timestamp discontinuity delta threshold.
828
@item -muxdelay @var{seconds}
829
Set the maximum demux-decode delay.
830
@item -muxpreload @var{seconds}
831
Set the initial demux-decode delay.
832
@end table
833

    
834
@section Preset files
835

    
836
A preset file contains a sequence of @var{option}=@var{value} pairs,
837
one for each line, specifying a sequence of options which would be
838
awkward to specify on the command line. Lines starting with the hash
839
('#') character are ignored and are used to provide comments. Check
840
the @file{ffpresets} directory in the FFmpeg source tree for examples.
841

    
842
Preset files are specified with the @code{vpre}, @code{apre},
843
@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
844
filename of the preset instead of a preset name as input and can be
845
used for any kind of codec. For the @code{vpre}, @code{apre}, and
846
@code{spre} options, the options specified in a preset file are
847
applied to the currently selected codec of the same type as the preset
848
option.
849

    
850
The argument passed to the @code{vpre}, @code{apre}, and @code{spre}
851
preset options identifies the preset file to use according to the
852
following rules:
853

    
854
First ffmpeg searches for a file named @var{arg}.ffpreset in the
855
directories @file{$HOME/.ffmpeg}, and in the datadir defined at
856
configuration time (usually @file{PREFIX/share/ffmpeg}) in that
857
order. For example, if the argument is @code{libx264-max}, it will
858
search for the file @file{libx264-max.ffpreset}.
859

    
860
If no such file is found, then ffmpeg will search for a file named
861
@var{codec_name}-@var{arg}.ffpreset in the above-mentioned
862
directories, where @var{codec_name} is the name of the codec to which
863
the preset file options will be applied. For example, if you select
864
the video codec with @code{-vcodec libx264} and use @code{-vpre max},
865
then it will search for the file @file{libx264-max.ffpreset}.
866

    
867
@anchor{FFmpeg formula evaluator}
868
@section FFmpeg formula evaluator
869

    
870
When evaluating a rate control string, FFmpeg uses an internal formula
871
evaluator.
872

    
873
The following binary operators are available: @code{+}, @code{-},
874
@code{*}, @code{/}, @code{^}.
875

    
876
The following unary operators are available: @code{+}, @code{-},
877
@code{(...)}.
878

    
879
The following statements are available: @code{ld}, @code{st},
880
@code{while}.
881

    
882
The following functions are available:
883
@table @var
884
@item sinh(x)
885
@item cosh(x)
886
@item tanh(x)
887
@item sin(x)
888
@item cos(x)
889
@item tan(x)
890
@item atan(x)
891
@item asin(x)
892
@item acos(x)
893
@item exp(x)
894
@item log(x)
895
@item abs(x)
896
@item squish(x)
897
@item gauss(x)
898
@item mod(x, y)
899
@item max(x, y)
900
@item min(x, y)
901
@item eq(x, y)
902
@item gte(x, y)
903
@item gt(x, y)
904
@item lte(x, y)
905
@item lt(x, y)
906
@item bits2qp(bits)
907
@item qp2bits(qp)
908
@end table
909

    
910
The following constants are available:
911
@table @var
912
@item PI
913
@item E
914
@item iTex
915
@item pTex
916
@item tex
917
@item mv
918
@item fCode
919
@item iCount
920
@item mcVar
921
@item var
922
@item isI
923
@item isP
924
@item isB
925
@item avgQP
926
@item qComp
927
@item avgIITex
928
@item avgPITex
929
@item avgPPTex
930
@item avgBPTex
931
@item avgTex
932
@end table
933

    
934
@c man end
935

    
936
@ignore
937

    
938
@setfilename ffmpeg
939
@settitle FFmpeg video converter
940

    
941
@c man begin SEEALSO
942
ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
943
@c man end
944

    
945
@c man begin AUTHOR
946
Fabrice Bellard
947
@c man end
948

    
949
@end ignore
950

    
951
@section Protocols
952

    
953
The file name can be @file{-} to read from standard input or to write
954
to standard output.
955

    
956
FFmpeg also handles many protocols specified with an URL syntax.
957

    
958
Use 'ffmpeg -protocols' to see a list of the supported protocols.
959

    
960
The protocol @code{http:} is currently used only to communicate with
961
FFserver (see the FFserver documentation). When FFmpeg will be a
962
video player it will also be used for streaming :-)
963

    
964
@chapter Tips
965

    
966
@itemize
967
@item For streaming at very low bitrate application, use a low frame rate
968
and a small GOP size. This is especially true for RealVideo where
969
the Linux player does not seem to be very fast, so it can miss
970
frames. An example is:
971

    
972
@example
973
ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
974
@end example
975

    
976
@item  The parameter 'q' which is displayed while encoding is the current
977
quantizer. The value 1 indicates that a very good quality could
978
be achieved. The value 31 indicates the worst quality. If q=31 appears
979
too often, it means that the encoder cannot compress enough to meet
980
your bitrate. You must either increase the bitrate, decrease the
981
frame rate or decrease the frame size.
982

    
983
@item If your computer is not fast enough, you can speed up the
984
compression at the expense of the compression ratio. You can use
985
'-me zero' to speed up motion estimation, and '-intra' to disable
986
motion estimation completely (you have only I-frames, which means it
987
is about as good as JPEG compression).
988

    
989
@item To have very low audio bitrates, reduce the sampling frequency
990
(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
991

    
992
@item To have a constant quality (but a variable bitrate), use the option
993
'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
994
quality).
995

    
996
@item When converting video files, you can use the '-sameq' option which
997
uses the same quality factor in the encoder as in the decoder.
998
It allows almost lossless encoding.
999

    
1000
@end itemize
1001

    
1002
@bye