[FFmpeg-cvslog] lavf/mpegtsenc: Fix stream_type for low sample rate MP2/MP3.

Carl Eugen Hoyos git at videolan.org
Tue May 3 14:16:33 CEST 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Tue May  3 14:15:14 2016 +0200| [fd0f1442eb78e2520fcfc7b13250ddf1ead2bc9d] | committer: Carl Eugen Hoyos

lavf/mpegtsenc: Fix stream_type for low sample rate MP2/MP3.

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

 libavformat/mpegtsenc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index f4cb862..d8927b7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -318,7 +318,12 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
             break;
         case AV_CODEC_ID_MP2:
         case AV_CODEC_ID_MP3:
-            stream_type = STREAM_TYPE_AUDIO_MPEG1;
+            if (   st->codec->sample_rate > 0
+                && st->codec->sample_rate < 32000) {
+                stream_type = STREAM_TYPE_AUDIO_MPEG2;
+            } else {
+                stream_type = STREAM_TYPE_AUDIO_MPEG1;
+            }
             break;
         case AV_CODEC_ID_AAC:
             stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM)



More information about the ffmpeg-cvslog mailing list