X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=ffmpeg_opt.c;h=a36922481f0a1e1c4f47451ba65d0933f9e5e7e0;hb=ed80dec621f621794e9d7ec7c1769bbf9a58a500;hp=28d305103a1dbac2d734be5a4ec320cca82f2ffd;hpb=b1d547fe024a3ba223e4d0d7f73617b71d629827;p=ffmpeg diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 28d305103a1..a36922481f0 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1992,12 +1992,14 @@ static int open_output_file(OptionsContext *o, const char *filename) /* audio: most channels */ if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) { - int channels = 0, idx = -1; + int best_score = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { + int score; ist = input_streams[i]; + score = ist->st->codec->channels + 100000000*!!ist->st->codec_info_nb_frames; if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && - ist->st->codec->channels > channels) { - channels = ist->st->codec->channels; + score > best_score) { + best_score = score; idx = i; } }