X264 码率控制不了啊
这个是我的参数设置
。。。
pX264Handle->g_param->rc.i_qp_constant = ctx->quality;//20
pX264Handle->g_param->rc.i_qp_max = 51;
pX264Handle->g_param->rc.i_qp_min = 10;
pX264Handle->g_param->rc.i_rc_method = ctx->rc_mode;//1
pX264Handle->g_param->rc.i_bitrate= ctx->bit_rate;//40
pX264Handle->g_param->rc.i_vbv_max_bitrate = ctx->bit_rate*2;
pX264Handle->g_param->rc.f_rate_tolerance = 1.0;
if (ctx->key_frame_interval)
pX264Handle->g_param->i_keyint_max = ctx->key_frame_interval;
//int i_keyint_min;
if (ctx->csp == X264_CSP_I420 || ctx->csp == X264_CSP_YV12)
{
p_read_frame = ReadYUV_BUF;
ctx->data_in_size = (ctx->width) * (ctx->height) * 3/2; // 一帧原始数据的大小, YV12 = w*h*3/2, RGB24 = w*h*3
}
else if (ctx->csp == (X264_CSP_BGR | X264_CSP_VFLIP))
{
p_read_frame = ReadRGB_BUF;
ctx->data_in_size = (ctx->width) * (ctx->height) * 3; // 一帧原始数据的大小, YV12 = w*h*3/2, RGB24 = w*h*3
}
else//defalut BGR
{
p_read_frame = ReadRGB_BUF;
ctx->data_in_size = (ctx->width) * (ctx->height) * 3;
}
ctx->data_in = new unsigned char[ctx->data_in_size];//
ctx->data_out = new unsigned char[(ctx->width) * (ctx->height) * 3];//多少合适?
if( ( pX264Handle->g_h = x264_encoder_open( pX264Handle->g_param ) ) == NULL )
{
return FALSE;
}
x264_picture_alloc( pX264Handle->g_pic, ctx->csp, ctx->width, ctx->height );
我设置为恒定码率 大小40 怎么有时候上传的带宽会飙到170多啊
要怎么设置啊 才能使我发送的流所占的带宽 比较稳定啊
求大神教导