pouët.net

kkapture compatabilty tips for DX11 coders

category: code [glöplog]
 
hi,

i've spent the better part of yesterday trying to figure out why kkapture was not able to record videos from my recent DX11-based demos (in particular my latest evoke release proto2 / science). I finally was able to make it work and I thought i'd quickly share my findings so other DX11 coders do not have to go through the same pain:

1) Make sure your D3D11 init code creates the swap chain via IDXGIFactory::CreateSwapchain and not D3D11CreateDeviceAndSwapChain. This is absolutely vital, as kkapture does not hook into the latter.

2) Use KeyJ's modified kkapture 1.02, not ryg's original version. Apparently, grabFrameD3D11() does not work reliably and kkapture won't be able to retrieve the backbuffer pixel data. KeyJ's version seems to work, although it still prints "video/d3d10: couldn't create staging texture for gpu->cpu download!" in the log file

3) If you are using BASS for audio, try using BASS_DEVICE_DSOUND when calling BASS_Init() and you should probably also provide a valid HWND handle

4) More log output (esp. in grabFrameD3D11) in the kkapture codebase would not hurt. You could modify the kkapture source code, but be aware that it's not possible to build it with VS Express..

Hope these tips help a bit.

P.S. It would be great if someone could add the hook for D3D11CreateDeviceAndSwapChain into kkapture and also integrate KeyJ's changes (reviewing grabFrameD3D11 along the way) or maybe add more documentation to the package.
added on the 2018-08-23 10:00:49 by arm1n arm1n
Link to KeyJ's modified version is in this thread
added on the 2018-08-23 10:04:07 by arm1n arm1n
1) Fixed in my fork, thanks for the info. "proto2" video capture works with that.

2) Strange. There was only one minor change between ryg's repo and 1.02 regarding D3D1x, and it looks like it might break D3D10 rather than 11.

3) You're right, something makes kkapture miss audio in your demo. I'll try to investigate.

4) Not sure about current VS Express, but VS Express 2010 and 2012 definitely worked, and so does VS Community 2017.
added on the 2018-08-23 22:03:57 by KeyJ KeyJ
3) Fixed too. Well, not exactly fixed ... merely worked around. The underlying issue is that BASS nowadays prefers to use WASAPI, which isn't intercepted by kkapture at all (proof: you still hear audio while kkapturing and timing is totally messed up). BASS can be forced to use DirectSound by modifying the flags passed in BASS_Init, which is what the workaround does, but a proper fix would be to implement WASAPI. That's something for later ...
added on the 2018-08-23 22:45:38 by KeyJ KeyJ
Hey KeyJ, thanks a lot for looking into these issues!

I think 2) might actually not be a bug, iirc both grabFrameD3D10 and 11 are called always, and then what happens is that the d3d10 variant just bails out with the misleading message, then the d3d11 variant gets called which works as it should.

Regarding 3): Yes BASS defaults to wasapi now. I force to direct sound in my demo code now, as described.

4) ok, I thought vs express can not handle the .rc resource stuff. I'll check again.
added on the 2018-08-23 23:20:36 by arm1n arm1n
2) You're right, both are called, and you'll get an error for each frame if it's the "wrong" version.

4) VS Express can't edit .rc files (you need to edit them with an external text editor -- been there, done that twice), but it compiles them to .res and links the resulting .res just fine.
added on the 2018-08-24 11:19:17 by KeyJ KeyJ
ok, great :)
Thanks and big thumps up for your support and effort to keep kkapture up-to-date!
added on the 2018-08-24 11:28:46 by arm1n arm1n

login