#7530 closed defect (fixed)
cuviddec/nvdec/nvenc: driver checking errors
Reported by: | Mark Sanders | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | avcodec |
Version: | git-master | Keywords: | nvenc |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When executing the FFmpeg tool with an ancient NVidia driver, the output ins't clear about the incompatibility of the driver.
This is the regular output when this error appears:
[AVHWDeviceContext @ 0x1f2d000] Loaded lib: libcuda.so.1 [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuInit [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGetCount [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGet [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGetName [AVHWDeviceContext @ 0x1f2d000] Cannot load cuDeviceGetUuid [AVHWDeviceContext @ 0x1f2d000] Could not dynamically load CUDA [h264_cuvid @ 0x1eec3c0] Error creating a CUDA device
Take note that the driver is installed and the card is working. However, when using a recent version of FFmpeg, in this case the error appears... as the driver version is too old. So, no errors at all when using a previous version of FFmpeg.
Here are the three points where the driver version is checked:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/cuviddec.c#L727
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvdec.c#L97
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvenc.c#L122
First of all, the function to check the driver version should be centralized (perhaps in "hwcontext_cuda.c"). And second, the function needs to log every time the minimum version required and the current version. This will help the user to identificate the problem.
I hope you can fix this soon.
Regards.
Change History (11)
follow-up: 6 comment:1 by , 5 years ago
Keywords: | cuviddec nvdec removed |
---|
follow-up: 4 comment:2 by , 5 years ago
I kindly ask original poster to stop opening new tickets. We are not support channel. Thanks.
Also all developers are volunteers.
follow-up: 5 comment:3 by , 5 years ago
There is no one minimum version, it depends on which version of the nvcodec headers you have built - the requirements are documented in the nvcodec repository README
All three video SDK branches, 8.0, 8.1 and 8.2 should still be capable of building FFmpeg, newer version will in turn result in higher driver requirements.
comment:4 by , 5 years ago
Replying to richardpl:
I kindly ask original poster to stop opening new tickets. We are not support channel. Thanks.
Also all developers are volunteers.
First of all, I'm too a volunteer!
I'm an independent programmer and I'm sharing my patches and reporting the troubles that I found. I'm not interested in a "support channel", but to report bugs and try to fix them.
In any case, thank you for remembering the requirement to have good manners.
I'll try to be positive all the time.
comment:5 by , 5 years ago
Replying to heleppkes:
There is no one minimum version, it depends on which version of the nvcodec headers you have built - the requirements are documented in the nvcodec repository README
All three video SDK branches, 8.0, 8.1 and 8.2 should still be capable of building FFmpeg, newer version will in turn result in higher driver requirements.
Hi,
In fact there is no minimum version to compile. This is true.
And it's true too that the nv-codec-headers repository lists the driver version:
https://github.com/FFmpeg/nv-codec-headers
However, when using a FFmpeg binary, the user knows nothing about what version it has been compiled with. He only sees the errors.
So, two options (in my opinion) can be used to resolve (in positive) this problem:
- Print in the header of the FFmpeg HELP some "nv-codec-headers" info when compiling with them (like with the configure parmeters).
- Or do a runtime check and print the expected version vs the current version of the driver.
I hope you agree with this suggestion.
Best.
follow-up: 7 comment:6 by , 5 years ago
Replying to cehoyos:
Note sure I understand: Current FFmpeg shows the correct error message and therefor works as expected?
Please provide the tested command line together with the complete, uncut console output.
$ ffmpeg -loglevel debug -hwaccel cuvid -c:v h264_cuvid -i input.ts c:v h264_nvenc -f mpegts output.ts ffmpeg version N-92330-gd6d407d Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.7 (Debian 4.7.2-5) configuration: --enable-static --disable-shared --disable-doc --disable-dxva2 --enable-small --enable-pthreads --enable-stripping --enable-bsfs --disable-devices --disable-hwaccels --disable-ffprobe --enable-gpl --enable-libx264 --enable-cuda --enable-nonfree --enable-cuvid --enable-nvenc --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ libavutil 56. 23.100 / 56. 23.100 libavcodec 58. 36.100 / 58. 36.100 libavformat 58. 21.100 / 58. 21.100 libavdevice 58. 6.100 / 58. 6.100 libavfilter 7. 41.100 / 7. 41.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'cuvid'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_cuvid'. Reading option '-i' ... matched as input url with argument 'input.ts'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_nvenc'. Reading option '-f' ... matched as option 'f' (force format) with argument 'mpegts'. Reading option 'output.ts' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input url input.ts. Applying option hwaccel (use HW accelerated decoding) with argument cuvid. Applying option c:v (codec name) with argument h264_cuvid. Successfully parsed a group of options. Opening an input file: input.ts. [NULL @ 0x1e6e6c0] Opening 'input.ts' for reading [...] Successfully opened the file. [h264_cuvid @ 0x1eec3c0] Initializing cuvid hwaccel [AVHWDeviceContext @ 0x1f2d000] Loaded lib: libcuda.so.1 [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuInit [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGetCount [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGet [AVHWDeviceContext @ 0x1f2d000] Loaded sym: cuDeviceGetName [AVHWDeviceContext @ 0x1f2d000] Cannot load cuDeviceGetUuid [AVHWDeviceContext @ 0x1f2d000] Could not dynamically load CUDA [h264_cuvid @ 0x1eec3c0] Error creating a CUDA device cuvid hwaccel requested for input stream #0:0, but cannot be initialized. [h264_cuvid @ 0x1eec3c0] ff_get_format failed: -1 Stream mapping: Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc)) Error while opening decoder for input stream #0:9 : Operation not permitted [AVIOContext @ 0x1edf080] Statistics: 0 seeks, 0 writeouts [AVIOContext @ 0x1e77400] Statistics: 8614320 bytes read, 4 seeks
This is the output with the last git-master compiled today. It fails, but only because the ancient nvidia driver. And the error doesn't print anything about the cause (the driver missmatch).
Running in the same computer, the same command, with a binary version of FFmpeg compiled in the same environment one year a go runs perfectly. So the problem is the driver version.
Please, if you need more information, let me know.
Best.
comment:7 by , 5 years ago
Replying to cehoyos:
After upgrading the video driver, the same binary procudes this output:
[...] [h264_nvenc @ 0x305c7c0] Loaded lib: libcuda.so.1 [h264_nvenc @ 0x305c7c0] Loaded sym: cuInit [h264_nvenc @ 0x305c7c0] Loaded sym: cuDeviceGetCount [h264_nvenc @ 0x305c7c0] Loaded sym: cuDeviceGet [h264_nvenc @ 0x305c7c0] Loaded sym: cuDeviceGetName [h264_nvenc @ 0x305c7c0] Loaded sym: cuDeviceGetUuid [h264_nvenc @ 0x305c7c0] Loaded sym: cuDeviceComputeCapability [h264_nvenc @ 0x305c7c0] Loaded sym: cuCtxCreate_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuCtxSetLimit [h264_nvenc @ 0x305c7c0] Loaded sym: cuCtxPushCurrent_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuCtxPopCurrent_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuCtxDestroy_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuMemAlloc_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuMemFree_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuMemcpy2D_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuMemcpy2DAsync_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuGetErrorName [h264_nvenc @ 0x305c7c0] Loaded sym: cuGetErrorString [h264_nvenc @ 0x305c7c0] Loaded sym: cuStreamCreate [h264_nvenc @ 0x305c7c0] Loaded sym: cuStreamQuery [h264_nvenc @ 0x305c7c0] Loaded sym: cuStreamSynchronize [h264_nvenc @ 0x305c7c0] Loaded sym: cuStreamDestroy_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuStreamAddCallback [h264_nvenc @ 0x305c7c0] Loaded sym: cuEventCreate [h264_nvenc @ 0x305c7c0] Loaded sym: cuEventDestroy_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuEventSynchronize [h264_nvenc @ 0x305c7c0] Loaded sym: cuEventQuery [h264_nvenc @ 0x305c7c0] Loaded sym: cuEventRecord [h264_nvenc @ 0x305c7c0] Loaded sym: cuGLGetDevices_v2 [h264_nvenc @ 0x305c7c0] Loaded sym: cuGraphicsGLRegisterImage [h264_nvenc @ 0x305c7c0] Loaded sym: cuGraphicsUnregisterResource [h264_nvenc @ 0x305c7c0] Loaded sym: cuGraphicsMapResources [h264_nvenc @ 0x305c7c0] Loaded sym: cuGraphicsUnmapResources [h264_nvenc @ 0x305c7c0] Loaded sym: cuGraphicsSubResourceGetMappedArray [h264_nvenc @ 0x305c7c0] Cannot load optional cuImportExternalMemory [h264_nvenc @ 0x305c7c0] Cannot load optional cuDestroyExternalMemory [h264_nvenc @ 0x305c7c0] Cannot load optional cuExternalMemoryGetMappedBuffer [h264_nvenc @ 0x305c7c0] Cannot load optional cuExternalMemoryGetMappedMipmappedArray [h264_nvenc @ 0x305c7c0] Loaded sym: cuMipmappedArrayGetLevel [h264_nvenc @ 0x305c7c0] Loaded lib: libnvidia-encode.so.1 [h264_nvenc @ 0x305c7c0] Loaded sym: NvEncodeAPICreateInstance [h264_nvenc @ 0x305c7c0] Loaded sym: NvEncodeAPIGetMaxSupportedVersion [h264_nvenc @ 0x305c7c0] Loaded Nvenc version 8.1 [h264_nvenc @ 0x305c7c0] Nvenc initialized successfully
Note that here the call to Load the function "cuDeviceGetUuid()" doesn't fail.
So, as a summary:
- Old FFmpeg binary, with old driver: OK
- Old FFmpeg binary, with new driver: OK
- New FFmpeg binary, with old driver: FAILS at runtime when using the cuvid driver
- New FFmpeg binary, with new driver: OK
All is done at runtime, so in my opinion the user should be advised that the problem is the (old) version of the video driver.
Regards.
comment:8 by , 5 years ago
Priority: | normal → minor |
---|
comment:9 by , 5 years ago
This is a valid issue in the current nv-codec-headers. I thought this was a really old function when I added it, but it actuallly only showed up in cuda 9.2 and we only need it to enable vulkan interop which requires cuda 10. I'm making it optional.
follow-up: 11 comment:10 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in nv-codec-headers
Replying to msiders:
Note sure I understand: Current FFmpeg shows the correct error message and therefor works as expected?
Please provide the tested command line together with the complete, uncut console output.