diff options
author | sr55 <[email protected]> | 2019-08-10 18:33:01 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-08-12 18:41:57 +0100 |
commit | fa2e8213e7f88ec261c74368761d855ae0b2ac86 (patch) | |
tree | 2ea3a96f2a1187614ed33c29e8acc04e82dca4db /libhb | |
parent | 13e5cd724c65163a96385ad433f399a382b5d20a (diff) |
nvenc: Change the rate control to vbr_hq, setting qmin/qmax #2231
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/encavcodec.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index e68cc3aa4..0dcafcadb 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -338,12 +338,13 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) char qualityI[7]; char quality[7]; char qualityB[7]; + double adjustedQualityI = job->vquality - 2; double adjustedQualityB = job->vquality + 2; if (adjustedQualityB > 51) { adjustedQualityB = 51; } - + if (adjustedQualityI < 0){ adjustedQualityI = 0; } @@ -351,17 +352,23 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) snprintf(quality, 7, "%.2f", job->vquality); snprintf(qualityI, 7, "%.2f", adjustedQualityI); snprintf(qualityB, 7, "%.2f", adjustedQualityB); - av_dict_set( &av_opts, "rc", "constqp", 0 ); + + context->bit_rate = 0; + + av_dict_set( &av_opts, "rc", "vbr_hq", 0 ); av_dict_set( &av_opts, "cq", quality, 0 ); + av_dict_set( &av_opts, "qmin", quality, 0 ); + av_dict_set( &av_opts, "qmax", quality, 0 ); // further Advanced Quality Settings in Constant Quality Mode av_dict_set( &av_opts, "init_qpP", quality, 0 ); av_dict_set( &av_opts, "init_qpB", qualityB, 0 ); av_dict_set( &av_opts, "init_qpI", qualityI, 0 ); - hb_log( "encavcodec: encoding at rc=constqp QP %.2f", job->vquality ); + hb_log( "encavcodec: encoding at rc=vbr %.2f", job->vquality ); // Force IDR frames when we force a new keyframe for chapters av_dict_set( &av_opts, "forced-idr", "1", 0 ); + } else if ( job->vcodec == HB_VCODEC_FFMPEG_VCE_H264 || job->vcodec == HB_VCODEC_FFMPEG_VCE_H265 ) { |