DiscreteTom / rusty-duplication

Capture the screen on Windows using the Desktop Duplication API in Rust, with shared memory support.
MIT License
9 stars 1 forks source link

Question: About RGB10A2 #13

Open TheKrisn opened 8 months ago

TheKrisn commented 8 months ago

Does this always capture RGBA8/BGRA8 or there is an ability to read from RGB10A2 buffers.

I am very new to this topic and recently been looking into obs-rs crate ( which works using graphics hook injection ) for game capture, but after injection that crate returns text_desc format = 24 for some games which is RGB10A2, but this crate return RGBA8 for everything.

Why is that happening, can someone help me or direct me to related reading material.

Thanks in advance

DiscreteTom commented 8 months ago

With Windows Desktop Duplication API, the pixel format is always BGRA.

See the doc here.

The format of the desktop image is always DXGI_FORMAT_B8G8R8A8_UNORM no matter what the current display mode is.

TheKrisn commented 8 months ago

That means obs graphics hook uses a different method for capturing than Windows Desktop Duplication API. Capturing via Duplication API should be faster than graphics hook, right?

Thanks for the information 💯

DiscreteTom commented 8 months ago

There are other ways to capture windows (not desktop), you can checkout this repo for some information. Desktop Duplication should be the fastest one.

However this repo may not be the fastest approach, see #12 . Maybe improve this later.

TheKrisn commented 8 months ago

It's hard for me to believe than python implementation is faster than rust xD. Yeah i hope you may improve performance in future, so starred your repo already. Also i am not able to capture fullscreen games with this, so have to settled with unmaintained dxgcap for now :(