ffmpeg and nvenc (or nvenc_h264), compilation and use

I’m trying to use ffmpeg with nvenc under Ubuntu, and finding the process kind of confusing. I downloaded nvidia_video_sdk_6.0.1.zip and it seemed to contain examples but no actual SDK library. I copied the .h files to /usr/local/include, configured ffmpeg with --enable-nvenc and it compiled. Does that mean I’ve got some (older?) version of the SDK installed from the ubuntu repo? Here’s the installed stuff I could find:

adrian> dpkg -l | grep ii | egrep 'nvidia|cuda'
ii  libcuda1-361   361.42-0ubun amd64        NVIDIA CUDA runtime library
ii  libcuda1-361-u 361.42-0ubun amd64        Transitional package for libcuda1
ii  nvidia-352     361.42-0ubun amd64        Transitional package for nvidia-3
ii  nvidia-361     361.42-0ubun amd64        NVIDIA binary driver - version 36
ii  nvidia-cg-dev: 3.1.0013-2   amd64        Cg Toolkit - GPU Shader Authoring
ii  nvidia-cg-tool 3.1.0013-2   amd64        Cg Toolkit - GPU Shader Authoring
ii  nvidia-opencl- 361.42-0ubun amd64        NVIDIA OpenCL ICD
ii  nvidia-prime   0.8.2        amd64        Tools to enable NVIDIA's Prime
ii  nvidia-setting 361.42-0ubun amd64        Tool for configuring the NVIDIA g

In any case, ffmpeg compiled. And if I run it with the nvenc codec I get a big speedup compared to using my CPU (about 50 times faster, 200 fps instead of 4 fps). However, I’m not sure the quality is as good, and it doesn’t seem to be possible to do something like -qrf. Furthermore, it’s not clear how to actually use it and I can’t find any examples. The interface doesn’t seem to match what I saw written in the nvidia documents such as http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/FFMPEG-with-NVIDIA-Acceleration-on-Ubuntu_UG_v01.pdf THe interface I got has -level, -profile, and -2pass and it’s not clear what any of these things do.

So I’m wondering, are there two different ways to run nvenc from ffmpeg?

Have I done something in a wrong or inferior way?

What is the best way to encode for maximum quality, ideally with something like -qrf so I can pick the quality rather than the bit rate?