mmozeiko / wcap

Simple and efficient screen recording utility for Windows 10 and 11
The Unlicense
831 stars 35 forks source link

Latest version records a green screen #9

Closed immortalx74 closed 2 years ago

immortalx74 commented 2 years ago

Latest version records an empty green video, and a second after I press the shortcut to stop recording, the program exits. I don't know if this was introduced in this particular version, cause I've missed a couple of updates.

This is on a Thinkpad with Windows 11, Intel GPU HD4600, Core i5 4300M

I tried both the provided binary, and also built it myself.

mmozeiko commented 2 years ago

Could you build debug binary (build.cmd debug) and run under debugger to see if it stop or produced output message (in debugger output window) when you start recording? I also have not tried running wcap with Windows 11 at all, it could be that something is not compatible with it and needs to be adjusted.

Oh, btw GPU you have HD4600 has pretty bad quality video encoding implementation. Good encoding started from Skylake and up. Try unchecking "Hardware Encoder" checkbox, so encoding is done on CPU - maybe that'll help with something.

immortalx74 commented 2 years ago

It first pauses at lines 153 and 154 on wcap_encoder.c (without me putting a breakpoint). I then continue execution and the program starts normally. As soon as I try to record it it throws an exception at line 468. Screenshot 2021-12-08 162904 It might be a Windows 11 thing as you said.

EDIT: I now saw your edited comment. Tried unchecking checkbox, same issue. wcap used to work fine on this PC, and I've used almost all versions since the beginning.

mmozeiko commented 2 years ago

That does not sound like Win11 issue. It something in D3D11 configuration I use that your GPU driver does not like or requires newer GPU. I'm pretty sure it should be possible to fix it, I just don't know the actual error.

When debugger stops, check the debugger output. I don't know where it is in VSCode, but in Visual Studio it is called "Debug -> Windows -> Output". It will show error explanation why it stopped there - not just "exception has occurred", but actual D3D11 error message why it is failing.

immortalx74 commented 2 years ago

I was checking the wrong output window. There's "debug console" and "output" in vscode and I accidentally watched the second. D3D11 ERROR: ID3D11Device::CreateComputeShader: Shader uses new Typed UAV Load formats, but the device does not support this. To check for support, check device caps via the CheckFeatureSupport() API [ STATE_CREATION ERROR #2097322: CREATECOMPUTESHADER_INVALIDSHADERBYTECODE]

D3D11 ERROR: ID3D11Device::CreateTexture2D: The format (0x57, B8G8R8A8_UNORM) cannot be bound as an UnorderedAccessView, or cast to a format that could be bound as an UnorderedAccessView. Therefore this format does not support D3D11_BIND_UNORDERED_ACCESS. [ STATE_CREATION ERROR #92: CREATETEXTURE2D_UNSUPPORTEDFORMAT]

The first one is at lines 153,154. I can see that ResizeShader and ConvertShader are NULL. If I continue the program and start recording it stops with the second error. It indeed seems my GPU is the issue, so I guess something has changed in wcap cause it used to work perfectly.

mmozeiko commented 2 years ago

Well it changed because I added these two compute shaders. So this change is expected :) These messages helps, thanks! I'll check what can be done about it. I just need to use different formats of textures, and then it should work.

mmozeiko commented 2 years ago

Here's one more request from me - run C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\dxcapsviewer.exe (version number in folder might be different for your installation). Select your GPU under "DXGI Device" and do "File -> Print subtree to file". It will create dxview.log file on your Desktop, please send it to me / upload here. It will contain detailed information about what your GPU supports - it would help me changing the code.

immortalx74 commented 2 years ago

Thanks so much, anything else you need I'd be glad to provide! Here's the log: dxview.log

mmozeiko commented 2 years ago

Can you try code from https://github.com/mmozeiko/wcap/tree/d3d11compat branch? Let me know if it works or not.

If it works, please check two following things: 1) check debug output from debugger - if there are any warning messages or not, just in case. 2) try recording large window or whole monitor with Width/Height settings set to 0 (so it won't resize video), and set to some smaller number, like 400/400 so it will force resizing. I just want to be sure if both cases works on your hardware.

immortalx74 commented 2 years ago

Here are my findings:

  1. The program works without crashing
  2. It produces correct video both on debug/release and with resize/ no resize
  3. The output has some access violations. I commented the output to mark the point after launch. The rest is the output after a recording session d3d11compat_output.txt .
mmozeiko commented 2 years ago

Awesome! I've pushed code to main branch. Those access violation messages are expected - they come from address sanitizer in debug builds.