[FFmpeg-devel] Latest FFMPEG 0.9 Issues

C Chatterjee cchatterj at hotmail.com
Thu Dec 29 21:04:23 CET 2011

I have been working with the latest ffmpeg 0.9 release and discovered the following issues which did not exist in the last ffmpeg I have been using from Jan 2011.

1. AAC audio decode.
I have a number of (H264+AAC) sequences which decoded fine but now I get an error in the first packet and works fine from there on. I found the issue in parse_adts_frame_header() function in aacdec.c. The sequence is initialized with ac->m4ac.chan_config = 2. But this function sets it to 0. Hence it fails in aac_decode_frame_int() and produces the following error:
            if (!(che=get_che(ac, elem_type, elem_id))) {
                av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
                       elem_type, elem_id);
                return -1;
The old ffmpeg initialized ac->m4ac.chan_config to 0 and set it to 2 in the parse_adts_frame_header().
Commenting out ac->m4ac.chan_config = 0; in parse_adts_frame_header() works great.

2. AAC Encode to flv and mp4/mov
If the first aac packet has the 2 byte header and payload together, the old ffmpeg encoded it correctly. The new ffmpeg checks for the pkt size to be 2 and errors.
flvenc.c - flv_write_packet() and 
movenc.c - ff_mov_write_packet()
have the following lines of code:

    else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 &&
               (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
        av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n");
        return -1;

Commenting this out the pkt->size > 2  works great. Otherwise we need to use -absf aac_adtstoasc.

3. Multibitrate output in one copy and one transcoded mode - FATA ERROR
The following configuration crashes ffmpeg:
ffmpeg -y -i Cricket-360p-600k.flv -an -vcodec copy -vbsf h264_mp4toannexb x1.ts -an -vcodec libx264 -preset superfast -b:v 300k -vbsf h264_mp4toannexb x2.ts 
The same happens for -acodec copy instead of -an in one or both outputs.
av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE);
in transcode_video() in ffmpeg.c has a NULL src buffer.
Several other combinations have similar issues.

Chanchal Chatterjee

More information about the ffmpeg-devel mailing list