diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index 18f65b9ae7..a4731a652a 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -33,6 +33,10 @@ extern char* passtmpfile; #include "libavcodec/avcodec.h" #endif +#if LIBAVCODEC_BUILD < 4601 +#error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG +#endif + extern int avcodec_inited; /* video options */ @@ -48,8 +52,12 @@ static int lavc_param_vqmax = 15; static int lavc_param_vqdiff = 3; static float lavc_param_vqcompress = 0.5; static float lavc_param_vqblur = 0.5; +static float lavc_param_vb_qfactor = 2.0; static int lavc_param_vmax_b_frames = 0; static int lavc_param_keyint = -1; +static int lavc_param_vpass = 0; +static int lavc_param_vrc_strategy = 2; +static int lavc_param_vb_strategy = 0; #include "cfgparser.h" @@ -67,7 +75,11 @@ struct config lavcopts_conf[]={ {"vqdiff", &lavc_param_vqdiff, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL}, {"vqcomp", &lavc_param_vqcompress, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL}, {"vqblur", &lavc_param_vqblur, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL}, + {"vb_qfactor", &lavc_param_vb_qfactor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 31.0, NULL}, {"vmax_b_frames", &lavc_param_vmax_b_frames, CONF_TYPE_INT, CONF_RANGE, 0, FF_MAX_B_FRAMES, NULL}, + {"vpass", &lavc_param_vpass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, + {"vrc_strategy", &lavc_param_vrc_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, + {"vb_strategy", &lavc_param_vb_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL}, {"keyint", &lavc_param_keyint, CONF_TYPE_INT, 0, 0, 0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; @@ -112,6 +124,10 @@ static int config(struct vf_instance_s* vf, lavc_venc_context.qcompress= lavc_param_vqcompress; lavc_venc_context.qblur= lavc_param_vqblur; lavc_venc_context.max_b_frames= lavc_param_vmax_b_frames; + lavc_venc_context.b_quant_factor= lavc_param_vb_qfactor; + lavc_venc_context.rc_strategy= lavc_param_vrc_strategy; + lavc_venc_context.b_frame_strategy= lavc_param_vb_strategy; + /* keyframe interval */ if (lavc_param_keyint >= 0) /* != -1 */ lavc_venc_context.gop_size = lavc_param_keyint; @@ -128,6 +144,12 @@ static int config(struct vf_instance_s* vf, lavc_venc_context.flags|= lavc_param_v4mv ? CODEC_FLAG_4MV : 0; + /* lavc internal 2pass bitrate control */ + if(lavc_param_vpass==1) + lavc_venc_context.flags|= CODEC_FLAG_PASS1; + else if(lavc_param_vpass==2) + lavc_venc_context.flags|= CODEC_FLAG_PASS2; + #ifdef ME_ZERO // workaround Juanjo's stupid incompatible change: motion_estimation_method = lavc_param_vme;