Search code examples
encodingffmpegnvidiah.264nvenc

How to get FFMPEG to use more GPU when encoding


so the situation is as following

Im receiging 20/30 uncompressed image per second. format is either PNG or Bitmap. Each individual photo size is between 40 and 50 mb (all have same size since uncompressed).

I want to encode them to a 265 lossless video and stream them to a http server using FFMPEG. The output video is 1920x1080, so there is some downsampling. Compression is allowed but nothing is allowed to be lost other than the down sampling.

now i m still in the testing phase. i have a 500 sample image. and i m tryng to encode them as effeciently as possible. Im using commands such as :

ffmpeg  -hwaccel cuvid -f  image2  -i "0(%01d).png" -framerate 30 / 
-pix_fmt p010le -c:v hevc_nvenc -preset lossless -rc vbr_hq /
-b:v 6M -maxrate:v 10M  -vf scale=1920:1080  -c:a aac -b:a 240k result.mp4

I have a powerfull modern quadro GPU and a 6 cores intel CPU and an Nvme hard drive.

The usuage of the GPU when encoding is exactly 10%, CPU is circa 30-40%

How can i get GPU usuage to 80% ? The machine on which im going to run the code will have at leat a quadro 4000 (maybe stronger) and i want to use it to the fullest


Solution

  • That’s not how it works. GPUs do not use the standard vector processing units for video encoding. (Well, it does a little, for things like color conversion and scaling, but not not for everything). The GPU has dedicated circuitry for video encoding primitives. When those are full, it doesn’t matter how many GPU cores you have, they will be idle.

    So to to use “more” GPU, you don’t get a beefy GPU, you buy a card that has more NVENC cores.