[FFmpeg-devel] [PATCH] avformat/mpegenc - reject unsupported audio streams

Gyan ffmpeg at gyani.pro
Mon Jul 8 15:05:20 EEST 2019



On 25-04-2019 01:48 PM, Gyan wrote:
>
>
> On 25-04-2019 01:23 PM, Ali KIZIL wrote:
>>
>> There are also Dolby Codecs (ac3 & eac3). Will it also throw error for
>> these codecs ?
>
> AC3   is      supported before and after this patch.
> EAC3 is unsupported before and after this patch.
>
> But it's sent to the same decoder, so support could be added. I'll check.

Attached patch allows muxing EAC3 in MPEG-PS.  Stock ffmpeg can demux 
and decode such streams fine.

Gyan
-------------- next part --------------
From 4558eab851efc252fc6cac4aff4f557b5768004a Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg at gyani.pro>
Date: Mon, 8 Jul 2019 17:04:21 +0530
Subject: [PATCH] avformat/mpegenc: allow muxing eac3 streams

---
 libavformat/mpegenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 43ebc46e0e..15b191bc9d 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -352,6 +352,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
         case AVMEDIA_TYPE_AUDIO:
             if (!s->is_mpeg2 &&
                 (st->codecpar->codec_id == AV_CODEC_ID_AC3 ||
+                 st->codecpar->codec_id == AV_CODEC_ID_EAC3 ||
                  st->codecpar->codec_id == AV_CODEC_ID_DTS ||
                  st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
                  st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD))
@@ -360,7 +361,8 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
                         "consider using the vob or the dvd muxer "
                         "to force a MPEG-2 program stream.\n",
                         avcodec_get_name(st->codecpar->codec_id));
-            if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+            if (st->codecpar->codec_id == AV_CODEC_ID_AC3 ||
+                st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
                 stream->id = ac3_id++;
             } else if (st->codecpar->codec_id == AV_CODEC_ID_DTS) {
                 stream->id = dts_id++;
@@ -415,7 +417,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
             } else if (st->codecpar->codec_id != AV_CODEC_ID_MP1 &&
                        st->codecpar->codec_id != AV_CODEC_ID_MP2 &&
                        st->codecpar->codec_id != AV_CODEC_ID_MP3) {
-                       av_log(ctx, AV_LOG_ERROR, "Unsupported audio codec. Must be one of mp1, mp2, mp3, 16-bit pcm_dvd, pcm_s16be, ac3 or dts.\n");
+                       av_log(ctx, AV_LOG_ERROR, "Unsupported audio codec. Must be one of mp1, mp2, mp3, 16-bit pcm_dvd, pcm_s16be, ac3, eac3 or dts.\n");
                        goto fail;
             } else {
                 stream->id = mpa_id++;
-- 
2.22.0


More information about the ffmpeg-devel mailing list