summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-18 03:27:52 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-28 23:07:12 +0200
commit628a73f8f3768513fa6152c98d54842cf2ae1aad (patch)
tree80522a8a5cecff8e584893d46a4bc91ee8fe47ba /ffmpeg.c
parent777df1ff746ea8a264971956cb09f3e199342151 (diff)
ffmpeg: force 128k default audio bitrate if nothing is specified and there is no specific default
This prevents breaking existing command lines in case the "ab" default is removed from libavcodec Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index ae02b00784..9f9170e327 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2604,6 +2604,11 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
av_dict_set(&ost->encoder_opts, "side_data_only_packets", "1", 0);
+ if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
+ !codec->defaults &&
+ !av_dict_get(ost->encoder_opts, "b", NULL, 0) &&
+ !av_dict_get(ost->encoder_opts, "ab", NULL, 0))
+ av_dict_set(&ost->encoder_opts, "b", "128000", 0);
if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
if (ret == AVERROR_EXPERIMENTAL)