Skip to content

Instantly share code, notes, and snippets.

@YounsooChoi
YounsooChoi / ffmpeg-hevc-encode-nvenc.md
Created February 9, 2018 21:32
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with an optional CUVID-based hardware-accelerated decoder.

Encoding high-quality HEVC content with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile>  \
-filter:v scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_hq \