Hi , I'm trying to encode and decode audio with the
Vorbis Codec, but it is not successfull. 
This is how I set the encoder:
               pCodecRawCodec = 
avcodec_find_encoder((AVCodecID)AV_CODEC_ID_VORBIS);
                    if(!pCodecRawCodec)
                    {
                        printf("codec not found\n");
                        return -1;
                    }
                    pCodecContextRawCodec = 
avcodec_alloc_context3(pCodecRawCodec);
                    pCodecContextRawCodec->bit_rate = 
pCodecContextRawInit->bit_rate;
                    pCodecContextRawCodec->sample_rate = 
pCodecContextRawInit->sample_rate;
                    pCodecContextRawCodec->channels = 
pCodecContextRawInit->channels;
                    pCodecContextRawCodec->sample_fmt = AV_SAMPLE_FMT_FLT;
           
                    pCodecContextRawCodec->channel_layout = 
select_channel_layout(pCodecRawCodec);

                    
if(avcodec_open2(pCodecContextRawCodec,pCodecRawCodec,NULL)<0)
                    {
                        printf("could not open codec audio\n");
                    }

And this is how I set the Vorbis decoder :

                pCodecCodecRaw = 
avcodec_find_decoder((AVCodecID)AV_CODEC_ID_VORBIS);
                        if(!pCodecCodecRaw)
                        {
                            printf("error found decoder \n");

                            return -1;
                        }
                        pCodecContextCodecRaw = 
avcodec_alloc_context3(pCodecCodecRaw);
                        pCodecContextCodecRaw->bit_rate = 
pCodecContextRawInit->bit_rate;
                        pCodecContextCodecRaw->sample_rate = 
pCodecContextRawInit->sample_rate;
                        pCodecContextCodecRaw->channels = 
pCodecContextRawInit->channels;
                        pCodecContextCodecRaw->sample_fmt = AV_SAMPLE_FMT_FLT;
                        pCodecContextCodecRaw->channel_layout = 
select_channel_layout(pCodecRawCodec);
                        pCodecContextCodecRaw->extradata = 
pCodecContextRawCodec->extradata;
                        pCodecContextCodecRaw->extradata_size = 
pCodecContextRawCodec->extradata_size;

                        
if(avcodec_open2(pCodecContextCodecRaw,pCodecCodecRaw,NULL)<0)
                        {
                            printf("could not open codec decoder vp8\n");
                        }

I get sometimes the error  "[libvorbis @ 01e03340] packet buffer is too small" 
by 

encoding the raw packet. And when I think the encoding and decoding was
 successfull without errors, the file has only zeros, that cant be read as raw 
audio data.
There is a mistake that I make by set the AVCodecContext for Vorbis ?
Any idea would be very helpfull, thnx.

arctor
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to