Nvidia NVENC

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

https://en.wikipedia.org/wiki/Nvidia_NVENC
https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENC

Example use:
Use NVENC for transcoding MPEG2 (MOVIE-raw.mkv) to X264 with ffmpeg. The sound (ac3-sound) is just copied.

Without nvenc:

ffmpeg -i MOVIE-raw.mkv -vf "crop=720:416:0:80" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -c:v libx264 -crf 18 -preset veryslow -tune film -c:s copy -c:a:0 copy -c:a:1 copy enc-MOVIE-raw.mkv

result: frame= 1626 fps= 48 q=-1.0 Lsize= 12518kB time=00:01:05.05 bitrate=1576.3kbits/s speed=1.93x

with nvenc:

  ffmpeg -i MOVIE-raw.mkv -vf "crop=720:416:0:80" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -c:v h264_nvenc -pixel_format yuv444p -crf 18 -preset slow -tune film -c:s copy -c:a:0 copy -c:a:1 copy enc-MOVIE-raw-nvenc.mkv
 

Result: fps=843 q=24.0 Lsize= 130448kB time=00:06:23.20 bitrate=2788.7kbits/s speed=33.7x

Gentoo ebuilds with nvenc use flag:
https://packages.gentoo.org/useflags/nvenc
http://linux.overshoot.tv/media-video/ffmpeg
The uvm use flag is also required for the nvidia-drivers:
http://linux.overshoot.tv/x11-drivers/nvidia-drivers

See also:
http://linux.overshoot.tv/wiki/video_encoding