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

Renjith Nair renjith4
Fri Mar 10 12:34:02 CET 2006


I replaced the

av_write_frame(outFormatCtx, &outPacket)    with

fwrite(output, 1, outPacket.size, f)

and the problem is still  the same. That means it is not a problem with
writing it as a packet or as a frame. But may be  due to some other
parameters which were assigned wrong values. Thanks in advance for any
suggestion.

Regards,
Renjith

On 3/10/06, Renjith Nair <renjith4 at gmail.com> wrote:
>
> 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,
> packet.size);
> 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");
>      exit(1);
>  }
>
> ---End of loop for reading packets---
>




More information about the ffmpeg-devel mailing list