Hardware H264 encoding ID3D11Texture2D with Media Foundation
<p>I am working on a project which captures screen and encodes it. I can already capture screen using desktop duplication API (Win8+). Using the API I can get <code>ID3D11Texture2D</code> textures and transfer them from GPU to CPU and then use libx264 to encode them.</p>

<p>However, pulling textures from GPU to CPU can be a bottle neck which potentially can decrease the fps. Also libx264 takes up CPU cycles (depending on quality) to encode frames. I am looking for encoding <code>ID3D11Texture2D</code> textures in GPU itself instead of using CPU for encoding as an optimization.</p>

<p>I have already checked the documentation and some sample codes but I have had no success. I would appreciate if someone could point me to some resource that does exactly what I want reliably.</p>