I've installed the latest gyan.dev full build on Windows 10, I want to convert a sequence of png to an h265 .mp4 movie and I'm successfully using this command
ffmpeg -r 60 -f image2 -s 3840x2160 -i TEST_%04d.png -vcodec libx265 -crf 1 -pix_fmt yuv440p -hwaccel cuvid Y:\TEST.mp4
I would like to take advantage of the hardware acceleration of my RTX2080 during the process, but I can't find any resource or command to add since -hwaccel which I supposed to be enough, doesn't works.
Any hint is highly appreciated! Best and stay safe.
12 Answers
libx265 is a software encoder. It does not support hardware encoding.
What you want is to use one of the hardware encoders. For hardware h.264 you will want to use the h264_nvenc video codec or for h.265 the hevc_nvenc
ffmpeg -r 60 -f image2 -s 3840x2160 -i TEST_%04d.png -vcodec hevc_nvenc -crf 1 -pix_fmt yuv440p -hwaccel cuvid Y:\TEST.mp4
You can list the encoders available using ffmpeg.exe -encoders and look for ones that mention NVIDIA in the list. For my ffmpeg I get the following Nvidia encoders in that list
V..... h264_nvenc NVIDIA NVENC H.264 encoder (codec h264) V..... nvenc NVIDIA NVENC H.264 encoder (codec h264) V..... nvenc_h264 NVIDIA NVENC H.264 encoder (codec h264) V..... nvenc_hevc NVIDIA NVENC hevc encoder (codec hevc) V..... hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)And you can list the encoder parameters using, for example, ffmpeg -h encoder=hevc_nvenc
Thanks to @Mokubai, @Gyan and @llogan for their answers.
In case someone wants to use ffmepg hwaccel for h265 to h264 conversion, use this:
ffmpeg -encoders | findstr /ic:"NVIDIA"You should see:
V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264) V....D hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)ffmpeg command:
ffmpeg.exe -vsync 0 -hwaccel cuda -i <input_file> -map 0 -c:a copy -c:v h264_nvenc -pix_fmt yuv420p -preset hq <output_file>It reduced the runtime by 4X for me, for a 30-minute video, on a GTX1060 card.
Cheers