[FFmpeg-devel] one question about aac bitstream in mov container

Hendrik Leppkes h.leppkes at gmail.com
Tue Mar 22 12:36:45 CET 2016


On Tue, Mar 22, 2016 at 11:35 AM, qw <applemax82 at 163.com> wrote:
> Hi,
>
> I am reading ffmpeg source code, and confused about the following logic in movenc.c,
>
>     if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
>         (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
>         if (!s->streams[pkt->stream_index]->nb_frames) {
>             av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
>                    "use the audio bitstream filter 'aac_adtstoasc' to fix it "
>                    "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
>             return -1;
>         }
>         av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
>     }
>
> If I used default setting to encode audio samples into packets and moved those packets into mp4 container, my transcoding program will report:
>
> [mov @ 0xe30a00] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
>
> why movenc.c can't support ADTS format? how to set fdk_aac encoder to code audio samples without the error message?
>

ADTS in MOV/MP4 is not allowed, only raw AAC is. When encoding with
ffmpeg straight into MP4, it should automatically do this, if you have
your own application, you need to set the global header flag on the
decoder context.

Please post questions to the user mailing list, not the development list.

- Hendrik


More information about the ffmpeg-devel mailing list