[Ffmpeg-devel] Strange problem while decoding/encoding audio using libavcodec. Frame rate gone high

Renjith Nair renjith4
Fri Mar 10 11:52:26 CET 2006

Hi All,

I have a strange problem while decoding/encoding audio using libavcodec.
When i decode an mp3 to a buffer and later encode that buffer to an output
mp3 file, everything works fine. But during the conversion of a wma file ->
mp3 or from mp3 -> wma, a strange problem happens. The audio appears to be
fast forwarded ( i guess that maybe the frame rate has gone high). I think
that somewhere i have  made a wrong assignment of values or maybe due to the
av_write_frame, which compresses the frame.  The code is given below. Any
help will be appreciated.... Thanks in Advance

---loop for reading packets---

len = avcodec_decode_audio(pCodecCtx,outBuf, &outBufSize,packet.data,
outPacket.size = avcodec_encode_audio(outCodecCtx,output, len, outBuf);

/* write the compressed frame in the media file */
// Comment: Is this Compression causing the above mentioned problem ?????
if (av_write_frame(outFormatCtx, &outPacket) != 0)  //
     fprintf(stderr, "Error while writing audio frame\n");

---End of loop for reading packets---

More information about the ffmpeg-devel mailing list