Skip to content

Commit

Permalink
Correct QP range when using ffmpeg VCE H265
Browse files Browse the repository at this point in the history
By default ffmpeg restricts qp factors to a range of 2 to 31, unless otherwise overwritten. This significantly constrains the low bitrate performance of VCE in H.264 mode.
This should fix issue HandBrake#3447 and could also address parts of issue HandBrake#2980.
  • Loading branch information
PMunkes committed Mar 4, 2021
1 parent 6cf536e commit a6d3fce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libhb/encavcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )

if ( job->vcodec == HB_VCODEC_FFMPEG_VCE_H264 || job->vcodec == HB_VCODEC_FFMPEG_VCE_H265 ) {
av_dict_set( &av_opts, "rc", "vbr_peak", 0 );
//Work around an ffmpeg issue mentioned in issue #3447
if (job->vcodec == HB_VCODEC_FFMPEG_VCE_H265)
{
av_dict_set( &av_opts, "min_qp_i", 1, 0 );
av_dict_set( &av_opts, "min_qp_p", 1, 0 );

av_dict_set( &av_opts, "max_qp_i", 51, 0 );
av_dict_set( &av_opts, "max_qp_p", 51, 0 );
}
hb_log( "encavcodec: encoding at rc=vbr_peak Bitrate %d", job->vbitrate );
}

Expand Down

0 comments on commit a6d3fce

Please sign in to comment.