[FFmpeg-trac] #5388(avformat:new): Audio Stream Specifier Need to Change for MP2 & MP3

FFmpeg trac at avcodec.org
Wed Mar 30 10:37:30 CEST 2016

#5388: Audio Stream Specifier Need to Change for MP2 & MP3
             Reporter:  smallishzulu  |                    Owner:
                 Type:  defect        |                   Status:  new
             Priority:  normal        |                Component:  avformat
              Version:  git-master    |               Resolution:
             Keywords:  mpegts        |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |

Comment (by smallishzulu):


 I am more DVB engineer than doing coding. So, I am not familiar with git
 format patches.
 However, for sure I can explain in details. Here is the issue:

 The Problem:
 There are Elementary Stream Types defined by ISO Standart 13818.

 In the standart, MPEG2 Audio need to have specifier of 0x04.
 However, in FFmpeg libavformat/mpegtsenc.c file in Line 310, the
 definition is:

         case AV_CODEC_ID_MP2:
         case AV_CODEC_ID_MP3:
             stream_type = STREAM_TYPE_AUDIO_MPEG1;

 Where in libavformat/mpegts.h STREAM_TYPE_AUDIO_MPEG1 defined as;

 At Line 47:
 #define STREAM_TYPE_AUDIO_MPEG1     0x03
 #define STREAM_TYPE_AUDIO_MPEG2     0x04

 So MPEG2 Audio gets identifier as 0x03. But in ISO Standart it needs to be

 The Fix:
 Line 312 in libavformat/mpegtsenc.c needs to be as below:

         case AV_CODEC_ID_MP2:
         case AV_CODEC_ID_MP3:
             stream_type = STREAM_TYPE_AUDIO_MPEG2;

 So it gets 0x04 identifier.

 I hope I did a clear explanation. This fix makes FFmpeg mpegts streams
 compatible with STBs which just check identifier to set a decoder.

Ticket URL: <https://trac.ffmpeg.org/ticket/5388#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list