FFMPEG, Tesla M60-8Q Grid, avcodec_open fails

I am not sure where to post this, so feel free to move it if needed.

The issue I am seeing is my code fails to open the h264_nvenc codec on my Tesla M60-8Q powered VM, however the same code ran locally on a GTX1080 works. I am not sure how to really debug this issue because FFMPEG hides all the underlying stuff from my eyes.

I am trying to do the following:

codec = avcodec_find_encoder_by_name(codecName);
if (!codec) {
	return -1;
c = avcodec_alloc_context3(codec);
if (!c) {
	return -1;

setup the c struct with size, bitrate, etc

// open codec
ret = avcodec_open2(c, codec, NULL);
if (ret < 0) {
	fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));

Like I said, this code works on my 1080 but not my tesla. I first thought drivers but they seem to be up to date, and the GPU support matrix makes me think this should be a supported operation.

The return code is -40 and means “Function not implemented” which makes me think it could be a CUDA version issue or something like that within FFMPEG. I did not build FFMPEG from source.

Any help is appreciated, thanks.

At first, no need to go into FFMPEG code.
I recommend to activate FFMPEG’s loglevel of debug or trace.
It usually provides a better starting point and will inform you of the error.

-loglevel [repeat+]loglevel | -v [repeat+]loglevel
Set the logging level used by the library. Adding “repeat+” indicates that repeated log output should not be compressed to the first line and the “Last message repeated n times” line will be omitted. “repeat” can also be used alone. If “repeat” is used alone, and with no prior loglevel set, the default loglevel will be used. If multiple loglevel parameters are given, using ’repeat’ will not change the loglevel. loglevel is a string or a number containing one of the following values:

‘debug, 48’
Show everything, including debugging information.

‘trace, 56’

Tomer Gal, CTO at OpTeamizer


Due to how I was running the code, the FFMPEG output was being hidden. I used another project with similar code, and was able to see the ffmpeg output (even without adjusting the log level).

It told me that

[h264_nvenc @ 00000197a27662a0] Driver does not support the required nvenc API version. Required: 8.0 Found: 7.0
[h264_nvenc @ 00000197a27662a0] The minimum required Nvidia driver for nvenc is 378.66 or newer

I thought it was a driver issue, but without this output I had no conclusive evidence.

Thanks for the help @tomer.gal

Hi,i have faced the same problem with you,have you solved this problem?