0

After updating my graphics card from a 680 to a 1650, I am now able to encode multiple bitrates of my HLS stream using NVENC. However, I am stumped with the following issue, if I attempt to add the argument for scaling -vf scale_npp=1280:720, FFmpeg fails to launch.

exec ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i rtmp://localhost/livestream/$name -c:a copy -c:v h264_nvenc -cbr true - b:v 1000k -vf scale_npp=960:540 -f flv rtmp://localhost/adapthls/$name_mid

  • What is the error message? What is the version of FFmpeg? Are you using Windows or Linux? For keeping things simple, can you test your command with a synthetic input file `in.flv`. Creating in.flv: `ffmpeg -y -f lavfi -i testsrc=size=384x256:rate=1:duration=100 -vcodec libx264 -pix_fmt yuv420p in.flv`. Also use a file as an output, like `out.flv`. (please edit your question). – Rotem Oct 21 '22 at 08:30
  • I am using Linux, Ubuntu Server 20.04.5 LTS. Nvidia-smi reports driver 470.141.03 and CUDA version 11.4. After some troubleshooting and further research, I believe my problem is related to the ffmepg that nginx is calling upon was not compiled with the CUDA toolkit that contains the filter scale_npp. How can I check which FFmpeg installation NginX is using? When I run the line you shared in the CLI, ffmpeg version 4.2.7 runs and does report --enable-nvenc but not --enable-nonfree or --enable-libnpp either. I do have another version of FFmpeg installed on my system, that does show CUDA support. – Taylor Sperring Oct 22 '22 at 20:32
  • I am using Windows and `scale_npp` filter is not supported. `scale_cuda` filter is working. I think the most efficient conversion is without using any filter, and using `h264_cuvid` decoder and `h264_nvenc` encoder: `ffmpeg -y -vsync 0 -init_hw_device cuda=cuda -hwaccel cuda -hwaccel_output_format cuda -c:v h264_cuvid -resize 960x540 -i in.mp4 -c:v h264_nvenc -cbr true -b:v 1000k output.flv` – Rotem Oct 22 '22 at 20:57
  • The error was caused by me not selectively executing the correct FFmpeg that I compiled with CUDA, now scale_npp is working. However, the video stream appears to be very corrupted. I will attempt to recompile. – Taylor Sperring Oct 22 '22 at 22:30
  • Turns out after reinstalling the Nvidia driver, the CUDA toolkit, and recompiling FFMPEG, I was still facing an error. In the end, this information helped: https://stackoverflow.com/questions/66505989/ffmpeg-hwaccel-no-decoder-surfaces-left – Taylor Sperring Oct 24 '22 at 16:54

0 Answers0