<div>Hi,</div><div> </div><div>    I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong.</div><div> </div><div>note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully!</div><div> </div><div>============program=================</div><div>main()</div><div>{<br> int ret;<br> AVCodec *codec;<br> AVCodecContext *c;<br> AVFrame *frame; </div><div> </div><div> avcodec_register_all();<br> codec = avcodec_find_encoder(AV_CODEC_ID_AAC);<br> if (!codec)  return;<br> //avcodec_register(codec);<br> c = avcodec_alloc_context3(codec);<br> if (!c)  return;</div><div> </div><div> c->bit_rate = 64000;<br> c->sample_rate    = 44100;<br> c->channels       = 2;<br> c->frame_size = 88200;<br> c->sample_fmt = AV_SAMPLE_FMT_S16;<br> // open it <br> ret = avcodec_open2(c, codec, NULL);<br> if (ret >= 0)  printf("OK\r\n");</div><div>}</div><div> </div><div>Best Regards,</div><div>Justin</div>