[help]h264_nvenc encoder don't take the second nvidia gpu.

Hello

OS: windows 10

2 NVIDIA quadro M4000 card,

on my machine ffmpeg command line takes the second gpu if i set -gpu 1.

Requirement is using c/c++ code, encode the video stream.

My Sample code is

av_hwdevice_ctx_create(&encode_device, AV_HWDEVICE_TYPE_QSV, NULL, NULL, 0);

codec = avcodec_find_encoder_by_name(“h264_nvenc”);

Codec_Context = avcodec_alloc_context3(codec);

Codec_Context->width = Outwidth;
Codec_Context->height = Outheight;

but if I set gpu → 1, it set 0 only.

Please help me.