annotate ffmpeg/doc/ffmpeg.1 @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 .\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
yading@10 2 .\"
yading@10 3 .\" Standard preamble:
yading@10 4 .\" ========================================================================
yading@10 5 .de Sp \" Vertical space (when we can't use .PP)
yading@10 6 .if t .sp .5v
yading@10 7 .if n .sp
yading@10 8 ..
yading@10 9 .de Vb \" Begin verbatim text
yading@10 10 .ft CW
yading@10 11 .nf
yading@10 12 .ne \\$1
yading@10 13 ..
yading@10 14 .de Ve \" End verbatim text
yading@10 15 .ft R
yading@10 16 .fi
yading@10 17 ..
yading@10 18 .\" Set up some character translations and predefined strings. \*(-- will
yading@10 19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
yading@10 20 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
yading@10 21 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
yading@10 22 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
yading@10 23 .\" nothing in troff, for use with C<>.
yading@10 24 .tr \(*W-
yading@10 25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
yading@10 26 .ie n \{\
yading@10 27 . ds -- \(*W-
yading@10 28 . ds PI pi
yading@10 29 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
yading@10 30 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
yading@10 31 . ds L" ""
yading@10 32 . ds R" ""
yading@10 33 . ds C` ""
yading@10 34 . ds C' ""
yading@10 35 'br\}
yading@10 36 .el\{\
yading@10 37 . ds -- \|\(em\|
yading@10 38 . ds PI \(*p
yading@10 39 . ds L" ``
yading@10 40 . ds R" ''
yading@10 41 'br\}
yading@10 42 .\"
yading@10 43 .\" Escape single quotes in literal strings from groff's Unicode transform.
yading@10 44 .ie \n(.g .ds Aq \(aq
yading@10 45 .el .ds Aq '
yading@10 46 .\"
yading@10 47 .\" If the F register is turned on, we'll generate index entries on stderr for
yading@10 48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
yading@10 49 .\" entries marked with X<> in POD. Of course, you'll have to process the
yading@10 50 .\" output yourself in some meaningful fashion.
yading@10 51 .ie \nF \{\
yading@10 52 . de IX
yading@10 53 . tm Index:\\$1\t\\n%\t"\\$2"
yading@10 54 ..
yading@10 55 . nr % 0
yading@10 56 . rr F
yading@10 57 .\}
yading@10 58 .el \{\
yading@10 59 . de IX
yading@10 60 ..
yading@10 61 .\}
yading@10 62 .\"
yading@10 63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
yading@10 64 .\" Fear. Run. Save yourself. No user-serviceable parts.
yading@10 65 . \" fudge factors for nroff and troff
yading@10 66 .if n \{\
yading@10 67 . ds #H 0
yading@10 68 . ds #V .8m
yading@10 69 . ds #F .3m
yading@10 70 . ds #[ \f1
yading@10 71 . ds #] \fP
yading@10 72 .\}
yading@10 73 .if t \{\
yading@10 74 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
yading@10 75 . ds #V .6m
yading@10 76 . ds #F 0
yading@10 77 . ds #[ \&
yading@10 78 . ds #] \&
yading@10 79 .\}
yading@10 80 . \" simple accents for nroff and troff
yading@10 81 .if n \{\
yading@10 82 . ds ' \&
yading@10 83 . ds ` \&
yading@10 84 . ds ^ \&
yading@10 85 . ds , \&
yading@10 86 . ds ~ ~
yading@10 87 . ds /
yading@10 88 .\}
yading@10 89 .if t \{\
yading@10 90 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
yading@10 91 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
yading@10 92 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
yading@10 93 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
yading@10 94 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
yading@10 95 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
yading@10 96 .\}
yading@10 97 . \" troff and (daisy-wheel) nroff accents
yading@10 98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
yading@10 99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
yading@10 100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
yading@10 101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
yading@10 102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
yading@10 103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
yading@10 104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
yading@10 105 .ds ae a\h'-(\w'a'u*4/10)'e
yading@10 106 .ds Ae A\h'-(\w'A'u*4/10)'E
yading@10 107 . \" corrections for vroff
yading@10 108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
yading@10 109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
yading@10 110 . \" for low resolution devices (crt and lpr)
yading@10 111 .if \n(.H>23 .if \n(.V>19 \
yading@10 112 \{\
yading@10 113 . ds : e
yading@10 114 . ds 8 ss
yading@10 115 . ds o a
yading@10 116 . ds d- d\h'-1'\(ga
yading@10 117 . ds D- D\h'-1'\(hy
yading@10 118 . ds th \o'bp'
yading@10 119 . ds Th \o'LP'
yading@10 120 . ds ae ae
yading@10 121 . ds Ae AE
yading@10 122 .\}
yading@10 123 .rm #[ #] #H #V #F C
yading@10 124 .\" ========================================================================
yading@10 125 .\"
yading@10 126 .IX Title "FFMPEG 1"
yading@10 127 .TH FFMPEG 1 "2013-04-21" " " " "
yading@10 128 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
yading@10 129 .\" way too many mistakes in technical documents.
yading@10 130 .if n .ad l
yading@10 131 .nh
yading@10 132 .SH "NAME"
yading@10 133 ffmpeg \- ffmpeg video converter
yading@10 134 .SH "SYNOPSIS"
yading@10 135 .IX Header "SYNOPSIS"
yading@10 136 ffmpeg [\fIglobal_options\fR] {[\fIinput_file_options\fR] \-i \fIinput_file\fR} ... {[\fIoutput_file_options\fR] \fIoutput_file\fR} ...
yading@10 137 .SH "DESCRIPTION"
yading@10 138 .IX Header "DESCRIPTION"
yading@10 139 \&\fBffmpeg\fR is a very fast video and audio converter that can also grab from
yading@10 140 a live audio/video source. It can also convert between arbitrary sample
yading@10 141 rates and resize video on the fly with a high quality polyphase filter.
yading@10 142 .PP
yading@10 143 \&\fBffmpeg\fR reads from an arbitrary number of input \*(L"files\*(R" (which can be regular
yading@10 144 files, pipes, network streams, grabbing devices, etc.), specified by the
yading@10 145 \&\f(CW\*(C`\-i\*(C'\fR option, and writes to an arbitrary number of output \*(L"files\*(R", which are
yading@10 146 specified by a plain output filename. Anything found on the command line which
yading@10 147 cannot be interpreted as an option is considered to be an output filename.
yading@10 148 .PP
yading@10 149 Each input or output file can, in principle, contain any number of streams of
yading@10 150 different types (video/audio/subtitle/attachment/data). The allowed number and/or
yading@10 151 types of streams may be limited by the container format. Selecting which
yading@10 152 streams from which inputs will go into which output is either done automatically
yading@10 153 or with the \f(CW\*(C`\-map\*(C'\fR option (see the Stream selection chapter).
yading@10 154 .PP
yading@10 155 To refer to input files in options, you must use their indices (0\-based). E.g.
yading@10 156 the first input file is \f(CW0\fR, the second is \f(CW1\fR, etc. Similarly, streams
yading@10 157 within a file are referred to by their indices. E.g. \f(CW\*(C`2:3\*(C'\fR refers to the
yading@10 158 fourth stream in the third input file. Also see the Stream specifiers chapter.
yading@10 159 .PP
yading@10 160 As a general rule, options are applied to the next specified
yading@10 161 file. Therefore, order is important, and you can have the same
yading@10 162 option on the command line multiple times. Each occurrence is
yading@10 163 then applied to the next input or output file.
yading@10 164 Exceptions from this rule are the global options (e.g. verbosity level),
yading@10 165 which should be specified first.
yading@10 166 .PP
yading@10 167 Do not mix input and output files \*(-- first specify all input files, then all
yading@10 168 output files. Also do not mix options which belong to different files. All
yading@10 169 options apply \s-1ONLY\s0 to the next input or output file and are reset between files.
yading@10 170 .IP "\(bu" 4
yading@10 171 To set the video bitrate of the output file to 64 kbit/s:
yading@10 172 .Sp
yading@10 173 .Vb 1
yading@10 174 \& ffmpeg \-i input.avi \-b:v 64k \-bufsize 64k output.avi
yading@10 175 .Ve
yading@10 176 .IP "\(bu" 4
yading@10 177 To force the frame rate of the output file to 24 fps:
yading@10 178 .Sp
yading@10 179 .Vb 1
yading@10 180 \& ffmpeg \-i input.avi \-r 24 output.avi
yading@10 181 .Ve
yading@10 182 .IP "\(bu" 4
yading@10 183 To force the frame rate of the input file (valid for raw formats only)
yading@10 184 to 1 fps and the frame rate of the output file to 24 fps:
yading@10 185 .Sp
yading@10 186 .Vb 1
yading@10 187 \& ffmpeg \-r 1 \-i input.m2v \-r 24 output.avi
yading@10 188 .Ve
yading@10 189 .PP
yading@10 190 The format option may be needed for raw input files.
yading@10 191 .SH "DETAILED DESCRIPTION"
yading@10 192 .IX Header "DETAILED DESCRIPTION"
yading@10 193 The transcoding process in \fBffmpeg\fR for each output can be described by
yading@10 194 the following diagram:
yading@10 195 .PP
yading@10 196 .Vb 5
yading@10 197 \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_
yading@10 198 \& | | | | | | | | | |
yading@10 199 \& | input | demuxer | encoded data | decoder | decoded | encoder | encoded data | muxer | output |
yading@10 200 \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-\-\-> | frames | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-> | file |
yading@10 201 \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_|
yading@10 202 .Ve
yading@10 203 .PP
yading@10 204 \&\fBffmpeg\fR calls the libavformat library (containing demuxers) to read
yading@10 205 input files and get packets containing encoded data from them. When there are
yading@10 206 multiple input files, \fBffmpeg\fR tries to keep them synchronized by
yading@10 207 tracking lowest timestamp on any active input stream.
yading@10 208 .PP
yading@10 209 Encoded packets are then passed to the decoder (unless streamcopy is selected
yading@10 210 for the stream, see further for a description). The decoder produces
yading@10 211 uncompressed frames (raw video/PCM audio/...) which can be processed further by
yading@10 212 filtering (see next section). After filtering, the frames are passed to the
yading@10 213 encoder, which encodes them and outputs encoded packets. Finally those are
yading@10 214 passed to the muxer, which writes the encoded packets to the output file.
yading@10 215 .SS "Filtering"
yading@10 216 .IX Subsection "Filtering"
yading@10 217 Before encoding, \fBffmpeg\fR can process raw audio and video frames using
yading@10 218 filters from the libavfilter library. Several chained filters form a filter
yading@10 219 graph. \fBffmpeg\fR distinguishes between two types of filtergraphs:
yading@10 220 simple and complex.
yading@10 221 .PP
yading@10 222 \fISimple filtergraphs\fR
yading@10 223 .IX Subsection "Simple filtergraphs"
yading@10 224 .PP
yading@10 225 Simple filtergraphs are those that have exactly one input and output, both of
yading@10 226 the same type. In the above diagram they can be represented by simply inserting
yading@10 227 an additional step between decoding and encoding:
yading@10 228 .PP
yading@10 229 .Vb 5
yading@10 230 \& _\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_
yading@10 231 \& | | | | | |
yading@10 232 \& | decoded | simple filtergraph | filtered | encoder | encoded data |
yading@10 233 \& | frames | \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> | frames | \-\-\-\-\-\-\-\-\-> | packets |
yading@10 234 \& |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
yading@10 235 .Ve
yading@10 236 .PP
yading@10 237 Simple filtergraphs are configured with the per-stream \fB\-filter\fR option
yading@10 238 (with \fB\-vf\fR and \fB\-af\fR aliases for video and audio respectively).
yading@10 239 A simple filtergraph for video can look for example like this:
yading@10 240 .PP
yading@10 241 .Vb 4
yading@10 242 \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_
yading@10 243 \& | | | | | | | | | |
yading@10 244 \& | input | \-\-\-> | deinterlace | \-\-\-> | scale | \-\-\-> | fps | \-\-\-> | output |
yading@10 245 \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_|
yading@10 246 .Ve
yading@10 247 .PP
yading@10 248 Note that some filters change frame properties but not frame contents. E.g. the
yading@10 249 \&\f(CW\*(C`fps\*(C'\fR filter in the example above changes number of frames, but does not
yading@10 250 touch the frame contents. Another example is the \f(CW\*(C`setpts\*(C'\fR filter, which
yading@10 251 only sets timestamps and otherwise passes the frames unchanged.
yading@10 252 .PP
yading@10 253 \fIComplex filtergraphs\fR
yading@10 254 .IX Subsection "Complex filtergraphs"
yading@10 255 .PP
yading@10 256 Complex filtergraphs are those which cannot be described as simply a linear
yading@10 257 processing chain applied to one stream. This is the case, for example, when the graph has
yading@10 258 more than one input and/or output, or when output stream type is different from
yading@10 259 input. They can be represented with the following diagram:
yading@10 260 .PP
yading@10 261 .Vb 10
yading@10 262 \& _\|_\|_\|_\|_\|_\|_\|_\|_
yading@10 263 \& | |
yading@10 264 \& | input 0 |\e _\|_\|_\|_\|_\|_\|_\|_\|_\|_
yading@10 265 \& |_\|_\|_\|_\|_\|_\|_\|_\|_| \e | |
yading@10 266 \& \e _\|_\|_\|_\|_\|_\|_\|_\|_ /| output 0 |
yading@10 267 \& \e | | / |_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
yading@10 268 \& _\|_\|_\|_\|_\|_\|_\|_\|_ \e| complex | /
yading@10 269 \& | | | |/
yading@10 270 \& | input 1 |\-\-\-\->| filter |\e
yading@10 271 \& |_\|_\|_\|_\|_\|_\|_\|_\|_| | | \e _\|_\|_\|_\|_\|_\|_\|_\|_\|_
yading@10 272 \& /| graph | \e | |
yading@10 273 \& / | | \e| output 1 |
yading@10 274 \& _\|_\|_\|_\|_\|_\|_\|_\|_ / |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
yading@10 275 \& | | /
yading@10 276 \& | input 2 |/
yading@10 277 \& |_\|_\|_\|_\|_\|_\|_\|_\|_|
yading@10 278 .Ve
yading@10 279 .PP
yading@10 280 Complex filtergraphs are configured with the \fB\-filter_complex\fR option.
yading@10 281 Note that this option is global, since a complex filtergraph, by its nature,
yading@10 282 cannot be unambiguously associated with a single stream or file.
yading@10 283 .PP
yading@10 284 The \fB\-lavfi\fR option is equivalent to \fB\-filter_complex\fR.
yading@10 285 .PP
yading@10 286 A trivial example of a complex filtergraph is the \f(CW\*(C`overlay\*(C'\fR filter, which
yading@10 287 has two video inputs and one video output, containing one video overlaid on top
yading@10 288 of the other. Its audio counterpart is the \f(CW\*(C`amix\*(C'\fR filter.
yading@10 289 .SS "Stream copy"
yading@10 290 .IX Subsection "Stream copy"
yading@10 291 Stream copy is a mode selected by supplying the \f(CW\*(C`copy\*(C'\fR parameter to the
yading@10 292 \&\fB\-codec\fR option. It makes \fBffmpeg\fR omit the decoding and encoding
yading@10 293 step for the specified stream, so it does only demuxing and muxing. It is useful
yading@10 294 for changing the container format or modifying container-level metadata. The
yading@10 295 diagram above will, in this case, simplify to this:
yading@10 296 .PP
yading@10 297 .Vb 5
yading@10 298 \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_
yading@10 299 \& | | | | | |
yading@10 300 \& | input | demuxer | encoded data | muxer | output |
yading@10 301 \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-> | file |
yading@10 302 \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_|
yading@10 303 .Ve
yading@10 304 .PP
yading@10 305 Since there is no decoding or encoding, it is very fast and there is no quality
yading@10 306 loss. However, it might not work in some cases because of many factors. Applying
yading@10 307 filters is obviously also impossible, since filters work on uncompressed data.
yading@10 308 .SH "STREAM SELECTION"
yading@10 309 .IX Header "STREAM SELECTION"
yading@10 310 By default, \fBffmpeg\fR includes only one stream of each type (video, audio, subtitle)
yading@10 311 present in the input files and adds them to each output file. It picks the
yading@10 312 \&\*(L"best\*(R" of each based upon the following criteria: for video, it is the stream
yading@10 313 with the highest resolution, for audio, it is the stream with the most channels, for
yading@10 314 subtitles, it is the first subtitle stream. In the case where several streams of
yading@10 315 the same type rate equally, the stream with the lowest index is chosen.
yading@10 316 .PP
yading@10 317 You can disable some of those defaults by using the \f(CW\*(C`\-vn/\-an/\-sn\*(C'\fR options. For
yading@10 318 full manual control, use the \f(CW\*(C`\-map\*(C'\fR option, which disables the defaults just
yading@10 319 described.
yading@10 320 .SH "OPTIONS"
yading@10 321 .IX Header "OPTIONS"
yading@10 322 All the numerical options, if not specified otherwise, accept a string
yading@10 323 representing a number as input, which may be followed by one of the \s-1SI\s0
yading@10 324 unit prefixes, for example: 'K', 'M', or 'G'.
yading@10 325 .PP
yading@10 326 If 'i' is appended to the \s-1SI\s0 unit prefix, the complete prefix will be
yading@10 327 interpreted as a unit prefix for binary multiplies, which are based on
yading@10 328 powers of 1024 instead of powers of 1000. Appending 'B' to the \s-1SI\s0 unit
yading@10 329 prefix multiplies the value by 8. This allows using, for example:
yading@10 330 \&'\s-1KB\s0', 'MiB', 'G' and 'B' as number suffixes.
yading@10 331 .PP
yading@10 332 Options which do not take arguments are boolean options, and set the
yading@10 333 corresponding value to true. They can be set to false by prefixing
yading@10 334 the option name with \*(L"no\*(R". For example using \*(L"\-nofoo\*(R"
yading@10 335 will set the boolean option with name \*(L"foo\*(R" to false.
yading@10 336 .SS "Stream specifiers"
yading@10 337 .IX Subsection "Stream specifiers"
yading@10 338 Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
yading@10 339 are used to precisely specify which stream(s) a given option belongs to.
yading@10 340 .PP
yading@10 341 A stream specifier is a string generally appended to the option name and
yading@10 342 separated from it by a colon. E.g. \f(CW\*(C`\-codec:a:1 ac3\*(C'\fR contains the
yading@10 343 \&\f(CW\*(C`a:1\*(C'\fR stream specifier, which matches the second audio stream. Therefore, it
yading@10 344 would select the ac3 codec for the second audio stream.
yading@10 345 .PP
yading@10 346 A stream specifier can match several streams, so that the option is applied to all
yading@10 347 of them. E.g. the stream specifier in \f(CW\*(C`\-b:a 128k\*(C'\fR matches all audio
yading@10 348 streams.
yading@10 349 .PP
yading@10 350 An empty stream specifier matches all streams. For example, \f(CW\*(C`\-codec copy\*(C'\fR
yading@10 351 or \f(CW\*(C`\-codec: copy\*(C'\fR would copy all the streams without reencoding.
yading@10 352 .PP
yading@10 353 Possible forms of stream specifiers are:
yading@10 354 .IP "\fIstream_index\fR" 4
yading@10 355 .IX Item "stream_index"
yading@10 356 Matches the stream with this index. E.g. \f(CW\*(C`\-threads:1 4\*(C'\fR would set the
yading@10 357 thread count for the second stream to 4.
yading@10 358 .IP "\fIstream_type\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4
yading@10 359 .IX Item "stream_type[:stream_index]"
yading@10 360 \&\fIstream_type\fR is one of following: 'v' for video, 'a' for audio, 's' for subtitle,
yading@10 361 \&'d' for data, and 't' for attachments. If \fIstream_index\fR is given, then it matches
yading@10 362 stream number \fIstream_index\fR of this type. Otherwise, it matches all
yading@10 363 streams of this type.
yading@10 364 .IP "\fBp:\fR\fIprogram_id\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4
yading@10 365 .IX Item "p:program_id[:stream_index]"
yading@10 366 If \fIstream_index\fR is given, then it matches the stream with number \fIstream_index\fR
yading@10 367 in the program with the id \fIprogram_id\fR. Otherwise, it matches all streams in the
yading@10 368 program.
yading@10 369 .IP "\fB#\fR\fIstream_id\fR" 4
yading@10 370 .IX Item "#stream_id"
yading@10 371 Matches the stream by a format-specific \s-1ID\s0.
yading@10 372 .SS "Generic options"
yading@10 373 .IX Subsection "Generic options"
yading@10 374 These options are shared amongst the ff* tools.
yading@10 375 .IP "\fB\-L\fR" 4
yading@10 376 .IX Item "-L"
yading@10 377 Show license.
yading@10 378 .IP "\fB\-h, \-?, \-help, \-\-help [\fR\fIarg\fR\fB]\fR" 4
yading@10 379 .IX Item "-h, -?, -help, --help [arg]"
yading@10 380 Show help. An optional parameter may be specified to print help about a specific
yading@10 381 item.
yading@10 382 .Sp
yading@10 383 Possible values of \fIarg\fR are:
yading@10 384 .RS 4
yading@10 385 .IP "\fBdecoder=\fR\fIdecoder_name\fR" 4
yading@10 386 .IX Item "decoder=decoder_name"
yading@10 387 Print detailed information about the decoder named \fIdecoder_name\fR. Use the
yading@10 388 \&\fB\-decoders\fR option to get a list of all decoders.
yading@10 389 .IP "\fBencoder=\fR\fIencoder_name\fR" 4
yading@10 390 .IX Item "encoder=encoder_name"
yading@10 391 Print detailed information about the encoder named \fIencoder_name\fR. Use the
yading@10 392 \&\fB\-encoders\fR option to get a list of all encoders.
yading@10 393 .IP "\fBdemuxer=\fR\fIdemuxer_name\fR" 4
yading@10 394 .IX Item "demuxer=demuxer_name"
yading@10 395 Print detailed information about the demuxer named \fIdemuxer_name\fR. Use the
yading@10 396 \&\fB\-formats\fR option to get a list of all demuxers and muxers.
yading@10 397 .IP "\fBmuxer=\fR\fImuxer_name\fR" 4
yading@10 398 .IX Item "muxer=muxer_name"
yading@10 399 Print detailed information about the muxer named \fImuxer_name\fR. Use the
yading@10 400 \&\fB\-formats\fR option to get a list of all muxers and demuxers.
yading@10 401 .IP "\fBfilter=\fR\fIfilter_name\fR" 4
yading@10 402 .IX Item "filter=filter_name"
yading@10 403 Print detailed information about the filter name \fIfilter_name\fR. Use the
yading@10 404 \&\fB\-filters\fR option to get a list of all filters.
yading@10 405 .RE
yading@10 406 .RS 4
yading@10 407 .RE
yading@10 408 .IP "\fB\-version\fR" 4
yading@10 409 .IX Item "-version"
yading@10 410 Show version.
yading@10 411 .IP "\fB\-formats\fR" 4
yading@10 412 .IX Item "-formats"
yading@10 413 Show available formats.
yading@10 414 .IP "\fB\-codecs\fR" 4
yading@10 415 .IX Item "-codecs"
yading@10 416 Show all codecs known to libavcodec.
yading@10 417 .Sp
yading@10 418 Note that the term 'codec' is used throughout this documentation as a shortcut
yading@10 419 for what is more correctly called a media bitstream format.
yading@10 420 .IP "\fB\-decoders\fR" 4
yading@10 421 .IX Item "-decoders"
yading@10 422 Show available decoders.
yading@10 423 .IP "\fB\-encoders\fR" 4
yading@10 424 .IX Item "-encoders"
yading@10 425 Show all available encoders.
yading@10 426 .IP "\fB\-bsfs\fR" 4
yading@10 427 .IX Item "-bsfs"
yading@10 428 Show available bitstream filters.
yading@10 429 .IP "\fB\-protocols\fR" 4
yading@10 430 .IX Item "-protocols"
yading@10 431 Show available protocols.
yading@10 432 .IP "\fB\-filters\fR" 4
yading@10 433 .IX Item "-filters"
yading@10 434 Show available libavfilter filters.
yading@10 435 .IP "\fB\-pix_fmts\fR" 4
yading@10 436 .IX Item "-pix_fmts"
yading@10 437 Show available pixel formats.
yading@10 438 .IP "\fB\-sample_fmts\fR" 4
yading@10 439 .IX Item "-sample_fmts"
yading@10 440 Show available sample formats.
yading@10 441 .IP "\fB\-layouts\fR" 4
yading@10 442 .IX Item "-layouts"
yading@10 443 Show channel names and standard channel layouts.
yading@10 444 .IP "\fB\-loglevel [repeat+]\fR\fIloglevel\fR \fB| \-v [repeat+]\fR\fIloglevel\fR" 4
yading@10 445 .IX Item "-loglevel [repeat+]loglevel | -v [repeat+]loglevel"
yading@10 446 Set the logging level used by the library.
yading@10 447 Adding \*(L"repeat+\*(R" indicates that repeated log output should not be compressed
yading@10 448 to the first line and the \*(L"Last message repeated n times\*(R" line will be
yading@10 449 omitted. \*(L"repeat\*(R" can also be used alone.
yading@10 450 If \*(L"repeat\*(R" is used alone, and with no prior loglevel set, the default
yading@10 451 loglevel will be used. If multiple loglevel parameters are given, using
yading@10 452 \&'repeat' will not change the loglevel.
yading@10 453 \&\fIloglevel\fR is a number or a string containing one of the following values:
yading@10 454 .RS 4
yading@10 455 .IP "\fBquiet\fR" 4
yading@10 456 .IX Item "quiet"
yading@10 457 Show nothing at all; be silent.
yading@10 458 .IP "\fBpanic\fR" 4
yading@10 459 .IX Item "panic"
yading@10 460 Only show fatal errors which could lead the process to crash, such as
yading@10 461 and assert failure. This is not currently used for anything.
yading@10 462 .IP "\fBfatal\fR" 4
yading@10 463 .IX Item "fatal"
yading@10 464 Only show fatal errors. These are errors after which the process absolutely
yading@10 465 cannot continue after.
yading@10 466 .IP "\fBerror\fR" 4
yading@10 467 .IX Item "error"
yading@10 468 Show all errors, including ones which can be recovered from.
yading@10 469 .IP "\fBwarning\fR" 4
yading@10 470 .IX Item "warning"
yading@10 471 Show all warnings and errors. Any message related to possibly
yading@10 472 incorrect or unexpected events will be shown.
yading@10 473 .IP "\fBinfo\fR" 4
yading@10 474 .IX Item "info"
yading@10 475 Show informative messages during processing. This is in addition to
yading@10 476 warnings and errors. This is the default value.
yading@10 477 .IP "\fBverbose\fR" 4
yading@10 478 .IX Item "verbose"
yading@10 479 Same as \f(CW\*(C`info\*(C'\fR, except more verbose.
yading@10 480 .IP "\fBdebug\fR" 4
yading@10 481 .IX Item "debug"
yading@10 482 Show everything, including debugging information.
yading@10 483 .RE
yading@10 484 .RS 4
yading@10 485 .Sp
yading@10 486 By default the program logs to stderr, if coloring is supported by the
yading@10 487 terminal, colors are used to mark errors and warnings. Log coloring
yading@10 488 can be disabled setting the environment variable
yading@10 489 \&\fB\s-1AV_LOG_FORCE_NOCOLOR\s0\fR or \fB\s-1NO_COLOR\s0\fR, or can be forced setting
yading@10 490 the environment variable \fB\s-1AV_LOG_FORCE_COLOR\s0\fR.
yading@10 491 The use of the environment variable \fB\s-1NO_COLOR\s0\fR is deprecated and
yading@10 492 will be dropped in a following FFmpeg version.
yading@10 493 .RE
yading@10 494 .IP "\fB\-report\fR" 4
yading@10 495 .IX Item "-report"
yading@10 496 Dump full command line and console output to a file named
yading@10 497 \&\f(CW\*(C`\f(CIprogram\f(CW\-\f(CIYYYYMMDD\f(CW\-\f(CIHHMMSS\f(CW.log\*(C'\fR in the current
yading@10 498 directory.
yading@10 499 This file can be useful for bug reports.
yading@10 500 It also implies \f(CW\*(C`\-loglevel verbose\*(C'\fR.
yading@10 501 .Sp
yading@10 502 Setting the environment variable \f(CW\*(C`FFREPORT\*(C'\fR to any value has the
yading@10 503 same effect. If the value is a ':'\-separated key=value sequence, these
yading@10 504 options will affect the report; options values must be escaped if they
yading@10 505 contain special characters or the options delimiter ':' (see the
yading@10 506 ``Quoting and escaping'' section in the ffmpeg-utils manual). The
yading@10 507 following option is recognized:
yading@10 508 .RS 4
yading@10 509 .IP "\fBfile\fR" 4
yading@10 510 .IX Item "file"
yading@10 511 set the file name to use for the report; \f(CW%p\fR is expanded to the name
yading@10 512 of the program, \f(CW%t\fR is expanded to a timestamp, \f(CW\*(C`%%\*(C'\fR is expanded
yading@10 513 to a plain \f(CW\*(C`%\*(C'\fR
yading@10 514 .RE
yading@10 515 .RS 4
yading@10 516 .Sp
yading@10 517 Errors in parsing the environment variable are not fatal, and will not
yading@10 518 appear in the report.
yading@10 519 .RE
yading@10 520 .IP "\fB\-cpuflags flags (\fR\fIglobal\fR\fB)\fR" 4
yading@10 521 .IX Item "-cpuflags flags (global)"
yading@10 522 Allows setting and clearing cpu flags. This option is intended
yading@10 523 for testing. Do not use it unless you know what you're doing.
yading@10 524 .Sp
yading@10 525 .Vb 3
yading@10 526 \& ffmpeg \-cpuflags \-sse+mmx ...
yading@10 527 \& ffmpeg \-cpuflags mmx ...
yading@10 528 \& ffmpeg \-cpuflags 0 ...
yading@10 529 .Ve
yading@10 530 .Sp
yading@10 531 Possible flags for this option are:
yading@10 532 .RS 4
yading@10 533 .IP "\fBx86\fR" 4
yading@10 534 .IX Item "x86"
yading@10 535 .RS 4
yading@10 536 .PD 0
yading@10 537 .IP "\fBmmx\fR" 4
yading@10 538 .IX Item "mmx"
yading@10 539 .IP "\fBmmxext\fR" 4
yading@10 540 .IX Item "mmxext"
yading@10 541 .IP "\fBsse\fR" 4
yading@10 542 .IX Item "sse"
yading@10 543 .IP "\fBsse2\fR" 4
yading@10 544 .IX Item "sse2"
yading@10 545 .IP "\fBsse2slow\fR" 4
yading@10 546 .IX Item "sse2slow"
yading@10 547 .IP "\fBsse3\fR" 4
yading@10 548 .IX Item "sse3"
yading@10 549 .IP "\fBsse3slow\fR" 4
yading@10 550 .IX Item "sse3slow"
yading@10 551 .IP "\fBssse3\fR" 4
yading@10 552 .IX Item "ssse3"
yading@10 553 .IP "\fBatom\fR" 4
yading@10 554 .IX Item "atom"
yading@10 555 .IP "\fBsse4.1\fR" 4
yading@10 556 .IX Item "sse4.1"
yading@10 557 .IP "\fBsse4.2\fR" 4
yading@10 558 .IX Item "sse4.2"
yading@10 559 .IP "\fBavx\fR" 4
yading@10 560 .IX Item "avx"
yading@10 561 .IP "\fBxop\fR" 4
yading@10 562 .IX Item "xop"
yading@10 563 .IP "\fBfma4\fR" 4
yading@10 564 .IX Item "fma4"
yading@10 565 .IP "\fB3dnow\fR" 4
yading@10 566 .IX Item "3dnow"
yading@10 567 .IP "\fB3dnowext\fR" 4
yading@10 568 .IX Item "3dnowext"
yading@10 569 .IP "\fBcmov\fR" 4
yading@10 570 .IX Item "cmov"
yading@10 571 .RE
yading@10 572 .RS 4
yading@10 573 .RE
yading@10 574 .IP "\fB\s-1ARM\s0\fR" 4
yading@10 575 .IX Item "ARM"
yading@10 576 .RS 4
yading@10 577 .IP "\fBarmv5te\fR" 4
yading@10 578 .IX Item "armv5te"
yading@10 579 .IP "\fBarmv6\fR" 4
yading@10 580 .IX Item "armv6"
yading@10 581 .IP "\fBarmv6t2\fR" 4
yading@10 582 .IX Item "armv6t2"
yading@10 583 .IP "\fBvfp\fR" 4
yading@10 584 .IX Item "vfp"
yading@10 585 .IP "\fBvfpv3\fR" 4
yading@10 586 .IX Item "vfpv3"
yading@10 587 .IP "\fBneon\fR" 4
yading@10 588 .IX Item "neon"
yading@10 589 .RE
yading@10 590 .RS 4
yading@10 591 .RE
yading@10 592 .IP "\fBPowerPC\fR" 4
yading@10 593 .IX Item "PowerPC"
yading@10 594 .RS 4
yading@10 595 .IP "\fBaltivec\fR" 4
yading@10 596 .IX Item "altivec"
yading@10 597 .RE
yading@10 598 .RS 4
yading@10 599 .RE
yading@10 600 .IP "\fBSpecific Processors\fR" 4
yading@10 601 .IX Item "Specific Processors"
yading@10 602 .RS 4
yading@10 603 .IP "\fBpentium2\fR" 4
yading@10 604 .IX Item "pentium2"
yading@10 605 .IP "\fBpentium3\fR" 4
yading@10 606 .IX Item "pentium3"
yading@10 607 .IP "\fBpentium4\fR" 4
yading@10 608 .IX Item "pentium4"
yading@10 609 .IP "\fBk6\fR" 4
yading@10 610 .IX Item "k6"
yading@10 611 .IP "\fBk62\fR" 4
yading@10 612 .IX Item "k62"
yading@10 613 .IP "\fBathlon\fR" 4
yading@10 614 .IX Item "athlon"
yading@10 615 .IP "\fBathlonxp\fR" 4
yading@10 616 .IX Item "athlonxp"
yading@10 617 .IP "\fBk8\fR" 4
yading@10 618 .IX Item "k8"
yading@10 619 .RE
yading@10 620 .RS 4
yading@10 621 .RE
yading@10 622 .RE
yading@10 623 .RS 4
yading@10 624 .RE
yading@10 625 .IP "\fB\-opencl_options options (\fR\fIglobal\fR\fB)\fR" 4
yading@10 626 .IX Item "-opencl_options options (global)"
yading@10 627 .PD
yading@10 628 Set OpenCL environment options. This option is only available when
yading@10 629 FFmpeg has been compiled with \f(CW\*(C`\-\-enable\-opencl\*(C'\fR.
yading@10 630 .Sp
yading@10 631 \&\fIoptions\fR must be a list of \fIkey\fR=\fIvalue\fR option pairs
yading@10 632 separated by ':'. See the ``OpenCL Options'' section in the
yading@10 633 ffmpeg-utils manual for the list of supported options.
yading@10 634 .SS "AVOptions"
yading@10 635 .IX Subsection "AVOptions"
yading@10 636 These options are provided directly by the libavformat, libavdevice and
yading@10 637 libavcodec libraries. To see the list of available AVOptions, use the
yading@10 638 \&\fB\-help\fR option. They are separated into two categories:
yading@10 639 .IP "\fBgeneric\fR" 4
yading@10 640 .IX Item "generic"
yading@10 641 These options can be set for any container, codec or device. Generic options
yading@10 642 are listed under AVFormatContext options for containers/devices and under
yading@10 643 AVCodecContext options for codecs.
yading@10 644 .IP "\fBprivate\fR" 4
yading@10 645 .IX Item "private"
yading@10 646 These options are specific to the given container, device or codec. Private
yading@10 647 options are listed under their corresponding containers/devices/codecs.
yading@10 648 .PP
yading@10 649 For example to write an ID3v2.3 header instead of a default ID3v2.4 to
yading@10 650 an \s-1MP3\s0 file, use the \fBid3v2_version\fR private option of the \s-1MP3\s0
yading@10 651 muxer:
yading@10 652 .PP
yading@10 653 .Vb 1
yading@10 654 \& ffmpeg \-i input.flac \-id3v2_version 3 out.mp3
yading@10 655 .Ve
yading@10 656 .PP
yading@10 657 All codec AVOptions are obviously per-stream, so the chapter on stream
yading@10 658 specifiers applies to them
yading@10 659 .PP
yading@10 660 Note \fB\-nooption\fR syntax cannot be used for boolean AVOptions,
yading@10 661 use \fB\-option 0\fR/\fB\-option 1\fR.
yading@10 662 .PP
yading@10 663 Note2 old undocumented way of specifying per-stream AVOptions by prepending
yading@10 664 v/a/s to the options name is now obsolete and will be removed soon.
yading@10 665 .SS "Main options"
yading@10 666 .IX Subsection "Main options"
yading@10 667 .IP "\fB\-f\fR \fIfmt\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
yading@10 668 .IX Item "-f fmt (input/output)"
yading@10 669 Force input or output file format. The format is normally auto detected for input
yading@10 670 files and guessed from the file extension for output files, so this option is not
yading@10 671 needed in most cases.
yading@10 672 .IP "\fB\-i\fR \fIfilename\fR \fB(\fR\fIinput\fR\fB)\fR" 4
yading@10 673 .IX Item "-i filename (input)"
yading@10 674 input file name
yading@10 675 .IP "\fB\-y (\fR\fIglobal\fR\fB)\fR" 4
yading@10 676 .IX Item "-y (global)"
yading@10 677 Overwrite output files without asking.
yading@10 678 .IP "\fB\-n (\fR\fIglobal\fR\fB)\fR" 4
yading@10 679 .IX Item "-n (global)"
yading@10 680 Do not overwrite output files, and exit immediately if a specified
yading@10 681 output file already exists.
yading@10 682 .IP "\fB\-c[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 683 .IX Item "-c[:stream_specifier] codec (input/output,per-stream)"
yading@10 684 .PD 0
yading@10 685 .IP "\fB\-codec[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 686 .IX Item "-codec[:stream_specifier] codec (input/output,per-stream)"
yading@10 687 .PD
yading@10 688 Select an encoder (when used before an output file) or a decoder (when used
yading@10 689 before an input file) for one or more streams. \fIcodec\fR is the name of a
yading@10 690 decoder/encoder or a special value \f(CW\*(C`copy\*(C'\fR (output only) to indicate that
yading@10 691 the stream is not to be re-encoded.
yading@10 692 .Sp
yading@10 693 For example
yading@10 694 .Sp
yading@10 695 .Vb 1
yading@10 696 \& ffmpeg \-i INPUT \-map 0 \-c:v libx264 \-c:a copy OUTPUT
yading@10 697 .Ve
yading@10 698 .Sp
yading@10 699 encodes all video streams with libx264 and copies all audio streams.
yading@10 700 .Sp
yading@10 701 For each stream, the last matching \f(CW\*(C`c\*(C'\fR option is applied, so
yading@10 702 .Sp
yading@10 703 .Vb 1
yading@10 704 \& ffmpeg \-i INPUT \-map 0 \-c copy \-c:v:1 libx264 \-c:a:137 libvorbis OUTPUT
yading@10 705 .Ve
yading@10 706 .Sp
yading@10 707 will copy all the streams except the second video, which will be encoded with
yading@10 708 libx264, and the 138th audio, which will be encoded with libvorbis.
yading@10 709 .IP "\fB\-t\fR \fIduration\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 710 .IX Item "-t duration (output)"
yading@10 711 Stop writing the output after its duration reaches \fIduration\fR.
yading@10 712 \&\fIduration\fR may be a number in seconds, or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form.
yading@10 713 .Sp
yading@10 714 \&\-to and \-t are mutually exclusive and \-t has priority.
yading@10 715 .IP "\fB\-to\fR \fIposition\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 716 .IX Item "-to position (output)"
yading@10 717 Stop writing the output at \fIposition\fR.
yading@10 718 \&\fIposition\fR may be a number in seconds, or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form.
yading@10 719 .Sp
yading@10 720 \&\-to and \-t are mutually exclusive and \-t has priority.
yading@10 721 .IP "\fB\-fs\fR \fIlimit_size\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 722 .IX Item "-fs limit_size (output)"
yading@10 723 Set the file size limit, expressed in bytes.
yading@10 724 .IP "\fB\-ss\fR \fIposition\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
yading@10 725 .IX Item "-ss position (input/output)"
yading@10 726 When used as an input option (before \f(CW\*(C`\-i\*(C'\fR), seeks in this input file to
yading@10 727 \&\fIposition\fR. When used as an output option (before an output filename),
yading@10 728 decodes but discards input until the timestamps reach \fIposition\fR. This is
yading@10 729 slower, but more accurate.
yading@10 730 .Sp
yading@10 731 \&\fIposition\fR may be either in seconds or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form.
yading@10 732 .IP "\fB\-itsoffset\fR \fIoffset\fR \fB(\fR\fIinput\fR\fB)\fR" 4
yading@10 733 .IX Item "-itsoffset offset (input)"
yading@10 734 Set the input time offset in seconds.
yading@10 735 \&\f(CW\*(C`[\-]hh:mm:ss[.xxx]\*(C'\fR syntax is also supported.
yading@10 736 The offset is added to the timestamps of the input files.
yading@10 737 Specifying a positive offset means that the corresponding
yading@10 738 streams are delayed by \fIoffset\fR seconds.
yading@10 739 .IP "\fB\-timestamp\fR \fItime\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 740 .IX Item "-timestamp time (output)"
yading@10 741 Set the recording timestamp in the container.
yading@10 742 The syntax for \fItime\fR is:
yading@10 743 .Sp
yading@10 744 .Vb 1
yading@10 745 \& now|([(YYYY\-MM\-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...])|(HHMMSS[.m...]))[Z|z])
yading@10 746 .Ve
yading@10 747 .Sp
yading@10 748 If the value is \*(L"now\*(R" it takes the current time.
yading@10 749 Time is local time unless 'Z' or 'z' is appended, in which case it is
yading@10 750 interpreted as \s-1UTC\s0.
yading@10 751 If the year-month-day part is not specified it takes the current
yading@10 752 year-month-day.
yading@10 753 .IP "\fB\-metadata[:metadata_specifier]\fR \fIkey\fR\fB=\fR\fIvalue\fR \fB(\fR\fIoutput,per\-metadata\fR\fB)\fR" 4
yading@10 754 .IX Item "-metadata[:metadata_specifier] key=value (output,per-metadata)"
yading@10 755 Set a metadata key/value pair.
yading@10 756 .Sp
yading@10 757 An optional \fImetadata_specifier\fR may be given to set metadata
yading@10 758 on streams or chapters. See \f(CW\*(C`\-map_metadata\*(C'\fR documentation for
yading@10 759 details.
yading@10 760 .Sp
yading@10 761 This option overrides metadata set with \f(CW\*(C`\-map_metadata\*(C'\fR. It is
yading@10 762 also possible to delete metadata by using an empty value.
yading@10 763 .Sp
yading@10 764 For example, for setting the title in the output file:
yading@10 765 .Sp
yading@10 766 .Vb 1
yading@10 767 \& ffmpeg \-i in.avi \-metadata title="my title" out.flv
yading@10 768 .Ve
yading@10 769 .Sp
yading@10 770 To set the language of the first audio stream:
yading@10 771 .Sp
yading@10 772 .Vb 1
yading@10 773 \& ffmpeg \-i INPUT \-metadata:s:a:1 language=eng OUTPUT
yading@10 774 .Ve
yading@10 775 .IP "\fB\-target\fR \fItype\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 776 .IX Item "-target type (output)"
yading@10 777 Specify target file type (\f(CW\*(C`vcd\*(C'\fR, \f(CW\*(C`svcd\*(C'\fR, \f(CW\*(C`dvd\*(C'\fR, \f(CW\*(C`dv\*(C'\fR,
yading@10 778 \&\f(CW\*(C`dv50\*(C'\fR). \fItype\fR may be prefixed with \f(CW\*(C`pal\-\*(C'\fR, \f(CW\*(C`ntsc\-\*(C'\fR or
yading@10 779 \&\f(CW\*(C`film\-\*(C'\fR to use the corresponding standard. All the format options
yading@10 780 (bitrate, codecs, buffer sizes) are then set automatically. You can just type:
yading@10 781 .Sp
yading@10 782 .Vb 1
yading@10 783 \& ffmpeg \-i myfile.avi \-target vcd /tmp/vcd.mpg
yading@10 784 .Ve
yading@10 785 .Sp
yading@10 786 Nevertheless you can specify additional options as long as you know
yading@10 787 they do not conflict with the standard, as in:
yading@10 788 .Sp
yading@10 789 .Vb 1
yading@10 790 \& ffmpeg \-i myfile.avi \-target vcd \-bf 2 /tmp/vcd.mpg
yading@10 791 .Ve
yading@10 792 .IP "\fB\-dframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 793 .IX Item "-dframes number (output)"
yading@10 794 Set the number of data frames to record. This is an alias for \f(CW\*(C`\-frames:d\*(C'\fR.
yading@10 795 .IP "\fB\-frames[:\fR\fIstream_specifier\fR\fB]\fR \fIframecount\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 796 .IX Item "-frames[:stream_specifier] framecount (output,per-stream)"
yading@10 797 Stop writing to the stream after \fIframecount\fR frames.
yading@10 798 .IP "\fB\-q[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 799 .IX Item "-q[:stream_specifier] q (output,per-stream)"
yading@10 800 .PD 0
yading@10 801 .IP "\fB\-qscale[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 802 .IX Item "-qscale[:stream_specifier] q (output,per-stream)"
yading@10 803 .PD
yading@10 804 Use fixed quality scale (\s-1VBR\s0). The meaning of \fIq\fR is
yading@10 805 codec-dependent.
yading@10 806 .IP "\fB\-filter[:\fR\fIstream_specifier\fR\fB]\fR \fIfiltergraph\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 807 .IX Item "-filter[:stream_specifier] filtergraph (output,per-stream)"
yading@10 808 Create the filtergraph specified by \fIfiltergraph\fR and use it to
yading@10 809 filter the stream.
yading@10 810 .Sp
yading@10 811 \&\fIfiltergraph\fR is a description of the filtergraph to apply to
yading@10 812 the stream, and must have a single input and a single output of the
yading@10 813 same type of the stream. In the filtergraph, the input is associated
yading@10 814 to the label \f(CW\*(C`in\*(C'\fR, and the output to the label \f(CW\*(C`out\*(C'\fR. See
yading@10 815 the ffmpeg-filters manual for more information about the filtergraph
yading@10 816 syntax.
yading@10 817 .Sp
yading@10 818 See the \-filter_complex option if you
yading@10 819 want to create filtergraphs with multiple inputs and/or outputs.
yading@10 820 .IP "\fB\-filter_script[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 821 .IX Item "-filter_script[:stream_specifier] filename (output,per-stream)"
yading@10 822 This option is similar to \fB\-filter\fR, the only difference is that its
yading@10 823 argument is the name of the file from which a filtergraph description is to be
yading@10 824 read.
yading@10 825 .IP "\fB\-pre[:\fR\fIstream_specifier\fR\fB]\fR \fIpreset_name\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 826 .IX Item "-pre[:stream_specifier] preset_name (output,per-stream)"
yading@10 827 Specify the preset for matching stream(s).
yading@10 828 .IP "\fB\-stats (\fR\fIglobal\fR\fB)\fR" 4
yading@10 829 .IX Item "-stats (global)"
yading@10 830 Print encoding progress/statistics. It is on by default, to explicitly
yading@10 831 disable it you need to specify \f(CW\*(C`\-nostats\*(C'\fR.
yading@10 832 .IP "\fB\-progress\fR \fIurl\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
yading@10 833 .IX Item "-progress url (global)"
yading@10 834 Send program-friendly progress information to \fIurl\fR.
yading@10 835 .Sp
yading@10 836 Progress information is written approximately every second and at the end of
yading@10 837 the encoding process. It is made of "\fIkey\fR=\fIvalue\fR" lines. \fIkey\fR
yading@10 838 consists of only alphanumeric characters. The last key of a sequence of
yading@10 839 progress information is always \*(L"progress\*(R".
yading@10 840 .IP "\fB\-stdin\fR" 4
yading@10 841 .IX Item "-stdin"
yading@10 842 Enable interaction on standard input. On by default unless standard input is
yading@10 843 used as an input. To explicitly disable interaction you need to specify
yading@10 844 \&\f(CW\*(C`\-nostdin\*(C'\fR.
yading@10 845 .Sp
yading@10 846 Disabling interaction on standard input is useful, for example, if
yading@10 847 ffmpeg is in the background process group. Roughly the same result can
yading@10 848 be achieved with \f(CW\*(C`ffmpeg ... < /dev/null\*(C'\fR but it requires a
yading@10 849 shell.
yading@10 850 .IP "\fB\-debug_ts (\fR\fIglobal\fR\fB)\fR" 4
yading@10 851 .IX Item "-debug_ts (global)"
yading@10 852 Print timestamp information. It is off by default. This option is
yading@10 853 mostly useful for testing and debugging purposes, and the output
yading@10 854 format may change from one version to another, so it should not be
yading@10 855 employed by portable scripts.
yading@10 856 .Sp
yading@10 857 See also the option \f(CW\*(C`\-fdebug ts\*(C'\fR.
yading@10 858 .IP "\fB\-attach\fR \fIfilename\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 859 .IX Item "-attach filename (output)"
yading@10 860 Add an attachment to the output file. This is supported by a few formats
yading@10 861 like Matroska for e.g. fonts used in rendering subtitles. Attachments
yading@10 862 are implemented as a specific type of stream, so this option will add
yading@10 863 a new stream to the file. It is then possible to use per-stream options
yading@10 864 on this stream in the usual way. Attachment streams created with this
yading@10 865 option will be created after all the other streams (i.e. those created
yading@10 866 with \f(CW\*(C`\-map\*(C'\fR or automatic mappings).
yading@10 867 .Sp
yading@10 868 Note that for Matroska you also have to set the mimetype metadata tag:
yading@10 869 .Sp
yading@10 870 .Vb 1
yading@10 871 \& ffmpeg \-i INPUT \-attach DejaVuSans.ttf \-metadata:s:2 mimetype=application/x\-truetype\-font out.mkv
yading@10 872 .Ve
yading@10 873 .Sp
yading@10 874 (assuming that the attachment stream will be third in the output file).
yading@10 875 .IP "\fB\-dump_attachment[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
yading@10 876 .IX Item "-dump_attachment[:stream_specifier] filename (input,per-stream)"
yading@10 877 Extract the matching attachment stream into a file named \fIfilename\fR. If
yading@10 878 \&\fIfilename\fR is empty, then the value of the \f(CW\*(C`filename\*(C'\fR metadata tag
yading@10 879 will be used.
yading@10 880 .Sp
yading@10 881 E.g. to extract the first attachment to a file named 'out.ttf':
yading@10 882 .Sp
yading@10 883 .Vb 1
yading@10 884 \& ffmpeg \-dump_attachment:t:0 out.ttf \-i INPUT
yading@10 885 .Ve
yading@10 886 .Sp
yading@10 887 To extract all attachments to files determined by the \f(CW\*(C`filename\*(C'\fR tag:
yading@10 888 .Sp
yading@10 889 .Vb 1
yading@10 890 \& ffmpeg \-dump_attachment:t "" \-i INPUT
yading@10 891 .Ve
yading@10 892 .Sp
yading@10 893 Technical note \*(-- attachments are implemented as codec extradata, so this
yading@10 894 option can actually be used to extract extradata from any stream, not just
yading@10 895 attachments.
yading@10 896 .SS "Video Options"
yading@10 897 .IX Subsection "Video Options"
yading@10 898 .IP "\fB\-vframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 899 .IX Item "-vframes number (output)"
yading@10 900 Set the number of video frames to record. This is an alias for \f(CW\*(C`\-frames:v\*(C'\fR.
yading@10 901 .IP "\fB\-r[:\fR\fIstream_specifier\fR\fB]\fR \fIfps\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 902 .IX Item "-r[:stream_specifier] fps (input/output,per-stream)"
yading@10 903 Set frame rate (Hz value, fraction or abbreviation).
yading@10 904 .Sp
yading@10 905 As an input option, ignore any timestamps stored in the file and instead
yading@10 906 generate timestamps assuming constant frame rate \fIfps\fR.
yading@10 907 .Sp
yading@10 908 As an output option, duplicate or drop input frames to achieve constant output
yading@10 909 frame rate \fIfps\fR.
yading@10 910 .IP "\fB\-s[:\fR\fIstream_specifier\fR\fB]\fR \fIsize\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 911 .IX Item "-s[:stream_specifier] size (input/output,per-stream)"
yading@10 912 Set frame size.
yading@10 913 .Sp
yading@10 914 As an input option, this is a shortcut for the \fBvideo_size\fR private
yading@10 915 option, recognized by some demuxers for which the frame size is either not
yading@10 916 stored in the file or is configurable \*(-- e.g. raw video or video grabbers.
yading@10 917 .Sp
yading@10 918 As an output option, this inserts the \f(CW\*(C`scale\*(C'\fR video filter to the
yading@10 919 \&\fIend\fR of the corresponding filtergraph. Please use the \f(CW\*(C`scale\*(C'\fR filter
yading@10 920 directly to insert it at the beginning or some other place.
yading@10 921 .Sp
yading@10 922 The format is \fBwxh\fR (default \- same as source).
yading@10 923 .IP "\fB\-aspect[:\fR\fIstream_specifier\fR\fB]\fR \fIaspect\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 924 .IX Item "-aspect[:stream_specifier] aspect (output,per-stream)"
yading@10 925 Set the video display aspect ratio specified by \fIaspect\fR.
yading@10 926 .Sp
yading@10 927 \&\fIaspect\fR can be a floating point number string, or a string of the
yading@10 928 form \fInum\fR:\fIden\fR, where \fInum\fR and \fIden\fR are the
yading@10 929 numerator and denominator of the aspect ratio. For example \*(L"4:3\*(R",
yading@10 930 \&\*(L"16:9\*(R", \*(L"1.3333\*(R", and \*(L"1.7777\*(R" are valid argument values.
yading@10 931 .Sp
yading@10 932 If used together with \fB\-vcodec copy\fR, it will affect the aspect ratio
yading@10 933 stored at container level, but not the aspect ratio stored in encoded
yading@10 934 frames, if it exists.
yading@10 935 .IP "\fB\-vn (\fR\fIoutput\fR\fB)\fR" 4
yading@10 936 .IX Item "-vn (output)"
yading@10 937 Disable video recording.
yading@10 938 .IP "\fB\-vcodec\fR \fIcodec\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 939 .IX Item "-vcodec codec (output)"
yading@10 940 Set the video codec. This is an alias for \f(CW\*(C`\-codec:v\*(C'\fR.
yading@10 941 .IP "\fB\-pass[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 942 .IX Item "-pass[:stream_specifier] n (output,per-stream)"
yading@10 943 Select the pass number (1 or 2). It is used to do two-pass
yading@10 944 video encoding. The statistics of the video are recorded in the first
yading@10 945 pass into a log file (see also the option \-passlogfile),
yading@10 946 and in the second pass that log file is used to generate the video
yading@10 947 at the exact requested bitrate.
yading@10 948 On pass 1, you may just deactivate audio and set output to null,
yading@10 949 examples for Windows and Unix:
yading@10 950 .Sp
yading@10 951 .Vb 2
yading@10 952 \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y NUL
yading@10 953 \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y /dev/null
yading@10 954 .Ve
yading@10 955 .IP "\fB\-passlogfile[:\fR\fIstream_specifier\fR\fB]\fR \fIprefix\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 956 .IX Item "-passlogfile[:stream_specifier] prefix (output,per-stream)"
yading@10 957 Set two-pass log file name prefix to \fIprefix\fR, the default file name
yading@10 958 prefix is ``ffmpeg2pass''. The complete file name will be
yading@10 959 \&\fI\s-1PREFIX\-N\s0.log\fR, where N is a number specific to the output
yading@10 960 stream
yading@10 961 .IP "\fB\-vlang\fR \fIcode\fR" 4
yading@10 962 .IX Item "-vlang code"
yading@10 963 Set the \s-1ISO\s0 639 language code (3 letters) of the current video stream.
yading@10 964 .IP "\fB\-vf\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 965 .IX Item "-vf filtergraph (output)"
yading@10 966 Create the filtergraph specified by \fIfiltergraph\fR and use it to
yading@10 967 filter the stream.
yading@10 968 .Sp
yading@10 969 This is an alias for \f(CW\*(C`\-filter:v\*(C'\fR, see the \-filter option.
yading@10 970 .SS "Advanced Video Options"
yading@10 971 .IX Subsection "Advanced Video Options"
yading@10 972 .IP "\fB\-pix_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIformat\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 973 .IX Item "-pix_fmt[:stream_specifier] format (input/output,per-stream)"
yading@10 974 Set pixel format. Use \f(CW\*(C`\-pix_fmts\*(C'\fR to show all the supported
yading@10 975 pixel formats.
yading@10 976 If the selected pixel format can not be selected, ffmpeg will print a
yading@10 977 warning and select the best pixel format supported by the encoder.
yading@10 978 If \fIpix_fmt\fR is prefixed by a \f(CW\*(C`+\*(C'\fR, ffmpeg will exit with an error
yading@10 979 if the requested pixel format can not be selected, and automatic conversions
yading@10 980 inside filtergraphs are disabled.
yading@10 981 If \fIpix_fmt\fR is a single \f(CW\*(C`+\*(C'\fR, ffmpeg selects the same pixel format
yading@10 982 as the input (or graph output) and automatic conversions are disabled.
yading@10 983 .IP "\fB\-sws_flags\fR \fIflags\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
yading@10 984 .IX Item "-sws_flags flags (input/output)"
yading@10 985 Set SwScaler flags.
yading@10 986 .IP "\fB\-vdt\fR \fIn\fR" 4
yading@10 987 .IX Item "-vdt n"
yading@10 988 Discard threshold.
yading@10 989 .IP "\fB\-rc_override[:\fR\fIstream_specifier\fR\fB]\fR \fIoverride\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 990 .IX Item "-rc_override[:stream_specifier] override (output,per-stream)"
yading@10 991 Rate control override for specific intervals, formatted as \*(L"int,int,int\*(R"
yading@10 992 list separated with slashes. Two first values are the beginning and
yading@10 993 end frame numbers, last one is quantizer to use if positive, or quality
yading@10 994 factor if negative.
yading@10 995 .IP "\fB\-deinterlace\fR" 4
yading@10 996 .IX Item "-deinterlace"
yading@10 997 Deinterlace pictures.
yading@10 998 This option is deprecated since the deinterlacing is very low quality.
yading@10 999 Use the yadif filter with \f(CW\*(C`\-filter:v yadif\*(C'\fR.
yading@10 1000 .IP "\fB\-ilme\fR" 4
yading@10 1001 .IX Item "-ilme"
yading@10 1002 Force interlacing support in encoder (\s-1MPEG\-2\s0 and \s-1MPEG\-4\s0 only).
yading@10 1003 Use this option if your input file is interlaced and you want
yading@10 1004 to keep the interlaced format for minimum losses.
yading@10 1005 The alternative is to deinterlace the input stream with
yading@10 1006 \&\fB\-deinterlace\fR, but deinterlacing introduces losses.
yading@10 1007 .IP "\fB\-psnr\fR" 4
yading@10 1008 .IX Item "-psnr"
yading@10 1009 Calculate \s-1PSNR\s0 of compressed frames.
yading@10 1010 .IP "\fB\-vstats\fR" 4
yading@10 1011 .IX Item "-vstats"
yading@10 1012 Dump video coding statistics to \fIvstats_HHMMSS.log\fR.
yading@10 1013 .IP "\fB\-vstats_file\fR \fIfile\fR" 4
yading@10 1014 .IX Item "-vstats_file file"
yading@10 1015 Dump video coding statistics to \fIfile\fR.
yading@10 1016 .IP "\fB\-top[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1017 .IX Item "-top[:stream_specifier] n (output,per-stream)"
yading@10 1018 top=1/bottom=0/auto=\-1 field first
yading@10 1019 .IP "\fB\-dc\fR \fIprecision\fR" 4
yading@10 1020 .IX Item "-dc precision"
yading@10 1021 Intra_dc_precision.
yading@10 1022 .IP "\fB\-vtag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1023 .IX Item "-vtag fourcc/tag (output)"
yading@10 1024 Force video tag/fourcc. This is an alias for \f(CW\*(C`\-tag:v\*(C'\fR.
yading@10 1025 .IP "\fB\-qphist (\fR\fIglobal\fR\fB)\fR" 4
yading@10 1026 .IX Item "-qphist (global)"
yading@10 1027 Show \s-1QP\s0 histogram
yading@10 1028 .IP "\fB\-vbsf\fR \fIbitstream_filter\fR" 4
yading@10 1029 .IX Item "-vbsf bitstream_filter"
yading@10 1030 Deprecated see \-bsf
yading@10 1031 .IP "\fB\-force_key_frames[:\fR\fIstream_specifier\fR\fB]\fR \fItime\fR\fB[,\fR\fItime\fR\fB...] (\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1032 .IX Item "-force_key_frames[:stream_specifier] time[,time...] (output,per-stream)"
yading@10 1033 .PD 0
yading@10 1034 .IP "\fB\-force_key_frames[:\fR\fIstream_specifier\fR\fB] expr:\fR\fIexpr\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1035 .IX Item "-force_key_frames[:stream_specifier] expr:expr (output,per-stream)"
yading@10 1036 .PD
yading@10 1037 Force key frames at the specified timestamps, more precisely at the first
yading@10 1038 frames after each specified time.
yading@10 1039 .Sp
yading@10 1040 If the argument is prefixed with \f(CW\*(C`expr:\*(C'\fR, the string \fIexpr\fR
yading@10 1041 is interpreted like an expression and is evaluated for each frame. A
yading@10 1042 key frame is forced in case the evaluation is non-zero.
yading@10 1043 .Sp
yading@10 1044 If one of the times is "\f(CW\*(C`chapters\*(C'\fR[\fIdelta\fR]", it is expanded into
yading@10 1045 the time of the beginning of all chapters in the file, shifted by
yading@10 1046 \&\fIdelta\fR, expressed as a time in seconds.
yading@10 1047 This option can be useful to ensure that a seek point is present at a
yading@10 1048 chapter mark or any other designated place in the output file.
yading@10 1049 .Sp
yading@10 1050 For example, to insert a key frame at 5 minutes, plus key frames 0.1 second
yading@10 1051 before the beginning of every chapter:
yading@10 1052 .Sp
yading@10 1053 .Vb 1
yading@10 1054 \& \-force_key_frames 0:05:00,chapters\-0.1
yading@10 1055 .Ve
yading@10 1056 .Sp
yading@10 1057 The expression in \fIexpr\fR can contain the following constants:
yading@10 1058 .RS 4
yading@10 1059 .IP "\fBn\fR" 4
yading@10 1060 .IX Item "n"
yading@10 1061 the number of current processed frame, starting from 0
yading@10 1062 .IP "\fBn_forced\fR" 4
yading@10 1063 .IX Item "n_forced"
yading@10 1064 the number of forced frames
yading@10 1065 .IP "\fBprev_forced_n\fR" 4
yading@10 1066 .IX Item "prev_forced_n"
yading@10 1067 the number of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no
yading@10 1068 keyframe was forced yet
yading@10 1069 .IP "\fBprev_forced_t\fR" 4
yading@10 1070 .IX Item "prev_forced_t"
yading@10 1071 the time of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no
yading@10 1072 keyframe was forced yet
yading@10 1073 .IP "\fBt\fR" 4
yading@10 1074 .IX Item "t"
yading@10 1075 the time of the current processed frame
yading@10 1076 .RE
yading@10 1077 .RS 4
yading@10 1078 .Sp
yading@10 1079 For example to force a key frame every 5 seconds, you can specify:
yading@10 1080 .Sp
yading@10 1081 .Vb 1
yading@10 1082 \& \-force_key_frames expr:gte(t,n_forced*5)
yading@10 1083 .Ve
yading@10 1084 .Sp
yading@10 1085 To force a key frame 5 seconds after the time of the last forced one,
yading@10 1086 starting from second 13:
yading@10 1087 .Sp
yading@10 1088 .Vb 1
yading@10 1089 \& \-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5))
yading@10 1090 .Ve
yading@10 1091 .Sp
yading@10 1092 Note that forcing too many keyframes is very harmful for the lookahead
yading@10 1093 algorithms of certain encoders: using fixed-GOP options or similar
yading@10 1094 would be more efficient.
yading@10 1095 .RE
yading@10 1096 .IP "\fB\-copyinkf[:\fR\fIstream_specifier\fR\fB] (\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1097 .IX Item "-copyinkf[:stream_specifier] (output,per-stream)"
yading@10 1098 When doing stream copy, copy also non-key frames found at the
yading@10 1099 beginning.
yading@10 1100 .SS "Audio Options"
yading@10 1101 .IX Subsection "Audio Options"
yading@10 1102 .IP "\fB\-aframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1103 .IX Item "-aframes number (output)"
yading@10 1104 Set the number of audio frames to record. This is an alias for \f(CW\*(C`\-frames:a\*(C'\fR.
yading@10 1105 .IP "\fB\-ar[:\fR\fIstream_specifier\fR\fB]\fR \fIfreq\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 1106 .IX Item "-ar[:stream_specifier] freq (input/output,per-stream)"
yading@10 1107 Set the audio sampling frequency. For output streams it is set by
yading@10 1108 default to the frequency of the corresponding input stream. For input
yading@10 1109 streams this option only makes sense for audio grabbing devices and raw
yading@10 1110 demuxers and is mapped to the corresponding demuxer options.
yading@10 1111 .IP "\fB\-aq\fR \fIq\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1112 .IX Item "-aq q (output)"
yading@10 1113 Set the audio quality (codec-specific, \s-1VBR\s0). This is an alias for \-q:a.
yading@10 1114 .IP "\fB\-ac[:\fR\fIstream_specifier\fR\fB]\fR \fIchannels\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
yading@10 1115 .IX Item "-ac[:stream_specifier] channels (input/output,per-stream)"
yading@10 1116 Set the number of audio channels. For output streams it is set by
yading@10 1117 default to the number of input audio channels. For input streams
yading@10 1118 this option only makes sense for audio grabbing devices and raw demuxers
yading@10 1119 and is mapped to the corresponding demuxer options.
yading@10 1120 .IP "\fB\-an (\fR\fIoutput\fR\fB)\fR" 4
yading@10 1121 .IX Item "-an (output)"
yading@10 1122 Disable audio recording.
yading@10 1123 .IP "\fB\-acodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
yading@10 1124 .IX Item "-acodec codec (input/output)"
yading@10 1125 Set the audio codec. This is an alias for \f(CW\*(C`\-codec:a\*(C'\fR.
yading@10 1126 .IP "\fB\-sample_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIsample_fmt\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1127 .IX Item "-sample_fmt[:stream_specifier] sample_fmt (output,per-stream)"
yading@10 1128 Set the audio sample format. Use \f(CW\*(C`\-sample_fmts\*(C'\fR to get a list
yading@10 1129 of supported sample formats.
yading@10 1130 .IP "\fB\-af\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1131 .IX Item "-af filtergraph (output)"
yading@10 1132 Create the filtergraph specified by \fIfiltergraph\fR and use it to
yading@10 1133 filter the stream.
yading@10 1134 .Sp
yading@10 1135 This is an alias for \f(CW\*(C`\-filter:a\*(C'\fR, see the \-filter option.
yading@10 1136 .SS "Advanced Audio options:"
yading@10 1137 .IX Subsection "Advanced Audio options:"
yading@10 1138 .IP "\fB\-atag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1139 .IX Item "-atag fourcc/tag (output)"
yading@10 1140 Force audio tag/fourcc. This is an alias for \f(CW\*(C`\-tag:a\*(C'\fR.
yading@10 1141 .IP "\fB\-absf\fR \fIbitstream_filter\fR" 4
yading@10 1142 .IX Item "-absf bitstream_filter"
yading@10 1143 Deprecated, see \-bsf
yading@10 1144 .IP "\fB\-guess_layout_max\fR \fIchannels\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
yading@10 1145 .IX Item "-guess_layout_max channels (input,per-stream)"
yading@10 1146 If some input channel layout is not known, try to guess only if it
yading@10 1147 corresponds to at most the specified number of channels. For example, 2
yading@10 1148 tells to \fBffmpeg\fR to recognize 1 channel as mono and 2 channels as
yading@10 1149 stereo but not 6 channels as 5.1. The default is to always try to guess. Use
yading@10 1150 0 to disable all guessing.
yading@10 1151 .SS "Subtitle options:"
yading@10 1152 .IX Subsection "Subtitle options:"
yading@10 1153 .IP "\fB\-slang\fR \fIcode\fR" 4
yading@10 1154 .IX Item "-slang code"
yading@10 1155 Set the \s-1ISO\s0 639 language code (3 letters) of the current subtitle stream.
yading@10 1156 .IP "\fB\-scodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
yading@10 1157 .IX Item "-scodec codec (input/output)"
yading@10 1158 Set the subtitle codec. This is an alias for \f(CW\*(C`\-codec:s\*(C'\fR.
yading@10 1159 .IP "\fB\-sn (\fR\fIoutput\fR\fB)\fR" 4
yading@10 1160 .IX Item "-sn (output)"
yading@10 1161 Disable subtitle recording.
yading@10 1162 .IP "\fB\-sbsf\fR \fIbitstream_filter\fR" 4
yading@10 1163 .IX Item "-sbsf bitstream_filter"
yading@10 1164 Deprecated, see \-bsf
yading@10 1165 .SS "Advanced Subtitle options:"
yading@10 1166 .IX Subsection "Advanced Subtitle options:"
yading@10 1167 .IP "\fB\-fix_sub_duration\fR" 4
yading@10 1168 .IX Item "-fix_sub_duration"
yading@10 1169 Fix subtitles durations. For each subtitle, wait for the next packet in the
yading@10 1170 same stream and adjust the duration of the first to avoid overlap. This is
yading@10 1171 necessary with some subtitles codecs, especially \s-1DVB\s0 subtitles, because the
yading@10 1172 duration in the original packet is only a rough estimate and the end is
yading@10 1173 actually marked by an empty subtitle frame. Failing to use this option when
yading@10 1174 necessary can result in exaggerated durations or muxing failures due to
yading@10 1175 non-monotonic timestamps.
yading@10 1176 .Sp
yading@10 1177 Note that this option will delay the output of all data until the next
yading@10 1178 subtitle packet is decoded: it may increase memory consumption and latency a
yading@10 1179 lot.
yading@10 1180 .IP "\fB\-canvas_size\fR \fIsize\fR" 4
yading@10 1181 .IX Item "-canvas_size size"
yading@10 1182 Set the size of the canvas used to render subtitles.
yading@10 1183 .SS "Advanced options"
yading@10 1184 .IX Subsection "Advanced options"
yading@10 1185 .IP "\fB\-map [\-]\fR\fIinput_file_id\fR\fB[:\fR\fIstream_specifier\fR\fB][,\fR\fIsync_file_id\fR\fB[:\fR\fIstream_specifier\fR\fB]] |\fR \fI[linklabel]\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1186 .IX Item "-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] | [linklabel] (output)"
yading@10 1187 Designate one or more input streams as a source for the output file. Each input
yading@10 1188 stream is identified by the input file index \fIinput_file_id\fR and
yading@10 1189 the input stream index \fIinput_stream_id\fR within the input
yading@10 1190 file. Both indices start at 0. If specified,
yading@10 1191 \&\fIsync_file_id\fR:\fIstream_specifier\fR sets which input stream
yading@10 1192 is used as a presentation sync reference.
yading@10 1193 .Sp
yading@10 1194 The first \f(CW\*(C`\-map\*(C'\fR option on the command line specifies the
yading@10 1195 source for output stream 0, the second \f(CW\*(C`\-map\*(C'\fR option specifies
yading@10 1196 the source for output stream 1, etc.
yading@10 1197 .Sp
yading@10 1198 A \f(CW\*(C`\-\*(C'\fR character before the stream identifier creates a \*(L"negative\*(R" mapping.
yading@10 1199 It disables matching streams from already created mappings.
yading@10 1200 .Sp
yading@10 1201 An alternative \fI[linklabel]\fR form will map outputs from complex filter
yading@10 1202 graphs (see the \fB\-filter_complex\fR option) to the output file.
yading@10 1203 \&\fIlinklabel\fR must correspond to a defined output link label in the graph.
yading@10 1204 .Sp
yading@10 1205 For example, to map \s-1ALL\s0 streams from the first input file to output
yading@10 1206 .Sp
yading@10 1207 .Vb 1
yading@10 1208 \& ffmpeg \-i INPUT \-map 0 output
yading@10 1209 .Ve
yading@10 1210 .Sp
yading@10 1211 For example, if you have two audio streams in the first input file,
yading@10 1212 these streams are identified by \*(L"0:0\*(R" and \*(L"0:1\*(R". You can use
yading@10 1213 \&\f(CW\*(C`\-map\*(C'\fR to select which streams to place in an output file. For
yading@10 1214 example:
yading@10 1215 .Sp
yading@10 1216 .Vb 1
yading@10 1217 \& ffmpeg \-i INPUT \-map 0:1 out.wav
yading@10 1218 .Ve
yading@10 1219 .Sp
yading@10 1220 will map the input stream in \fI\s-1INPUT\s0\fR identified by \*(L"0:1\*(R" to
yading@10 1221 the (single) output stream in \fIout.wav\fR.
yading@10 1222 .Sp
yading@10 1223 For example, to select the stream with index 2 from input file
yading@10 1224 \&\fIa.mov\fR (specified by the identifier \*(L"0:2\*(R"), and stream with
yading@10 1225 index 6 from input \fIb.mov\fR (specified by the identifier \*(L"1:6\*(R"),
yading@10 1226 and copy them to the output file \fIout.mov\fR:
yading@10 1227 .Sp
yading@10 1228 .Vb 1
yading@10 1229 \& ffmpeg \-i a.mov \-i b.mov \-c copy \-map 0:2 \-map 1:6 out.mov
yading@10 1230 .Ve
yading@10 1231 .Sp
yading@10 1232 To select all video and the third audio stream from an input file:
yading@10 1233 .Sp
yading@10 1234 .Vb 1
yading@10 1235 \& ffmpeg \-i INPUT \-map 0:v \-map 0:a:2 OUTPUT
yading@10 1236 .Ve
yading@10 1237 .Sp
yading@10 1238 To map all the streams except the second audio, use negative mappings
yading@10 1239 .Sp
yading@10 1240 .Vb 1
yading@10 1241 \& ffmpeg \-i INPUT \-map 0 \-map \-0:a:1 OUTPUT
yading@10 1242 .Ve
yading@10 1243 .Sp
yading@10 1244 Note that using this option disables the default mappings for this output file.
yading@10 1245 .IP "\fB\-map_channel [\fR\fIinput_file_id\fR\fB.\fR\fIstream_specifier\fR\fB.\fR\fIchannel_id\fR\fB|\-1][:\fR\fIoutput_file_id\fR\fB.\fR\fIstream_specifier\fR\fB]\fR" 4
yading@10 1246 .IX Item "-map_channel [input_file_id.stream_specifier.channel_id|-1][:output_file_id.stream_specifier]"
yading@10 1247 Map an audio channel from a given input to an output. If
yading@10 1248 \&\fIoutput_file_id\fR.\fIstream_specifier\fR is not set, the audio channel will
yading@10 1249 be mapped on all the audio streams.
yading@10 1250 .Sp
yading@10 1251 Using \*(L"\-1\*(R" instead of
yading@10 1252 \&\fIinput_file_id\fR.\fIstream_specifier\fR.\fIchannel_id\fR will map a muted
yading@10 1253 channel.
yading@10 1254 .Sp
yading@10 1255 For example, assuming \fI\s-1INPUT\s0\fR is a stereo audio file, you can switch the
yading@10 1256 two audio channels with the following command:
yading@10 1257 .Sp
yading@10 1258 .Vb 1
yading@10 1259 \& ffmpeg \-i INPUT \-map_channel 0.0.1 \-map_channel 0.0.0 OUTPUT
yading@10 1260 .Ve
yading@10 1261 .Sp
yading@10 1262 If you want to mute the first channel and keep the second:
yading@10 1263 .Sp
yading@10 1264 .Vb 1
yading@10 1265 \& ffmpeg \-i INPUT \-map_channel \-1 \-map_channel 0.0.1 OUTPUT
yading@10 1266 .Ve
yading@10 1267 .Sp
yading@10 1268 The order of the \*(L"\-map_channel\*(R" option specifies the order of the channels in
yading@10 1269 the output stream. The output channel layout is guessed from the number of
yading@10 1270 channels mapped (mono if one \*(L"\-map_channel\*(R", stereo if two, etc.). Using \*(L"\-ac\*(R"
yading@10 1271 in combination of \*(L"\-map_channel\*(R" makes the channel gain levels to be updated if
yading@10 1272 input and output channel layouts don't match (for instance two \*(L"\-map_channel\*(R"
yading@10 1273 options and \*(L"\-ac 6\*(R").
yading@10 1274 .Sp
yading@10 1275 You can also extract each channel of an input to specific outputs; the following
yading@10 1276 command extracts two channels of the \fI\s-1INPUT\s0\fR audio stream (file 0, stream 0)
yading@10 1277 to the respective \fI\s-1OUTPUT_CH0\s0\fR and \fI\s-1OUTPUT_CH1\s0\fR outputs:
yading@10 1278 .Sp
yading@10 1279 .Vb 1
yading@10 1280 \& ffmpeg \-i INPUT \-map_channel 0.0.0 OUTPUT_CH0 \-map_channel 0.0.1 OUTPUT_CH1
yading@10 1281 .Ve
yading@10 1282 .Sp
yading@10 1283 The following example splits the channels of a stereo input into two separate
yading@10 1284 streams, which are put into the same output file:
yading@10 1285 .Sp
yading@10 1286 .Vb 1
yading@10 1287 \& ffmpeg \-i stereo.wav \-map 0:0 \-map 0:0 \-map_channel 0.0.0:0.0 \-map_channel 0.0.1:0.1 \-y out.ogg
yading@10 1288 .Ve
yading@10 1289 .Sp
yading@10 1290 Note that currently each output stream can only contain channels from a single
yading@10 1291 input stream; you can't for example use \*(L"\-map_channel\*(R" to pick multiple input
yading@10 1292 audio channels contained in different streams (from the same or different files)
yading@10 1293 and merge them into a single output stream. It is therefore not currently
yading@10 1294 possible, for example, to turn two separate mono streams into a single stereo
yading@10 1295 stream. However splitting a stereo stream into two single channel mono streams
yading@10 1296 is possible.
yading@10 1297 .Sp
yading@10 1298 If you need this feature, a possible workaround is to use the \fIamerge\fR
yading@10 1299 filter. For example, if you need to merge a media (here \fIinput.mkv\fR) with 2
yading@10 1300 mono audio streams into one single stereo channel audio stream (and keep the
yading@10 1301 video stream), you can use the following command:
yading@10 1302 .Sp
yading@10 1303 .Vb 1
yading@10 1304 \& ffmpeg \-i input.mkv \-filter_complex "[0:1] [0:2] amerge" \-c:a pcm_s16le \-c:v copy output.mkv
yading@10 1305 .Ve
yading@10 1306 .IP "\fB\-map_metadata[:\fR\fImetadata_spec_out\fR\fB]\fR \fIinfile\fR\fB[:\fR\fImetadata_spec_in\fR\fB] (\fR\fIoutput,per\-metadata\fR\fB)\fR" 4
yading@10 1307 .IX Item "-map_metadata[:metadata_spec_out] infile[:metadata_spec_in] (output,per-metadata)"
yading@10 1308 Set metadata information of the next output file from \fIinfile\fR. Note that
yading@10 1309 those are file indices (zero-based), not filenames.
yading@10 1310 Optional \fImetadata_spec_in/out\fR parameters specify, which metadata to copy.
yading@10 1311 A metadata specifier can have the following forms:
yading@10 1312 .RS 4
yading@10 1313 .IP "\fIg\fR" 4
yading@10 1314 .IX Item "g"
yading@10 1315 global metadata, i.e. metadata that applies to the whole file
yading@10 1316 .IP "\fIs\fR\fB[:\fR\fIstream_spec\fR\fB]\fR" 4
yading@10 1317 .IX Item "s[:stream_spec]"
yading@10 1318 per-stream metadata. \fIstream_spec\fR is a stream specifier as described
yading@10 1319 in the Stream specifiers chapter. In an input metadata specifier, the first
yading@10 1320 matching stream is copied from. In an output metadata specifier, all matching
yading@10 1321 streams are copied to.
yading@10 1322 .IP "\fIc\fR\fB:\fR\fIchapter_index\fR" 4
yading@10 1323 .IX Item "c:chapter_index"
yading@10 1324 per-chapter metadata. \fIchapter_index\fR is the zero-based chapter index.
yading@10 1325 .IP "\fIp\fR\fB:\fR\fIprogram_index\fR" 4
yading@10 1326 .IX Item "p:program_index"
yading@10 1327 per-program metadata. \fIprogram_index\fR is the zero-based program index.
yading@10 1328 .RE
yading@10 1329 .RS 4
yading@10 1330 .Sp
yading@10 1331 If metadata specifier is omitted, it defaults to global.
yading@10 1332 .Sp
yading@10 1333 By default, global metadata is copied from the first input file,
yading@10 1334 per-stream and per-chapter metadata is copied along with streams/chapters. These
yading@10 1335 default mappings are disabled by creating any mapping of the relevant type. A negative
yading@10 1336 file index can be used to create a dummy mapping that just disables automatic copying.
yading@10 1337 .Sp
yading@10 1338 For example to copy metadata from the first stream of the input file to global metadata
yading@10 1339 of the output file:
yading@10 1340 .Sp
yading@10 1341 .Vb 1
yading@10 1342 \& ffmpeg \-i in.ogg \-map_metadata 0:s:0 out.mp3
yading@10 1343 .Ve
yading@10 1344 .Sp
yading@10 1345 To do the reverse, i.e. copy global metadata to all audio streams:
yading@10 1346 .Sp
yading@10 1347 .Vb 1
yading@10 1348 \& ffmpeg \-i in.mkv \-map_metadata:s:a 0:g out.mkv
yading@10 1349 .Ve
yading@10 1350 .Sp
yading@10 1351 Note that simple \f(CW0\fR would work as well in this example, since global
yading@10 1352 metadata is assumed by default.
yading@10 1353 .RE
yading@10 1354 .IP "\fB\-map_chapters\fR \fIinput_file_index\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1355 .IX Item "-map_chapters input_file_index (output)"
yading@10 1356 Copy chapters from input file with index \fIinput_file_index\fR to the next
yading@10 1357 output file. If no chapter mapping is specified, then chapters are copied from
yading@10 1358 the first input file with at least one chapter. Use a negative file index to
yading@10 1359 disable any chapter copying.
yading@10 1360 .IP "\fB\-benchmark (\fR\fIglobal\fR\fB)\fR" 4
yading@10 1361 .IX Item "-benchmark (global)"
yading@10 1362 Show benchmarking information at the end of an encode.
yading@10 1363 Shows \s-1CPU\s0 time used and maximum memory consumption.
yading@10 1364 Maximum memory consumption is not supported on all systems,
yading@10 1365 it will usually display as 0 if not supported.
yading@10 1366 .IP "\fB\-benchmark_all (\fR\fIglobal\fR\fB)\fR" 4
yading@10 1367 .IX Item "-benchmark_all (global)"
yading@10 1368 Show benchmarking information during the encode.
yading@10 1369 Shows \s-1CPU\s0 time used in various steps (audio/video encode/decode).
yading@10 1370 .IP "\fB\-timelimit\fR \fIduration\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
yading@10 1371 .IX Item "-timelimit duration (global)"
yading@10 1372 Exit after ffmpeg has been running for \fIduration\fR seconds.
yading@10 1373 .IP "\fB\-dump (\fR\fIglobal\fR\fB)\fR" 4
yading@10 1374 .IX Item "-dump (global)"
yading@10 1375 Dump each input packet to stderr.
yading@10 1376 .IP "\fB\-hex (\fR\fIglobal\fR\fB)\fR" 4
yading@10 1377 .IX Item "-hex (global)"
yading@10 1378 When dumping packets, also dump the payload.
yading@10 1379 .IP "\fB\-re (\fR\fIinput\fR\fB)\fR" 4
yading@10 1380 .IX Item "-re (input)"
yading@10 1381 Read input at native frame rate. Mainly used to simulate a grab device.
yading@10 1382 By default \fBffmpeg\fR attempts to read the input(s) as fast as possible.
yading@10 1383 This option will slow down the reading of the input(s) to the native frame rate
yading@10 1384 of the input(s). It is useful for real-time output (e.g. live streaming). If
yading@10 1385 your input(s) is coming from some other live streaming source (through \s-1HTTP\s0 or
yading@10 1386 \&\s-1UDP\s0 for example) the server might already be in real-time, thus the option will
yading@10 1387 likely not be required. On the other hand, this is meaningful if your input(s)
yading@10 1388 is a file you are trying to push in real-time.
yading@10 1389 .IP "\fB\-loop_input\fR" 4
yading@10 1390 .IX Item "-loop_input"
yading@10 1391 Loop over the input stream. Currently it works only for image
yading@10 1392 streams. This option is used for automatic FFserver testing.
yading@10 1393 This option is deprecated, use \-loop 1.
yading@10 1394 .IP "\fB\-loop_output\fR \fInumber_of_times\fR" 4
yading@10 1395 .IX Item "-loop_output number_of_times"
yading@10 1396 Repeatedly loop output for formats that support looping such as animated \s-1GIF\s0
yading@10 1397 (0 will loop the output infinitely).
yading@10 1398 This option is deprecated, use \-loop.
yading@10 1399 .IP "\fB\-vsync\fR \fIparameter\fR" 4
yading@10 1400 .IX Item "-vsync parameter"
yading@10 1401 Video sync method.
yading@10 1402 For compatibility reasons old values can be specified as numbers.
yading@10 1403 Newly added values will have to be specified as strings always.
yading@10 1404 .RS 4
yading@10 1405 .IP "\fB0, passthrough\fR" 4
yading@10 1406 .IX Item "0, passthrough"
yading@10 1407 Each frame is passed with its timestamp from the demuxer to the muxer.
yading@10 1408 .IP "\fB1, cfr\fR" 4
yading@10 1409 .IX Item "1, cfr"
yading@10 1410 Frames will be duplicated and dropped to achieve exactly the requested
yading@10 1411 constant frame rate.
yading@10 1412 .IP "\fB2, vfr\fR" 4
yading@10 1413 .IX Item "2, vfr"
yading@10 1414 Frames are passed through with their timestamp or dropped so as to
yading@10 1415 prevent 2 frames from having the same timestamp.
yading@10 1416 .IP "\fBdrop\fR" 4
yading@10 1417 .IX Item "drop"
yading@10 1418 As passthrough but destroys all timestamps, making the muxer generate
yading@10 1419 fresh timestamps based on frame-rate.
yading@10 1420 .IP "\fB\-1, auto\fR" 4
yading@10 1421 .IX Item "-1, auto"
yading@10 1422 Chooses between 1 and 2 depending on muxer capabilities. This is the
yading@10 1423 default method.
yading@10 1424 .RE
yading@10 1425 .RS 4
yading@10 1426 .Sp
yading@10 1427 Note that the timestamps may be further modified by the muxer, after this.
yading@10 1428 For example, in the case that the format option \fBavoid_negative_ts\fR
yading@10 1429 is enabled.
yading@10 1430 .Sp
yading@10 1431 With \-map you can select from which stream the timestamps should be
yading@10 1432 taken. You can leave either video or audio unchanged and sync the
yading@10 1433 remaining stream(s) to the unchanged one.
yading@10 1434 .RE
yading@10 1435 .IP "\fB\-async\fR \fIsamples_per_second\fR" 4
yading@10 1436 .IX Item "-async samples_per_second"
yading@10 1437 Audio sync method. \*(L"Stretches/squeezes\*(R" the audio stream to match the timestamps,
yading@10 1438 the parameter is the maximum samples per second by which the audio is changed.
yading@10 1439 \&\-async 1 is a special case where only the start of the audio stream is corrected
yading@10 1440 without any later correction.
yading@10 1441 .Sp
yading@10 1442 Note that the timestamps may be further modified by the muxer, after this.
yading@10 1443 For example, in the case that the format option \fBavoid_negative_ts\fR
yading@10 1444 is enabled.
yading@10 1445 .Sp
yading@10 1446 This option has been deprecated. Use the \f(CW\*(C`aresample\*(C'\fR audio filter instead.
yading@10 1447 .IP "\fB\-copyts\fR" 4
yading@10 1448 .IX Item "-copyts"
yading@10 1449 Do not process input timestamps, but keep their values without trying
yading@10 1450 to sanitize them. In particular, do not remove the initial start time
yading@10 1451 offset value.
yading@10 1452 .Sp
yading@10 1453 Note that, depending on the \fBvsync\fR option or on specific muxer
yading@10 1454 processing (e.g. in case the format option \fBavoid_negative_ts\fR
yading@10 1455 is enabled) the output timestamps may mismatch with the input
yading@10 1456 timestamps even when this option is selected.
yading@10 1457 .IP "\fB\-copytb\fR \fImode\fR" 4
yading@10 1458 .IX Item "-copytb mode"
yading@10 1459 Specify how to set the encoder timebase when stream copying. \fImode\fR is an
yading@10 1460 integer numeric value, and can assume one of the following values:
yading@10 1461 .RS 4
yading@10 1462 .IP "\fB1\fR" 4
yading@10 1463 .IX Item "1"
yading@10 1464 Use the demuxer timebase.
yading@10 1465 .Sp
yading@10 1466 The time base is copied to the output encoder from the corresponding input
yading@10 1467 demuxer. This is sometimes required to avoid non monotonically increasing
yading@10 1468 timestamps when copying video streams with variable frame rate.
yading@10 1469 .IP "\fB0\fR" 4
yading@10 1470 .IX Item "0"
yading@10 1471 Use the decoder timebase.
yading@10 1472 .Sp
yading@10 1473 The time base is copied to the output encoder from the corresponding input
yading@10 1474 decoder.
yading@10 1475 .IP "\fB\-1\fR" 4
yading@10 1476 .IX Item "-1"
yading@10 1477 Try to make the choice automatically, in order to generate a sane output.
yading@10 1478 .RE
yading@10 1479 .RS 4
yading@10 1480 .Sp
yading@10 1481 Default value is \-1.
yading@10 1482 .RE
yading@10 1483 .IP "\fB\-shortest (\fR\fIoutput\fR\fB)\fR" 4
yading@10 1484 .IX Item "-shortest (output)"
yading@10 1485 Finish encoding when the shortest input stream ends.
yading@10 1486 .IP "\fB\-dts_delta_threshold\fR" 4
yading@10 1487 .IX Item "-dts_delta_threshold"
yading@10 1488 Timestamp discontinuity delta threshold.
yading@10 1489 .IP "\fB\-muxdelay\fR \fIseconds\fR \fB(\fR\fIinput\fR\fB)\fR" 4
yading@10 1490 .IX Item "-muxdelay seconds (input)"
yading@10 1491 Set the maximum demux-decode delay.
yading@10 1492 .IP "\fB\-muxpreload\fR \fIseconds\fR \fB(\fR\fIinput\fR\fB)\fR" 4
yading@10 1493 .IX Item "-muxpreload seconds (input)"
yading@10 1494 Set the initial demux-decode delay.
yading@10 1495 .IP "\fB\-streamid\fR \fIoutput-stream-index\fR\fB:\fR\fInew-value\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
yading@10 1496 .IX Item "-streamid output-stream-index:new-value (output)"
yading@10 1497 Assign a new stream-id value to an output stream. This option should be
yading@10 1498 specified prior to the output filename to which it applies.
yading@10 1499 For the situation where multiple output files exist, a streamid
yading@10 1500 may be reassigned to a different value.
yading@10 1501 .Sp
yading@10 1502 For example, to set the stream 0 \s-1PID\s0 to 33 and the stream 1 \s-1PID\s0 to 36 for
yading@10 1503 an output mpegts file:
yading@10 1504 .Sp
yading@10 1505 .Vb 1
yading@10 1506 \& ffmpeg \-i infile \-streamid 0:33 \-streamid 1:36 out.ts
yading@10 1507 .Ve
yading@10 1508 .IP "\fB\-bsf[:\fR\fIstream_specifier\fR\fB]\fR \fIbitstream_filters\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
yading@10 1509 .IX Item "-bsf[:stream_specifier] bitstream_filters (output,per-stream)"
yading@10 1510 Set bitstream filters for matching streams. \fIbitstream_filters\fR is
yading@10 1511 a comma-separated list of bitstream filters. Use the \f(CW\*(C`\-bsfs\*(C'\fR option
yading@10 1512 to get the list of bitstream filters.
yading@10 1513 .Sp
yading@10 1514 .Vb 1
yading@10 1515 \& ffmpeg \-i h264.mp4 \-c:v copy \-bsf:v h264_mp4toannexb \-an out.h264
yading@10 1516 \&
yading@10 1517 \&
yading@10 1518 \& ffmpeg \-i file.mov \-an \-vn \-bsf:s mov2textsub \-c:s copy \-f rawvideo sub.txt
yading@10 1519 .Ve
yading@10 1520 .IP "\fB\-tag[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec_tag\fR \fB(\fR\fIper-stream\fR\fB)\fR" 4
yading@10 1521 .IX Item "-tag[:stream_specifier] codec_tag (per-stream)"
yading@10 1522 Force a tag/fourcc for matching streams.
yading@10 1523 .IP "\fB\-timecode\fR \fIhh\fR\fB:\fR\fImm\fR\fB:\fR\fIss\fR\fB\s-1SEP\s0\fR\fIff\fR" 4
yading@10 1524 .IX Item "-timecode hh:mm:ssSEPff"
yading@10 1525 Specify Timecode for writing. \fI\s-1SEP\s0\fR is ':' for non drop timecode and ';'
yading@10 1526 (or '.') for drop.
yading@10 1527 .Sp
yading@10 1528 .Vb 1
yading@10 1529 \& ffmpeg \-i input.mpg \-timecode 01:02:03.04 \-r 30000/1001 \-s ntsc output.mpg
yading@10 1530 .Ve
yading@10 1531 .IP "\fB\-filter_complex\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
yading@10 1532 .IX Item "-filter_complex filtergraph (global)"
yading@10 1533 Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
yading@10 1534 outputs. For simple graphs \*(-- those with one input and one output of the same
yading@10 1535 type \*(-- see the \fB\-filter\fR options. \fIfiltergraph\fR is a description of
yading@10 1536 the filtergraph, as described in the ``Filtergraph syntax'' section of the
yading@10 1537 ffmpeg-filters manual.
yading@10 1538 .Sp
yading@10 1539 Input link labels must refer to input streams using the
yading@10 1540 \&\f(CW\*(C`[file_index:stream_specifier]\*(C'\fR syntax (i.e. the same as \fB\-map\fR
yading@10 1541 uses). If \fIstream_specifier\fR matches multiple streams, the first one will be
yading@10 1542 used. An unlabeled input will be connected to the first unused input stream of
yading@10 1543 the matching type.
yading@10 1544 .Sp
yading@10 1545 Output link labels are referred to with \fB\-map\fR. Unlabeled outputs are
yading@10 1546 added to the first output file.
yading@10 1547 .Sp
yading@10 1548 Note that with this option it is possible to use only lavfi sources without
yading@10 1549 normal input files.
yading@10 1550 .Sp
yading@10 1551 For example, to overlay an image over video
yading@10 1552 .Sp
yading@10 1553 .Vb 2
yading@10 1554 \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aq[0:v][1:v]overlay[out]\*(Aq \-map
yading@10 1555 \& \*(Aq[out]\*(Aq out.mkv
yading@10 1556 .Ve
yading@10 1557 .Sp
yading@10 1558 Here \f(CW\*(C`[0:v]\*(C'\fR refers to the first video stream in the first input file,
yading@10 1559 which is linked to the first (main) input of the overlay filter. Similarly the
yading@10 1560 first video stream in the second input is linked to the second (overlay) input
yading@10 1561 of overlay.
yading@10 1562 .Sp
yading@10 1563 Assuming there is only one video stream in each input file, we can omit input
yading@10 1564 labels, so the above is equivalent to
yading@10 1565 .Sp
yading@10 1566 .Vb 2
yading@10 1567 \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay[out]\*(Aq \-map
yading@10 1568 \& \*(Aq[out]\*(Aq out.mkv
yading@10 1569 .Ve
yading@10 1570 .Sp
yading@10 1571 Furthermore we can omit the output label and the single output from the filter
yading@10 1572 graph will be added to the output file automatically, so we can simply write
yading@10 1573 .Sp
yading@10 1574 .Vb 1
yading@10 1575 \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay\*(Aq out.mkv
yading@10 1576 .Ve
yading@10 1577 .Sp
yading@10 1578 To generate 5 seconds of pure red video using lavfi \f(CW\*(C`color\*(C'\fR source:
yading@10 1579 .Sp
yading@10 1580 .Vb 1
yading@10 1581 \& ffmpeg \-filter_complex \*(Aqcolor=c=red\*(Aq \-t 5 out.mkv
yading@10 1582 .Ve
yading@10 1583 .IP "\fB\-lavfi\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
yading@10 1584 .IX Item "-lavfi filtergraph (global)"
yading@10 1585 Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
yading@10 1586 outputs. Equivalent to \fB\-filter_complex\fR.
yading@10 1587 .IP "\fB\-filter_complex_script\fR \fIfilename\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
yading@10 1588 .IX Item "-filter_complex_script filename (global)"
yading@10 1589 This option is similar to \fB\-filter_complex\fR, the only difference is that
yading@10 1590 its argument is the name of the file from which a complex filtergraph
yading@10 1591 description is to be read.
yading@10 1592 .PP
yading@10 1593 As a special exception, you can use a bitmap subtitle stream as input: it
yading@10 1594 will be converted into a video with the same size as the largest video in
yading@10 1595 the file, or 720x576 if no video is present. Note that this is an
yading@10 1596 experimental and temporary solution. It will be removed once libavfilter has
yading@10 1597 proper support for subtitles.
yading@10 1598 .PP
yading@10 1599 For example, to hardcode subtitles on top of a DVB-T recording stored in
yading@10 1600 MPEG-TS format, delaying the subtitles by 1 second:
yading@10 1601 .PP
yading@10 1602 .Vb 3
yading@10 1603 \& ffmpeg \-i input.ts \-filter_complex \e
yading@10 1604 \& \*(Aq[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay\*(Aq \e
yading@10 1605 \& \-sn \-map \*(Aq#0x2dc\*(Aq output.mkv
yading@10 1606 .Ve
yading@10 1607 .PP
yading@10 1608 (0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the video,
yading@10 1609 audio and subtitles streams; 0:0, 0:3 and 0:7 would have worked too)
yading@10 1610 .SS "Preset files"
yading@10 1611 .IX Subsection "Preset files"
yading@10 1612 A preset file contains a sequence of \fIoption\fR=\fIvalue\fR pairs,
yading@10 1613 one for each line, specifying a sequence of options which would be
yading@10 1614 awkward to specify on the command line. Lines starting with the hash
yading@10 1615 ('#') character are ignored and are used to provide comments. Check
yading@10 1616 the \fIpresets\fR directory in the FFmpeg source tree for examples.
yading@10 1617 .PP
yading@10 1618 Preset files are specified with the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR,
yading@10 1619 \&\f(CW\*(C`spre\*(C'\fR, and \f(CW\*(C`fpre\*(C'\fR options. The \f(CW\*(C`fpre\*(C'\fR option takes the
yading@10 1620 filename of the preset instead of a preset name as input and can be
yading@10 1621 used for any kind of codec. For the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, and
yading@10 1622 \&\f(CW\*(C`spre\*(C'\fR options, the options specified in a preset file are
yading@10 1623 applied to the currently selected codec of the same type as the preset
yading@10 1624 option.
yading@10 1625 .PP
yading@10 1626 The argument passed to the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, and \f(CW\*(C`spre\*(C'\fR
yading@10 1627 preset options identifies the preset file to use according to the
yading@10 1628 following rules:
yading@10 1629 .PP
yading@10 1630 First ffmpeg searches for a file named \fIarg\fR.ffpreset in the
yading@10 1631 directories \fI\f(CI$FFMPEG_DATADIR\fI\fR (if set), and \fI\f(CI$HOME\fI/.ffmpeg\fR, and in
yading@10 1632 the datadir defined at configuration time (usually \fIPREFIX/share/ffmpeg\fR)
yading@10 1633 or in a \fIffpresets\fR folder along the executable on win32,
yading@10 1634 in that order. For example, if the argument is \f(CW\*(C`libvpx\-1080p\*(C'\fR, it will
yading@10 1635 search for the file \fIlibvpx\-1080p.ffpreset\fR.
yading@10 1636 .PP
yading@10 1637 If no such file is found, then ffmpeg will search for a file named
yading@10 1638 \&\fIcodec_name\fR\-\fIarg\fR.ffpreset in the above-mentioned
yading@10 1639 directories, where \fIcodec_name\fR is the name of the codec to which
yading@10 1640 the preset file options will be applied. For example, if you select
yading@10 1641 the video codec with \f(CW\*(C`\-vcodec libvpx\*(C'\fR and use \f(CW\*(C`\-vpre 1080p\*(C'\fR,
yading@10 1642 then it will search for the file \fIlibvpx\-1080p.ffpreset\fR.
yading@10 1643 .SH "TIPS"
yading@10 1644 .IX Header "TIPS"
yading@10 1645 .IP "\(bu" 4
yading@10 1646 For streaming at very low bitrate application, use a low frame rate
yading@10 1647 and a small \s-1GOP\s0 size. This is especially true for RealVideo where
yading@10 1648 the Linux player does not seem to be very fast, so it can miss
yading@10 1649 frames. An example is:
yading@10 1650 .Sp
yading@10 1651 .Vb 1
yading@10 1652 \& ffmpeg \-g 3 \-r 3 \-t 10 \-b:v 50k \-s qcif \-f rv10 /tmp/b.rm
yading@10 1653 .Ve
yading@10 1654 .IP "\(bu" 4
yading@10 1655 The parameter 'q' which is displayed while encoding is the current
yading@10 1656 quantizer. The value 1 indicates that a very good quality could
yading@10 1657 be achieved. The value 31 indicates the worst quality. If q=31 appears
yading@10 1658 too often, it means that the encoder cannot compress enough to meet
yading@10 1659 your bitrate. You must either increase the bitrate, decrease the
yading@10 1660 frame rate or decrease the frame size.
yading@10 1661 .IP "\(bu" 4
yading@10 1662 If your computer is not fast enough, you can speed up the
yading@10 1663 compression at the expense of the compression ratio. You can use
yading@10 1664 \&'\-me zero' to speed up motion estimation, and '\-g 0' to disable
yading@10 1665 motion estimation completely (you have only I\-frames, which means it
yading@10 1666 is about as good as \s-1JPEG\s0 compression).
yading@10 1667 .IP "\(bu" 4
yading@10 1668 To have very low audio bitrates, reduce the sampling frequency
yading@10 1669 (down to 22050 Hz for \s-1MPEG\s0 audio, 22050 or 11025 for \s-1AC\-3\s0).
yading@10 1670 .IP "\(bu" 4
yading@10 1671 To have a constant quality (but a variable bitrate), use the option
yading@10 1672 \&'\-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
yading@10 1673 quality).
yading@10 1674 .SH "EXAMPLES"
yading@10 1675 .IX Header "EXAMPLES"
yading@10 1676 .SS "Preset files"
yading@10 1677 .IX Subsection "Preset files"
yading@10 1678 A preset file contains a sequence of \fIoption=value\fR pairs, one for
yading@10 1679 each line, specifying a sequence of options which can be specified also on
yading@10 1680 the command line. Lines starting with the hash ('#') character are ignored and
yading@10 1681 are used to provide comments. Empty lines are also ignored. Check the
yading@10 1682 \&\fIpresets\fR directory in the FFmpeg source tree for examples.
yading@10 1683 .PP
yading@10 1684 Preset files are specified with the \f(CW\*(C`pre\*(C'\fR option, this option takes a
yading@10 1685 preset name as input. FFmpeg searches for a file named \fIpreset_name\fR.avpreset in
yading@10 1686 the directories \fI\f(CI$AVCONV_DATADIR\fI\fR (if set), and \fI\f(CI$HOME\fI/.ffmpeg\fR, and in
yading@10 1687 the data directory defined at configuration time (usually \fI\f(CI$PREFIX\fI/share/ffmpeg\fR)
yading@10 1688 in that order. For example, if the argument is \f(CW\*(C`libx264\-max\*(C'\fR, it will
yading@10 1689 search for the file \fIlibx264\-max.avpreset\fR.
yading@10 1690 .SS "Video and Audio grabbing"
yading@10 1691 .IX Subsection "Video and Audio grabbing"
yading@10 1692 If you specify the input format and device then ffmpeg can grab video
yading@10 1693 and audio directly.
yading@10 1694 .PP
yading@10 1695 .Vb 1
yading@10 1696 \& ffmpeg \-f oss \-i /dev/dsp \-f video4linux2 \-i /dev/video0 /tmp/out.mpg
yading@10 1697 .Ve
yading@10 1698 .PP
yading@10 1699 Or with an \s-1ALSA\s0 audio source (mono input, card id 1) instead of \s-1OSS:\s0
yading@10 1700 .PP
yading@10 1701 .Vb 1
yading@10 1702 \& ffmpeg \-f alsa \-ac 1 \-i hw:1 \-f video4linux2 \-i /dev/video0 /tmp/out.mpg
yading@10 1703 .Ve
yading@10 1704 .PP
yading@10 1705 Note that you must activate the right video source and channel before
yading@10 1706 launching ffmpeg with any \s-1TV\s0 viewer such as
yading@10 1707 <\fBhttp://linux.bytesex.org/xawtv/\fR> by Gerd Knorr. You also
yading@10 1708 have to set the audio recording levels correctly with a
yading@10 1709 standard mixer.
yading@10 1710 .SS "X11 grabbing"
yading@10 1711 .IX Subsection "X11 grabbing"
yading@10 1712 Grab the X11 display with ffmpeg via
yading@10 1713 .PP
yading@10 1714 .Vb 1
yading@10 1715 \& ffmpeg \-f x11grab \-s cif \-r 25 \-i :0.0 /tmp/out.mpg
yading@10 1716 .Ve
yading@10 1717 .PP
yading@10 1718 0.0 is display.screen number of your X11 server, same as
yading@10 1719 the \s-1DISPLAY\s0 environment variable.
yading@10 1720 .PP
yading@10 1721 .Vb 1
yading@10 1722 \& ffmpeg \-f x11grab \-s cif \-r 25 \-i :0.0+10,20 /tmp/out.mpg
yading@10 1723 .Ve
yading@10 1724 .PP
yading@10 1725 0.0 is display.screen number of your X11 server, same as the \s-1DISPLAY\s0 environment
yading@10 1726 variable. 10 is the x\-offset and 20 the y\-offset for the grabbing.
yading@10 1727 .SS "Video and Audio file format conversion"
yading@10 1728 .IX Subsection "Video and Audio file format conversion"
yading@10 1729 Any supported file format and protocol can serve as input to ffmpeg:
yading@10 1730 .PP
yading@10 1731 Examples:
yading@10 1732 .IP "\(bu" 4
yading@10 1733 You can use \s-1YUV\s0 files as input:
yading@10 1734 .Sp
yading@10 1735 .Vb 1
yading@10 1736 \& ffmpeg \-i /tmp/test%d.Y /tmp/out.mpg
yading@10 1737 .Ve
yading@10 1738 .Sp
yading@10 1739 It will use the files:
yading@10 1740 .Sp
yading@10 1741 .Vb 2
yading@10 1742 \& /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
yading@10 1743 \& /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
yading@10 1744 .Ve
yading@10 1745 .Sp
yading@10 1746 The Y files use twice the resolution of the U and V files. They are
yading@10 1747 raw files, without header. They can be generated by all decent video
yading@10 1748 decoders. You must specify the size of the image with the \fB\-s\fR option
yading@10 1749 if ffmpeg cannot guess it.
yading@10 1750 .IP "\(bu" 4
yading@10 1751 You can input from a raw \s-1YUV420P\s0 file:
yading@10 1752 .Sp
yading@10 1753 .Vb 1
yading@10 1754 \& ffmpeg \-i /tmp/test.yuv /tmp/out.avi
yading@10 1755 .Ve
yading@10 1756 .Sp
yading@10 1757 test.yuv is a file containing raw \s-1YUV\s0 planar data. Each frame is composed
yading@10 1758 of the Y plane followed by the U and V planes at half vertical and
yading@10 1759 horizontal resolution.
yading@10 1760 .IP "\(bu" 4
yading@10 1761 You can output to a raw \s-1YUV420P\s0 file:
yading@10 1762 .Sp
yading@10 1763 .Vb 1
yading@10 1764 \& ffmpeg \-i mydivx.avi hugefile.yuv
yading@10 1765 .Ve
yading@10 1766 .IP "\(bu" 4
yading@10 1767 You can set several input files and output files:
yading@10 1768 .Sp
yading@10 1769 .Vb 1
yading@10 1770 \& ffmpeg \-i /tmp/a.wav \-s 640x480 \-i /tmp/a.yuv /tmp/a.mpg
yading@10 1771 .Ve
yading@10 1772 .Sp
yading@10 1773 Converts the audio file a.wav and the raw \s-1YUV\s0 video file a.yuv
yading@10 1774 to \s-1MPEG\s0 file a.mpg.
yading@10 1775 .IP "\(bu" 4
yading@10 1776 You can also do audio and video conversions at the same time:
yading@10 1777 .Sp
yading@10 1778 .Vb 1
yading@10 1779 \& ffmpeg \-i /tmp/a.wav \-ar 22050 /tmp/a.mp2
yading@10 1780 .Ve
yading@10 1781 .Sp
yading@10 1782 Converts a.wav to \s-1MPEG\s0 audio at 22050 Hz sample rate.
yading@10 1783 .IP "\(bu" 4
yading@10 1784 You can encode to several formats at the same time and define a
yading@10 1785 mapping from input stream to output streams:
yading@10 1786 .Sp
yading@10 1787 .Vb 1
yading@10 1788 \& ffmpeg \-i /tmp/a.wav \-map 0:a \-b:a 64k /tmp/a.mp2 \-map 0:a \-b:a 128k /tmp/b.mp2
yading@10 1789 .Ve
yading@10 1790 .Sp
yading@10 1791 Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '\-map
yading@10 1792 file:index' specifies which input stream is used for each output
yading@10 1793 stream, in the order of the definition of output streams.
yading@10 1794 .IP "\(bu" 4
yading@10 1795 You can transcode decrypted VOBs:
yading@10 1796 .Sp
yading@10 1797 .Vb 1
yading@10 1798 \& ffmpeg \-i snatch_1.vob \-f avi \-c:v mpeg4 \-b:v 800k \-g 300 \-bf 2 \-c:a libmp3lame \-b:a 128k snatch.avi
yading@10 1799 .Ve
yading@10 1800 .Sp
yading@10 1801 This is a typical \s-1DVD\s0 ripping example; the input is a \s-1VOB\s0 file, the
yading@10 1802 output an \s-1AVI\s0 file with \s-1MPEG\-4\s0 video and \s-1MP3\s0 audio. Note that in this
yading@10 1803 command we use B\-frames so the \s-1MPEG\-4\s0 stream is DivX5 compatible, and
yading@10 1804 \&\s-1GOP\s0 size is 300 which means one intra frame every 10 seconds for 29.97fps
yading@10 1805 input video. Furthermore, the audio stream is MP3\-encoded so you need
yading@10 1806 to enable \s-1LAME\s0 support by passing \f(CW\*(C`\-\-enable\-libmp3lame\*(C'\fR to configure.
yading@10 1807 The mapping is particularly useful for \s-1DVD\s0 transcoding
yading@10 1808 to get the desired audio language.
yading@10 1809 .Sp
yading@10 1810 \&\s-1NOTE:\s0 To see the supported input formats, use \f(CW\*(C`ffmpeg \-formats\*(C'\fR.
yading@10 1811 .IP "\(bu" 4
yading@10 1812 You can extract images from a video, or create a video from many images:
yading@10 1813 .Sp
yading@10 1814 For extracting images from a video:
yading@10 1815 .Sp
yading@10 1816 .Vb 1
yading@10 1817 \& ffmpeg \-i foo.avi \-r 1 \-s WxH \-f image2 foo\-%03d.jpeg
yading@10 1818 .Ve
yading@10 1819 .Sp
yading@10 1820 This will extract one video frame per second from the video and will
yading@10 1821 output them in files named \fIfoo\-001.jpeg\fR, \fIfoo\-002.jpeg\fR,
yading@10 1822 etc. Images will be rescaled to fit the new WxH values.
yading@10 1823 .Sp
yading@10 1824 If you want to extract just a limited number of frames, you can use the
yading@10 1825 above command in combination with the \-vframes or \-t option, or in
yading@10 1826 combination with \-ss to start extracting from a certain point in time.
yading@10 1827 .Sp
yading@10 1828 For creating a video from many images:
yading@10 1829 .Sp
yading@10 1830 .Vb 1
yading@10 1831 \& ffmpeg \-f image2 \-i foo\-%03d.jpeg \-r 12 \-s WxH foo.avi
yading@10 1832 .Ve
yading@10 1833 .Sp
yading@10 1834 The syntax \f(CW\*(C`foo\-%03d.jpeg\*(C'\fR specifies to use a decimal number
yading@10 1835 composed of three digits padded with zeroes to express the sequence
yading@10 1836 number. It is the same syntax supported by the C printf function, but
yading@10 1837 only formats accepting a normal integer are suitable.
yading@10 1838 .Sp
yading@10 1839 When importing an image sequence, \-i also supports expanding
yading@10 1840 shell-like wildcard patterns (globbing) internally, by selecting the
yading@10 1841 image2\-specific \f(CW\*(C`\-pattern_type glob\*(C'\fR option.
yading@10 1842 .Sp
yading@10 1843 For example, for creating a video from filenames matching the glob pattern
yading@10 1844 \&\f(CW\*(C`foo\-*.jpeg\*(C'\fR:
yading@10 1845 .Sp
yading@10 1846 .Vb 1
yading@10 1847 \& ffmpeg \-f image2 \-pattern_type glob \-i \*(Aqfoo\-*.jpeg\*(Aq \-r 12 \-s WxH foo.avi
yading@10 1848 .Ve
yading@10 1849 .IP "\(bu" 4
yading@10 1850 You can put many streams of the same type in the output:
yading@10 1851 .Sp
yading@10 1852 .Vb 1
yading@10 1853 \& ffmpeg \-i test1.avi \-i test2.avi \-map 0:3 \-map 0:2 \-map 0:1 \-map 0:0 \-c copy test12.nut
yading@10 1854 .Ve
yading@10 1855 .Sp
yading@10 1856 The resulting output file \fItest12.avi\fR will contain first four streams from
yading@10 1857 the input file in reverse order.
yading@10 1858 .IP "\(bu" 4
yading@10 1859 To force \s-1CBR\s0 video output:
yading@10 1860 .Sp
yading@10 1861 .Vb 1
yading@10 1862 \& ffmpeg \-i myfile.avi \-b 4000k \-minrate 4000k \-maxrate 4000k \-bufsize 1835k out.m2v
yading@10 1863 .Ve
yading@10 1864 .IP "\(bu" 4
yading@10 1865 The four options lmin, lmax, mblmin and mblmax use 'lambda' units,
yading@10 1866 but you may use the \s-1QP2LAMBDA\s0 constant to easily convert from 'q' units:
yading@10 1867 .Sp
yading@10 1868 .Vb 1
yading@10 1869 \& ffmpeg \-i src.ext \-lmax 21*QP2LAMBDA dst.ext
yading@10 1870 .Ve
yading@10 1871 .SH "SEE ALSO"
yading@10 1872 .IX Header "SEE ALSO"
yading@10 1873 \&\fIffmpeg\-all\fR\|(1),
yading@10 1874 \&\fIffplay\fR\|(1), \fIffprobe\fR\|(1), \fIffserver\fR\|(1),
yading@10 1875 \&\fIffmpeg\-utils\fR\|(1), \fIffmpeg\-scaler\fR\|(1), \fIffmpeg\-resampler\fR\|(1),
yading@10 1876 \&\fIffmpeg\-codecs\fR\|(1), \fIffmpeg\-bitstream\-filters\fR\|(1), \fIffmpeg\-formats\fR\|(1),
yading@10 1877 \&\fIffmpeg\-devices\fR\|(1), \fIffmpeg\-protocols\fR\|(1), \fIffmpeg\-filters\fR\|(1)
yading@10 1878 .SH "AUTHORS"
yading@10 1879 .IX Header "AUTHORS"
yading@10 1880 The FFmpeg developers.
yading@10 1881 .PP
yading@10 1882 For details about the authorship, see the Git history of the project
yading@10 1883 (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
yading@10 1884 \&\fBgit log\fR in the FFmpeg source directory, or browsing the
yading@10 1885 online repository at <\fBhttp://source.ffmpeg.org\fR>.
yading@10 1886 .PP
yading@10 1887 Maintainers for the specific components are listed in the file
yading@10 1888 \&\fI\s-1MAINTAINERS\s0\fR in the source code tree.