yading@10: .\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) yading@10: .\" yading@10: .\" Standard preamble: yading@10: .\" ======================================================================== yading@10: .de Sp \" Vertical space (when we can't use .PP) yading@10: .if t .sp .5v yading@10: .if n .sp yading@10: .. yading@10: .de Vb \" Begin verbatim text yading@10: .ft CW yading@10: .nf yading@10: .ne \\$1 yading@10: .. yading@10: .de Ve \" End verbatim text yading@10: .ft R yading@10: .fi yading@10: .. yading@10: .\" Set up some character translations and predefined strings. \*(-- will yading@10: .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left yading@10: .\" double quote, and \*(R" will give a right double quote. \*(C+ will yading@10: .\" give a nicer C++. Capital omega is used to do unbreakable dashes and yading@10: .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, yading@10: .\" nothing in troff, for use with C<>. yading@10: .tr \(*W- yading@10: .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' yading@10: .ie n \{\ yading@10: . ds -- \(*W- yading@10: . ds PI pi yading@10: . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch yading@10: . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch yading@10: . ds L" "" yading@10: . ds R" "" yading@10: . ds C` "" yading@10: . ds C' "" yading@10: 'br\} yading@10: .el\{\ yading@10: . ds -- \|\(em\| yading@10: . ds PI \(*p yading@10: . ds L" `` yading@10: . ds R" '' yading@10: 'br\} yading@10: .\" yading@10: .\" Escape single quotes in literal strings from groff's Unicode transform. yading@10: .ie \n(.g .ds Aq \(aq yading@10: .el .ds Aq ' yading@10: .\" yading@10: .\" If the F register is turned on, we'll generate index entries on stderr for yading@10: .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index yading@10: .\" entries marked with X<> in POD. Of course, you'll have to process the yading@10: .\" output yourself in some meaningful fashion. yading@10: .ie \nF \{\ yading@10: . de IX yading@10: . tm Index:\\$1\t\\n%\t"\\$2" yading@10: .. yading@10: . nr % 0 yading@10: . rr F yading@10: .\} yading@10: .el \{\ yading@10: . de IX yading@10: .. yading@10: .\} yading@10: .\" yading@10: .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). yading@10: .\" Fear. Run. Save yourself. No user-serviceable parts. yading@10: . \" fudge factors for nroff and troff yading@10: .if n \{\ yading@10: . ds #H 0 yading@10: . ds #V .8m yading@10: . ds #F .3m yading@10: . ds #[ \f1 yading@10: . ds #] \fP yading@10: .\} yading@10: .if t \{\ yading@10: . ds #H ((1u-(\\\\n(.fu%2u))*.13m) yading@10: . ds #V .6m yading@10: . ds #F 0 yading@10: . ds #[ \& yading@10: . ds #] \& yading@10: .\} yading@10: . \" simple accents for nroff and troff yading@10: .if n \{\ yading@10: . ds ' \& yading@10: . ds ` \& yading@10: . ds ^ \& yading@10: . ds , \& yading@10: . ds ~ ~ yading@10: . ds / yading@10: .\} yading@10: .if t \{\ yading@10: . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" yading@10: . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' yading@10: . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' yading@10: . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' yading@10: . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' yading@10: . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' yading@10: .\} yading@10: . \" troff and (daisy-wheel) nroff accents yading@10: .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' yading@10: .ds 8 \h'\*(#H'\(*b\h'-\*(#H' yading@10: .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] yading@10: .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' yading@10: .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' yading@10: .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] yading@10: .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] yading@10: .ds ae a\h'-(\w'a'u*4/10)'e yading@10: .ds Ae A\h'-(\w'A'u*4/10)'E yading@10: . \" corrections for vroff yading@10: .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' yading@10: .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' yading@10: . \" for low resolution devices (crt and lpr) yading@10: .if \n(.H>23 .if \n(.V>19 \ yading@10: \{\ yading@10: . ds : e yading@10: . ds 8 ss yading@10: . ds o a yading@10: . ds d- d\h'-1'\(ga yading@10: . ds D- D\h'-1'\(hy yading@10: . ds th \o'bp' yading@10: . ds Th \o'LP' yading@10: . ds ae ae yading@10: . ds Ae AE yading@10: .\} yading@10: .rm #[ #] #H #V #F C yading@10: .\" ======================================================================== yading@10: .\" yading@10: .IX Title "FFMPEG 1" yading@10: .TH FFMPEG 1 "2013-04-21" " " " " yading@10: .\" For nroff, turn off justification. Always turn off hyphenation; it makes yading@10: .\" way too many mistakes in technical documents. yading@10: .if n .ad l yading@10: .nh yading@10: .SH "NAME" yading@10: ffmpeg \- ffmpeg video converter yading@10: .SH "SYNOPSIS" yading@10: .IX Header "SYNOPSIS" yading@10: ffmpeg [\fIglobal_options\fR] {[\fIinput_file_options\fR] \-i \fIinput_file\fR} ... {[\fIoutput_file_options\fR] \fIoutput_file\fR} ... yading@10: .SH "DESCRIPTION" yading@10: .IX Header "DESCRIPTION" yading@10: \&\fBffmpeg\fR is a very fast video and audio converter that can also grab from yading@10: a live audio/video source. It can also convert between arbitrary sample yading@10: rates and resize video on the fly with a high quality polyphase filter. yading@10: .PP yading@10: \&\fBffmpeg\fR reads from an arbitrary number of input \*(L"files\*(R" (which can be regular yading@10: files, pipes, network streams, grabbing devices, etc.), specified by the yading@10: \&\f(CW\*(C`\-i\*(C'\fR option, and writes to an arbitrary number of output \*(L"files\*(R", which are yading@10: specified by a plain output filename. Anything found on the command line which yading@10: cannot be interpreted as an option is considered to be an output filename. yading@10: .PP yading@10: Each input or output file can, in principle, contain any number of streams of yading@10: different types (video/audio/subtitle/attachment/data). The allowed number and/or yading@10: types of streams may be limited by the container format. Selecting which yading@10: streams from which inputs will go into which output is either done automatically yading@10: or with the \f(CW\*(C`\-map\*(C'\fR option (see the Stream selection chapter). yading@10: .PP yading@10: To refer to input files in options, you must use their indices (0\-based). E.g. yading@10: the first input file is \f(CW0\fR, the second is \f(CW1\fR, etc. Similarly, streams yading@10: within a file are referred to by their indices. E.g. \f(CW\*(C`2:3\*(C'\fR refers to the yading@10: fourth stream in the third input file. Also see the Stream specifiers chapter. yading@10: .PP yading@10: As a general rule, options are applied to the next specified yading@10: file. Therefore, order is important, and you can have the same yading@10: option on the command line multiple times. Each occurrence is yading@10: then applied to the next input or output file. yading@10: Exceptions from this rule are the global options (e.g. verbosity level), yading@10: which should be specified first. yading@10: .PP yading@10: Do not mix input and output files \*(-- first specify all input files, then all yading@10: output files. Also do not mix options which belong to different files. All yading@10: options apply \s-1ONLY\s0 to the next input or output file and are reset between files. yading@10: .IP "\(bu" 4 yading@10: To set the video bitrate of the output file to 64 kbit/s: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i input.avi \-b:v 64k \-bufsize 64k output.avi yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: To force the frame rate of the output file to 24 fps: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i input.avi \-r 24 output.avi yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: To force the frame rate of the input file (valid for raw formats only) yading@10: to 1 fps and the frame rate of the output file to 24 fps: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-r 1 \-i input.m2v \-r 24 output.avi yading@10: .Ve yading@10: .PP yading@10: The format option may be needed for raw input files. yading@10: .SH "DETAILED DESCRIPTION" yading@10: .IX Header "DETAILED DESCRIPTION" yading@10: The transcoding process in \fBffmpeg\fR for each output can be described by yading@10: the following diagram: yading@10: .PP yading@10: .Vb 5 yading@10: \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_ yading@10: \& | | | | | | | | | | yading@10: \& | input | demuxer | encoded data | decoder | decoded | encoder | encoded data | muxer | output | yading@10: \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-\-\-> | frames | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-> | file | yading@10: \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_| yading@10: .Ve yading@10: .PP yading@10: \&\fBffmpeg\fR calls the libavformat library (containing demuxers) to read yading@10: input files and get packets containing encoded data from them. When there are yading@10: multiple input files, \fBffmpeg\fR tries to keep them synchronized by yading@10: tracking lowest timestamp on any active input stream. yading@10: .PP yading@10: Encoded packets are then passed to the decoder (unless streamcopy is selected yading@10: for the stream, see further for a description). The decoder produces yading@10: uncompressed frames (raw video/PCM audio/...) which can be processed further by yading@10: filtering (see next section). After filtering, the frames are passed to the yading@10: encoder, which encodes them and outputs encoded packets. Finally those are yading@10: passed to the muxer, which writes the encoded packets to the output file. yading@10: .SS "Filtering" yading@10: .IX Subsection "Filtering" yading@10: Before encoding, \fBffmpeg\fR can process raw audio and video frames using yading@10: filters from the libavfilter library. Several chained filters form a filter yading@10: graph. \fBffmpeg\fR distinguishes between two types of filtergraphs: yading@10: simple and complex. yading@10: .PP yading@10: \fISimple filtergraphs\fR yading@10: .IX Subsection "Simple filtergraphs" yading@10: .PP yading@10: Simple filtergraphs are those that have exactly one input and output, both of yading@10: the same type. In the above diagram they can be represented by simply inserting yading@10: an additional step between decoding and encoding: yading@10: .PP yading@10: .Vb 5 yading@10: \& _\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ yading@10: \& | | | | | | yading@10: \& | decoded | simple filtergraph | filtered | encoder | encoded data | yading@10: \& | frames | \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> | frames | \-\-\-\-\-\-\-\-\-> | packets | yading@10: \& |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| yading@10: .Ve yading@10: .PP yading@10: Simple filtergraphs are configured with the per-stream \fB\-filter\fR option yading@10: (with \fB\-vf\fR and \fB\-af\fR aliases for video and audio respectively). yading@10: A simple filtergraph for video can look for example like this: yading@10: .PP yading@10: .Vb 4 yading@10: \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_ yading@10: \& | | | | | | | | | | yading@10: \& | input | \-\-\-> | deinterlace | \-\-\-> | scale | \-\-\-> | fps | \-\-\-> | output | yading@10: \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_| yading@10: .Ve yading@10: .PP yading@10: Note that some filters change frame properties but not frame contents. E.g. the yading@10: \&\f(CW\*(C`fps\*(C'\fR filter in the example above changes number of frames, but does not yading@10: touch the frame contents. Another example is the \f(CW\*(C`setpts\*(C'\fR filter, which yading@10: only sets timestamps and otherwise passes the frames unchanged. yading@10: .PP yading@10: \fIComplex filtergraphs\fR yading@10: .IX Subsection "Complex filtergraphs" yading@10: .PP yading@10: Complex filtergraphs are those which cannot be described as simply a linear yading@10: processing chain applied to one stream. This is the case, for example, when the graph has yading@10: more than one input and/or output, or when output stream type is different from yading@10: input. They can be represented with the following diagram: yading@10: .PP yading@10: .Vb 10 yading@10: \& _\|_\|_\|_\|_\|_\|_\|_\|_ yading@10: \& | | yading@10: \& | input 0 |\e _\|_\|_\|_\|_\|_\|_\|_\|_\|_ yading@10: \& |_\|_\|_\|_\|_\|_\|_\|_\|_| \e | | yading@10: \& \e _\|_\|_\|_\|_\|_\|_\|_\|_ /| output 0 | yading@10: \& \e | | / |_\|_\|_\|_\|_\|_\|_\|_\|_\|_| yading@10: \& _\|_\|_\|_\|_\|_\|_\|_\|_ \e| complex | / yading@10: \& | | | |/ yading@10: \& | input 1 |\-\-\-\->| filter |\e yading@10: \& |_\|_\|_\|_\|_\|_\|_\|_\|_| | | \e _\|_\|_\|_\|_\|_\|_\|_\|_\|_ yading@10: \& /| graph | \e | | yading@10: \& / | | \e| output 1 | yading@10: \& _\|_\|_\|_\|_\|_\|_\|_\|_ / |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_| yading@10: \& | | / yading@10: \& | input 2 |/ yading@10: \& |_\|_\|_\|_\|_\|_\|_\|_\|_| yading@10: .Ve yading@10: .PP yading@10: Complex filtergraphs are configured with the \fB\-filter_complex\fR option. yading@10: Note that this option is global, since a complex filtergraph, by its nature, yading@10: cannot be unambiguously associated with a single stream or file. yading@10: .PP yading@10: The \fB\-lavfi\fR option is equivalent to \fB\-filter_complex\fR. yading@10: .PP yading@10: A trivial example of a complex filtergraph is the \f(CW\*(C`overlay\*(C'\fR filter, which yading@10: has two video inputs and one video output, containing one video overlaid on top yading@10: of the other. Its audio counterpart is the \f(CW\*(C`amix\*(C'\fR filter. yading@10: .SS "Stream copy" yading@10: .IX Subsection "Stream copy" yading@10: Stream copy is a mode selected by supplying the \f(CW\*(C`copy\*(C'\fR parameter to the yading@10: \&\fB\-codec\fR option. It makes \fBffmpeg\fR omit the decoding and encoding yading@10: step for the specified stream, so it does only demuxing and muxing. It is useful yading@10: for changing the container format or modifying container-level metadata. The yading@10: diagram above will, in this case, simplify to this: yading@10: .PP yading@10: .Vb 5 yading@10: \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_ yading@10: \& | | | | | | yading@10: \& | input | demuxer | encoded data | muxer | output | yading@10: \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-> | file | yading@10: \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_| yading@10: .Ve yading@10: .PP yading@10: Since there is no decoding or encoding, it is very fast and there is no quality yading@10: loss. However, it might not work in some cases because of many factors. Applying yading@10: filters is obviously also impossible, since filters work on uncompressed data. yading@10: .SH "STREAM SELECTION" yading@10: .IX Header "STREAM SELECTION" yading@10: By default, \fBffmpeg\fR includes only one stream of each type (video, audio, subtitle) yading@10: present in the input files and adds them to each output file. It picks the yading@10: \&\*(L"best\*(R" of each based upon the following criteria: for video, it is the stream yading@10: with the highest resolution, for audio, it is the stream with the most channels, for yading@10: subtitles, it is the first subtitle stream. In the case where several streams of yading@10: the same type rate equally, the stream with the lowest index is chosen. yading@10: .PP yading@10: You can disable some of those defaults by using the \f(CW\*(C`\-vn/\-an/\-sn\*(C'\fR options. For yading@10: full manual control, use the \f(CW\*(C`\-map\*(C'\fR option, which disables the defaults just yading@10: described. yading@10: .SH "OPTIONS" yading@10: .IX Header "OPTIONS" yading@10: All the numerical options, if not specified otherwise, accept a string yading@10: representing a number as input, which may be followed by one of the \s-1SI\s0 yading@10: unit prefixes, for example: 'K', 'M', or 'G'. yading@10: .PP yading@10: If 'i' is appended to the \s-1SI\s0 unit prefix, the complete prefix will be yading@10: interpreted as a unit prefix for binary multiplies, which are based on yading@10: powers of 1024 instead of powers of 1000. Appending 'B' to the \s-1SI\s0 unit yading@10: prefix multiplies the value by 8. This allows using, for example: yading@10: \&'\s-1KB\s0', 'MiB', 'G' and 'B' as number suffixes. yading@10: .PP yading@10: Options which do not take arguments are boolean options, and set the yading@10: corresponding value to true. They can be set to false by prefixing yading@10: the option name with \*(L"no\*(R". For example using \*(L"\-nofoo\*(R" yading@10: will set the boolean option with name \*(L"foo\*(R" to false. yading@10: .SS "Stream specifiers" yading@10: .IX Subsection "Stream specifiers" yading@10: Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers yading@10: are used to precisely specify which stream(s) a given option belongs to. yading@10: .PP yading@10: A stream specifier is a string generally appended to the option name and yading@10: separated from it by a colon. E.g. \f(CW\*(C`\-codec:a:1 ac3\*(C'\fR contains the yading@10: \&\f(CW\*(C`a:1\*(C'\fR stream specifier, which matches the second audio stream. Therefore, it yading@10: would select the ac3 codec for the second audio stream. yading@10: .PP yading@10: A stream specifier can match several streams, so that the option is applied to all yading@10: of them. E.g. the stream specifier in \f(CW\*(C`\-b:a 128k\*(C'\fR matches all audio yading@10: streams. yading@10: .PP yading@10: An empty stream specifier matches all streams. For example, \f(CW\*(C`\-codec copy\*(C'\fR yading@10: or \f(CW\*(C`\-codec: copy\*(C'\fR would copy all the streams without reencoding. yading@10: .PP yading@10: Possible forms of stream specifiers are: yading@10: .IP "\fIstream_index\fR" 4 yading@10: .IX Item "stream_index" yading@10: Matches the stream with this index. E.g. \f(CW\*(C`\-threads:1 4\*(C'\fR would set the yading@10: thread count for the second stream to 4. yading@10: .IP "\fIstream_type\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4 yading@10: .IX Item "stream_type[:stream_index]" yading@10: \&\fIstream_type\fR is one of following: 'v' for video, 'a' for audio, 's' for subtitle, yading@10: \&'d' for data, and 't' for attachments. If \fIstream_index\fR is given, then it matches yading@10: stream number \fIstream_index\fR of this type. Otherwise, it matches all yading@10: streams of this type. yading@10: .IP "\fBp:\fR\fIprogram_id\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4 yading@10: .IX Item "p:program_id[:stream_index]" yading@10: If \fIstream_index\fR is given, then it matches the stream with number \fIstream_index\fR yading@10: in the program with the id \fIprogram_id\fR. Otherwise, it matches all streams in the yading@10: program. yading@10: .IP "\fB#\fR\fIstream_id\fR" 4 yading@10: .IX Item "#stream_id" yading@10: Matches the stream by a format-specific \s-1ID\s0. yading@10: .SS "Generic options" yading@10: .IX Subsection "Generic options" yading@10: These options are shared amongst the ff* tools. yading@10: .IP "\fB\-L\fR" 4 yading@10: .IX Item "-L" yading@10: Show license. yading@10: .IP "\fB\-h, \-?, \-help, \-\-help [\fR\fIarg\fR\fB]\fR" 4 yading@10: .IX Item "-h, -?, -help, --help [arg]" yading@10: Show help. An optional parameter may be specified to print help about a specific yading@10: item. yading@10: .Sp yading@10: Possible values of \fIarg\fR are: yading@10: .RS 4 yading@10: .IP "\fBdecoder=\fR\fIdecoder_name\fR" 4 yading@10: .IX Item "decoder=decoder_name" yading@10: Print detailed information about the decoder named \fIdecoder_name\fR. Use the yading@10: \&\fB\-decoders\fR option to get a list of all decoders. yading@10: .IP "\fBencoder=\fR\fIencoder_name\fR" 4 yading@10: .IX Item "encoder=encoder_name" yading@10: Print detailed information about the encoder named \fIencoder_name\fR. Use the yading@10: \&\fB\-encoders\fR option to get a list of all encoders. yading@10: .IP "\fBdemuxer=\fR\fIdemuxer_name\fR" 4 yading@10: .IX Item "demuxer=demuxer_name" yading@10: Print detailed information about the demuxer named \fIdemuxer_name\fR. Use the yading@10: \&\fB\-formats\fR option to get a list of all demuxers and muxers. yading@10: .IP "\fBmuxer=\fR\fImuxer_name\fR" 4 yading@10: .IX Item "muxer=muxer_name" yading@10: Print detailed information about the muxer named \fImuxer_name\fR. Use the yading@10: \&\fB\-formats\fR option to get a list of all muxers and demuxers. yading@10: .IP "\fBfilter=\fR\fIfilter_name\fR" 4 yading@10: .IX Item "filter=filter_name" yading@10: Print detailed information about the filter name \fIfilter_name\fR. Use the yading@10: \&\fB\-filters\fR option to get a list of all filters. yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .IP "\fB\-version\fR" 4 yading@10: .IX Item "-version" yading@10: Show version. yading@10: .IP "\fB\-formats\fR" 4 yading@10: .IX Item "-formats" yading@10: Show available formats. yading@10: .IP "\fB\-codecs\fR" 4 yading@10: .IX Item "-codecs" yading@10: Show all codecs known to libavcodec. yading@10: .Sp yading@10: Note that the term 'codec' is used throughout this documentation as a shortcut yading@10: for what is more correctly called a media bitstream format. yading@10: .IP "\fB\-decoders\fR" 4 yading@10: .IX Item "-decoders" yading@10: Show available decoders. yading@10: .IP "\fB\-encoders\fR" 4 yading@10: .IX Item "-encoders" yading@10: Show all available encoders. yading@10: .IP "\fB\-bsfs\fR" 4 yading@10: .IX Item "-bsfs" yading@10: Show available bitstream filters. yading@10: .IP "\fB\-protocols\fR" 4 yading@10: .IX Item "-protocols" yading@10: Show available protocols. yading@10: .IP "\fB\-filters\fR" 4 yading@10: .IX Item "-filters" yading@10: Show available libavfilter filters. yading@10: .IP "\fB\-pix_fmts\fR" 4 yading@10: .IX Item "-pix_fmts" yading@10: Show available pixel formats. yading@10: .IP "\fB\-sample_fmts\fR" 4 yading@10: .IX Item "-sample_fmts" yading@10: Show available sample formats. yading@10: .IP "\fB\-layouts\fR" 4 yading@10: .IX Item "-layouts" yading@10: Show channel names and standard channel layouts. yading@10: .IP "\fB\-loglevel [repeat+]\fR\fIloglevel\fR \fB| \-v [repeat+]\fR\fIloglevel\fR" 4 yading@10: .IX Item "-loglevel [repeat+]loglevel | -v [repeat+]loglevel" yading@10: Set the logging level used by the library. yading@10: Adding \*(L"repeat+\*(R" indicates that repeated log output should not be compressed yading@10: to the first line and the \*(L"Last message repeated n times\*(R" line will be yading@10: omitted. \*(L"repeat\*(R" can also be used alone. yading@10: If \*(L"repeat\*(R" is used alone, and with no prior loglevel set, the default yading@10: loglevel will be used. If multiple loglevel parameters are given, using yading@10: \&'repeat' will not change the loglevel. yading@10: \&\fIloglevel\fR is a number or a string containing one of the following values: yading@10: .RS 4 yading@10: .IP "\fBquiet\fR" 4 yading@10: .IX Item "quiet" yading@10: Show nothing at all; be silent. yading@10: .IP "\fBpanic\fR" 4 yading@10: .IX Item "panic" yading@10: Only show fatal errors which could lead the process to crash, such as yading@10: and assert failure. This is not currently used for anything. yading@10: .IP "\fBfatal\fR" 4 yading@10: .IX Item "fatal" yading@10: Only show fatal errors. These are errors after which the process absolutely yading@10: cannot continue after. yading@10: .IP "\fBerror\fR" 4 yading@10: .IX Item "error" yading@10: Show all errors, including ones which can be recovered from. yading@10: .IP "\fBwarning\fR" 4 yading@10: .IX Item "warning" yading@10: Show all warnings and errors. Any message related to possibly yading@10: incorrect or unexpected events will be shown. yading@10: .IP "\fBinfo\fR" 4 yading@10: .IX Item "info" yading@10: Show informative messages during processing. This is in addition to yading@10: warnings and errors. This is the default value. yading@10: .IP "\fBverbose\fR" 4 yading@10: .IX Item "verbose" yading@10: Same as \f(CW\*(C`info\*(C'\fR, except more verbose. yading@10: .IP "\fBdebug\fR" 4 yading@10: .IX Item "debug" yading@10: Show everything, including debugging information. yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: By default the program logs to stderr, if coloring is supported by the yading@10: terminal, colors are used to mark errors and warnings. Log coloring yading@10: can be disabled setting the environment variable yading@10: \&\fB\s-1AV_LOG_FORCE_NOCOLOR\s0\fR or \fB\s-1NO_COLOR\s0\fR, or can be forced setting yading@10: the environment variable \fB\s-1AV_LOG_FORCE_COLOR\s0\fR. yading@10: The use of the environment variable \fB\s-1NO_COLOR\s0\fR is deprecated and yading@10: will be dropped in a following FFmpeg version. yading@10: .RE yading@10: .IP "\fB\-report\fR" 4 yading@10: .IX Item "-report" yading@10: Dump full command line and console output to a file named yading@10: \&\f(CW\*(C`\f(CIprogram\f(CW\-\f(CIYYYYMMDD\f(CW\-\f(CIHHMMSS\f(CW.log\*(C'\fR in the current yading@10: directory. yading@10: This file can be useful for bug reports. yading@10: It also implies \f(CW\*(C`\-loglevel verbose\*(C'\fR. yading@10: .Sp yading@10: Setting the environment variable \f(CW\*(C`FFREPORT\*(C'\fR to any value has the yading@10: same effect. If the value is a ':'\-separated key=value sequence, these yading@10: options will affect the report; options values must be escaped if they yading@10: contain special characters or the options delimiter ':' (see the yading@10: ``Quoting and escaping'' section in the ffmpeg-utils manual). The yading@10: following option is recognized: yading@10: .RS 4 yading@10: .IP "\fBfile\fR" 4 yading@10: .IX Item "file" yading@10: set the file name to use for the report; \f(CW%p\fR is expanded to the name yading@10: of the program, \f(CW%t\fR is expanded to a timestamp, \f(CW\*(C`%%\*(C'\fR is expanded yading@10: to a plain \f(CW\*(C`%\*(C'\fR yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: Errors in parsing the environment variable are not fatal, and will not yading@10: appear in the report. yading@10: .RE yading@10: .IP "\fB\-cpuflags flags (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-cpuflags flags (global)" yading@10: Allows setting and clearing cpu flags. This option is intended yading@10: for testing. Do not use it unless you know what you're doing. yading@10: .Sp yading@10: .Vb 3 yading@10: \& ffmpeg \-cpuflags \-sse+mmx ... yading@10: \& ffmpeg \-cpuflags mmx ... yading@10: \& ffmpeg \-cpuflags 0 ... yading@10: .Ve yading@10: .Sp yading@10: Possible flags for this option are: yading@10: .RS 4 yading@10: .IP "\fBx86\fR" 4 yading@10: .IX Item "x86" yading@10: .RS 4 yading@10: .PD 0 yading@10: .IP "\fBmmx\fR" 4 yading@10: .IX Item "mmx" yading@10: .IP "\fBmmxext\fR" 4 yading@10: .IX Item "mmxext" yading@10: .IP "\fBsse\fR" 4 yading@10: .IX Item "sse" yading@10: .IP "\fBsse2\fR" 4 yading@10: .IX Item "sse2" yading@10: .IP "\fBsse2slow\fR" 4 yading@10: .IX Item "sse2slow" yading@10: .IP "\fBsse3\fR" 4 yading@10: .IX Item "sse3" yading@10: .IP "\fBsse3slow\fR" 4 yading@10: .IX Item "sse3slow" yading@10: .IP "\fBssse3\fR" 4 yading@10: .IX Item "ssse3" yading@10: .IP "\fBatom\fR" 4 yading@10: .IX Item "atom" yading@10: .IP "\fBsse4.1\fR" 4 yading@10: .IX Item "sse4.1" yading@10: .IP "\fBsse4.2\fR" 4 yading@10: .IX Item "sse4.2" yading@10: .IP "\fBavx\fR" 4 yading@10: .IX Item "avx" yading@10: .IP "\fBxop\fR" 4 yading@10: .IX Item "xop" yading@10: .IP "\fBfma4\fR" 4 yading@10: .IX Item "fma4" yading@10: .IP "\fB3dnow\fR" 4 yading@10: .IX Item "3dnow" yading@10: .IP "\fB3dnowext\fR" 4 yading@10: .IX Item "3dnowext" yading@10: .IP "\fBcmov\fR" 4 yading@10: .IX Item "cmov" yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .IP "\fB\s-1ARM\s0\fR" 4 yading@10: .IX Item "ARM" yading@10: .RS 4 yading@10: .IP "\fBarmv5te\fR" 4 yading@10: .IX Item "armv5te" yading@10: .IP "\fBarmv6\fR" 4 yading@10: .IX Item "armv6" yading@10: .IP "\fBarmv6t2\fR" 4 yading@10: .IX Item "armv6t2" yading@10: .IP "\fBvfp\fR" 4 yading@10: .IX Item "vfp" yading@10: .IP "\fBvfpv3\fR" 4 yading@10: .IX Item "vfpv3" yading@10: .IP "\fBneon\fR" 4 yading@10: .IX Item "neon" yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .IP "\fBPowerPC\fR" 4 yading@10: .IX Item "PowerPC" yading@10: .RS 4 yading@10: .IP "\fBaltivec\fR" 4 yading@10: .IX Item "altivec" yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .IP "\fBSpecific Processors\fR" 4 yading@10: .IX Item "Specific Processors" yading@10: .RS 4 yading@10: .IP "\fBpentium2\fR" 4 yading@10: .IX Item "pentium2" yading@10: .IP "\fBpentium3\fR" 4 yading@10: .IX Item "pentium3" yading@10: .IP "\fBpentium4\fR" 4 yading@10: .IX Item "pentium4" yading@10: .IP "\fBk6\fR" 4 yading@10: .IX Item "k6" yading@10: .IP "\fBk62\fR" 4 yading@10: .IX Item "k62" yading@10: .IP "\fBathlon\fR" 4 yading@10: .IX Item "athlon" yading@10: .IP "\fBathlonxp\fR" 4 yading@10: .IX Item "athlonxp" yading@10: .IP "\fBk8\fR" 4 yading@10: .IX Item "k8" yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .RE yading@10: .RS 4 yading@10: .RE yading@10: .IP "\fB\-opencl_options options (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-opencl_options options (global)" yading@10: .PD yading@10: Set OpenCL environment options. This option is only available when yading@10: FFmpeg has been compiled with \f(CW\*(C`\-\-enable\-opencl\*(C'\fR. yading@10: .Sp yading@10: \&\fIoptions\fR must be a list of \fIkey\fR=\fIvalue\fR option pairs yading@10: separated by ':'. See the ``OpenCL Options'' section in the yading@10: ffmpeg-utils manual for the list of supported options. yading@10: .SS "AVOptions" yading@10: .IX Subsection "AVOptions" yading@10: These options are provided directly by the libavformat, libavdevice and yading@10: libavcodec libraries. To see the list of available AVOptions, use the yading@10: \&\fB\-help\fR option. They are separated into two categories: yading@10: .IP "\fBgeneric\fR" 4 yading@10: .IX Item "generic" yading@10: These options can be set for any container, codec or device. Generic options yading@10: are listed under AVFormatContext options for containers/devices and under yading@10: AVCodecContext options for codecs. yading@10: .IP "\fBprivate\fR" 4 yading@10: .IX Item "private" yading@10: These options are specific to the given container, device or codec. Private yading@10: options are listed under their corresponding containers/devices/codecs. yading@10: .PP yading@10: For example to write an ID3v2.3 header instead of a default ID3v2.4 to yading@10: an \s-1MP3\s0 file, use the \fBid3v2_version\fR private option of the \s-1MP3\s0 yading@10: muxer: yading@10: .PP yading@10: .Vb 1 yading@10: \& ffmpeg \-i input.flac \-id3v2_version 3 out.mp3 yading@10: .Ve yading@10: .PP yading@10: All codec AVOptions are obviously per-stream, so the chapter on stream yading@10: specifiers applies to them yading@10: .PP yading@10: Note \fB\-nooption\fR syntax cannot be used for boolean AVOptions, yading@10: use \fB\-option 0\fR/\fB\-option 1\fR. yading@10: .PP yading@10: Note2 old undocumented way of specifying per-stream AVOptions by prepending yading@10: v/a/s to the options name is now obsolete and will be removed soon. yading@10: .SS "Main options" yading@10: .IX Subsection "Main options" yading@10: .IP "\fB\-f\fR \fIfmt\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4 yading@10: .IX Item "-f fmt (input/output)" yading@10: Force input or output file format. The format is normally auto detected for input yading@10: files and guessed from the file extension for output files, so this option is not yading@10: needed in most cases. yading@10: .IP "\fB\-i\fR \fIfilename\fR \fB(\fR\fIinput\fR\fB)\fR" 4 yading@10: .IX Item "-i filename (input)" yading@10: input file name yading@10: .IP "\fB\-y (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-y (global)" yading@10: Overwrite output files without asking. yading@10: .IP "\fB\-n (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-n (global)" yading@10: Do not overwrite output files, and exit immediately if a specified yading@10: output file already exists. yading@10: .IP "\fB\-c[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-c[:stream_specifier] codec (input/output,per-stream)" yading@10: .PD 0 yading@10: .IP "\fB\-codec[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-codec[:stream_specifier] codec (input/output,per-stream)" yading@10: .PD yading@10: Select an encoder (when used before an output file) or a decoder (when used yading@10: before an input file) for one or more streams. \fIcodec\fR is the name of a yading@10: decoder/encoder or a special value \f(CW\*(C`copy\*(C'\fR (output only) to indicate that yading@10: the stream is not to be re-encoded. yading@10: .Sp yading@10: For example yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0 \-c:v libx264 \-c:a copy OUTPUT yading@10: .Ve yading@10: .Sp yading@10: encodes all video streams with libx264 and copies all audio streams. yading@10: .Sp yading@10: For each stream, the last matching \f(CW\*(C`c\*(C'\fR option is applied, so yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0 \-c copy \-c:v:1 libx264 \-c:a:137 libvorbis OUTPUT yading@10: .Ve yading@10: .Sp yading@10: will copy all the streams except the second video, which will be encoded with yading@10: libx264, and the 138th audio, which will be encoded with libvorbis. yading@10: .IP "\fB\-t\fR \fIduration\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-t duration (output)" yading@10: Stop writing the output after its duration reaches \fIduration\fR. yading@10: \&\fIduration\fR may be a number in seconds, or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form. yading@10: .Sp yading@10: \&\-to and \-t are mutually exclusive and \-t has priority. yading@10: .IP "\fB\-to\fR \fIposition\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-to position (output)" yading@10: Stop writing the output at \fIposition\fR. yading@10: \&\fIposition\fR may be a number in seconds, or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form. yading@10: .Sp yading@10: \&\-to and \-t are mutually exclusive and \-t has priority. yading@10: .IP "\fB\-fs\fR \fIlimit_size\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-fs limit_size (output)" yading@10: Set the file size limit, expressed in bytes. yading@10: .IP "\fB\-ss\fR \fIposition\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4 yading@10: .IX Item "-ss position (input/output)" yading@10: When used as an input option (before \f(CW\*(C`\-i\*(C'\fR), seeks in this input file to yading@10: \&\fIposition\fR. When used as an output option (before an output filename), yading@10: decodes but discards input until the timestamps reach \fIposition\fR. This is yading@10: slower, but more accurate. yading@10: .Sp yading@10: \&\fIposition\fR may be either in seconds or in \f(CW\*(C`hh:mm:ss[.xxx]\*(C'\fR form. yading@10: .IP "\fB\-itsoffset\fR \fIoffset\fR \fB(\fR\fIinput\fR\fB)\fR" 4 yading@10: .IX Item "-itsoffset offset (input)" yading@10: Set the input time offset in seconds. yading@10: \&\f(CW\*(C`[\-]hh:mm:ss[.xxx]\*(C'\fR syntax is also supported. yading@10: The offset is added to the timestamps of the input files. yading@10: Specifying a positive offset means that the corresponding yading@10: streams are delayed by \fIoffset\fR seconds. yading@10: .IP "\fB\-timestamp\fR \fItime\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-timestamp time (output)" yading@10: Set the recording timestamp in the container. yading@10: The syntax for \fItime\fR is: yading@10: .Sp yading@10: .Vb 1 yading@10: \& now|([(YYYY\-MM\-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...])|(HHMMSS[.m...]))[Z|z]) yading@10: .Ve yading@10: .Sp yading@10: If the value is \*(L"now\*(R" it takes the current time. yading@10: Time is local time unless 'Z' or 'z' is appended, in which case it is yading@10: interpreted as \s-1UTC\s0. yading@10: If the year-month-day part is not specified it takes the current yading@10: year-month-day. yading@10: .IP "\fB\-metadata[:metadata_specifier]\fR \fIkey\fR\fB=\fR\fIvalue\fR \fB(\fR\fIoutput,per\-metadata\fR\fB)\fR" 4 yading@10: .IX Item "-metadata[:metadata_specifier] key=value (output,per-metadata)" yading@10: Set a metadata key/value pair. yading@10: .Sp yading@10: An optional \fImetadata_specifier\fR may be given to set metadata yading@10: on streams or chapters. See \f(CW\*(C`\-map_metadata\*(C'\fR documentation for yading@10: details. yading@10: .Sp yading@10: This option overrides metadata set with \f(CW\*(C`\-map_metadata\*(C'\fR. It is yading@10: also possible to delete metadata by using an empty value. yading@10: .Sp yading@10: For example, for setting the title in the output file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i in.avi \-metadata title="my title" out.flv yading@10: .Ve yading@10: .Sp yading@10: To set the language of the first audio stream: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-metadata:s:a:1 language=eng OUTPUT yading@10: .Ve yading@10: .IP "\fB\-target\fR \fItype\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-target type (output)" yading@10: 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: \&\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: \&\f(CW\*(C`film\-\*(C'\fR to use the corresponding standard. All the format options yading@10: (bitrate, codecs, buffer sizes) are then set automatically. You can just type: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i myfile.avi \-target vcd /tmp/vcd.mpg yading@10: .Ve yading@10: .Sp yading@10: Nevertheless you can specify additional options as long as you know yading@10: they do not conflict with the standard, as in: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i myfile.avi \-target vcd \-bf 2 /tmp/vcd.mpg yading@10: .Ve yading@10: .IP "\fB\-dframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-dframes number (output)" yading@10: Set the number of data frames to record. This is an alias for \f(CW\*(C`\-frames:d\*(C'\fR. yading@10: .IP "\fB\-frames[:\fR\fIstream_specifier\fR\fB]\fR \fIframecount\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-frames[:stream_specifier] framecount (output,per-stream)" yading@10: Stop writing to the stream after \fIframecount\fR frames. yading@10: .IP "\fB\-q[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-q[:stream_specifier] q (output,per-stream)" yading@10: .PD 0 yading@10: .IP "\fB\-qscale[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-qscale[:stream_specifier] q (output,per-stream)" yading@10: .PD yading@10: Use fixed quality scale (\s-1VBR\s0). The meaning of \fIq\fR is yading@10: codec-dependent. yading@10: .IP "\fB\-filter[:\fR\fIstream_specifier\fR\fB]\fR \fIfiltergraph\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-filter[:stream_specifier] filtergraph (output,per-stream)" yading@10: Create the filtergraph specified by \fIfiltergraph\fR and use it to yading@10: filter the stream. yading@10: .Sp yading@10: \&\fIfiltergraph\fR is a description of the filtergraph to apply to yading@10: the stream, and must have a single input and a single output of the yading@10: same type of the stream. In the filtergraph, the input is associated yading@10: to the label \f(CW\*(C`in\*(C'\fR, and the output to the label \f(CW\*(C`out\*(C'\fR. See yading@10: the ffmpeg-filters manual for more information about the filtergraph yading@10: syntax. yading@10: .Sp yading@10: See the \-filter_complex option if you yading@10: want to create filtergraphs with multiple inputs and/or outputs. yading@10: .IP "\fB\-filter_script[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-filter_script[:stream_specifier] filename (output,per-stream)" yading@10: This option is similar to \fB\-filter\fR, the only difference is that its yading@10: argument is the name of the file from which a filtergraph description is to be yading@10: read. yading@10: .IP "\fB\-pre[:\fR\fIstream_specifier\fR\fB]\fR \fIpreset_name\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-pre[:stream_specifier] preset_name (output,per-stream)" yading@10: Specify the preset for matching stream(s). yading@10: .IP "\fB\-stats (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-stats (global)" yading@10: Print encoding progress/statistics. It is on by default, to explicitly yading@10: disable it you need to specify \f(CW\*(C`\-nostats\*(C'\fR. yading@10: .IP "\fB\-progress\fR \fIurl\fR \fB(\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-progress url (global)" yading@10: Send program-friendly progress information to \fIurl\fR. yading@10: .Sp yading@10: Progress information is written approximately every second and at the end of yading@10: the encoding process. It is made of "\fIkey\fR=\fIvalue\fR" lines. \fIkey\fR yading@10: consists of only alphanumeric characters. The last key of a sequence of yading@10: progress information is always \*(L"progress\*(R". yading@10: .IP "\fB\-stdin\fR" 4 yading@10: .IX Item "-stdin" yading@10: Enable interaction on standard input. On by default unless standard input is yading@10: used as an input. To explicitly disable interaction you need to specify yading@10: \&\f(CW\*(C`\-nostdin\*(C'\fR. yading@10: .Sp yading@10: Disabling interaction on standard input is useful, for example, if yading@10: ffmpeg is in the background process group. Roughly the same result can yading@10: be achieved with \f(CW\*(C`ffmpeg ... < /dev/null\*(C'\fR but it requires a yading@10: shell. yading@10: .IP "\fB\-debug_ts (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-debug_ts (global)" yading@10: Print timestamp information. It is off by default. This option is yading@10: mostly useful for testing and debugging purposes, and the output yading@10: format may change from one version to another, so it should not be yading@10: employed by portable scripts. yading@10: .Sp yading@10: See also the option \f(CW\*(C`\-fdebug ts\*(C'\fR. yading@10: .IP "\fB\-attach\fR \fIfilename\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-attach filename (output)" yading@10: Add an attachment to the output file. This is supported by a few formats yading@10: like Matroska for e.g. fonts used in rendering subtitles. Attachments yading@10: are implemented as a specific type of stream, so this option will add yading@10: a new stream to the file. It is then possible to use per-stream options yading@10: on this stream in the usual way. Attachment streams created with this yading@10: option will be created after all the other streams (i.e. those created yading@10: with \f(CW\*(C`\-map\*(C'\fR or automatic mappings). yading@10: .Sp yading@10: Note that for Matroska you also have to set the mimetype metadata tag: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-attach DejaVuSans.ttf \-metadata:s:2 mimetype=application/x\-truetype\-font out.mkv yading@10: .Ve yading@10: .Sp yading@10: (assuming that the attachment stream will be third in the output file). yading@10: .IP "\fB\-dump_attachment[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-dump_attachment[:stream_specifier] filename (input,per-stream)" yading@10: Extract the matching attachment stream into a file named \fIfilename\fR. If yading@10: \&\fIfilename\fR is empty, then the value of the \f(CW\*(C`filename\*(C'\fR metadata tag yading@10: will be used. yading@10: .Sp yading@10: E.g. to extract the first attachment to a file named 'out.ttf': yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-dump_attachment:t:0 out.ttf \-i INPUT yading@10: .Ve yading@10: .Sp yading@10: To extract all attachments to files determined by the \f(CW\*(C`filename\*(C'\fR tag: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-dump_attachment:t "" \-i INPUT yading@10: .Ve yading@10: .Sp yading@10: Technical note \*(-- attachments are implemented as codec extradata, so this yading@10: option can actually be used to extract extradata from any stream, not just yading@10: attachments. yading@10: .SS "Video Options" yading@10: .IX Subsection "Video Options" yading@10: .IP "\fB\-vframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-vframes number (output)" yading@10: Set the number of video frames to record. This is an alias for \f(CW\*(C`\-frames:v\*(C'\fR. yading@10: .IP "\fB\-r[:\fR\fIstream_specifier\fR\fB]\fR \fIfps\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-r[:stream_specifier] fps (input/output,per-stream)" yading@10: Set frame rate (Hz value, fraction or abbreviation). yading@10: .Sp yading@10: As an input option, ignore any timestamps stored in the file and instead yading@10: generate timestamps assuming constant frame rate \fIfps\fR. yading@10: .Sp yading@10: As an output option, duplicate or drop input frames to achieve constant output yading@10: frame rate \fIfps\fR. yading@10: .IP "\fB\-s[:\fR\fIstream_specifier\fR\fB]\fR \fIsize\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-s[:stream_specifier] size (input/output,per-stream)" yading@10: Set frame size. yading@10: .Sp yading@10: As an input option, this is a shortcut for the \fBvideo_size\fR private yading@10: option, recognized by some demuxers for which the frame size is either not yading@10: stored in the file or is configurable \*(-- e.g. raw video or video grabbers. yading@10: .Sp yading@10: As an output option, this inserts the \f(CW\*(C`scale\*(C'\fR video filter to the yading@10: \&\fIend\fR of the corresponding filtergraph. Please use the \f(CW\*(C`scale\*(C'\fR filter yading@10: directly to insert it at the beginning or some other place. yading@10: .Sp yading@10: The format is \fBwxh\fR (default \- same as source). yading@10: .IP "\fB\-aspect[:\fR\fIstream_specifier\fR\fB]\fR \fIaspect\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-aspect[:stream_specifier] aspect (output,per-stream)" yading@10: Set the video display aspect ratio specified by \fIaspect\fR. yading@10: .Sp yading@10: \&\fIaspect\fR can be a floating point number string, or a string of the yading@10: form \fInum\fR:\fIden\fR, where \fInum\fR and \fIden\fR are the yading@10: numerator and denominator of the aspect ratio. For example \*(L"4:3\*(R", yading@10: \&\*(L"16:9\*(R", \*(L"1.3333\*(R", and \*(L"1.7777\*(R" are valid argument values. yading@10: .Sp yading@10: If used together with \fB\-vcodec copy\fR, it will affect the aspect ratio yading@10: stored at container level, but not the aspect ratio stored in encoded yading@10: frames, if it exists. yading@10: .IP "\fB\-vn (\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-vn (output)" yading@10: Disable video recording. yading@10: .IP "\fB\-vcodec\fR \fIcodec\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-vcodec codec (output)" yading@10: Set the video codec. This is an alias for \f(CW\*(C`\-codec:v\*(C'\fR. yading@10: .IP "\fB\-pass[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-pass[:stream_specifier] n (output,per-stream)" yading@10: Select the pass number (1 or 2). It is used to do two-pass yading@10: video encoding. The statistics of the video are recorded in the first yading@10: pass into a log file (see also the option \-passlogfile), yading@10: and in the second pass that log file is used to generate the video yading@10: at the exact requested bitrate. yading@10: On pass 1, you may just deactivate audio and set output to null, yading@10: examples for Windows and Unix: yading@10: .Sp yading@10: .Vb 2 yading@10: \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y NUL yading@10: \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y /dev/null yading@10: .Ve yading@10: .IP "\fB\-passlogfile[:\fR\fIstream_specifier\fR\fB]\fR \fIprefix\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-passlogfile[:stream_specifier] prefix (output,per-stream)" yading@10: Set two-pass log file name prefix to \fIprefix\fR, the default file name yading@10: prefix is ``ffmpeg2pass''. The complete file name will be yading@10: \&\fI\s-1PREFIX\-N\s0.log\fR, where N is a number specific to the output yading@10: stream yading@10: .IP "\fB\-vlang\fR \fIcode\fR" 4 yading@10: .IX Item "-vlang code" yading@10: Set the \s-1ISO\s0 639 language code (3 letters) of the current video stream. yading@10: .IP "\fB\-vf\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-vf filtergraph (output)" yading@10: Create the filtergraph specified by \fIfiltergraph\fR and use it to yading@10: filter the stream. yading@10: .Sp yading@10: This is an alias for \f(CW\*(C`\-filter:v\*(C'\fR, see the \-filter option. yading@10: .SS "Advanced Video Options" yading@10: .IX Subsection "Advanced Video Options" yading@10: .IP "\fB\-pix_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIformat\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-pix_fmt[:stream_specifier] format (input/output,per-stream)" yading@10: Set pixel format. Use \f(CW\*(C`\-pix_fmts\*(C'\fR to show all the supported yading@10: pixel formats. yading@10: If the selected pixel format can not be selected, ffmpeg will print a yading@10: warning and select the best pixel format supported by the encoder. yading@10: If \fIpix_fmt\fR is prefixed by a \f(CW\*(C`+\*(C'\fR, ffmpeg will exit with an error yading@10: if the requested pixel format can not be selected, and automatic conversions yading@10: inside filtergraphs are disabled. yading@10: If \fIpix_fmt\fR is a single \f(CW\*(C`+\*(C'\fR, ffmpeg selects the same pixel format yading@10: as the input (or graph output) and automatic conversions are disabled. yading@10: .IP "\fB\-sws_flags\fR \fIflags\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4 yading@10: .IX Item "-sws_flags flags (input/output)" yading@10: Set SwScaler flags. yading@10: .IP "\fB\-vdt\fR \fIn\fR" 4 yading@10: .IX Item "-vdt n" yading@10: Discard threshold. yading@10: .IP "\fB\-rc_override[:\fR\fIstream_specifier\fR\fB]\fR \fIoverride\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-rc_override[:stream_specifier] override (output,per-stream)" yading@10: Rate control override for specific intervals, formatted as \*(L"int,int,int\*(R" yading@10: list separated with slashes. Two first values are the beginning and yading@10: end frame numbers, last one is quantizer to use if positive, or quality yading@10: factor if negative. yading@10: .IP "\fB\-deinterlace\fR" 4 yading@10: .IX Item "-deinterlace" yading@10: Deinterlace pictures. yading@10: This option is deprecated since the deinterlacing is very low quality. yading@10: Use the yadif filter with \f(CW\*(C`\-filter:v yadif\*(C'\fR. yading@10: .IP "\fB\-ilme\fR" 4 yading@10: .IX Item "-ilme" yading@10: Force interlacing support in encoder (\s-1MPEG\-2\s0 and \s-1MPEG\-4\s0 only). yading@10: Use this option if your input file is interlaced and you want yading@10: to keep the interlaced format for minimum losses. yading@10: The alternative is to deinterlace the input stream with yading@10: \&\fB\-deinterlace\fR, but deinterlacing introduces losses. yading@10: .IP "\fB\-psnr\fR" 4 yading@10: .IX Item "-psnr" yading@10: Calculate \s-1PSNR\s0 of compressed frames. yading@10: .IP "\fB\-vstats\fR" 4 yading@10: .IX Item "-vstats" yading@10: Dump video coding statistics to \fIvstats_HHMMSS.log\fR. yading@10: .IP "\fB\-vstats_file\fR \fIfile\fR" 4 yading@10: .IX Item "-vstats_file file" yading@10: Dump video coding statistics to \fIfile\fR. yading@10: .IP "\fB\-top[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-top[:stream_specifier] n (output,per-stream)" yading@10: top=1/bottom=0/auto=\-1 field first yading@10: .IP "\fB\-dc\fR \fIprecision\fR" 4 yading@10: .IX Item "-dc precision" yading@10: Intra_dc_precision. yading@10: .IP "\fB\-vtag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-vtag fourcc/tag (output)" yading@10: Force video tag/fourcc. This is an alias for \f(CW\*(C`\-tag:v\*(C'\fR. yading@10: .IP "\fB\-qphist (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-qphist (global)" yading@10: Show \s-1QP\s0 histogram yading@10: .IP "\fB\-vbsf\fR \fIbitstream_filter\fR" 4 yading@10: .IX Item "-vbsf bitstream_filter" yading@10: Deprecated see \-bsf yading@10: .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: .IX Item "-force_key_frames[:stream_specifier] time[,time...] (output,per-stream)" yading@10: .PD 0 yading@10: .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: .IX Item "-force_key_frames[:stream_specifier] expr:expr (output,per-stream)" yading@10: .PD yading@10: Force key frames at the specified timestamps, more precisely at the first yading@10: frames after each specified time. yading@10: .Sp yading@10: If the argument is prefixed with \f(CW\*(C`expr:\*(C'\fR, the string \fIexpr\fR yading@10: is interpreted like an expression and is evaluated for each frame. A yading@10: key frame is forced in case the evaluation is non-zero. yading@10: .Sp yading@10: If one of the times is "\f(CW\*(C`chapters\*(C'\fR[\fIdelta\fR]", it is expanded into yading@10: the time of the beginning of all chapters in the file, shifted by yading@10: \&\fIdelta\fR, expressed as a time in seconds. yading@10: This option can be useful to ensure that a seek point is present at a yading@10: chapter mark or any other designated place in the output file. yading@10: .Sp yading@10: For example, to insert a key frame at 5 minutes, plus key frames 0.1 second yading@10: before the beginning of every chapter: yading@10: .Sp yading@10: .Vb 1 yading@10: \& \-force_key_frames 0:05:00,chapters\-0.1 yading@10: .Ve yading@10: .Sp yading@10: The expression in \fIexpr\fR can contain the following constants: yading@10: .RS 4 yading@10: .IP "\fBn\fR" 4 yading@10: .IX Item "n" yading@10: the number of current processed frame, starting from 0 yading@10: .IP "\fBn_forced\fR" 4 yading@10: .IX Item "n_forced" yading@10: the number of forced frames yading@10: .IP "\fBprev_forced_n\fR" 4 yading@10: .IX Item "prev_forced_n" yading@10: the number of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no yading@10: keyframe was forced yet yading@10: .IP "\fBprev_forced_t\fR" 4 yading@10: .IX Item "prev_forced_t" yading@10: the time of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no yading@10: keyframe was forced yet yading@10: .IP "\fBt\fR" 4 yading@10: .IX Item "t" yading@10: the time of the current processed frame yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: For example to force a key frame every 5 seconds, you can specify: yading@10: .Sp yading@10: .Vb 1 yading@10: \& \-force_key_frames expr:gte(t,n_forced*5) yading@10: .Ve yading@10: .Sp yading@10: To force a key frame 5 seconds after the time of the last forced one, yading@10: starting from second 13: yading@10: .Sp yading@10: .Vb 1 yading@10: \& \-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5)) yading@10: .Ve yading@10: .Sp yading@10: Note that forcing too many keyframes is very harmful for the lookahead yading@10: algorithms of certain encoders: using fixed-GOP options or similar yading@10: would be more efficient. yading@10: .RE yading@10: .IP "\fB\-copyinkf[:\fR\fIstream_specifier\fR\fB] (\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-copyinkf[:stream_specifier] (output,per-stream)" yading@10: When doing stream copy, copy also non-key frames found at the yading@10: beginning. yading@10: .SS "Audio Options" yading@10: .IX Subsection "Audio Options" yading@10: .IP "\fB\-aframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-aframes number (output)" yading@10: Set the number of audio frames to record. This is an alias for \f(CW\*(C`\-frames:a\*(C'\fR. yading@10: .IP "\fB\-ar[:\fR\fIstream_specifier\fR\fB]\fR \fIfreq\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-ar[:stream_specifier] freq (input/output,per-stream)" yading@10: Set the audio sampling frequency. For output streams it is set by yading@10: default to the frequency of the corresponding input stream. For input yading@10: streams this option only makes sense for audio grabbing devices and raw yading@10: demuxers and is mapped to the corresponding demuxer options. yading@10: .IP "\fB\-aq\fR \fIq\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-aq q (output)" yading@10: Set the audio quality (codec-specific, \s-1VBR\s0). This is an alias for \-q:a. yading@10: .IP "\fB\-ac[:\fR\fIstream_specifier\fR\fB]\fR \fIchannels\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-ac[:stream_specifier] channels (input/output,per-stream)" yading@10: Set the number of audio channels. For output streams it is set by yading@10: default to the number of input audio channels. For input streams yading@10: this option only makes sense for audio grabbing devices and raw demuxers yading@10: and is mapped to the corresponding demuxer options. yading@10: .IP "\fB\-an (\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-an (output)" yading@10: Disable audio recording. yading@10: .IP "\fB\-acodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4 yading@10: .IX Item "-acodec codec (input/output)" yading@10: Set the audio codec. This is an alias for \f(CW\*(C`\-codec:a\*(C'\fR. yading@10: .IP "\fB\-sample_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIsample_fmt\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-sample_fmt[:stream_specifier] sample_fmt (output,per-stream)" yading@10: Set the audio sample format. Use \f(CW\*(C`\-sample_fmts\*(C'\fR to get a list yading@10: of supported sample formats. yading@10: .IP "\fB\-af\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-af filtergraph (output)" yading@10: Create the filtergraph specified by \fIfiltergraph\fR and use it to yading@10: filter the stream. yading@10: .Sp yading@10: This is an alias for \f(CW\*(C`\-filter:a\*(C'\fR, see the \-filter option. yading@10: .SS "Advanced Audio options:" yading@10: .IX Subsection "Advanced Audio options:" yading@10: .IP "\fB\-atag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-atag fourcc/tag (output)" yading@10: Force audio tag/fourcc. This is an alias for \f(CW\*(C`\-tag:a\*(C'\fR. yading@10: .IP "\fB\-absf\fR \fIbitstream_filter\fR" 4 yading@10: .IX Item "-absf bitstream_filter" yading@10: Deprecated, see \-bsf yading@10: .IP "\fB\-guess_layout_max\fR \fIchannels\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-guess_layout_max channels (input,per-stream)" yading@10: If some input channel layout is not known, try to guess only if it yading@10: corresponds to at most the specified number of channels. For example, 2 yading@10: tells to \fBffmpeg\fR to recognize 1 channel as mono and 2 channels as yading@10: stereo but not 6 channels as 5.1. The default is to always try to guess. Use yading@10: 0 to disable all guessing. yading@10: .SS "Subtitle options:" yading@10: .IX Subsection "Subtitle options:" yading@10: .IP "\fB\-slang\fR \fIcode\fR" 4 yading@10: .IX Item "-slang code" yading@10: Set the \s-1ISO\s0 639 language code (3 letters) of the current subtitle stream. yading@10: .IP "\fB\-scodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4 yading@10: .IX Item "-scodec codec (input/output)" yading@10: Set the subtitle codec. This is an alias for \f(CW\*(C`\-codec:s\*(C'\fR. yading@10: .IP "\fB\-sn (\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-sn (output)" yading@10: Disable subtitle recording. yading@10: .IP "\fB\-sbsf\fR \fIbitstream_filter\fR" 4 yading@10: .IX Item "-sbsf bitstream_filter" yading@10: Deprecated, see \-bsf yading@10: .SS "Advanced Subtitle options:" yading@10: .IX Subsection "Advanced Subtitle options:" yading@10: .IP "\fB\-fix_sub_duration\fR" 4 yading@10: .IX Item "-fix_sub_duration" yading@10: Fix subtitles durations. For each subtitle, wait for the next packet in the yading@10: same stream and adjust the duration of the first to avoid overlap. This is yading@10: necessary with some subtitles codecs, especially \s-1DVB\s0 subtitles, because the yading@10: duration in the original packet is only a rough estimate and the end is yading@10: actually marked by an empty subtitle frame. Failing to use this option when yading@10: necessary can result in exaggerated durations or muxing failures due to yading@10: non-monotonic timestamps. yading@10: .Sp yading@10: Note that this option will delay the output of all data until the next yading@10: subtitle packet is decoded: it may increase memory consumption and latency a yading@10: lot. yading@10: .IP "\fB\-canvas_size\fR \fIsize\fR" 4 yading@10: .IX Item "-canvas_size size" yading@10: Set the size of the canvas used to render subtitles. yading@10: .SS "Advanced options" yading@10: .IX Subsection "Advanced options" yading@10: .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: .IX Item "-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] | [linklabel] (output)" yading@10: Designate one or more input streams as a source for the output file. Each input yading@10: stream is identified by the input file index \fIinput_file_id\fR and yading@10: the input stream index \fIinput_stream_id\fR within the input yading@10: file. Both indices start at 0. If specified, yading@10: \&\fIsync_file_id\fR:\fIstream_specifier\fR sets which input stream yading@10: is used as a presentation sync reference. yading@10: .Sp yading@10: The first \f(CW\*(C`\-map\*(C'\fR option on the command line specifies the yading@10: source for output stream 0, the second \f(CW\*(C`\-map\*(C'\fR option specifies yading@10: the source for output stream 1, etc. yading@10: .Sp yading@10: A \f(CW\*(C`\-\*(C'\fR character before the stream identifier creates a \*(L"negative\*(R" mapping. yading@10: It disables matching streams from already created mappings. yading@10: .Sp yading@10: An alternative \fI[linklabel]\fR form will map outputs from complex filter yading@10: graphs (see the \fB\-filter_complex\fR option) to the output file. yading@10: \&\fIlinklabel\fR must correspond to a defined output link label in the graph. yading@10: .Sp yading@10: For example, to map \s-1ALL\s0 streams from the first input file to output yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0 output yading@10: .Ve yading@10: .Sp yading@10: For example, if you have two audio streams in the first input file, yading@10: these streams are identified by \*(L"0:0\*(R" and \*(L"0:1\*(R". You can use yading@10: \&\f(CW\*(C`\-map\*(C'\fR to select which streams to place in an output file. For yading@10: example: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0:1 out.wav yading@10: .Ve yading@10: .Sp yading@10: will map the input stream in \fI\s-1INPUT\s0\fR identified by \*(L"0:1\*(R" to yading@10: the (single) output stream in \fIout.wav\fR. yading@10: .Sp yading@10: For example, to select the stream with index 2 from input file yading@10: \&\fIa.mov\fR (specified by the identifier \*(L"0:2\*(R"), and stream with yading@10: index 6 from input \fIb.mov\fR (specified by the identifier \*(L"1:6\*(R"), yading@10: and copy them to the output file \fIout.mov\fR: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i a.mov \-i b.mov \-c copy \-map 0:2 \-map 1:6 out.mov yading@10: .Ve yading@10: .Sp yading@10: To select all video and the third audio stream from an input file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0:v \-map 0:a:2 OUTPUT yading@10: .Ve yading@10: .Sp yading@10: To map all the streams except the second audio, use negative mappings yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map 0 \-map \-0:a:1 OUTPUT yading@10: .Ve yading@10: .Sp yading@10: Note that using this option disables the default mappings for this output file. yading@10: .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: .IX Item "-map_channel [input_file_id.stream_specifier.channel_id|-1][:output_file_id.stream_specifier]" yading@10: Map an audio channel from a given input to an output. If yading@10: \&\fIoutput_file_id\fR.\fIstream_specifier\fR is not set, the audio channel will yading@10: be mapped on all the audio streams. yading@10: .Sp yading@10: Using \*(L"\-1\*(R" instead of yading@10: \&\fIinput_file_id\fR.\fIstream_specifier\fR.\fIchannel_id\fR will map a muted yading@10: channel. yading@10: .Sp yading@10: For example, assuming \fI\s-1INPUT\s0\fR is a stereo audio file, you can switch the yading@10: two audio channels with the following command: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map_channel 0.0.1 \-map_channel 0.0.0 OUTPUT yading@10: .Ve yading@10: .Sp yading@10: If you want to mute the first channel and keep the second: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map_channel \-1 \-map_channel 0.0.1 OUTPUT yading@10: .Ve yading@10: .Sp yading@10: The order of the \*(L"\-map_channel\*(R" option specifies the order of the channels in yading@10: the output stream. The output channel layout is guessed from the number of yading@10: channels mapped (mono if one \*(L"\-map_channel\*(R", stereo if two, etc.). Using \*(L"\-ac\*(R" yading@10: in combination of \*(L"\-map_channel\*(R" makes the channel gain levels to be updated if yading@10: input and output channel layouts don't match (for instance two \*(L"\-map_channel\*(R" yading@10: options and \*(L"\-ac 6\*(R"). yading@10: .Sp yading@10: You can also extract each channel of an input to specific outputs; the following yading@10: command extracts two channels of the \fI\s-1INPUT\s0\fR audio stream (file 0, stream 0) yading@10: to the respective \fI\s-1OUTPUT_CH0\s0\fR and \fI\s-1OUTPUT_CH1\s0\fR outputs: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i INPUT \-map_channel 0.0.0 OUTPUT_CH0 \-map_channel 0.0.1 OUTPUT_CH1 yading@10: .Ve yading@10: .Sp yading@10: The following example splits the channels of a stereo input into two separate yading@10: streams, which are put into the same output file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& 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: .Ve yading@10: .Sp yading@10: Note that currently each output stream can only contain channels from a single yading@10: input stream; you can't for example use \*(L"\-map_channel\*(R" to pick multiple input yading@10: audio channels contained in different streams (from the same or different files) yading@10: and merge them into a single output stream. It is therefore not currently yading@10: possible, for example, to turn two separate mono streams into a single stereo yading@10: stream. However splitting a stereo stream into two single channel mono streams yading@10: is possible. yading@10: .Sp yading@10: If you need this feature, a possible workaround is to use the \fIamerge\fR yading@10: filter. For example, if you need to merge a media (here \fIinput.mkv\fR) with 2 yading@10: mono audio streams into one single stereo channel audio stream (and keep the yading@10: video stream), you can use the following command: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i input.mkv \-filter_complex "[0:1] [0:2] amerge" \-c:a pcm_s16le \-c:v copy output.mkv yading@10: .Ve yading@10: .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: .IX Item "-map_metadata[:metadata_spec_out] infile[:metadata_spec_in] (output,per-metadata)" yading@10: Set metadata information of the next output file from \fIinfile\fR. Note that yading@10: those are file indices (zero-based), not filenames. yading@10: Optional \fImetadata_spec_in/out\fR parameters specify, which metadata to copy. yading@10: A metadata specifier can have the following forms: yading@10: .RS 4 yading@10: .IP "\fIg\fR" 4 yading@10: .IX Item "g" yading@10: global metadata, i.e. metadata that applies to the whole file yading@10: .IP "\fIs\fR\fB[:\fR\fIstream_spec\fR\fB]\fR" 4 yading@10: .IX Item "s[:stream_spec]" yading@10: per-stream metadata. \fIstream_spec\fR is a stream specifier as described yading@10: in the Stream specifiers chapter. In an input metadata specifier, the first yading@10: matching stream is copied from. In an output metadata specifier, all matching yading@10: streams are copied to. yading@10: .IP "\fIc\fR\fB:\fR\fIchapter_index\fR" 4 yading@10: .IX Item "c:chapter_index" yading@10: per-chapter metadata. \fIchapter_index\fR is the zero-based chapter index. yading@10: .IP "\fIp\fR\fB:\fR\fIprogram_index\fR" 4 yading@10: .IX Item "p:program_index" yading@10: per-program metadata. \fIprogram_index\fR is the zero-based program index. yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: If metadata specifier is omitted, it defaults to global. yading@10: .Sp yading@10: By default, global metadata is copied from the first input file, yading@10: per-stream and per-chapter metadata is copied along with streams/chapters. These yading@10: default mappings are disabled by creating any mapping of the relevant type. A negative yading@10: file index can be used to create a dummy mapping that just disables automatic copying. yading@10: .Sp yading@10: For example to copy metadata from the first stream of the input file to global metadata yading@10: of the output file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i in.ogg \-map_metadata 0:s:0 out.mp3 yading@10: .Ve yading@10: .Sp yading@10: To do the reverse, i.e. copy global metadata to all audio streams: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i in.mkv \-map_metadata:s:a 0:g out.mkv yading@10: .Ve yading@10: .Sp yading@10: Note that simple \f(CW0\fR would work as well in this example, since global yading@10: metadata is assumed by default. yading@10: .RE yading@10: .IP "\fB\-map_chapters\fR \fIinput_file_index\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-map_chapters input_file_index (output)" yading@10: Copy chapters from input file with index \fIinput_file_index\fR to the next yading@10: output file. If no chapter mapping is specified, then chapters are copied from yading@10: the first input file with at least one chapter. Use a negative file index to yading@10: disable any chapter copying. yading@10: .IP "\fB\-benchmark (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-benchmark (global)" yading@10: Show benchmarking information at the end of an encode. yading@10: Shows \s-1CPU\s0 time used and maximum memory consumption. yading@10: Maximum memory consumption is not supported on all systems, yading@10: it will usually display as 0 if not supported. yading@10: .IP "\fB\-benchmark_all (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-benchmark_all (global)" yading@10: Show benchmarking information during the encode. yading@10: Shows \s-1CPU\s0 time used in various steps (audio/video encode/decode). yading@10: .IP "\fB\-timelimit\fR \fIduration\fR \fB(\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-timelimit duration (global)" yading@10: Exit after ffmpeg has been running for \fIduration\fR seconds. yading@10: .IP "\fB\-dump (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-dump (global)" yading@10: Dump each input packet to stderr. yading@10: .IP "\fB\-hex (\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-hex (global)" yading@10: When dumping packets, also dump the payload. yading@10: .IP "\fB\-re (\fR\fIinput\fR\fB)\fR" 4 yading@10: .IX Item "-re (input)" yading@10: Read input at native frame rate. Mainly used to simulate a grab device. yading@10: By default \fBffmpeg\fR attempts to read the input(s) as fast as possible. yading@10: This option will slow down the reading of the input(s) to the native frame rate yading@10: of the input(s). It is useful for real-time output (e.g. live streaming). If yading@10: your input(s) is coming from some other live streaming source (through \s-1HTTP\s0 or yading@10: \&\s-1UDP\s0 for example) the server might already be in real-time, thus the option will yading@10: likely not be required. On the other hand, this is meaningful if your input(s) yading@10: is a file you are trying to push in real-time. yading@10: .IP "\fB\-loop_input\fR" 4 yading@10: .IX Item "-loop_input" yading@10: Loop over the input stream. Currently it works only for image yading@10: streams. This option is used for automatic FFserver testing. yading@10: This option is deprecated, use \-loop 1. yading@10: .IP "\fB\-loop_output\fR \fInumber_of_times\fR" 4 yading@10: .IX Item "-loop_output number_of_times" yading@10: Repeatedly loop output for formats that support looping such as animated \s-1GIF\s0 yading@10: (0 will loop the output infinitely). yading@10: This option is deprecated, use \-loop. yading@10: .IP "\fB\-vsync\fR \fIparameter\fR" 4 yading@10: .IX Item "-vsync parameter" yading@10: Video sync method. yading@10: For compatibility reasons old values can be specified as numbers. yading@10: Newly added values will have to be specified as strings always. yading@10: .RS 4 yading@10: .IP "\fB0, passthrough\fR" 4 yading@10: .IX Item "0, passthrough" yading@10: Each frame is passed with its timestamp from the demuxer to the muxer. yading@10: .IP "\fB1, cfr\fR" 4 yading@10: .IX Item "1, cfr" yading@10: Frames will be duplicated and dropped to achieve exactly the requested yading@10: constant frame rate. yading@10: .IP "\fB2, vfr\fR" 4 yading@10: .IX Item "2, vfr" yading@10: Frames are passed through with their timestamp or dropped so as to yading@10: prevent 2 frames from having the same timestamp. yading@10: .IP "\fBdrop\fR" 4 yading@10: .IX Item "drop" yading@10: As passthrough but destroys all timestamps, making the muxer generate yading@10: fresh timestamps based on frame-rate. yading@10: .IP "\fB\-1, auto\fR" 4 yading@10: .IX Item "-1, auto" yading@10: Chooses between 1 and 2 depending on muxer capabilities. This is the yading@10: default method. yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: Note that the timestamps may be further modified by the muxer, after this. yading@10: For example, in the case that the format option \fBavoid_negative_ts\fR yading@10: is enabled. yading@10: .Sp yading@10: With \-map you can select from which stream the timestamps should be yading@10: taken. You can leave either video or audio unchanged and sync the yading@10: remaining stream(s) to the unchanged one. yading@10: .RE yading@10: .IP "\fB\-async\fR \fIsamples_per_second\fR" 4 yading@10: .IX Item "-async samples_per_second" yading@10: Audio sync method. \*(L"Stretches/squeezes\*(R" the audio stream to match the timestamps, yading@10: the parameter is the maximum samples per second by which the audio is changed. yading@10: \&\-async 1 is a special case where only the start of the audio stream is corrected yading@10: without any later correction. yading@10: .Sp yading@10: Note that the timestamps may be further modified by the muxer, after this. yading@10: For example, in the case that the format option \fBavoid_negative_ts\fR yading@10: is enabled. yading@10: .Sp yading@10: This option has been deprecated. Use the \f(CW\*(C`aresample\*(C'\fR audio filter instead. yading@10: .IP "\fB\-copyts\fR" 4 yading@10: .IX Item "-copyts" yading@10: Do not process input timestamps, but keep their values without trying yading@10: to sanitize them. In particular, do not remove the initial start time yading@10: offset value. yading@10: .Sp yading@10: Note that, depending on the \fBvsync\fR option or on specific muxer yading@10: processing (e.g. in case the format option \fBavoid_negative_ts\fR yading@10: is enabled) the output timestamps may mismatch with the input yading@10: timestamps even when this option is selected. yading@10: .IP "\fB\-copytb\fR \fImode\fR" 4 yading@10: .IX Item "-copytb mode" yading@10: Specify how to set the encoder timebase when stream copying. \fImode\fR is an yading@10: integer numeric value, and can assume one of the following values: yading@10: .RS 4 yading@10: .IP "\fB1\fR" 4 yading@10: .IX Item "1" yading@10: Use the demuxer timebase. yading@10: .Sp yading@10: The time base is copied to the output encoder from the corresponding input yading@10: demuxer. This is sometimes required to avoid non monotonically increasing yading@10: timestamps when copying video streams with variable frame rate. yading@10: .IP "\fB0\fR" 4 yading@10: .IX Item "0" yading@10: Use the decoder timebase. yading@10: .Sp yading@10: The time base is copied to the output encoder from the corresponding input yading@10: decoder. yading@10: .IP "\fB\-1\fR" 4 yading@10: .IX Item "-1" yading@10: Try to make the choice automatically, in order to generate a sane output. yading@10: .RE yading@10: .RS 4 yading@10: .Sp yading@10: Default value is \-1. yading@10: .RE yading@10: .IP "\fB\-shortest (\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-shortest (output)" yading@10: Finish encoding when the shortest input stream ends. yading@10: .IP "\fB\-dts_delta_threshold\fR" 4 yading@10: .IX Item "-dts_delta_threshold" yading@10: Timestamp discontinuity delta threshold. yading@10: .IP "\fB\-muxdelay\fR \fIseconds\fR \fB(\fR\fIinput\fR\fB)\fR" 4 yading@10: .IX Item "-muxdelay seconds (input)" yading@10: Set the maximum demux-decode delay. yading@10: .IP "\fB\-muxpreload\fR \fIseconds\fR \fB(\fR\fIinput\fR\fB)\fR" 4 yading@10: .IX Item "-muxpreload seconds (input)" yading@10: Set the initial demux-decode delay. yading@10: .IP "\fB\-streamid\fR \fIoutput-stream-index\fR\fB:\fR\fInew-value\fR \fB(\fR\fIoutput\fR\fB)\fR" 4 yading@10: .IX Item "-streamid output-stream-index:new-value (output)" yading@10: Assign a new stream-id value to an output stream. This option should be yading@10: specified prior to the output filename to which it applies. yading@10: For the situation where multiple output files exist, a streamid yading@10: may be reassigned to a different value. yading@10: .Sp yading@10: For example, to set the stream 0 \s-1PID\s0 to 33 and the stream 1 \s-1PID\s0 to 36 for yading@10: an output mpegts file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i infile \-streamid 0:33 \-streamid 1:36 out.ts yading@10: .Ve yading@10: .IP "\fB\-bsf[:\fR\fIstream_specifier\fR\fB]\fR \fIbitstream_filters\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4 yading@10: .IX Item "-bsf[:stream_specifier] bitstream_filters (output,per-stream)" yading@10: Set bitstream filters for matching streams. \fIbitstream_filters\fR is yading@10: a comma-separated list of bitstream filters. Use the \f(CW\*(C`\-bsfs\*(C'\fR option yading@10: to get the list of bitstream filters. yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i h264.mp4 \-c:v copy \-bsf:v h264_mp4toannexb \-an out.h264 yading@10: \& yading@10: \& yading@10: \& ffmpeg \-i file.mov \-an \-vn \-bsf:s mov2textsub \-c:s copy \-f rawvideo sub.txt yading@10: .Ve yading@10: .IP "\fB\-tag[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec_tag\fR \fB(\fR\fIper-stream\fR\fB)\fR" 4 yading@10: .IX Item "-tag[:stream_specifier] codec_tag (per-stream)" yading@10: Force a tag/fourcc for matching streams. yading@10: .IP "\fB\-timecode\fR \fIhh\fR\fB:\fR\fImm\fR\fB:\fR\fIss\fR\fB\s-1SEP\s0\fR\fIff\fR" 4 yading@10: .IX Item "-timecode hh:mm:ssSEPff" yading@10: Specify Timecode for writing. \fI\s-1SEP\s0\fR is ':' for non drop timecode and ';' yading@10: (or '.') for drop. yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i input.mpg \-timecode 01:02:03.04 \-r 30000/1001 \-s ntsc output.mpg yading@10: .Ve yading@10: .IP "\fB\-filter_complex\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-filter_complex filtergraph (global)" yading@10: Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or yading@10: outputs. For simple graphs \*(-- those with one input and one output of the same yading@10: type \*(-- see the \fB\-filter\fR options. \fIfiltergraph\fR is a description of yading@10: the filtergraph, as described in the ``Filtergraph syntax'' section of the yading@10: ffmpeg-filters manual. yading@10: .Sp yading@10: Input link labels must refer to input streams using the yading@10: \&\f(CW\*(C`[file_index:stream_specifier]\*(C'\fR syntax (i.e. the same as \fB\-map\fR yading@10: uses). If \fIstream_specifier\fR matches multiple streams, the first one will be yading@10: used. An unlabeled input will be connected to the first unused input stream of yading@10: the matching type. yading@10: .Sp yading@10: Output link labels are referred to with \fB\-map\fR. Unlabeled outputs are yading@10: added to the first output file. yading@10: .Sp yading@10: Note that with this option it is possible to use only lavfi sources without yading@10: normal input files. yading@10: .Sp yading@10: For example, to overlay an image over video yading@10: .Sp yading@10: .Vb 2 yading@10: \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aq[0:v][1:v]overlay[out]\*(Aq \-map yading@10: \& \*(Aq[out]\*(Aq out.mkv yading@10: .Ve yading@10: .Sp yading@10: Here \f(CW\*(C`[0:v]\*(C'\fR refers to the first video stream in the first input file, yading@10: which is linked to the first (main) input of the overlay filter. Similarly the yading@10: first video stream in the second input is linked to the second (overlay) input yading@10: of overlay. yading@10: .Sp yading@10: Assuming there is only one video stream in each input file, we can omit input yading@10: labels, so the above is equivalent to yading@10: .Sp yading@10: .Vb 2 yading@10: \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay[out]\*(Aq \-map yading@10: \& \*(Aq[out]\*(Aq out.mkv yading@10: .Ve yading@10: .Sp yading@10: Furthermore we can omit the output label and the single output from the filter yading@10: graph will be added to the output file automatically, so we can simply write yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay\*(Aq out.mkv yading@10: .Ve yading@10: .Sp yading@10: To generate 5 seconds of pure red video using lavfi \f(CW\*(C`color\*(C'\fR source: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-filter_complex \*(Aqcolor=c=red\*(Aq \-t 5 out.mkv yading@10: .Ve yading@10: .IP "\fB\-lavfi\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-lavfi filtergraph (global)" yading@10: Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or yading@10: outputs. Equivalent to \fB\-filter_complex\fR. yading@10: .IP "\fB\-filter_complex_script\fR \fIfilename\fR \fB(\fR\fIglobal\fR\fB)\fR" 4 yading@10: .IX Item "-filter_complex_script filename (global)" yading@10: This option is similar to \fB\-filter_complex\fR, the only difference is that yading@10: its argument is the name of the file from which a complex filtergraph yading@10: description is to be read. yading@10: .PP yading@10: As a special exception, you can use a bitmap subtitle stream as input: it yading@10: will be converted into a video with the same size as the largest video in yading@10: the file, or 720x576 if no video is present. Note that this is an yading@10: experimental and temporary solution. It will be removed once libavfilter has yading@10: proper support for subtitles. yading@10: .PP yading@10: For example, to hardcode subtitles on top of a DVB-T recording stored in yading@10: MPEG-TS format, delaying the subtitles by 1 second: yading@10: .PP yading@10: .Vb 3 yading@10: \& ffmpeg \-i input.ts \-filter_complex \e yading@10: \& \*(Aq[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay\*(Aq \e yading@10: \& \-sn \-map \*(Aq#0x2dc\*(Aq output.mkv yading@10: .Ve yading@10: .PP yading@10: (0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the video, yading@10: audio and subtitles streams; 0:0, 0:3 and 0:7 would have worked too) yading@10: .SS "Preset files" yading@10: .IX Subsection "Preset files" yading@10: A preset file contains a sequence of \fIoption\fR=\fIvalue\fR pairs, yading@10: one for each line, specifying a sequence of options which would be yading@10: awkward to specify on the command line. Lines starting with the hash yading@10: ('#') character are ignored and are used to provide comments. Check yading@10: the \fIpresets\fR directory in the FFmpeg source tree for examples. yading@10: .PP yading@10: Preset files are specified with the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, yading@10: \&\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: filename of the preset instead of a preset name as input and can be yading@10: used for any kind of codec. For the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, and yading@10: \&\f(CW\*(C`spre\*(C'\fR options, the options specified in a preset file are yading@10: applied to the currently selected codec of the same type as the preset yading@10: option. yading@10: .PP yading@10: 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: preset options identifies the preset file to use according to the yading@10: following rules: yading@10: .PP yading@10: First ffmpeg searches for a file named \fIarg\fR.ffpreset in the yading@10: directories \fI\f(CI$FFMPEG_DATADIR\fI\fR (if set), and \fI\f(CI$HOME\fI/.ffmpeg\fR, and in yading@10: the datadir defined at configuration time (usually \fIPREFIX/share/ffmpeg\fR) yading@10: or in a \fIffpresets\fR folder along the executable on win32, yading@10: in that order. For example, if the argument is \f(CW\*(C`libvpx\-1080p\*(C'\fR, it will yading@10: search for the file \fIlibvpx\-1080p.ffpreset\fR. yading@10: .PP yading@10: If no such file is found, then ffmpeg will search for a file named yading@10: \&\fIcodec_name\fR\-\fIarg\fR.ffpreset in the above-mentioned yading@10: directories, where \fIcodec_name\fR is the name of the codec to which yading@10: the preset file options will be applied. For example, if you select yading@10: the video codec with \f(CW\*(C`\-vcodec libvpx\*(C'\fR and use \f(CW\*(C`\-vpre 1080p\*(C'\fR, yading@10: then it will search for the file \fIlibvpx\-1080p.ffpreset\fR. yading@10: .SH "TIPS" yading@10: .IX Header "TIPS" yading@10: .IP "\(bu" 4 yading@10: For streaming at very low bitrate application, use a low frame rate yading@10: and a small \s-1GOP\s0 size. This is especially true for RealVideo where yading@10: the Linux player does not seem to be very fast, so it can miss yading@10: frames. An example is: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-g 3 \-r 3 \-t 10 \-b:v 50k \-s qcif \-f rv10 /tmp/b.rm yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: The parameter 'q' which is displayed while encoding is the current yading@10: quantizer. The value 1 indicates that a very good quality could yading@10: be achieved. The value 31 indicates the worst quality. If q=31 appears yading@10: too often, it means that the encoder cannot compress enough to meet yading@10: your bitrate. You must either increase the bitrate, decrease the yading@10: frame rate or decrease the frame size. yading@10: .IP "\(bu" 4 yading@10: If your computer is not fast enough, you can speed up the yading@10: compression at the expense of the compression ratio. You can use yading@10: \&'\-me zero' to speed up motion estimation, and '\-g 0' to disable yading@10: motion estimation completely (you have only I\-frames, which means it yading@10: is about as good as \s-1JPEG\s0 compression). yading@10: .IP "\(bu" 4 yading@10: To have very low audio bitrates, reduce the sampling frequency yading@10: (down to 22050 Hz for \s-1MPEG\s0 audio, 22050 or 11025 for \s-1AC\-3\s0). yading@10: .IP "\(bu" 4 yading@10: To have a constant quality (but a variable bitrate), use the option yading@10: \&'\-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst yading@10: quality). yading@10: .SH "EXAMPLES" yading@10: .IX Header "EXAMPLES" yading@10: .SS "Preset files" yading@10: .IX Subsection "Preset files" yading@10: A preset file contains a sequence of \fIoption=value\fR pairs, one for yading@10: each line, specifying a sequence of options which can be specified also on yading@10: the command line. Lines starting with the hash ('#') character are ignored and yading@10: are used to provide comments. Empty lines are also ignored. Check the yading@10: \&\fIpresets\fR directory in the FFmpeg source tree for examples. yading@10: .PP yading@10: Preset files are specified with the \f(CW\*(C`pre\*(C'\fR option, this option takes a yading@10: preset name as input. FFmpeg searches for a file named \fIpreset_name\fR.avpreset in yading@10: the directories \fI\f(CI$AVCONV_DATADIR\fI\fR (if set), and \fI\f(CI$HOME\fI/.ffmpeg\fR, and in yading@10: the data directory defined at configuration time (usually \fI\f(CI$PREFIX\fI/share/ffmpeg\fR) yading@10: in that order. For example, if the argument is \f(CW\*(C`libx264\-max\*(C'\fR, it will yading@10: search for the file \fIlibx264\-max.avpreset\fR. yading@10: .SS "Video and Audio grabbing" yading@10: .IX Subsection "Video and Audio grabbing" yading@10: If you specify the input format and device then ffmpeg can grab video yading@10: and audio directly. yading@10: .PP yading@10: .Vb 1 yading@10: \& ffmpeg \-f oss \-i /dev/dsp \-f video4linux2 \-i /dev/video0 /tmp/out.mpg yading@10: .Ve yading@10: .PP yading@10: Or with an \s-1ALSA\s0 audio source (mono input, card id 1) instead of \s-1OSS:\s0 yading@10: .PP yading@10: .Vb 1 yading@10: \& ffmpeg \-f alsa \-ac 1 \-i hw:1 \-f video4linux2 \-i /dev/video0 /tmp/out.mpg yading@10: .Ve yading@10: .PP yading@10: Note that you must activate the right video source and channel before yading@10: launching ffmpeg with any \s-1TV\s0 viewer such as yading@10: <\fBhttp://linux.bytesex.org/xawtv/\fR> by Gerd Knorr. You also yading@10: have to set the audio recording levels correctly with a yading@10: standard mixer. yading@10: .SS "X11 grabbing" yading@10: .IX Subsection "X11 grabbing" yading@10: Grab the X11 display with ffmpeg via yading@10: .PP yading@10: .Vb 1 yading@10: \& ffmpeg \-f x11grab \-s cif \-r 25 \-i :0.0 /tmp/out.mpg yading@10: .Ve yading@10: .PP yading@10: 0.0 is display.screen number of your X11 server, same as yading@10: the \s-1DISPLAY\s0 environment variable. yading@10: .PP yading@10: .Vb 1 yading@10: \& ffmpeg \-f x11grab \-s cif \-r 25 \-i :0.0+10,20 /tmp/out.mpg yading@10: .Ve yading@10: .PP yading@10: 0.0 is display.screen number of your X11 server, same as the \s-1DISPLAY\s0 environment yading@10: variable. 10 is the x\-offset and 20 the y\-offset for the grabbing. yading@10: .SS "Video and Audio file format conversion" yading@10: .IX Subsection "Video and Audio file format conversion" yading@10: Any supported file format and protocol can serve as input to ffmpeg: yading@10: .PP yading@10: Examples: yading@10: .IP "\(bu" 4 yading@10: You can use \s-1YUV\s0 files as input: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i /tmp/test%d.Y /tmp/out.mpg yading@10: .Ve yading@10: .Sp yading@10: It will use the files: yading@10: .Sp yading@10: .Vb 2 yading@10: \& /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V, yading@10: \& /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc... yading@10: .Ve yading@10: .Sp yading@10: The Y files use twice the resolution of the U and V files. They are yading@10: raw files, without header. They can be generated by all decent video yading@10: decoders. You must specify the size of the image with the \fB\-s\fR option yading@10: if ffmpeg cannot guess it. yading@10: .IP "\(bu" 4 yading@10: You can input from a raw \s-1YUV420P\s0 file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i /tmp/test.yuv /tmp/out.avi yading@10: .Ve yading@10: .Sp yading@10: test.yuv is a file containing raw \s-1YUV\s0 planar data. Each frame is composed yading@10: of the Y plane followed by the U and V planes at half vertical and yading@10: horizontal resolution. yading@10: .IP "\(bu" 4 yading@10: You can output to a raw \s-1YUV420P\s0 file: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i mydivx.avi hugefile.yuv yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: You can set several input files and output files: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i /tmp/a.wav \-s 640x480 \-i /tmp/a.yuv /tmp/a.mpg yading@10: .Ve yading@10: .Sp yading@10: Converts the audio file a.wav and the raw \s-1YUV\s0 video file a.yuv yading@10: to \s-1MPEG\s0 file a.mpg. yading@10: .IP "\(bu" 4 yading@10: You can also do audio and video conversions at the same time: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i /tmp/a.wav \-ar 22050 /tmp/a.mp2 yading@10: .Ve yading@10: .Sp yading@10: Converts a.wav to \s-1MPEG\s0 audio at 22050 Hz sample rate. yading@10: .IP "\(bu" 4 yading@10: You can encode to several formats at the same time and define a yading@10: mapping from input stream to output streams: yading@10: .Sp yading@10: .Vb 1 yading@10: \& 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: .Ve yading@10: .Sp yading@10: Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '\-map yading@10: file:index' specifies which input stream is used for each output yading@10: stream, in the order of the definition of output streams. yading@10: .IP "\(bu" 4 yading@10: You can transcode decrypted VOBs: yading@10: .Sp yading@10: .Vb 1 yading@10: \& 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: .Ve yading@10: .Sp yading@10: This is a typical \s-1DVD\s0 ripping example; the input is a \s-1VOB\s0 file, the yading@10: output an \s-1AVI\s0 file with \s-1MPEG\-4\s0 video and \s-1MP3\s0 audio. Note that in this yading@10: command we use B\-frames so the \s-1MPEG\-4\s0 stream is DivX5 compatible, and yading@10: \&\s-1GOP\s0 size is 300 which means one intra frame every 10 seconds for 29.97fps yading@10: input video. Furthermore, the audio stream is MP3\-encoded so you need yading@10: to enable \s-1LAME\s0 support by passing \f(CW\*(C`\-\-enable\-libmp3lame\*(C'\fR to configure. yading@10: The mapping is particularly useful for \s-1DVD\s0 transcoding yading@10: to get the desired audio language. yading@10: .Sp yading@10: \&\s-1NOTE:\s0 To see the supported input formats, use \f(CW\*(C`ffmpeg \-formats\*(C'\fR. yading@10: .IP "\(bu" 4 yading@10: You can extract images from a video, or create a video from many images: yading@10: .Sp yading@10: For extracting images from a video: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i foo.avi \-r 1 \-s WxH \-f image2 foo\-%03d.jpeg yading@10: .Ve yading@10: .Sp yading@10: This will extract one video frame per second from the video and will yading@10: output them in files named \fIfoo\-001.jpeg\fR, \fIfoo\-002.jpeg\fR, yading@10: etc. Images will be rescaled to fit the new WxH values. yading@10: .Sp yading@10: If you want to extract just a limited number of frames, you can use the yading@10: above command in combination with the \-vframes or \-t option, or in yading@10: combination with \-ss to start extracting from a certain point in time. yading@10: .Sp yading@10: For creating a video from many images: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-f image2 \-i foo\-%03d.jpeg \-r 12 \-s WxH foo.avi yading@10: .Ve yading@10: .Sp yading@10: The syntax \f(CW\*(C`foo\-%03d.jpeg\*(C'\fR specifies to use a decimal number yading@10: composed of three digits padded with zeroes to express the sequence yading@10: number. It is the same syntax supported by the C printf function, but yading@10: only formats accepting a normal integer are suitable. yading@10: .Sp yading@10: When importing an image sequence, \-i also supports expanding yading@10: shell-like wildcard patterns (globbing) internally, by selecting the yading@10: image2\-specific \f(CW\*(C`\-pattern_type glob\*(C'\fR option. yading@10: .Sp yading@10: For example, for creating a video from filenames matching the glob pattern yading@10: \&\f(CW\*(C`foo\-*.jpeg\*(C'\fR: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-f image2 \-pattern_type glob \-i \*(Aqfoo\-*.jpeg\*(Aq \-r 12 \-s WxH foo.avi yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: You can put many streams of the same type in the output: yading@10: .Sp yading@10: .Vb 1 yading@10: \& 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: .Ve yading@10: .Sp yading@10: The resulting output file \fItest12.avi\fR will contain first four streams from yading@10: the input file in reverse order. yading@10: .IP "\(bu" 4 yading@10: To force \s-1CBR\s0 video output: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i myfile.avi \-b 4000k \-minrate 4000k \-maxrate 4000k \-bufsize 1835k out.m2v yading@10: .Ve yading@10: .IP "\(bu" 4 yading@10: The four options lmin, lmax, mblmin and mblmax use 'lambda' units, yading@10: but you may use the \s-1QP2LAMBDA\s0 constant to easily convert from 'q' units: yading@10: .Sp yading@10: .Vb 1 yading@10: \& ffmpeg \-i src.ext \-lmax 21*QP2LAMBDA dst.ext yading@10: .Ve yading@10: .SH "SEE ALSO" yading@10: .IX Header "SEE ALSO" yading@10: \&\fIffmpeg\-all\fR\|(1), yading@10: \&\fIffplay\fR\|(1), \fIffprobe\fR\|(1), \fIffserver\fR\|(1), yading@10: \&\fIffmpeg\-utils\fR\|(1), \fIffmpeg\-scaler\fR\|(1), \fIffmpeg\-resampler\fR\|(1), yading@10: \&\fIffmpeg\-codecs\fR\|(1), \fIffmpeg\-bitstream\-filters\fR\|(1), \fIffmpeg\-formats\fR\|(1), yading@10: \&\fIffmpeg\-devices\fR\|(1), \fIffmpeg\-protocols\fR\|(1), \fIffmpeg\-filters\fR\|(1) yading@10: .SH "AUTHORS" yading@10: .IX Header "AUTHORS" yading@10: The FFmpeg developers. yading@10: .PP yading@10: For details about the authorship, see the Git history of the project yading@10: (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command yading@10: \&\fBgit log\fR in the FFmpeg source directory, or browsing the yading@10: online repository at <\fBhttp://source.ffmpeg.org\fR>. yading@10: .PP yading@10: Maintainers for the specific components are listed in the file yading@10: \&\fI\s-1MAINTAINERS\s0\fR in the source code tree.