-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScreenCaptureforHWND - Is it possible to downscale the resolution of the capture frame? #60
Comments
Getting a scaled down buffer directly from the API is not available at the moment, but it's something we're investigating. In the mean-time, you'll need to scale down the buffer yourself using D3D/D2D. This won't give you any perf back on generating the frame, but if your pipeline is resolution dependent you may get something back there. If you use D2D, there's a variety of interpolation modes. |
Thanks. |
I will try to ask you better what example I want: In file SimpleCapture.cpp in function auto frame = sender.TryGetNextFrame();
if (frameContentSize.Width != m_lastSize.Width ||
frameContentSize.Height != m_lastSize.Height)
{
.....
.....
}
auto frameSurface = GetDXGIInterfaceFromObject<ID3D11Texture2D>(frame.Surface());
.....
.....
m_d3dContext->CopyResource(backBuffer.get(), frameSurface.get());
What I want to do is this: m_d3dContext->CopyResource(backBuffer.get(), frameSurface.get()); I know that I get
m_d3dContext->CopyResource(backBuffer.get(), frameSurface.get()); To be clear: This line (unlike in the original example) actually copies the resized texture (original resolution but not the original frame) You don't need to be care about step 2. Thanks! |
If you can send me a modified version of the code in void SimpleCapture::OnFrameArrived(
Direct3D11CaptureFramePool const& sender,
winrt::Windows::Foundation::IInspectable const&) Choose any resolution you want.. for example, you can write that the code will always resize it to 1024x768 and then resize it to the original frame resolution I will be very thanks to you. |
One more important note: I want that the resize will be done natively and not using the CPU. I did not found any docs about resizing the |
You need to setup a render target and texture a quad with the buffer (using shaders, a sampler, etc). Then you can use that render target (Or a copy of it with CopyResource) in the rest of your pipeline. I would look at D3D tutorials for that, that's outside the scope of these samples. |
I found that it will not help. Please add support in the API to reduce the resolution of the scan so that at the very beginning I will not get the bottleneck. If you add this support when it is expected to release? |
Unfortunately I can't provide a timeline at this time. I'll let you know when things change. |
OK, thanks. |
Hi @robmikh I need that the API will able to capture lower resolution. I need it to solve this issue: |
There is no update at this time. |
OK thanks for the response. |
No |
@robmikh I did some test with your ScreenCaptureforHWND example.
In the case that the ScreenCaptureforHWND window was very big, I noticed very big slowdown. I was able to prove it also in another way |
@robmikh Windows.UI.Composition-Win32-Samples/cpp/ScreenCaptureforHWND/ScreenCaptureforHWND/d3dHelpers.h Line 167 in a59e758
I have 0 knowledge about all of this stuff but my common sense told me that the flag So I tried to change it to My strategy was to look for any code on the internet that creating swap chain with flag Looks like it is your code from another example so I thought to use it somehow. Windows.UI.Composition-Win32-Samples/cpp/ScreenCaptureforHWND/ScreenCaptureforHWND/App.cpp Line 69 in a59e758
Then my common sense told me that maybe I should just remove these lines: auto surface = m_capture->CreateSurface(m_compositor);
m_brush.Surface(surface); And it just worked! |
Hello,
Is it possible to downscale the resolution of the capture frame from the API used in the example?
I want to reduce the resolution for example from 4K to 1080P without damaging performances too much.
I will appreciate any example or best instructions on how to do it efficiently.
I need to resize the actual pixels and not the way I display it on the screen.
I want at the end to get fewer pixels - instead of 4k, get 1920x1080 pixels
Thanks!
The text was updated successfully, but these errors were encountered: