[Libav-user] AAC decoding problems

Funky Factory Development funkyfactory at gmx.at
Sat Dec 29 12:54:36 CET 2012


Hi,

I'm having some issues with AAC decoding with recent version of ffmpeg:

I'm using this code to decode AAC Frames (from a stream).
I had some troubles with the decoding - everything runs fine but the 
after a few seconds playing
the decoded buffer (m_avAACFrame->data) only contains zeros.

         int gotframe=0;
         if(!m_avAACFrame)
             m_avAACFrame=avcodec_alloc_frame();
         else
             avcodec_get_frame_defaults(m_avAACFrame);
         int buff=avcodec_decode_audio4(pAACCodecCtx, m_avAACFrame, 
&gotframe, &avAACpkt);
         if (gotframe==0 || buff<0)
         {
             *outputsize=0;
             return;
         }
         *outputsize=av_samples_get_buffer_size(NULL, 2, 
m_avAACFrame->nb_samples, pAACCodecCtx->sample_fmt, 1);
memcpy(outbuffer,*(byte**)&m_avAACFrame->data,*outputsize);

So i switched to the latest version of ffmpeg (Zeranoe FFmpeg for 
Windows) and now i have the problem that the output sample format is 
always AV_SAMPLE_FMT_FLT instead of AV_SAMPLE_FMT_S16 ?

     pAACCodecCtx->bit_rate = 64000;
     pAACCodecCtx->sample_rate = 44100;
     pAACCodecCtx->channels = 2;
     pAACCodecCtx->channel_layout = 3;
     pAACCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;

     //pAACCodecCtx->bit_rate = 64000;
     //pAACCodecCtx->sample_rate = fmtp[11];
     //pAACCodecCtx->channels = fmtp[7];
     //c->sample_fmt = AV_SAMPLE_FMT_DBL;
     //c->profile = FF_PROFILE_AAC_SSR;

     /* open it */

     if (avcodec_open2(pAACCodecCtx, AACCodec,NULL) < 0)
     {
         return false;
     }

Is AAC not properly supported on ffmpeg ?

Thanks for your help



More information about the Libav-user mailing list