They are confusing, irregular and redundant -- -map already contains all
the information.
Break programid for now, but it never worked properly anyway. A better
solution will be written soon.
---
av.c | 323 ++++++++++++++++++-----------------------------------------
doc/av.texi | 45 ++-------
2 files changed, 108 insertions(+), 260 deletions(-)
diff --git a/av.c b/av.c
index 3f42bce..2f4f194 100644
--- a/av.c
+++ b/av.c
@@ -133,7 +133,6 @@ static float video_qscale = 0;
static uint16_t *intra_matrix = NULL;
static uint16_t *inter_matrix = NULL;
static const char *video_rc_override_string=NULL;
-static int video_disable = 0;
static int video_discard = 0;
static char *video_codec_name = NULL;
static unsigned int video_codec_tag = 0;
@@ -152,18 +151,15 @@ static int intra_only = 0;
static int audio_sample_rate = 0;
#define QSCALE_NONE -99999
static float audio_qscale = QSCALE_NONE;
-static int audio_disable = 0;
static int audio_channels = 0;
static char *audio_codec_name = NULL;
static unsigned int audio_codec_tag = 0;
static char *audio_language = NULL;
-static int subtitle_disable = 0;
static char *subtitle_codec_name = NULL;
static char *subtitle_language = NULL;
static unsigned int subtitle_codec_tag = 0;
-static int data_disable = 0;
static char *data_codec_name = NULL;
static unsigned int data_codec_tag = 0;
@@ -464,7 +460,6 @@ static int exit_program(int ret)
av_free(vstats_filename);
av_free(streamid_map);
- av_free(stream_maps);
av_free(meta_data_maps);
av_freep(&input_streams);
@@ -1946,8 +1941,7 @@ static void parse_forced_key_frames(char *kf,
OutputStream *ost,
static int transcode(AVFormatContext **output_files,
int nb_output_files,
InputFile *input_files,
- int nb_input_files,
- StreamMap *stream_maps, int nb_stream_maps)
+ int nb_input_files)
{
int ret = 0, i, j, k, n, nb_ostreams = 0;
AVFormatContext *is, *os;
@@ -1975,32 +1969,6 @@ static int transcode(AVFormatContext **output_files,
}
nb_ostreams += os->nb_streams;
}
- if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
- fprintf(stderr, "Number of stream maps must match number of output
streams\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- /* Sanity check the mapping args -- do the input files & streams exist? */
- for(i=0;i<nb_stream_maps;i++) {
- int fi = stream_maps[i].file_index;
- int si = stream_maps[i].stream_index;
-
- if (fi < 0 || fi > nb_input_files - 1 ||
- si < 0 || si > input_files[fi].ctx->nb_streams - 1) {
- fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- fi = stream_maps[i].sync_file_index;
- si = stream_maps[i].sync_stream_index;
- if (fi < 0 || fi > nb_input_files - 1 ||
- si < 0 || si > input_files[fi].ctx->nb_streams - 1) {
- fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- }
ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams);
if (!ost_table)
@@ -2008,80 +1976,8 @@ static int transcode(AVFormatContext **output_files,
n = 0;
for(k=0;k<nb_output_files;k++) {
os = output_files[k];
- for(i=0;i<os->nb_streams;i++,n++) {
- int found;
- ost = ost_table[n] = output_streams_for_file[k][i];
- if (nb_stream_maps > 0) {
- ost->source_index =
input_files[stream_maps[n].file_index].ist_index +
- stream_maps[n].stream_index;
-
- /* Sanity check that the stream types match */
- if (input_streams[ost->source_index].st->codec->codec_type !=
ost->st->codec->codec_type) {
- int i= ost->file_index;
- av_dump_format(output_files[i], i,
output_files[i]->filename, 1);
- fprintf(stderr, "Codec type mismatch for mapping #%d.%d ->
#%d.%d\n",
- stream_maps[n].file_index, stream_maps[n].stream_index,
- ost->file_index, ost->index);
- exit_program(1);
- }
-
- } else {
- int best_nb_frames=-1;
- /* get corresponding input stream index : we select the first
one with the right type */
- found = 0;
- for (j = 0; j < nb_input_streams; j++) {
- int skip=0;
- ist = &input_streams[j];
- if(opt_programid){
- int pi,si;
- AVFormatContext *f = input_files[ist->file_index].ctx;
- skip=1;
- for(pi=0; pi<f->nb_programs; pi++){
- AVProgram *p= f->programs[pi];
- if(p->id == opt_programid)
- for(si=0; si<p->nb_stream_indexes; si++){
- if(f->streams[ p->stream_index[si] ] ==
ist->st)
- skip=0;
- }
- }
- }
- if (ist->discard && ist->st->discard != AVDISCARD_ALL &&
!skip &&
- ist->st->codec->codec_type ==
ost->st->codec->codec_type) {
- if(best_nb_frames < ist->st->codec_info_nb_frames){
- best_nb_frames= ist->st->codec_info_nb_frames;
- ost->source_index = j;
- found = 1;
- }
- }
- }
-
- if (!found) {
- if(! opt_programid) {
- /* try again and reuse existing stream */
- for (j = 0; j < nb_input_streams; j++) {
- ist = &input_streams[j];
- if ( ist->st->codec->codec_type ==
ost->st->codec->codec_type
- && ist->st->discard != AVDISCARD_ALL) {
- ost->source_index = j;
- found = 1;
- }
- }
- }
- if (!found) {
- int i= ost->file_index;
- av_dump_format(output_files[i], i,
output_files[i]->filename, 1);
- fprintf(stderr, "Could not find input stream matching
output stream #%d.%d\n",
- ost->file_index, ost->index);
- exit_program(1);
- }
- }
- }
- ist = &input_streams[ost->source_index];
- ist->discard = 0;
- ost->sync_ist = (nb_stream_maps > 0) ?
-
&input_streams[input_files[stream_maps[n].sync_file_index].ist_index +
- stream_maps[n].sync_stream_index] : ist;
- }
+ for (i = 0; i < os->nb_streams; i++, n++)
+ ost_table[n] = output_streams_for_file[k][i];
}
/* for each output stream, we compute the right encoding parameters */
@@ -3208,8 +3104,6 @@ static int opt_input_file(const char *opt, const char
*filename)
switch (dec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ist->dec = avcodec_find_decoder_by_name(audio_codec_name);
- if(audio_disable)
- st->discard= AVDISCARD_ALL;
break;
case AVMEDIA_TYPE_VIDEO:
ist->dec = avcodec_find_decoder_by_name(video_codec_name);
@@ -3232,8 +3126,6 @@ static int opt_input_file(const char *opt, const char
*filename)
(float)rfps / rfps_base, rfps, rfps_base);
}
- if(video_disable)
- st->discard= AVDISCARD_ALL;
else if(video_discard)
st->discard= video_discard;
break;
@@ -3241,8 +3133,6 @@ static int opt_input_file(const char *opt, const char
*filename)
break;
case AVMEDIA_TYPE_SUBTITLE:
ist->dec = avcodec_find_decoder_by_name(subtitle_codec_name);
- if(subtitle_disable)
- st->discard = AVDISCARD_ALL;
break;
case AVMEDIA_TYPE_ATTACHMENT:
case AVMEDIA_TYPE_UNKNOWN:
@@ -3282,50 +3172,7 @@ static int opt_input_file(const char *opt, const char
*filename)
return 0;
}
-static void check_inputs(int *has_video_ptr,
- int *has_audio_ptr,
- int *has_subtitle_ptr,
- int *has_data_ptr)
-{
- int has_video, has_audio, has_subtitle, has_data, i, j;
- AVFormatContext *ic;
-
- has_video = 0;
- has_audio = 0;
- has_subtitle = 0;
- has_data = 0;
-
- for(j=0;j<nb_input_files;j++) {
- ic = input_files[j].ctx;
- for(i=0;i<ic->nb_streams;i++) {
- AVCodecContext *enc = ic->streams[i]->codec;
- switch(enc->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- has_audio = 1;
- break;
- case AVMEDIA_TYPE_VIDEO:
- has_video = 1;
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- has_subtitle = 1;
- break;
- case AVMEDIA_TYPE_DATA:
- case AVMEDIA_TYPE_ATTACHMENT:
- case AVMEDIA_TYPE_UNKNOWN:
- has_data = 1;
- break;
- default:
- abort();
- }
- }
- }
- *has_video_ptr = has_video;
- *has_audio_ptr = has_audio;
- *has_subtitle_ptr = has_subtitle;
- *has_data_ptr = has_data;
-}
-
-static void new_video_stream(AVFormatContext *oc, int file_idx)
+static OutputStream *new_video_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
@@ -3449,14 +3296,14 @@ static void new_video_stream(AVFormatContext *oc, int
file_idx)
}
/* reset some key parameters */
- video_disable = 0;
av_freep(&video_codec_name);
av_freep(&forced_key_frames);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
+ return ost;
}
-static void new_audio_stream(AVFormatContext *oc, int file_idx)
+static OutputStream *new_audio_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
@@ -3512,12 +3359,13 @@ static void new_audio_stream(AVFormatContext *oc, int
file_idx)
}
/* reset some key parameters */
- audio_disable = 0;
av_freep(&audio_codec_name);
audio_stream_copy = 0;
+
+ return ost;
}
-static void new_data_stream(AVFormatContext *oc, int file_idx)
+static OutputStream *new_data_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
@@ -3543,12 +3391,12 @@ static void new_data_stream(AVFormatContext *oc, int
file_idx)
st->stream_copy = 1;
}
- data_disable = 0;
av_freep(&data_codec_name);
data_stream_copy = 0;
+ return ost;
}
-static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
+static OutputStream *new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
@@ -3591,27 +3439,9 @@ static void new_subtitle_stream(AVFormatContext *oc, int
file_idx)
av_freep(&subtitle_language);
}
- subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
-}
-
-static int opt_new_stream(const char *opt, const char *arg)
-{
- AVFormatContext *oc;
- int file_idx = nb_output_files - 1;
- if (nb_output_files <= 0) {
- fprintf(stderr, "At least one output file must be specified\n");
- exit_program(1);
- }
- oc = output_files[file_idx];
-
- if (!strcmp(opt, "newvideo" )) new_video_stream (oc, file_idx);
- else if (!strcmp(opt, "newaudio" )) new_audio_stream (oc, file_idx);
- else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc, file_idx);
- else if (!strcmp(opt, "newdata" )) new_data_stream (oc, file_idx);
- else av_assert0(0);
- return 0;
+ return ost;
}
/* arg format is "output-stream-index:streamid-value". */
@@ -3639,9 +3469,10 @@ static int opt_streamid(const char *opt, const char *arg)
static void opt_output_file(const char *filename)
{
AVFormatContext *oc;
- int i, err, use_video, use_audio, use_subtitle, use_data;
- int input_has_video, input_has_audio, input_has_subtitle, input_has_data;
+ int i, err;
AVOutputFormat *file_oformat;
+ OutputStream *ost;
+ InputStream *ist;
if (!strcmp(filename, "-"))
filename = "pipe:";
@@ -3680,42 +3511,88 @@ static void opt_output_file(const char *filename)
print_error(filename, err);
exit_program(1);
}
+ } else if (!nb_stream_maps) {
+ int have_video = 0, have_audio = 0, have_subs = 0, have_data = 0;
+
+ for (i = 0; i < nb_input_streams; i++) {
+ ost = NULL;
+ switch (input_streams[i].st->codec->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ if (!have_video && (file_oformat->video_codec != CODEC_ID_NONE
||
+ video_stream_copy || video_codec_name)) {
+ ost = new_video_stream(oc, nb_output_files);
+ have_video = 1;
+ }
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (!have_audio && (file_oformat->audio_codec != CODEC_ID_NONE
||
+ audio_stream_copy || audio_codec_name)) {
+ ost = new_audio_stream(oc, nb_output_files);
+ have_audio = 1;
+ }
+ break;
+ case AVMEDIA_TYPE_SUBTITLE:
+ if (!have_subs && (file_oformat->subtitle_codec !=
CODEC_ID_NONE ||
+ subtitle_stream_copy ||
subtitle_codec_name)) {
+ ost = new_subtitle_stream(oc, nb_output_files);
+ have_subs = 1;
+ }
+ break;
+ case AVMEDIA_TYPE_DATA:
+ if (!have_data && (data_stream_copy || data_codec_name)) {
+ ost = new_data_stream(oc, nb_output_files);
+ have_data = 1;
+ }
+ break;
+ }
+
+ if (ost) {
+ ost->source_index = i;
+ ost->sync_ist = &input_streams[i];
+ input_streams[i].discard = 0;
+ }
+ }
} else {
- use_video = file_oformat->video_codec != CODEC_ID_NONE ||
video_stream_copy || video_codec_name;
- use_audio = file_oformat->audio_codec != CODEC_ID_NONE ||
audio_stream_copy || audio_codec_name;
- use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE ||
subtitle_stream_copy || subtitle_codec_name;
- use_data = data_stream_copy || data_codec_name; /* XXX once generic
data codec will be available add a ->data_codec reference and use it here */
-
- /* disable if no corresponding type found */
- check_inputs(&input_has_video,
- &input_has_audio,
- &input_has_subtitle,
- &input_has_data);
-
- if (!input_has_video)
- use_video = 0;
- if (!input_has_audio)
- use_audio = 0;
- if (!input_has_subtitle)
- use_subtitle = 0;
- if (!input_has_data)
- use_data = 0;
-
- /* manual disable */
- if (audio_disable) use_audio = 0;
- if (video_disable) use_video = 0;
- if (subtitle_disable) use_subtitle = 0;
- if (data_disable) use_data = 0;
-
- if (use_video) new_video_stream(oc, nb_output_files);
- if (use_audio) new_audio_stream(oc, nb_output_files);
- if (use_subtitle) new_subtitle_stream(oc, nb_output_files);
- if (use_data) new_data_stream(oc, nb_output_files);
-
- av_dict_copy(&oc->metadata, metadata, 0);
- av_dict_free(&metadata);
+ for (i = 0; i < nb_stream_maps; i++) {
+ StreamMap *map = &stream_maps[i];
+ int fi = map->file_index;
+ int si = map->stream_index;
+
+ if (fi < 0 || fi >= nb_input_files ||
+ si < 0 || si >= input_files[fi].ctx->nb_streams) {
+ av_log(NULL, AV_LOG_ERROR, "Input stream #%d.%d does not
exist.\n", fi, si);
+ exit_program(1);
+ }
+ fi = map->sync_file_index;
+ si = map->sync_stream_index;
+ if (fi < 0 || fi >= nb_input_files ||
+ si < 0 || si >= input_files[fi].ctx->nb_streams) {
+ av_log(NULL, AV_LOG_ERROR, "Sync stream #%d.%d does not
exist.\n", fi, si);
+ exit_program(1);
+ }
+
+ ist = &input_streams[input_files[map->file_index].ist_index +
map->stream_index];
+ switch (ist->st->codec->codec_type) {
+ case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(oc,
nb_output_files); break;
+ case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(oc,
nb_output_files); break;
+ case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(oc,
nb_output_files); break;
+ case AVMEDIA_TYPE_DATA: ost = new_data_stream(oc,
nb_output_files); break;
+ default:
+ av_log(NULL, AV_LOG_ERROR, "Cannot map stream #%d.%d -
unsupported type.\n",
+ map->file_index, map->stream_index);
+ exit_program(1);
+ }
+
+ ost->source_index = input_files[map->file_index].ist_index +
map->stream_index;
+ ost->sync_ist =
&input_streams[input_files[map->sync_file_index].ist_index +
+ map->sync_stream_index];
+ ist->discard = 0;
+ }
}
+ av_dict_copy(&oc->metadata, metadata, 0);
+ av_dict_free(&metadata);
+
av_dict_copy(&output_opts[nb_output_files], format_opts, 0);
output_files[nb_output_files++] = oc;
@@ -3787,6 +3664,9 @@ static void opt_output_file(const char *filename)
audio_sample_fmt = AV_SAMPLE_FMT_NONE;
chapters_input_file = INT_MAX;
+ av_freep(&stream_maps);
+ nb_stream_maps = 0;
+
av_freep(&forced_key_frames);
uninit_opts();
init_opts();
@@ -4217,7 +4097,6 @@ static const OptionDef options[] = {
{ "padright", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad
filter instead", "size" },
{ "padcolor", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad
filter instead", "color" },
{ "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use
only intra frames"},
- { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
{ "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO,
{(void*)&video_discard}, "discard threshold", "n" },
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use
fixed video quantizer scale (VBR)", "q" },
{ "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO,
{(void*)opt_video_rc_override_string}, "rate control override for specific
intervals", "override" },
@@ -4240,7 +4119,6 @@ static const OptionDef options[] = {
{ "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first},
"top=1/bottom=0/auto=-1 field first", "" },
{ "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO,
{(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
{ "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force
video tag/fourcc", "fourcc/tag" },
- { "newvideo", OPT_VIDEO, {(void*)opt_new_stream}, "add a new video stream
to the current output stream" },
{ "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language},
"set the ISO 639 language code (3 letters) of the current video stream" ,
"code" },
{ "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show
QP histogram" },
{ "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps},
"force the selected framerate, disable the best supported framerate selection"
},
@@ -4252,18 +4130,14 @@ static const OptionDef options[] = {
{ "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set
audio quality (codec-specific)", "quality", },
{ "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling
rate (in Hz)", "rate" },
{ "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of
audio channels", "channels" },
- { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" },
{ "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio
codec ('copy' to copy stream)", "codec" },
{ "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force
audio tag/fourcc", "fourcc/tag" },
{ "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change
audio volume (256=normal)" , "volume" }, //
- { "newaudio", OPT_AUDIO, {(void*)opt_new_stream}, "add a new audio stream
to the current output stream" },
{ "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language},
"set the ISO 639 language code (3 letters) of the current audio stream" ,
"code" },
{ "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO,
{(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all
the sample formats supported", "format" },
/* subtitle options */
- { "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable
subtitle" },
{ "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force
subtitle codec ('copy' to copy stream)", "codec" },
- { "newsubtitle", OPT_SUBTITLE, {(void*)opt_new_stream}, "add a new
subtitle stream to the current output stream" },
{ "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void
*)&subtitle_language}, "set the ISO 639 language code (3 letters) of the
current subtitle stream" , "code" },
{ "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag},
"force subtitle tag/fourcc", "fourcc/tag" },
@@ -4331,8 +4205,7 @@ int main(int argc, char **argv)
}
ti = getutime();
- if (transcode(output_files, nb_output_files, input_files, nb_input_files,
- stream_maps, nb_stream_maps) < 0)
+ if (transcode(output_files, nb_output_files, input_files, nb_input_files)
< 0)
exit_program(1);
ti = getutime() - ti;
if (do_benchmark) {
diff --git a/doc/av.texi b/doc/av.texi
index 6255979..094e07d 100644
--- a/doc/av.texi
+++ b/doc/av.texi
@@ -295,9 +295,6 @@ prefix is ``av2pass''. The complete file name will be
@file{PREFIX-N.log}, where N is a number specific to the output
stream.
-@item -newvideo
-Add a new video stream to the current output stream.
-
@item -vlang @var{code}
Set the ISO 639 language code (3 letters) of the current video stream.
@@ -565,18 +562,6 @@ Disable audio recording.
@item -acodec @var{codec}
Force audio codec to @var{codec}. Use the @code{copy} special value to
specify that the raw codec data must be copied as is.
-@item -newaudio
-Add a new audio track to the output file. If you want to specify parameters,
-do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
-
-Mapping will be done automatically, if the number of output streams is equal to
-the number of input streams, else it will pick the first one that matches. You
-can override the mapping using @code{-map} as usual.
-
-Example:
-@example
-av -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k
-newaudio
-@end example
@item -alang @var{code}
Set the ISO 639 language code (3 letters) of the current audio stream.
@end table
@@ -617,8 +602,6 @@ Bitstream filters available are "dump_extra",
"remove_extra", "noise", "mp3comp"
@table @option
@item -scodec @var{codec}
Force subtitle codec ('copy' to copy stream).
-@item -newsubtitle
-Add a new subtitle stream to the current output stream.
@item -slang @var{code}
Set the ISO 639 language code (3 letters) of the current subtitle stream.
@item -sn
@@ -649,19 +632,19 @@ file. Both indexes start at 0. If specified,
@var{sync_file_id}.@var{sync_stream_id} sets which input stream
is used as a presentation sync reference.
-The @code{-map} options must be specified just after the output file.
-If any @code{-map} options are used, the number of @code{-map} options
-on the command line must match the number of streams in the output
-file. The first @code{-map} option on the command line specifies the
+The first @code{-map} option on the command line specifies the
source for output stream 0, the second @code{-map} option specifies
the source for output stream 1, etc.
+If no mappings are specified, the first stream of each type
+(video/audio/subtitle/data) from input is mapped to output.
+
For example, if you have two audio streams in the first input file,
these streams are identified by "0.0" and "0.1". You can use
-@code{-map} to select which stream to place in an output file. For
+@code{-map} to select which streams to place in an output file. For
example:
@example
-av -i INPUT out.wav -map 0.1
+av -i INPUT -map 0.1 out.wav
@end example
will map the input stream in @file{INPUT} identified by "0.1" to
the (single) output stream in @file{out.wav}.
@@ -671,12 +654,9 @@ For example, to select the stream with index 2 from input
file
index 6 from input @file{b.mov} (specified by the identifier "1.6"),
and copy them to the output file @file{out.mov}:
@example
-av -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
+av -i a.mov -i b.mov -vcodec copy -acodec copy -map 0.2 -map 1.6 out.mov
@end example
-To add more streams to the output file, you can use the
-@code{-newaudio}, @code{-newvideo}, @code{-newsubtitle} options.
-
@item -map_metadata
@var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
Set metadata information of @var{outfile} from @var{infile}. Note that those
are file indices (zero-based), not filenames.
@@ -1007,16 +987,11 @@ only formats accepting a normal integer are suitable.
You can put many streams of the same type in the output:
@example
-av -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec
copy test12.avi -newvideo -newaudio
+av -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -vcodec copy
-acodec copy -vcodec copy -acodec copy test12.avi
@end example
-In addition to the first video and audio streams, the resulting
-output file @file{test12.avi} will contain the second video
-and the second audio stream found in the input streams list.
-
-The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
-options have to be specified immediately after the name of the output
-file to which you want to add them.
+The resulting output file @file{test12.avi} will contain first four streams
from
+the input file in reverse order.
@end itemize
@c man end EXAMPLES
--
1.7.5.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel