<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div>Hi , I'm trying to encode and decode audio with the</div><div>Vorbis Codec, but it is not successfull. </div><div>This is how I set the encoder:</div><div style="color: rgb(0, 0, 0); font-size: 18.6667px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">   </span><font size="2">pCodecRawCodec = avcodec_find_encoder((AVCodecID)AV_CODEC_ID_VORBIS);<br>                    if(!pCodecRawCodec)<br>                    {<br>       
                 printf("codec not found\n");<br>                        return -1;<br>                    }<br>                    pCodecContextRawCodec = avcodec_alloc_context3(pCodecRawCodec);<br>                    pCodecContextRawCodec->bit_rate = pCodecContextRawInit->bit_rate;<br>                    pCodecContextRawCodec->sample_rate = pCodecContextRawInit->sample_rate;<br>                   
 pCodecContextRawCodec->channels = pCodecContextRawInit->channels;<br>                    pCodecContextRawCodec->sample_fmt = AV_SAMPLE_FMT_FLT;<br>           <br>                    pCodecContextRawCodec->channel_layout = select_channel_layout(pCodecRawCodec);<br><br>                    if(avcodec_open2(pCodecContextRawCodec,pCodecRawCodec,NULL)<0)<br>                    {<br>                        printf("could not open codec audio\n");<br>               
     }</font></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="4">And this is how I set the Vorbis decoder :</font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><font size="2">pCodecCodecRaw =
 avcodec_find_decoder((AVCodecID)AV_CODEC_ID_VORBIS);<br>                        if(!pCodecCodecRaw)<br>                        {<br>                            printf("error found decoder \n");<br><br>                            return -1;<br>                        }<br>                        pCodecContextCodecRaw = avcodec_alloc_context3(pCodecCodecRaw);<br>   
                     pCodecContextCodecRaw->bit_rate = pCodecContextRawInit->bit_rate;<br>                        pCodecContextCodecRaw->sample_rate = pCodecContextRawInit->sample_rate;<br>                        pCodecContextCodecRaw->channels = pCodecContextRawInit->channels;<br>                        pCodecContextCodecRaw->sample_fmt = AV_SAMPLE_FMT_FLT;<br>                        pCodecContextCodecRaw->channel_layout = select_channel_layout(pCodecRawCodec);<br>       
                 pCodecContextCodecRaw->extradata = pCodecContextRawCodec->extradata;<br>                        pCodecContextCodecRaw->extradata_size = pCodecContextRawCodec->extradata_size;<br><br>                        if(avcodec_open2(pCodecContextCodecRaw,pCodecCodecRaw,NULL)<0)<br>                        {<br>                            printf("could not open codec decoder vp8\n");<br>                       
 }</font></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4">I get sometimes the error  "[libvorbis @ 01e03340] packet buffer is too small" by <br></font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4">encoding the raw packet. And when I think the encoding and decoding was</font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4"> successfull without errors, the
 file has only zeros, that cant be read as raw audio data.</font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4">There is a mistake that I make by set the AVCodecContext for Vorbis ?</font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4">Any idea would be very helpfull, thnx.</font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font
 size="4">arctor<br></font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4"><br></font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4"><br></font></font></div><div style="color: rgb(0, 0, 0); font-size: 18px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><font size="2"><font size="4"> </font><br></font></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style:
 normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div></div></body></html>