Encoding at 40 fps Using NVIDIA Video Codec SDK

I’m trying to use Nvidia’s sample cuda SDK (version 4, can be found at https://developer.nvidia.com/nvidia-video-codec-sdk) to encode a video at 40 fps. However, when I try to encode the video to be more than 30 fps (at 1080p), the encoder fails to initialize and I get the following output:

GetNumberEncoders() has detected 1 CUDA capable GPU device(s) <<
[ GPU #0 - < Tesla K40c > has Compute SM 3.5, NVENC Available ]

InitCUDA() has detected 1 CUDA capable GPU device(s)<<
[ GPU #0 - < Tesla K40c > has Compute SM 3.5, Available NVENC ]

Select GPU #0 - < Tesla K40c > supports SM 3.5 and NVENC

nvEncoder Error: NVENC H.264 encoder initialization failure! Check input params!

Normally when I run it at 30 fps, the code successfully runs with the following initializations:

GetNumberEncoders() has detected 1 CUDA capable GPU device(s) <<
[ GPU #0 - < Tesla K40c > has Compute SM 3.5, NVENC Available ]

InitCUDA() has detected 1 CUDA capable GPU device(s)<<
[ GPU #0 - < Tesla K40c > has Compute SM 3.5, Available NVENC ]

Select GPU #0 - < Tesla K40c > supports SM 3.5 and NVENC
CNvEncoder::AllocateIOBuffers() = Size (1920x1080 @ 16 frames)
System Memory with 16 buffers.

NVENC Encoder[0] configuration parameters for configuration #0
GPU Device ID = 0
Frames = 0 frames
ConfigFile = (null)
Frame at which 0th configuration will happen = 0
maxWidth,maxHeight = [1920,1080]
Width,Height = [1920,1080]
Video Output Codec = 4 - H.264 Codec
Average Bitrate = 6000000 (bps/sec)
Peak Bitrate = 0 (bps/sec)
Rate Control Mode = 2 - CBR (Constant Bitrate)
Frame Rate (Num/Denom) = (30/1) 30.0000 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
Video codec profile = 100
Video codec Level = 40
FieldEncoding = 0
Number slices per Frame = 0
Encoder Preset = 0 - Default Preset
NVENC API Interface = 2 - CUDA

When I ran the program through a debugger, I found that the initialization fails when it executes:

nvStatus = m_pEncodeAPI->nvEncInitializeEncoder(m_hEncoder, &m_stInitEncParams);

I was then unable to go into the nvenc APi.

Is there any setting that I am running incorrectly? I am using a Tesla k40c video card, which should be able to encode 1080p at more than 30 fps.

This may not be a good place to ask this question. Best I know, NVENC is not based on CUDA. There was an older decoder called NVCUENC which was based on CUDA, it has been discontinued. I think NVENC offers CUDA interop of some sort, but this question does not seem to be about such interoperatibility. Not sure what the best place is to ask, the following may work:

https://devtalk.nvidia.com/default/board/55/gpu-accelerated-libraries/

okay thanks