Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg hwaccel no decoder surfaces left

Tags:

ffmpeg

gpu

nvidia

Recently I compiled natively the latest version of ffmpeg 4.3 on Windows 10 amd64. Evironment:CUDA11.0, NASM, VS2019, MYSY2 with mingw64.

I also used the patch https://trac.ffmpeg.org/attachment/ticket/9019/0001-Patch-for-ticket-9019-CUDA-Compile-Broken-Using-MSVC.patch

Compile featrues were:

--enable-nonfree --enable-cuda-nvcc --enable-libnpp --enable-gpl --enable-libx264 --enable-cuda-llvm --enable-nvenc
--toolchain=msvc --extra-cflags=-I../nv_sdk --extra-ldflags=-libpath:../nv_sdk

I tested ffmpeg for cuda acceleration. the CPU is an AMD 3500x. the GPU is an RTX 2060Ultra.

Issuing this command:

.\ffmpeg -hwaccel cuvid -i .\a.wmv -c:v hevc_nvenc -bf 4 -preset slow -c:a aac -b:a 256k myvideo.mp4

But recieved this error:

[wmv3 @ 000002632DFC5180] No decoder surfaces left
Error while decoding stream #0:0: Cannot allocate memory
[hevc_nvenc @ 00000263300B1740] Failed locking bitstream buffer: out of memory (10):
video encoding failed: Cannot allocate memory

I'm not sure where I've gone wrong here.

like image 834
desperateLord Avatar asked Nov 15 '22 23:11

desperateLord


1 Answers

Try adding -extra_hw_frames N to your input and increase N until the error ceases. I just needed 8 myself.

I encountered this same problem on version 4.4 as well. This was reported against 4.1 but only on some cases. Someone suggested the -extra_hw_frames N workaround on https://trac.ffmpeg.org/ticket/7562 and it worked for me.

like image 91
Moby Disk Avatar answered Nov 17 '22 13:11

Moby Disk