[FFmpeg-cvslog] avformat/flvenc: support mp3 audio with 48khz

fuqiuping git at videolan.org
Sun Nov 6 23:46:43 EET 2016


ffmpeg | branch: master | fuqiuping <fu.qiuping at hotmail.com> | Wed Sep 28 07:47:47 2016 -0700| [2d72ea68f0edb72d96ec44bf50a1994cadc65f4c] | committer: Michael Niedermayer

avformat/flvenc: support mp3 audio with 48khz

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2d72ea68f0edb72d96ec44bf50a1994cadc65f4c
---

 libavformat/flvenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index e50f8e4..94f95ac 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -107,6 +107,14 @@ static int get_audio_flags(AVFormatContext *s, AVCodecParameters *par)
         return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
     } else {
         switch (par->sample_rate) {
+        case 48000:
+            // 48khz mp3 is stored with 44k1 samplerate identifer
+            if (par->codec_id == AV_CODEC_ID_MP3) {
+                flags |= FLV_SAMPLERATE_44100HZ;
+                break;
+            } else {
+                goto error;
+            }
         case 44100:
             flags |= FLV_SAMPLERATE_44100HZ;
             break;
@@ -124,6 +132,7 @@ static int get_audio_flags(AVFormatContext *s, AVCodecParameters *par)
                 break;
             }
         default:
+error:
             av_log(s, AV_LOG_ERROR,
                    "FLV does not support sample rate %d, "
                    "choose from (44100, 22050, 11025)\n", par->sample_rate);



More information about the ffmpeg-cvslog mailing list