日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

码率控制方式选择

發布時間:2023/12/10 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 码率控制方式选择 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

同碼率下的圖像質量或同圖像質量下的碼率。

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;


總結

以上是生活随笔為你收集整理的码率控制方式选择的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。