[FFmpeg-devel] [PATCH] avcodec/mpegaudioenc_template: default to 384k bitrate as default

Michael Niedermayer michaelni at gmx.at
Wed Apr 9 07:29:01 CEST 2014


If 384k is too high for the samplerate, choose the closest
possible

Idea to increase the bitrate from: 46439e156219d27f059cf687743ba5aacf238b87
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/mpegaudioenc_template.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 451d140..ec837f3 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -112,6 +112,11 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
         if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
             break;
     }
+    if (i == 15 && !avctx->bit_rate) {
+        i = 14;
+        bitrate = avpriv_mpa_bitrate_tab[s->lsf][1][i];
+        avctx->bit_rate = bitrate * 1000;
+    }
     if (i == 15){
         av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
         return AVERROR(EINVAL);
@@ -774,7 +779,7 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 }
 
 static const AVCodecDefault mp2_defaults[] = {
-    { "b", "128k" },
+    { "b", "0" },
     { NULL },
 };
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list