AVCodecContext c;
c->bit_rate = 400000;
c->width = width;
c->height = height;
c->time_base = avRate;
c->lmin = 1;
c->lmax = 1000;
c->me_method = 8;
c->me_range = 16;
c->me_subpel_quality = 7;
c->qmin = 10;
c->qmax = 51;
c->gop_size = 12; / emit one intra frame every twelve frames at most */
c->pix_fmt = PIX_FMT_YUV420P;
if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
c->max_b_frames = 2;
}
if (c->codec_id == CODEC_ID_MPEG1VIDEO){
c->mb_decision=2;
avcodec_open2宽度和高度不同时有时打开成功,有时失败,如1366*768打开成功,1365*767打开失败