Repository navigation
Conversation
Patch for HandBrake#974 moving to FFMPEG 3.4 from LIBAV 12.2. All patches have been moved to subfolder 'old' since they do not apply cleanly anymore. Work has to be performed to validate whether patches are still required. The re-ordering of to be linked modules was required to solve statically linked dependencies. See libhb/module.defs etc.
… and mirror qsv_h264 values
Basically working: - h264_nvenc - hevc_nvenc Possible optimization: - Even in constant quality mode, a user ceiling bit_rate might be desirable, currently only the maximum is used like in VP8/9: w x h x fps Remaining issues: 1) Muxer issue with h264_nvenc + MKV, ffprobe shows: [h264 @ 0x55ae4dedacc0] sps_id 32 out of range [h264 @ 0x55ae4dedacc0] Invalid nal size 1677734572 [h264 @ 0x55ae4dedacc0] missing picture in access unit with size 40644 Notable: This does not happen with hevc_nvenc Tested: - GNU/Linux Debian 9 - GeForce GTX 950 - BD 1080p source, cropped: Around 70fps h264 + hevc
Adding 'rc-lookahead 32, init_qp 1, spatial_aq 1, aq-strength 8' for h264 and hevc in case of VBR CQ mode, see <https://devtalk.nvidia.com/default/topic/1013152/video-technologies/crf-for-nvenc/post/5179877/#5179877> and NVENC_VideoEncoder_API_ProgGuide.pdf v08 Chapter 8 p27, as well as Table 1 p33.
|
Encoding to h265-nvenc gives me (similar with h264-nvenc) an error code in the end despite proper results/artifacts, see below. Working a bit on the fine details and will also change the type defines to 'FF_NVENC' specific one from the Handbrake view, since this code path is specific. [15:22:24] work: average encoding speed for job is 73.192154 fps |
| #define HB_VCODEC_FFMPEG_VP8 0x0000040 | ||
| #define HB_VCODEC_FFMPEG_VP9 0x0000080 | ||
| #define HB_VCODEC_FFMPEG_VP9 0x0000050 | ||
| #define HB_VCODEC_FFMPEG_H264 0x0000070 |
There was a problem hiding this comment.
I don't have time to do a full review at the moment. But noticed this during a quick scan.
This should be HB_VCODEC_NVENC_H264 and HB_VCODEC_NVENC_H265. "FFMPEG" is too generic. FFMPEG_VP9 is a bad example to follow unfortunately, it should have been LIBVPX_VP9 or some such.
| } break; | ||
| case AV_CODEC_ID_H264: | ||
| { | ||
| codec = avcodec_find_encoder_by_name("h264_nvenc"); |
There was a problem hiding this comment.
Although not strictly necessary at this time, this should be:
case AV_CODEC_ID_H264:
{
if (job->vcodec == HB_VCODEC_NVENC_H264)
{
codec = avcodec_find_encoder_by_name("h264_nvenc");
}
else
{
hb_error("encavcodecInit: unsupported encoder!");
ret = 1;
goto done;
}
} break;
In the future, there will be other h.264 encoders that use this path.
| if( w->codec_param == AV_CODEC_ID_HEVC ) { | ||
| av_dict_set( &av_opts, "spatial_aq", "1", 0 ); // oops, nvenc_hevc.c uses an underscore | ||
| } else { | ||
| av_dict_set( &av_opts, "spatial-aq", "1", 0 ); // oops, nvenc_h264.c uses a dash |
There was a problem hiding this comment.
We should be able to bring these options though the extra arguments string, split that and feed those to the encoder. Having full control over the encoder is defiantly preferable.
| /****************************************************************************** | ||
| * hb_job_t: settings to be filled by the UI | ||
| * Update win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs when changing this struct | ||
| * Update win/CS/HandBrake.ApplicationServices/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs when changing this struct |
There was a problem hiding this comment.
Something odd happened with this commend. It was incorrect. HandBrake.Interop is gone. Correct path is: HandBrake.ApplicationServices\Interop\HbLib
@sr55 'Something odd happened with this comment. It was incorrect. HandBrake.Interop is gone. Correct path is: HandBrake.ApplicationServices\Interop\HbLib' HandBrake#983 (comment)
Replacing pull request #971
Working on issue #259
Re-created branch https://github.com/sgothel/HandBrake/tree/nvenc-encoder
This is on top of FFMPEG pull request #981
and issue #974
i.e. my branch https://github.com/sgothel/HandBrake/tree/ffmpeg
WIP