Wednesday, May 25, 2016

impressive CPU offload and FPS boost from NVidia "nvenc" codec

As I just purchased an NVidia GeForce GTX 970, I installed the FFmpeg "nvenc" codec to see if I would gain any benefits from the hardware encoding acceleration on the card.  From the results, I think I did!

H264 encode
In the picture below, you can see that the H264 maxes out my CPU at 92% while I transcode a 2.7K GoPro video.  Also, final FPS of the encode is 23:

Now here is the encode using the Maxwell class CPU on the GTX 970.  CPU utilization is down to 15% and my FPS goes from 20 to 38!  Impressive!

Encoding Parameters
The params are be a bit different between the two, but I think they might be good enough for a comparison.

H264
ffmpeg -i GOPR0099.MP4 -profile:v high -preset medium -vcodec libx264 -acodec copy output2.mp4

NVenc
ffmpeg -i GOPR0099.MP4 -c:v nvenc -acodec copy nvenc.mp4

Reference
https://developer.nvidia.com/nvidia-video-codec-sdk
https://trac.ffmpeg.org/wiki/HWAccelIntro
http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/FFMPEG-with-NVIDIA-Acceleration-on-Ubuntu_UG_v01.pdf
http://ubuntuforums.org/showthread.php?t=2265485
https://www.phoronix.com/scan.php?page=news_item&px=MTg0NTY