[Ffmpeg-devel] Audio corruption creating .mov with avcodec_encode_audio

Ben Weekes ben.weekes
Wed Sep 6 20:02:20 CEST 2006


On occasion, when we write raw audio to a file (together with YUV using
av_write_frame) the sound becomes corrupted with a violent, jerky sound.


Do you know what could be causing this?


The audio is fine as when writing it simultaneously to a WAV file and
replaying it sounds fine


We are doing this to create the .mov file 


    pkt.size=avcodec_encode_audio(c, audio_outbuf, AUDIO_LEN,  (short *)

    pkt.pts= c->coded_frame->pts;

    pkt.flags |= PKT_FLAG_KEY;

    pkt.stream_index= st->index;

    pkt.data= audio_outbuf;


    PWaitAndSignal mutex(write_audio_mutex);

    if (av_write_frame(oc, &pkt) != 0) {

        p.Logger("write_audio_frame Error while writing audio frame");






Any help greatly appreciated




More information about the ffmpeg-devel mailing list