I'm working on a program that captures footage from OpenGL/Direct3D/Vulkan games: https://github.com/itchio/capsule
It's really interesting to work on!
- I need to use different strategies on Linux, Mac OSX & Windows to hook into a running executable
- LD_PRELOAD on Linux
- DYLD_INSERT_LIBRARIES on Mac (+ swizzling Objective-C methods)
- CreateRemoteThread + Detouring (emitting binary code directly in the program's memory so it'll jump to OUR version of a function like wglSwapBuffers instead) on Windows
- OpenGL has a flat API (simple C functions), but Direct3D has an object-oriented C++ API, which means swapping function pointers in vtables instead!
- My reference project for game capture is OBS Studio, which is great, but a huge codebase with a lot of dependencies, in particular...
- OBS deals directly with video encoding - but all I want capsule to do is send raw frames (uncompressed pixel data) to another program which will take care of encoding. That'll make my program a lot simpler than obs
- OBS has this whole concept of scenes, layouts, various sources, etc. - again, for capsule I just need one video source and at most one audio source
- OBS doesn't draw anything on top of games, but for capsule I want to do that! To show stuff like progress when capturing a game (maybe it only captures 30s of video max and you can pause/resume like in Vine?)
Anyway, still lots to do, everything is open-source as usual (Github repo), help is welcome if you know your way around C++/CMake :)
BONUS:
Nevermind, I got it! 👍 pic.twitter.com/4NWG5MwJpf
— amos (@fasterthanlime) May 17, 2016
Hello pixels! pic.twitter.com/USKk4DmSaY
— amos (@fasterthanlime) May 17, 2016