doc/ffmpeg: update -map documentation

Make it match reality (current text was not updated for stream
specifiers), extend and clarify the text.
pull/388/head
Anton Khirnov 2 years ago
parent fee249b30a
commit 889b4b2f60
  1. 58
      doc/ffmpeg.texi

@ -1413,14 +1413,16 @@ Set the size of the canvas used to render subtitles.
@table @option @table @option
@item -map [-]@var{input_file_id}[:@var{stream_specifier}][?] | @var{[linklabel]} (@emph{output}) @item -map [-]@var{input_file_id}[:@var{stream_specifier}][?] | @var{[linklabel]} (@emph{output})
Designate one or more input streams as a source for the output file. Each input Create one or more streams in the output file. This option has two forms for
stream is identified by the input file index @var{input_file_id} and specifying the data source(s): the first selects one or more streams from some
the input stream index @var{input_stream_id} within the input input file (specified with @code{-i}), the second takes an output from some
file. Both indices start at 0. complex filtergraph (specified with @code{-filter_complex} or
@code{-filter_complex_script}).
The first @code{-map} option on the command line specifies the In the first form, an output stream is created for every stream from the input
source for output stream 0, the second @code{-map} option specifies file with the index @var{input_file_id}. If @var{stream_specifier} is given,
the source for output stream 1, etc. only those streams that match the specifier are used (see the
@ref{Stream specifiers} section for the @var{stream_specifier} syntax).
A @code{-} character before the stream identifier creates a "negative" mapping. A @code{-} character before the stream identifier creates a "negative" mapping.
It disables matching streams from already created mappings. It disables matching streams from already created mappings.
@ -1434,39 +1436,56 @@ An alternative @var{[linklabel]} form will map outputs from complex filter
graphs (see the @option{-filter_complex} option) to the output file. graphs (see the @option{-filter_complex} option) to the output file.
@var{linklabel} must correspond to a defined output link label in the graph. @var{linklabel} must correspond to a defined output link label in the graph.
For example, to map ALL streams from the first input file to output This option may be specified multiple times, each adding more streams to the
output file. Any given input stream may also be mapped any number of times as a
source for different output streams, e.g. in order to use different encoding
options and/or filters. The streams are created in the output in the same order
in which the @code{-map} options are given on the commandline.
Using this option disables the default mappings for this output file.
Examples:
@table @emph
@item map everything
To map ALL streams from the first input file to output
@example @example
ffmpeg -i INPUT -map 0 output ffmpeg -i INPUT -map 0 output
@end example @end example
For example, if you have two audio streams in the first input file, @item select specific stream
these streams are identified by "0:0" and "0:1". You can use If you have two audio streams in the first input file, these streams are
@code{-map} to select which streams to place in an output file. For identified by @var{0:0} and @var{0:1}. You can use @code{-map} to select which
example: streams to place in an output file. For example:
@example @example
ffmpeg -i INPUT -map 0:1 out.wav ffmpeg -i INPUT -map 0:1 out.wav
@end example @end example
will map the input stream in @file{INPUT} identified by "0:1" to will map the second input stream in @file{INPUT} to the (single) output stream
the (single) output stream in @file{out.wav}. in @file{out.wav}.
For example, to select the stream with index 2 from input file @item create multiple streams
@file{a.mov} (specified by the identifier "0:2"), and stream with To select the stream with index 2 from input file @file{a.mov} (specified by the
index 6 from input @file{b.mov} (specified by the identifier "1:6"), identifier @var{0:2}), and stream with index 6 from input @file{b.mov}
and copy them to the output file @file{out.mov}: (specified by the identifier @var{1:6}), and copy them to the output file
@file{out.mov}:
@example @example
ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov
@end example @end example
@item create multiple streams 2
To select all video and the third audio stream from an input file: To select all video and the third audio stream from an input file:
@example @example
ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT
@end example @end example
@item negative map
To map all the streams except the second audio, use negative mappings To map all the streams except the second audio, use negative mappings
@example @example
ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT
@end example @end example
@item optional map
To map the video and audio streams from the first input, and using the To map the video and audio streams from the first input, and using the
trailing @code{?}, ignore the audio mapping if no audio streams exist in trailing @code{?}, ignore the audio mapping if no audio streams exist in
the first input: the first input:
@ -1474,12 +1493,13 @@ the first input:
ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT
@end example @end example
@item map by language
To pick the English audio stream: To pick the English audio stream:
@example @example
ffmpeg -i INPUT -map 0:m:language:eng OUTPUT ffmpeg -i INPUT -map 0:m:language:eng OUTPUT
@end example @end example
Note that using this option disables the default mappings for this output file. @end table
@item -ignore_unknown @item -ignore_unknown
Ignore input streams with unknown type instead of failing if copying Ignore input streams with unknown type instead of failing if copying

Loading…
Cancel
Save