Struggling with wasapi2src with loopback-target-pid

I’ve been trying to use wasapi2src with loopback-target-pid, but whenever I specify a PID (I usually grab one from the PID column in Task Manager), no audio gets recorded. If I don’t specify a PID, the recording works fine.

gst-launch-1.0.exe --gst-debug "*:3" wasapi2src loopback=true loopback-mode=include-process-tree loopback-target-pid=5772 do-timestamp=true loopback-silence-on-device-mute=true ! queue ! audioconvert ! audioresample ! audio/x-raw,format=S16LE,layout=interleaved,rate=48000,channels=2 ! queue ! opusenc ! filesink location=audio.opus

I initially ran into the issue with the python gstreamber-bundle package, but also ran into it with the gstreamer build for MSVC 1.28.0 and 1.28.1 build, as well as mingw 1.28.1 (always with the same warnings). Output with debug level set to 3:

Use Windows high-resolution clock, precision: 1 ms
Setting pipeline to PAUSED ...
0:00:00.056814600      19040       6824 WARN                 wasapi2 gstwasapi2util.cpp:852:gst_wasapi2_get_shared_mode_formats: WASAPI call failed: 0x80004001, Not implemented
Pipeline is live and does not need PREROLL ...
0:00:00.059433600      19040       5116 FIXME                default gstutils.c:4213:gst_element_decorate_stream_id_internal:<wasapi2src0> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
0:00:00.063500900      19040       8732 WARN       wasapi2ringbuffer gstwasapi2rbuf.cpp:907:gst_wasapi2_rbuf_ctx_init: WASAPI call failed: 0x80004002, No such interface supported
0:00:00.065852400      19040       8732 WARN       wasapi2ringbuffer gstwasapi2rbuf.cpp:908:gst_wasapi2_rbuf_ctx_init: Couldn't get ISimpleAudioVolume interface

I’ve tried adding/removing queues, enabling/disabling low-latency, adding/removing do-timestamp. Googling around generally indicates the command only works on Windows 11, but I run into the issue on Windows 11 (and actually got the same errors when I tried it on a different Windows 10 computer).