0

I am using DirectShow to capture images from a USB-connected camera. My goal is to have the captured camera image on DirectX 11 Texture2D to use it for rendering, and I would like it to happen automatically by DirectShow graph, without having the buffers being copied to the user space at all.

Looked at many examples/threads, but could not see how to do exactly that. I find many recommendations to use Media Foundation instead, but for current project it's not an option at this point.

There seem to be examples of playback on DirectX 9 texture, maybe there is a way to get a "Dx9" texture out of "Dx11" and use it in the rendering later?

  • You cannot make absolutely sure with DirectShow that video capture goes directly into texture buffer without single data copy. In the same time, if you absolutely need that, you can make it single copy and no more than this. In the same time, there is normally a minimal number of data copy operations taking place and even if you don't pay much attention to it and have an extra copy operation somewhere, it is not a big deal. – Roman R. Aug 13 '15 at 13:52
  • @Roman thanks, I'm primarily concerned about doing the copy in the user space, just to transfer the image from memory to GPU takes me ~5msec, which is a huge amount of time to waste on each camera frame. – Michael Gopshtein Aug 13 '15 at 14:04
  • Extra data copies you might have with DirectShow (format conversions etc.) will take place between system memory buffers. It is only last copy to pass data from system memory to video memory. This is the reason I wrote above that extra copy is unlikely anything to worry about. – Roman R. Aug 13 '15 at 14:07
  • 1
    @Roman this sounds like the solution I need, I'm still wondering how to create the appropriate DirectShow Graph to achieve this. – Michael Gopshtein Aug 13 '15 at 14:17
  • You are looking at proper samples (older SDKs might have more samples), and if you give up there is another option for desperate to simply grab frames out of DirectShow pipeline and copy into texture memory yourself. – Roman R. Aug 13 '15 at 14:22

0 Answers0