Edit: I am using the terms "primary" & "secondary" cards below loosely. I'm just assuming the Intel card is considered the first card.
I recently discovered how to use my secondary graphics card (nVidia GeForce 930MX) to render a game on my Windows 10 system. However, when I do so, FFmpeg no longer captures what is displayed in that window. It captures whatever is displayed from the primary card (Intel(R) HD Graphics 630) at the coordinates of said window. Is there an argument that can be passed to FFmpeg's gdigrab or dshow formats to specify on which card the window/app is being rendered?
Example of command with gdigrab:
ffmpeg -format gdigrab -i title="<window name>" -c:v libx264 -preset ultrafast -qp 0 \
-x264opts keyint="1" "<outfile>"
Example of command with dshow (window info read from registry):
ffmpeg -format dshow -i video="video-capture-recorder" -c:v libx264 -preset ultrafast \
-qp 0 -x264opts keyint="1" "<outfile>"
I have been searching around the internet for quite a while, but haven't found much information on it.
I did try using the hwaccel & hwaccel_device arguments, but still Intel card is captured. I'm thinking these are actually to allow FFmpeg to take advantage of the hardware resources for its own performance?
ffmpeg -hwaccel_device 0 -hwaccel nvdec -f gdigrab -i title="<window name>" \
-c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "<outfile>"
ffmpeg -hwaccel_device 1 -hwaccel nvdec -f gdigrab -i title="<window name>" \
-c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "<outfile>"
...
[AVHWDeviceContext @ 000001f78689ef40] cu->cuDeviceGet(&cu_device, device_idx) failed -> CUDA_ERROR_INVALID_DEVICE: invalid device ordinal
Device creation failed: -1313558101.
[bmp @ 000001f7883ada40] No device available for decoder: device type cuda needed for codec bmp.
ffmpeg -hwaccel_device 1 -hwaccel cuvid -f gdigrab -i title="<window name>" \
-c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "<outfile>"
Edit: Perhaps because the command using -hwaccel_device 0 -hwaccel nvdec
doesn't exit with an error, this means that the nVidia GPU is considered card 0 & Intel is card 1?
In case it helps, I am on an HP Pavilion 24-b217c.
ffmpeg -f gdigrab -i desktop -c:v h264_nvenc -gpu list -f null -
will list your GPUs for you and the index number. You may just need to switch around which GPU is being used for h/w encoding. Depending on how your devices get enumerated will dictate what GPU gets assigned to what index. Index of a GPU is usually pretty static, but not if you have a dockable GPU, e.g. Microsoft Surface Book 2, desktop with multiple cards, eGPU over Thunderbolt, etc. When you run that command you will get an error about the encoder, just ignore it.