使用libavcodec的mpeg1编码性能低下

时间:2012-07-10 07:55:49

标签: libavcodec

我正在使用mpeg1编解码器来创建我的HD和SD内容的代理视频。 Mpeg1分辨率和比特率是; 对于高清视频代理:704x576 4.5 Mbit 对于SD视频代理:352x288 1.5 Mbit

我的视频像这样; 怎样才能获得更多性能来改变任何参数...

最诚挚的问候,

AVCodecContext *c = &m_OutputCodecCtxVideo;
avcodec_get_context_defaults2( c, AVMEDIA_TYPE_VIDEO );
c->codec_id = CODEC_ID_MPEG1VIDEO;
c->codec_type = AVMEDIA_TYPE_VIDEO;
c->pix_fmt = PIX_FMT_YUV420P; 
if( bHD ){
    c->width = 704; 
    c->height = 576; 
    c->sample_aspect_ratio.num = 16;
    c->sample_aspect_ratio.den = 11;    
    c->bit_rate = 4500000; 
}
else{
    c->width = 352; 
    c->height = 288; 
    c->sample_aspect_ratio.num = 12;
    c->sample_aspect_ratio.den = 11;
    c->bit_rate = 1500000; 
}
c->time_base.num = 1; 
c->time_base.den = 25; 
c->gop_size = 15; 
c->max_b_frames = 2; 
//      Needed to avoid using macroblocks in which some coeffs overflow.
//      This does not happen with normal video, it just happens here as
//      the motion of the chroma plane does not match the luma plane.
c->mb_decision = 2;
// some formats want stream headers to be separate
if( m_pFormatCtxDst->oformat->flags & AVFMT_GLOBALHEADER )
    c->flags |= CODEC_FLAG_GLOBAL_HEADER;

m_OutputCodecCtxVideo.thread_count = 0;

0 个答案:

没有答案