高血压专题网,内容丰富有趣,生活中的好帮手!
高血压专题网 > 码率控制方式选择

码率控制方式选择

时间:2018-08-11 22:27:59

相关推荐

码率控制方式选择

同码率下的图像质量或同图像质量下的码率。

AVCodecContext

/**

* the average bitrate

* - encoding: Set by user; unused for constant quantizer encoding.

* - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.

*/

// int bit_rate;

/**

* CODEC_FLAG_*.

* - encoding: Set by user.

* - decoding: Set by user.

*/

int flags;

/**

* CODEC_FLAG2_*

* - encoding: Set by user.

* - decoding: Set by user.

*/

int flags2;

}

static int

X264_init(AVCodecContext *avctx)函数中,libx264.c中

x4->params.i_keyint_max = avctx->gop_size;

x4->params.rc.i_bitrate = avctx->bit_rate / 1000;

x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;

x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;

x4->params.rc.b_stat_write = (avctx->flags & CODEC_FLAG_PASS1);

//#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.

//#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.

if(avctx->flags & CODEC_FLAG_PASS2) x4->params.rc.b_stat_read = 1;//h->param.rc.i_rc_method == X264_RC_ABR && h->param.rc.b_stat_read;

else{

if(avctx->crf){//crf的默认值为24或是26;

x4->params.rc.i_rc_method = X264_RC_CRF;//参数i_rc_method表示码率控制,CQP(恒定质量),CRF(恒定码率),ABR(平均码率)

x4->params.rc.f_rf_constant = avctx->crf;

}else if(avctx->cqp > -1){

x4->params.rc.i_rc_method = X264_RC_CQP;//CQP生效,必须要设置crf=0 //固定量化模式并设置使用的量化值,范围0~51,0为无损压缩,默认26

x4->params.rc.i_qp_constant = avctx->cqp;

}

}

// if neither crf nor cqp modes are selected we have to enable the RC

// we do it this way because we cannot check if the bitrate has been set

if(!(avctx->crf || (avctx->cqp > -1))) //只有设置CRF=0和cqb为-1时,ABR才有效

x4->params.rc.i_rc_method = X264_RC_ABR;//#define X264_RC_ABR 平均码率 2

x4->params.i_bframe = avctx->max_b_frames;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
码率控制技术原理

码率控制技术原理

2020-05-27

码率控制模式

码率控制模式

2020-07-24

FFmpeg码率控制

FFmpeg码率控制

2021-02-15

码率控制

码率控制

2019-05-22