Can we use NVidia NVENC/GPU hardware acceleration on FFMPEG under LGPL

We are developing a commercial product that is using FFMpeg to composite data onto a video stream and encode in h.265. We would like to use the CUDA toolkit to enable NVidia hardware acceleration in FFMpeg, to take advantage of our graphics card. Is it possible to do this and still remain within the FFMpeg LGPL open source licence?


I don’t have an answer to your open source license question but I’m wondering why you would use CUDA toolkit for transcode? Why not using NVENC for transcode?

ffmpeg -hide_banner -h encoder=hevc_nvenc

I forgot to mention we are running on Windows 10.
We have a software based solution using the x265 encoder, but we wanted to user hardware acceleration to reduce the load on the CPU. I thought we had to use the CUDA toolkit to do this, after looking on the web for hints and tips.
Does hevc_nvenc use the hardware NVENC chip, without the CUDA toolkit, or is it a software solution?

for sure :) This is exactly the use case. No need to use CUDA for transcoding as long as you are OK with the presets given for the hardware encoder. Which GPU do you have?


Currently its an NVidia Quadro P2000 (Pascal GP107).

Ok, that should work. Pascal already supports H265. You can check the capability here:

Thanks for the pointers, we are building an hevc_nvenc library now to test on our hardware. It says its LGPL so this will suit us perfectly license wise. We just need to see how the processing load is split across the CPU and GPU.

Thanks this works for us, NVidia hardware acceleration in FFMpeg under LGPL. Thank you.

Happy to hear it’s working. What about the speed-up compared to CPU only ?

There is a good question, we’ve proven it builds and encodes on the GPU, we are now performing a clean install/build to make sure none of our previous NVidia CUDA toolkit work was being used in our test. That will take a while, then we will look at speed.

So we used a 30 minute video clip, an episode of “the sky at night”, 704x576 frame, data rate 15256kbps, frame rate 25fps, encoded as mpg.
Using a NVIDIA Quadro T2000 .
Using a release build of FFMpeg.
Hardware accelerated encode, hevc_nvenc, took 28 seconds (66 x normal speed) CPU 35%, GPU1 0%, GPU1 Encode 90%
Software encode, libx265, took 2 hours (0.23 x normal speed) CPU 65%, GPU1 2%, GPU1 Encode 2%.

Wow, thanks for the feedback. Really impressive speed-up :)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.