Sufficiently new nvenc hardware (GM20x or later) has support for H.265 encoding. This works the same as the H.264 encoder except the codec parameters are different.
Due to the fact that common codec parameters are not shareable, there's quite a bit of conditional logic you'd wish we could do without, but such is life.
21175d8 avcodec/nvenc: Add support for H.265 encoding
libavcodec/Makefile | 2 +-
libavcodec/allcodecs.c | 1 +
libavcodec/nvenc.c | 153 +++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 133 insertions(+), 23 deletions(-)