From 247e3954fc710ac3f8a9a10ad1e006304cad81fa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 23 Feb 2010 16:31:14 +0000 Subject: Favor streams with more packets if the user did not specify what she wants. Fixes issue1156 Originally committed as revision 22002 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ffmpeg.c') diff --git a/ffmpeg.c b/ffmpeg.c index ad45ea3..ecaa7e1 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1777,6 +1777,7 @@ static int av_encode(AVFormatContext **output_files, } } 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;jdiscard && ist->st->discard != AVDISCARD_ALL && !skip && ist->st->codec->codec_type == ost->st->codec->codec_type) { - ost->source_index = j; - found = 1; - break; + 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; + } } } -- cgit v1.1