1

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

1
  • Perhaps your disk isn't fast enough.
    – CodeCaster
    Commented Aug 6, 2020 at 14:21

2 Answers 2

5

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.

5
  • OK, when i use 1920x1080 images as input, FFMPEG uses 30% of the encoding resources of my GPU according the the task manager. When i use 4000x3000 only 10% is used. I know that i m limited to what you call nvenc cores but FFMPEG is using a fraction of them and i do not how to use more.
    – Entropy
    Commented Aug 10, 2020 at 8:16
  • You can’t. You are using 100% of the nvenc cores. Your tool just doesn’t report that. The 30%/10% are the GPGPU cores which are waiting on nvenc. It’s a similar phenomenon to that of Amdahl’s law.
    – szatmary
    Commented Aug 10, 2020 at 15:14
  • I can t find anywhere the number of nvenc cores in each graphic card. Can you please give me a source. I think that something in the range of 1000-1500 $ would be great.
    – Entropy
    Commented Aug 12, 2020 at 9:04
  • BTW, I wasn t using 100% of my nvenc cores I was bottlenecked by my ssd samsung 970 PRO :O the 4000x3000 images were too big and getting them to memory was the bottleneck. That s all the data it managed to fetch and write simulatiounsly
    – Entropy
    Commented Aug 12, 2020 at 11:50
  • List of how many NVENC's are on each GPU: developer.nvidia.com/…
    – Xairoo
    Commented Mar 25, 2021 at 13:41
3

If your ffmpeg was compiled with --enable-libnpp then consider using the GPU based scale_npp filter instead of scale which is CPU only. Example from FFmpeg Wiki: Hardware Acceleration:

ffmpeg -hwaccel cuda -i input -vf scale_npp=1920:1080 -c:v h265_nvenc output.mp4

You may see an improvement in performance or GPU utilization.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.