[Ffmpeg-devel] Re: [PATCH] ADTS muxer

Baptiste COUDURIER baptiste.coudurier
Fri Feb 10 02:06:06 CET 2006


M?ns Rullg?rd wrote:
> Baptiste COUDURIER <baptiste.coudurier at smartjog.com> writes:
> 
>> Hi,
>>
>> Here is an ADTS muxer. I think it will solve Erik Slagter problem with
>> gpac. Does it worker for you Erik ?
>>
>> +static int adts_write_aac_header(ADTSContext *ctx, int size)
>> +{
>> +    PutBitContext pb;
>> +    uint8_t buffer[ADTS_HEADER_SIZE];
>> +
>> +    init_put_bits(&pb, buffer, ADTS_HEADER_SIZE);
>> +    put_bits(&pb, 12, 0xfff);
>> +    put_bits(&pb, 1, 0);
>> +    put_bits(&pb, 2, 0);
>> +    put_bits(&pb, 1, 0); /* protection present ? */
>> +    put_bits(&pb, 2, 0);
>> +    put_bits(&pb, 2, ctx->sample_rate_index);
>> +    put_bits(&pb, 1, 0);
>> +    put_bits(&pb, 3, ctx->enc->channels);
>> +    put_bits(&pb, 1, 0);
>> +    put_bits(&pb, 1, 0);
>> +
>> +
>> +    /* adts variable header */
>> +    put_bits(&pb, 1, 0);
>> +    put_bits(&pb, 1, 0);
>> +    put_bits(&pb, 13, size); /* size */
>> +    put_bits(&pb, 11, 0);
>> +    put_bits(&pb, 2, 0);
>> +    flush_put_bits(&pb);
>> +    return 0;
>> +}
> 
> This will not create a valid adts frame header.  Furthermore, you are
> never actually writing it to the output.
> 
> Annoyingly, documentation for AAC seems notoriously difficult to find.
> Worse, the various drafts I've managed to come across vary quite
> considerably.
> 

Haa you are right, after tweaking a bit, and getting all conditions to
fit Erik's case, it seems that setting ADTS_HEADER_SIZE to 7 build a
somewhat valid ADTS header for faad. It can decompress it but I still
get, during the decompression, an error :

Maximum number of bitstream elements exceeded

Do you know what could provoke that ?

I will try to find precise specifications, and to achieve muxing it
correctly. Thanks a lot.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312





More information about the ffmpeg-devel mailing list