Stream a source to memory or pipe

wizzar

New Member
I'm working on a program that analyzes a game screen to gather information.
Currently, I'm using the built-in screenshot function to generate an image, and then my program opens this image an analyzes that. The problem is that this method is kinda slow.
I've been looking for quite some time for a way to optmize this by streaming the source directed to a shared memory region, pipe, or something; maybe even having my program directly capture the image being displayed on source would be faster than going through the whole file creating process, but no luck.

What do you guys recommend for this kind of scenario, how can I optimze this process? I can't capture the game screen directly because of its anti-cheat measures.
 

upgradeQ

Member
The built-in virtual camera does not support outputting from selected source, only the preview(unless using this plugin). It's also has issues with OpenCV.

@wizzar could you also provide more details, like how in terms of time it's slow ? 1s, 2s, 0.5s ? There is yet another plugin which supports outputting images from any source to shared memory, raw image, HTTP. It's built for Windows and supports outputting to those destinations periodically under 250 ms.

You might also try capture window projector of a source.
 

wizzar

New Member
The built-in virtual camera does not support outputting from selected source, only the preview(unless using this plugin). It's also has issues with OpenCV.

@wizzar could you also provide more details, like how in terms of time it's slow ? 1s, 2s, 0.5s ? There is yet another plugin which supports outputting images from any source to shared memory, raw image, HTTP. It's built for Windows and supports outputting to those destinations periodically under 250 ms.

You might also try capture window projector of a source.

It takes about 0.5s on an i7-4700HQ, 12gb RAM, and 2gb dedicated video. The average user, however, has a considerably slower machine (mainly intel U processors, no SSD, ~6gb ram, integrated video).

Thanks for the plugins indications. I will check them out.
 

wizzar

New Member
Using the second plugin (https://github.com/synap5e/obs-screenshot-plugin) configured to write to shared memory every 250ms (as fast as it's allowed) I was able to speed up my update rate about 4 times.

Curiously enough, I'm actually able to read the raw image data about 10x faster than the plugin can write, i.e. I read the same image about 10 times every 250ms.
 
Top