cuda – ffmpeg opencl filters with nvenc encoding

I am trying to denoise HD video with GPU acceleration:

ffmpeg.exe -init_hw_device opencl=gpu:0.0 -filter_hw_device gpu -i $FileBrowser.FileName -vf "hwupload, nlmeans_opencl=5:7:5:3:3, hwdownload, format=yuv420p" -c:v libx265 -c:a copy -crf 20 $f_output

filtering is fast, but encode is slowed down by CPU Ryzen 9 5950X @ 4GHz + RTX 3060 Ti ~1.8x

I can also fast encode with cuda nvenc 5x on above by mentioned GPU without filtering

ffmpeg.exe -hwaccel nvdec -init_hw_device cuda=cuda:0 -hwaccel_output_format cuda -i $FileBrowser.FileName -c:v hevc_nvenc -preset slow -tune hq -rc vbr_hq -b:v 6M -maxrate:v 12M -c:a copy -crf 20 $f_output

Is there a way to combine opencl filtering & cuda encode on same GPU, please?

I tried to combine both together, but there is filter format=yuv420p error

Read more here: Source link