<div dir="ltr"><div><div><div>Hi,<br></div>I have written a c++ code for audio transcoding.. From any given format to any output audio format..<br></div><div>I have trouble creating a ".mka" file with vorbis codec.<br>

</div><br></div>In my code after adding a stream , I am setting the following fields for codec context. (AVCodecContext * enc_ctx)<br><br>                enc_ctx -> codec_id = codec_id;<br>                enc_ctx -> codec_type = AVMEDIA_TYPE_AUDIO;<br>

                enc_ctx -> bit_rate = 128000;<br>                enc_ctx -> sample_rate = 22050;<br>                enc_ctx -> sample_fmt = AV_SAMPLE_FMT_FLTP;<br>                enc_ctx -> channels = 1;<br>                enc_ctx -> channel_layout = av_get_default_channel_layout(enc_ctx -> channels);<br>

                enc_ctx -> global_quality = 6;<br>                enc_ctx -> rc_min_rate = 64000;<br>                enc_ctx -> rc_max_rate = 128000 * 1.5;<br><br><div>However when I call avcodec_open2(), it gives the following error.<br>

<br>               [libvorbis @ 0x14c7100] encoder setup failed<br><br></div><div>This code is working fine for .wav .aac and .ogg(with FLAC) formats. <br></div><div>Can someone tell what more I have to do for vorbis?<br>

<br></div><div>The full code is at <a href="http://stackoverflow.com/questions/20439640/ffmpeg-audio-transcoding-using-libav-libraries.">http://stackoverflow.com/questions/20439640/ffmpeg-audio-transcoding-using-libav-libraries.</a><br>

</div><div><br></div><div><br clear="all"></div><div><div><div><div><div><div><div><br>-- <br>Vinod<br><br>
</div></div></div></div></div></div></div></div>