[FFmpeg-user] Transport Stream (.ts) with ac3 audio

Andy Furniss adf.lists at gmail.com
Sat Feb 15 15:42:00 CET 2014


relaht at gmx.de wrote:
> Am 13.02.2014 um 16:48 schrieb Andy Furniss <adf.lists at gmail.com>:
>
>> If this is just to test for personal use you can effectively do the same
>> by building your own ffmpeg with this diff applied (or just edit by
>> hand
>
> That sounds like a great idea! :-)
> And I think it worth a try.
>
> So I just have to edit the file: mpegts.h
>
> and change this line:
> #define STREAM_TYPE_AUDIO_AC3       0x81
>
> to this:
> #define STREAM_TYPE_AUDIO_AC3       0x06
>
>
> Am I right on this?
> Or is there more to do?

I wouldn't do that there - I suspect it would mess up decoders.

The file to edit is libavformat/mpegtsenc.c

Around line 280 there is a big case statement like -

     for(i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
         MpegTSWriteStream *ts_st = st->priv_data;
         AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", 
NULL,0);
         switch(st->codec->codec_id) {
         case AV_CODEC_ID_MPEG1VIDEO:
         case AV_CODEC_ID_MPEG2VIDEO:
             stream_type = STREAM_TYPE_VIDEO_MPEG2;
             break;
         case AV_CODEC_ID_MPEG4:
             stream_type = STREAM_TYPE_VIDEO_MPEG4;
             break;
         case AV_CODEC_ID_H264:
             stream_type = STREAM_TYPE_VIDEO_H264;
             break;
         case AV_CODEC_ID_CAVS:
             stream_type = STREAM_TYPE_VIDEO_CAVS;
             break;
         case AV_CODEC_ID_DIRAC:
             stream_type = STREAM_TYPE_VIDEO_DIRAC;
             break;
         case AV_CODEC_ID_MP2:
         case AV_CODEC_ID_MP3:
             stream_type = STREAM_TYPE_AUDIO_MPEG1;
             break;
         case AV_CODEC_ID_AAC:
             stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? 
STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC;
             break;
         case AV_CODEC_ID_AAC_LATM:
             stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
             break;
         case AV_CODEC_ID_AC3:
             stream_type = STREAM_TYPE_AUDIO_AC3;
             break;
         default:
             stream_type = STREAM_TYPE_PRIVATE_DATA;
             break;
         }


Change

stream_type = STREAM_TYPE_AUDIO_AC3;

to

stream_type = STREAM_TYPE_PRIVATE_DATA;




More information about the ffmpeg-user mailing list