AX-VideoCapture

Had some spare time over the long weekend to knock out AX-VideoCapture, which borrows a lot from my AX-MediaPlayer block, but for hardware accelerated webcam capture on windows.

It (ab)uses WGL_NV_DX_interop2 to share DirectX textures with OpenGL on the GPU side, which saves a round trip down to the CPU and back up again, which is important as 4k video streams become more prevalent.

If you need access to the pixel data on the CPU side there’s a non-accelerated path that will allow you to grab a ci::SurfaceRef out to do with as you please, otherwise frames exist on the GPU only and can be extracted via the FrameLease concept I used for AX-MediaPlayer to handle the locking and synchronisation and whatnot behind the scenes.

There’s a SimpleCapture sample provided that basically covers the entire API, so hopefully you shouldn’t need much more than that to get going. I also added rudimentary device events (i.e inserted/unplugged etc) as well as some of the CameraControl api, so if your device exposes certain parameters via KSPROPERTY_CAMERACONTROL_* I will detect them and provide a way to read and write those values: Brightness, exposure, zoom etc being some of the common ones.

Hopefully it might come in useful for somebody :slight_smile:

A

2 Likes

Just wanted to throw some gratitude your way, despite me not knowing if I actually will use it.

My most prevalent use case is to record the render output of my live performance software, but for it to be truly useful, I’d have to also record the audio along the way. Right now, my solution is to simply rely on Xsplit to record the output window and the output audio. The downside of this approach is - of course - that audio/video can only be captured at the speed it’s played-back.

Of all the things I’d like to do in my spare time, this is definitely on the list, but just often enough eeked out by other higher priority things.

Anyway, that has really nothing to do with your excellent work, so again - really appreciate all the work you do @lithium !

Cheers,
Gazoo