简体   繁体   中英

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 im still in the testing phase. i have a 500 sample image. and im 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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM