FFmpeg Can't Capture Window Rendered with Secondary GPU Edit: I am using the terms "primary" &amp; "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="&lt;window name&gt;" -c:v libx264 -preset ultrafast -qp 0 \
  -x264opts keyint="1" "&lt;outfile&gt;"


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" "&lt;outfile&gt;"


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 &amp; 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="&lt;window name&gt;" \
  -c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "&lt;outfile&gt;"


ffmpeg -hwaccel_device 1 -hwaccel nvdec -f gdigrab -i title="&lt;window name&gt;" \
  -c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "&lt;outfile&gt;"

...

[AVHWDeviceContext @ 000001f78689ef40] cu-&gt;cuDeviceGet(&amp;cu_device, device_idx) failed -&gt; 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="&lt;window name&gt;" \
  -c:v libx264 -preset ultrafast -qp 0 -x264opts keyint="1" "&lt;outfile&gt;"


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 &amp; Intel is card 1?

In case it helps, I am on an HP Pavilion 24-b217c.
For capturing (NVIDIA GPU rendered) chrome window, GPU compositing must be disabled via --disable-gpu-compositing. Maybe you can also disable it in your application.