Browse Source

ffmpeg: more expressive sample rate automatic selection.

Output now lists the available sample rates with commands like
ffmpeg -f lavfi -i aevalsrc=0 -ar 20000 -y /tmp/out.mp3
tags/n0.11
Clément Bœsch Clément Bœsch 13 years ago
parent
commit
21d650cb69
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      ffmpeg.c

+ 12
- 1
ffmpeg.c View File

@@ -953,7 +953,18 @@ static void choose_sample_rate(AVStream *st, AVCodec *codec)
}
}
if (best_dist) {
av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best);
int i;
const int *sample_rates = codec->supported_samplerates;
av_log(st->codec, AV_LOG_WARNING,
"Requested sampling rate (%dHz) unsupported, using %dHz instead\n"
"Available sampling rates for %s:",
st->codec->sample_rate, best, codec->name);
for (i = 0; sample_rates[i]; i++) {
if (!sample_rates[i + 1]) av_log(st->codec, AV_LOG_WARNING, " and");
else if (i) av_log(st->codec, AV_LOG_WARNING, ",");
av_log(st->codec, AV_LOG_WARNING, " %d", sample_rates[i]);
}
av_log(st->codec, AV_LOG_WARNING, ".\n");
}
st->codec->sample_rate = best;
}


Loading…
Cancel
Save