Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specified level for AV1 crashes #645

Closed
Dendraspis opened this issue Nov 14, 2024 · 5 comments
Closed

Specified level for AV1 crashes #645

Dendraspis opened this issue Nov 14, 2024 · 5 comments

Comments

@Dendraspis
Copy link
Contributor

Dendraspis commented Nov 14, 2024

Hello rigaya,

this one seems to be similar to #612 , but also different.
When using AV1 codec with
--qvbr 16 --codec av1 --preset P7 --profile high --tier 1
the encode starts and finishes, but the media info says that the Main Profile was used instead of the set High Profile, which I guess is sort of not okay:

Video
ID                             : 1
Format                         : AV1
Format/Info                    : AOMedia Video 1
Format profile                 : Main@L4.0
Codec ID                       : V_AV1
Duration                       : 3 min 33 s
Bit rate                       : 4 875 kb/s
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 25.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.094
Stream size                    : 124 MiB (100%)
Default                        : No
Forced                         : No
Color range                    : Limited

When the profile is not specified, the result is the same, which is okay in this case.

But:
No matter if you set a profile or not, no matter which tier to set: When you specify a level, for example the level 4.0 that the encoder used before, you get an error message:

nvenc : Failed to Initialize the encoder
nvenc : .: 8 (NVENC indicates that one or more of the parameter passed to the API call is invalid.)

Used command line:
NVEncC64.exe --avsdll [..]\AviSynth.dll --qvbr 16 --codec av1 --preset P7 --level 4 -i [..]\XXX_NVEncC-Test_new.avs -o [..]\XXX_NVEncC-Test_new_out.mkv
Messages got with --log-level debug:

cuInit: Success.
cuvidInit: Success.
InitCuda: Success.
gpuinfo: checking for DX11 device #0.
devDX11: EnumAdapters 0...
devDX11: InitDX11() success.
gpuinfo: Init DX11 device 59549056.
gpuinfo:   cuDeviceGet:DX11(0): success: 0
gpuinfo:   cuDeviceGetName(0): NVIDIA GeForce RTX 4070 Ti
gpuinfo:   cudaDeviceGetAttribute: CUDA 8.9
gpuinfo:   PCIBusId: 0000:0A:00.0
gpuinfo:   Got GPU Info from NVML.
gpuinfo:   NV Driver version: 535980.
gpuinfo:   CUDA Driver version: 12020.
gpuinfo: using cuda schedule mode: auto.
gpuinfo: cuCtxCreate: Success.
gpuinfo: cuCtxPopCurrent: Success.
gpuinfo: cuvidCtxLockCreate: Success.
nvenc : Loaded nvEncodeAPI64.dll.
nvenc : nvEncodeAPICreateInstance(APIVer=0x200000c: 12.2): Success.
nvenc : Failed to open Encode Session as API ver 12.2
nvenc : nvEncodeAPICreateInstance(APIVer=0x100000c: 12.1): Success.
nvenc : Opened Encode Session (API ver 12.1)
nvenc : NvEncOpenEncodeSessionEx(device_type=NV_ENC_DEVICE_TYPE_CUDA): Success.
nvenc : m_pEncodeAPI->nvEncGetEncodeGUIDCount: 3.
nvenc : Found codec H.264/AVC.
nvenc : Found codec H.265/HEVC.
nvenc : Found codec AV1.
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 6.
nvenc : Found H.264/AVC baseline profile.
nvenc : Found H.264/AVC main profile.
nvenc : Found H.264/AVC high profile.
nvenc : Found H.264/AVC Unknown profile.
nvenc : Found H.264/AVC high444 profile.
nvenc : Found H.264/AVC auto profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 17.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 9.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yuv444 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 4.
nvenc : Found H.265/HEVC Unknown profile.
nvenc : Found H.265/HEVC main profile.
nvenc : Found H.265/HEVC main10 profile.
nvenc : Found H.265/HEVC main444 profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 17.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 11.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yuv444 
nvenc : yv12(10bit) 
nvenc : yuv444(10bit) 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 2.
nvenc : Found AV1 Unknown profile.
nvenc : Found AV1 main profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 7.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 9.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yv12(10bit) 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
gpuinfo:   createDeviceFeatureList
nvenc : nvEncDestroyEncoder...
nvenc : nvEncDestroyEncoder: success.
InitDeviceList: Success.
GPU #0 (NVIDIA GeForce RTX 4070 Ti) available for encode.
CheckGPUListByEncoder: Success.
GPUAutoSelect: Success.
Set csp thread param: all (0x0xffffff), priority=normal, throttling=auto.
avs reader selected.
InitInput: input selected : 4.
avs: Load Avisynth DLL "[..]\AviSynth.dll".
avs: opened avs file: "[..]\XXX_NVEncC-Test_new.avs"
avs: found video from avs file, pixel type 0xa0000010.
avs: AviSynth+ 3.7.3 r4003(yv12)->nv12 [AVX2], 1920x1080, 25/1 fps
InitInput: Success.
InitDevice: device #0 (NVIDIA GeForce RTX 4070 Ti) selected.
nvenc : Loaded nvEncodeAPI64.dll.
nvenc : nvEncodeAPICreateInstance(APIVer=0x200000c: 12.2): Success.
nvenc : Failed to open Encode Session as API ver 12.2
nvenc : nvEncodeAPICreateInstance(APIVer=0x100000c: 12.1): Success.
nvenc : Opened Encode Session (API ver 12.1)
nvenc : NvEncOpenEncodeSessionEx(device_type=NV_ENC_DEVICE_TYPE_CUDA): Success.
nvenc : m_pEncodeAPI->nvEncGetEncodeGUIDCount: 3.
nvenc : Found codec H.264/AVC.
nvenc : Found codec H.265/HEVC.
nvenc : Found codec AV1.
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 6.
nvenc : Found H.264/AVC baseline profile.
nvenc : Found H.264/AVC main profile.
nvenc : Found H.264/AVC high profile.
nvenc : Found H.264/AVC Unknown profile.
nvenc : Found H.264/AVC high444 profile.
nvenc : Found H.264/AVC auto profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 17.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 9.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yuv444 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 4.
nvenc : Found H.265/HEVC Unknown profile.
nvenc : Found H.265/HEVC main profile.
nvenc : Found H.265/HEVC main10 profile.
nvenc : Found H.265/HEVC main444 profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 17.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 11.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yuv444 
nvenc : yv12(10bit) 
nvenc : yuv444(10bit) 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : m_pEncodeAPI->nvEncGetEncodeProfileGUIDCount: 2.
nvenc : Found AV1 Unknown profile.
nvenc : Found AV1 main profile.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetCount: 7.
nvenc : m_pEncodeAPI->nvEncGetEncodePresetGUIDs: Success.
nvenc : m_pEncodeAPI->nvEncGetInputFormatCount: 9.
nvenc : Found input fmt: 
nvenc : nv12 
nvenc : yv12 
nvenc : Invalid 
nvenc : yv12(10bit) 
nvenc : rgb32 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
nvenc : Invalid 
InitNVEncInstance: Success.
InitDecoder: Success.
copyHtoD: copyHtoD
InitFilters: Success.
SetInputParam: Success.
nvenc : Failed to Initialize the encoder
nvenc : .: 8 (NVENC indicates that one or more of the parameter passed to the API call is invalid.)
avs: Closing...
avs: Closed.
avs: Closing...
avs: Close...
Released IO Buffers.
gpuinfo: Closing device #0: NVIDIA GeForce RTX 4070 Ti...
gpuinfo: Closing Encoder...
nvenc : nvEncDestroyEncoder...
nvenc : nvEncDestroyEncoder: success.
gpuinfo: Closed Encoder.
gpuinfo: Closed cuvid Ctx Lock...
gpuinfo: Closed cuvid Ctx Lock.
gpuinfo: Closed CUDA Context...
gpuinfo: Closed CUDA Context.
gpuinfo: Closed device #0: NVIDIA GeForce RTX 4070 Ti.
Closed EncodeStatus.
Closing perf monitor...
Closing logger...
devDX11: Closing DX11 device...
@rigaya
Copy link
Owner

rigaya commented Nov 14, 2024

AV1 + --profile high

Looks like same as #515, You don't need --profile high, default main profile is enough for YUV420 10bit (high is for YUV444, not supported now by the hardware).

AV1 + --level

The drivers seems to like to decided level by itself, so please remove --level. I'll make --level ignored for AV1 in the future (as it does not work).

@Dendraspis
Copy link
Contributor Author

Dendraspis commented Nov 14, 2024

Ah, that's good to know!

You don't need --profile high, default main profile is enough for YUV420 10bit

I have thought that if specified, the high(er) profile would be set, weather needed or not. Noted...
So I guess the --profile parameter is also sort of obsolete, at least for AV1. 🤔

[..] so please remove --level. I'll make --level ignored for AV1 in the future (as it does not work).

In that case it really makes sense to remove it from the UI. May I suggest modifying the docs as specifying the mentioned profiles will lead to a crash? 😊
image

...and in case you alter the docs, you could also change the [HEVC only] condition for --tier or remove the AV1-options when they are also auto-set:

@rigaya
Copy link
Owner

rigaya commented Nov 15, 2024

I have thought that if specified, the high(er) profile would be set, weather needed or not. Noted...

Yes, it might be expected to work like that (as same as other codecs), but it seems that simply current hardware (or driver) does not support high profile, although it is defined in the NVENC SDK. That also does make sense, as current hardware does not support AV1 YUV444 encoding, and current support is limited in the range of AV1 main profile. It is also harmless as it works anyway (doesn't cause any errors).

The key part here is that there no need to set high profile in AV1 in current hardware limitations, so you need not to care about that. We'll need to check again, whenever if AV1 gets YUV444 support (although I don't know when).

May I suggest modifying the docs as specifying the mentioned profiles will lead to a crash?

I'll remove values other than "auto" from the docs. Other values will still can be parsed, but will be treated as same as "auto", to avoid crush.

@Dendraspis
Copy link
Contributor Author

Interesting and thanks for the insight.

Other values will still can be parsed, but will be treated as same as "auto", to avoid crush.

Must be a personal preference, because I prefer an error message that tells me why my expectations and specifications cannot be fulfilled instead of just being ignored. I was just irritated because the docs mentioned those values to be valid.

Thanks for removing the AV1 values from the docs. I have already removed Level, Profile and Tier for AV1, so there shouldn't be any issues anymore. 😊

So I close this one...

@rigaya
Copy link
Owner

rigaya commented Nov 22, 2024

The fix for AV1 --level has been applied in the new NVEnc 7.75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants