Timothy003
Timothy003

Reputation: 2378

"NVENC Feature not available for current license key type" error from nvEncoder sample

When I try to run the nvEncoder sample application included in NV Encode SDK 2.0, it fails to open an encode session. Here is the output:

C:\Users\Timothy\Downloads\nvenc_2.0_pkg\Samples\nvEncodeApp>1080p_heavyhand_3se
c.bat

C:\Users\Timothy\Downloads\nvenc_2.0_pkg\Samples\nvEncodeApp>nvEncoder -infile=.
.\yuv\1080p\HeavyHandIdiot.3sec.yuv -outfile=HeavyHandIdiot.3sec.264 -width=1920
 -height=1080 -bitrate=6000000
> NVEncode configuration parameters for Encoder[0]
> GPU Device ID             = 0
> Input File                = ..\yuv\1080p\HeavyHandIdiot.3sec.yuv
> Output File               = HeavyHandIdiot.3sec.264
> Frames [000--01]          = 0 frames
> Multi-View Codec          = No
> Width,Height              = [1920,1080]
> Video Output Codec        = 4 - H.264 Codec
> Average Bitrate           = 6000000 (bps/sec)
> Peak Bitrate              = 24000000 (bps/sec)
> BufferSize                = 3000000
> Rate Control Mode         = 2 - CBR (Constant Bitrate)
> Frame Rate (Num/Denom)    = (30000/1001) 29.9700 fps
> GOP Length                = 30
> Set Initial RC      QP    = 0
> Initial RC QP (I,P,B)     = I(0), P(0), B(0)
> Number of B Frames        = 0
> Display Aspect Ratio X    = 1920
> Display Aspect Ratio Y    = 1080
> Number of B-Frames        = 0
> QP (All Frames)           = 26
> QP (I-Frames)             = 25
> QP (P-Frames)             = 28
> QP (B-Frames)             = 31
> Hiearchical P-Frames      = 0
> Hiearchical B-Frames      = 0
> SVC Temporal Scalability  = 0
> Number of Temporal Layers = 0
> Outband SPSPPS            = 0
> Video codec profile       = 100
> Stereo 3D Mode            = 0
> Stereo 3D Enable          = No
> Number slices per Frame   = 1
> Encoder Preset            = 3 - High Performance (HP) Preset
> Asynchronous Mode         = Yes
> YUV Input Format          = NV12 (Semi-Planar UV Interleaved) Pitch Linear
> NVENC API Interface       = 2 - CUDA
> Map Resource API Demo     = No
> Dynamic Resolution Change = 0
> Dynamic Bitrate Change    = 0
Input Filesize: 236390400 bytes
Input Filename: ..\yuv\1080p\HeavyHandIdiot.3sec.yuv
Auto-Detected (nvAppEncoderParams.endFrame = 76 frames)


>> GetNumberEncoders() has detected 1 CUDA capable GPU device(s) <<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, NVENC Available ]

>> InitCUDA() has detected 1 CUDA capable GPU device(s)<<
  [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0, Available NVENC ]

>> Select GPU #0 - < GeForce GTX 670 > supports SM 3.0 and NVENC
File: src\CNVEncoder.cpp, Line: 1380, nvEncOpenEncodeSessionEx() returned with e
rror 21
Note: GUID key may be invalid or incorrect.  Recommend to upgrade your drivers a
nd obtain a new key
NVENC error at src\CNVEncoder.cpp:1382 code=21(NVENC Feature not available for c
urrent license key type) "nvStatus"

The API says error code 21 is NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY, with the comment:

/**
 * This indicates that the client is attempting to use a feature
 * that is not available for the license type for the current system.
 */

The programming guide says:

2. SETTING UP THE HARDWARE FOR ENCODING

2.1 Opening an Encode Session

After loading the NVENC Interface, the client should first call NvEncOpenEncodeSession to open an encoding session. The NVENC Interface will provide a encode session handle to the client, which must be used for all further API calls in the current session.

2.1.1 Using the License client Key GUID:

The client should pass a pointer to the key GUID that has been delivered with this SDK or has been purchased as part of a license separately, as NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS::clientKeyPtr

According to the guide, the sample code is invalid, as it doesn't set NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS::clientKeyPtr. But the SDK wasn't delivered with a key GUID like the guide said.

Someone had the same problem here and resolved it by using a free trial key. It seems to have been included with the 2.0 beta version of the SDK, which is no longer available.

I've also tried installing drivers 311.06, 312.07, and 314.22 with no success. I have a GeForce GTX 670.

Is there a solution?

Upvotes: 1

Views: 3730

Answers (3)

Timothy003
Timothy003

Reputation: 2378

Starting with the GeForce 334.67 driver, NVENC no longer requires a license key to use on GeForce cards.

Upvotes: 2

totaam
totaam

Reputation: 1310

You need a license key, which can be obtained by asking Nvidia (good luck!), or found by disassembling the shared library, or using gdb's rwatch with the bundled example code. Sorry I can't be more helpful than this.

Upvotes: -1

coolbho3k
coolbho3k

Reputation: 176

Unfortunately, I have not been able to find the beta version of the SDK anywhere, only the final version. The only way would probably to be to find someone who downloaded the beta version.

The other way would be try to reverse engineer NVIDIA's drivers (especially with "Shadowplay" and SHIELD coming both using NVENC) or existing encoding tools that are licensed to use NVENC on Geforce cards to find a compatible key.

Another potential solution I've been watching is to simply hard mod the card into a Quadro/Tesla/GRID, which you should be able to do on your 670 (though unfortunately for me, nobody has tried it on a Titan): http://www.eevblog.com/forum/projects/hacking-nvidia-cards-into-their-professional-counterparts/

Annoyingly, NVIDIA advertised NVENC as a feature of consumer-level Kepler cards upon the launch of the GTX 680, and they've backed away from this to make it a pro-only feature. It doesn't even work with my "prosumer" $1k GTX Titans. Ironically, I don't even want to use the Titans long-term; even with NVENC, the Grid K1 or K2 would be far more suitable for my project. It would be great to get something working on my workstation/gaming rig before scaling it up (and buying a ton of NVIDIA GPUs...) instead of dropping more of my own money on GPUs... Guess it might be better to go the AMD/OpenCL route with their Open Video Encode engine instead, except Catalyst on GNU/Linux doesn't support it. Ugh.

Upvotes: 1

Related Questions