[FFmpeg-devel] [PATCH] Fix the MPEG TS Encoding PES Start Code for the AAC Codec

Måns Rullgård mans
Tue Feb 22 00:56:39 CET 2011


Tony Strauss <tony at animoto.com> writes:

> Disclaimer: I'm new to the ffmpeg code base and problem space
>
> This patch adds the AAC codec to the list of audio codecs that results
> in a PES start code of 0x1c0 (audio stream) when ffmpeg encodes mpeg 2
> ts.  I think that this is correct because:
> * AAC has been standardized as part of various MPEG specifications
> * There's at least one Flash player that depends on this
> * Apple does the same thing in their mpeg 2 ts encoding software
> that's part of their mediafilesegmenter for HTTP Live streams
>
> http://en.wikipedia.org/wiki/Packetized_elementary_stream
>
> Tony
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 99becbc..be11a06 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -746,7 +746,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>                      *q++ = 0xe0;
>              } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
>                         (st->codec->codec_id == CODEC_ID_MP2 ||
> -                        st->codec->codec_id == CODEC_ID_MP3)) {
> +                        st->codec->codec_id == CODEC_ID_MP3 ||
> +                        st->codec->codec_id == CODEC_ID_AAC)) {
>                  *q++ = 0xc0;
>              } else {
>                  *q++ = 0xbd;

The MPEG spec agrees.  Patch queued.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list