aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-14 05:07:11 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-14 10:43:16 +0200
commitae2cb9290ac23565f0a6b07d7c3e5ca5b62ea7b6 (patch)
tree27eb5b28517ed6a9bc625e06e04582dcba6e7ab8 /ffmpeg_opt.c
parent856452cf63afad723230e02e069c79a18ac3814c (diff)
downloadffmpeg-ae2cb9290ac23565f0a6b07d7c3e5ca5b62ea7b6.tar.gz
ffmpeg_opt: Prefer audio streams with packets
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 28d305103a..a36922481f 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;
}
}