Please, Nvidia and its devs, help us fix the bug in ffmpeg, since 4 core CPU already gives by default 5 threads and fails. We have a file that requires at least 30 surfaces for 1 thread. But for 5 threads it is 34 surfaces and it fails. There are other files that fail with 10 threads and this on newer CPUs will cause big problems.
The proposed patch is https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210810023754.2905-1-ameer.jalil6@gmail.com/
but that has some problems:
So far, the 32 surface limit has only ever been enforced as a soft
limit, and a warning printed when exceeded. Since it being a limit is
not strictly documented and it might be risen in the future.
Old cuviddec (ffmpeg.exe -c:v h264_cuvid -i example.mp4 -f null -) is not affected.
https://trac.ffmpeg.org/ticket/8948#comment:8
sample only https://trac.ffmpeg.org/raw-attachment/ticket/8948/example.mp4
Command
ffmpeg.exe -hwaccel cuda -i example.mp4" -f null -
leads to
[h264 @ 000001c962e62040] decoder->cvdl->cuvidCreateDecoder(&decoder->decoder, params) failed → CUDA_ERROR_INVALID_VALU
E: invalid argument
[h264 @ 000001c962e62040] Using more than 32 (34) decode surfaces might cause nvdec to fail.
[h264 @ 000001c962e62040] Try lowering the amount of threads. Using 5 right now.
[h264 @ 000001c962e62040] Failed setup for format cuda: hwaccel initialisation returned error.