2009/2/27 Jose Mortensen <[email protected]> > I had a similar problem, In my case, it was that the decoded audio > buffer size is different from the encoding audio buffer size. The > encoder was expecting a smaller buffer on its input. > > The size of the encoder input buffer depends on the encoder setup, and > given by the AVCodecContext::frame_size and the number of channels. > > Look into ffmpeg.c or the code snipped below. I hope it helps. > > > // Write audio to fifo. Reallocate fifo space if needed. > if (av_fifo_realloc2(&audioFifo, av_fifo_size(&audioFifo) + > frame.size) < 0) { > throw TRANSCODE_EXCEPTION("Can reallocate fifo"); > } > > av_fifo_generic_write(&audioFifo, frame.data, frame.size, NULL); > > while (av_fifo_size(&audioFifo) >= frame_bytes) { > // Process audio frame. > av_fifo_read(&audioFifo, frameBuffer, frame_bytes); > > int size = avcodec_encode_audio(ctx, bufferPtr, bufferSize, > (short*)frameBuffer); > > bufferPtr += size; > bufferSize -= size; > pkt.size += size; > > } >
Thanks a lot! It was indeed because the AAC encoder expects a smaller buffer! I made a FIFO and everything works fine! _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
