0

I'm running it on modern equipment with latest drivers. I use it to compress video files, like so:

ffmpeg -i 20230502_200913.mp4 -vcodec libx265 -crf 28 -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" output.mp4

that command runs in 160 seconds on the CPU. but if I use the GPU, like so:

ffmpeg -hwaccel cuda -i 20230502_200913.mp4 -vcodec libx265 -crf 28 -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" output.mp4

it actually takes 280 seconds. And again, these are same era CPU and GPU. I can see it uses 100% of the GPU when running on the GPU but only 50% of the CPU when running on the CPU. I expected it to run much faster on the GPU than the CPU.

Am I missing something?

1
  • You're only decoding on the GPU. The scaling and encoding still occurs on the CPU and the decoded frame has to be transferred to system RAM from GPU RAM. Switch to scale_cuda and hevc_nvenc to keep everything on GPU.
    – Gyan
    May 4 at 4:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.