To do it "right" you would need to check for compatible hardware and its features. Features differ not only by hardware but also by codec. (Not that I suggest it must be done "right". Some basic integration with letting the user handle the rest is fine.)
https://github.com/rigaya/NVEnc/blob...--check-device
https://github.com/rigaya/NVEnc/blob...--check-hw-int
https://github.com/rigaya/NVEnc/blob...k-features-int
For me:
Code:
nvencc64 --check-device
DeviceId #0: GeForce GTX 1660 Ti
nvencc64 --check-hw
NVEncC (x64) 4.45 (r1169) by rigaya, Aug 19 2019 11:47:02 (VC 1916/Win/avx2)
[NVENC API v9.0, CUDA 10.1]
reader: raw, avi, avs, vpy, avhw [H.264/AVC, H.265/HEVC, MPEG2, VP8, VP9, VC-1,
MPEG1, MPEG4]
Loaded nvEncodeAPI64.dll.
InitCuda: device #0.
Checking Environment Info...
NVEncC (x64) 4.45 (r1169) by rigaya, Aug 19 2019 11:47:02 (VC 1916/Win/avx2)
OS Version Windows 7 x64 (7601)
CPU Intel Core i5-2500K @ 3.30GHz [TB: 3.70GHz] (4C/4T)
GPU #0: GeForce GTX 1660 Ti (431.60)
NVENC / CUDA NVENC API 9.0, CUDA 10.1, schedule mode: auto
cuInit: Success.
cuDeviceGetCount: Success.
cuDeviceGet: ID:0.
cuDeviceComputeCapability: Success: 7.5.
NVENC capabilities: OK.
using cuda schedule mode: auto.
cuCtxCreate: Success.
cuCtxPopCurrent: Success.
cuvidInit: Success.
cuvidCtxLockCreate: Success.
InitCuda: Success.
nvEncodeAPICreateInstance(APIVer=0x70020009): Success.
NvEncOpenEncodeSessionEx(device_type=NV_ENC_DEVICE_TYPE_CUDA): Success.
nvEncDestroyEncoder: success.
Closing perf monitor...
Avaliable Codec(s)
H.264/AVC
H.265/HEVC
nvencc64 --check-features
NVEncC (x64) 4.45 (r1169) by rigaya, Aug 19 2019 11:47:02 (VC 1916/Win/avx2)
[NVENC API v9.0, CUDA 10.1]
reader: raw, avi, avs, vpy, avhw [H.264/AVC, H.265/HEVC, MPEG2, VP8, VP9, VC-1,
MPEG1, MPEG4]
Environment Info
OS : Windows 7 x64 (7601)
CPU: Intel Core i5-2500K @ 3.30GHz [TB: 3.70GHz] (4C/4T)
RAM: Used 4099 MB, Total 16337 MB
GPU: #0: GeForce GTX 1660 Ti (1536 cores, 1875 MHz)[PCIe2x16][431.60]
List of available features.
Codec: H.264/AVC
Max Bframes 4
B Ref Mode yes
RC Modes 63
Field Encoding no
MonoChrome no
FMO no
Quater-Pel MV yes
B Direct Mode yes
CABAC yes
Adaptive Transform yes
Max Temporal Layers 0
Hierarchial P Frames no
Hierarchial B Frames no
Max Level 51
Min Level 1
4:4:4 yes
Max Width 4096
Max Height 4096
Dynamic Resolution Change yes
Dynamic Bitrate Change yes
Forced constant QP yes
Dynamic RC Mode Change no
Subframe Readback yes
Constrained Encoding yes
Intra Refresh yes
Custom VBV Bufsize yes
Dynamic Slice Mode yes
Ref Pic Invalidiation yes
PreProcess no
Async Encoding yes
Max MBs 65536
Lossless yes
SAO no
Me Only Mode yes
Lookahead yes
AQ (temporal) yes
Weighted Prediction yes
Max LTR Frames 8
10bit depth no
Codec: H.265/HEVC
Max Bframes 5
B Ref Mode yes
RC Modes 63
Field Encoding no
MonoChrome no
Quater-Pel MV yes
B Direct Mode no
Max Temporal Layers 0
Hierarchial P Frames no
Hierarchial B Frames no
Max Level 62
Min Level 1
4:4:4 yes
Max Width 8192
Max Height 8192
Dynamic Resolution Change yes
Dynamic Bitrate Change yes
Forced constant QP yes
Dynamic RC Mode Change no
Subframe Readback yes
Constrained Encoding no
Intra Refresh yes
Custom VBV Bufsize yes
Dynamic Slice Mode yes
Ref Pic Invalidiation yes
PreProcess no
Async Encoding yes
Max MBs 262144
Lossless yes
SAO yes
Me Only Mode yes
Lookahead yes
AQ (temporal) yes
Weighted Prediction yes
Max LTR Frames 7
10bit depth yes