J2Kbr / GtunerIV

Gtuner IV - Titan Two's software bug report.
http://www.consoletuner.com
25 stars 4 forks source link

Computer Vision on PC, T2 , switching Resolution -> can't grab frames #395

Closed Scachi closed 3 years ago

Scachi commented 3 years ago

Hi,

I am trying to use Computer Vision on PC via capture Card via the T2. Testing Apex Legends on PC with my usb hid anti recoil script and applying your anti recoil values to it to see if I can make it work via some scaling factors.

I have to duplicate my monitor output to my capture card and can't feed the monitor signal directly to the capture card because of cable/resolution issues. I am using a display-port connection to my monitor and a hdmi connection to my capture card. So I do win+p to mirror my main screen to the capture card connection.

This is working fine until I enter a game that changes the screens resolution / to fullscreen mode. This gives a black screen for 1sec and results for the capture card in reporting that it cant grab frames anymore:

GCV Error: [ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1159) 
 CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147483638

I can switch the T2 slot back & for to reload the CV script and it works fine until the game switches resolution again, like leaving game and going back to games dashboard.

Is there any option to make the Computer Vision to try to reinit the video grabbing on its own somehow ? Like after failing to grab 3 frames let it restart/reopen the stream ?

This would safe me from switching T2 slots on every instance a game is messing with the displays.

Scachi commented 3 years ago

I can use display capture but that does seem to cause more cpu load than using the capture card and is also limited to lower fps of the capturing.

J2Kbr commented 3 years ago

Hi Scachi. After some researching it seems to be a issue with MSMF backend. Once it is initialized with specific resolution, any change on the resolution will cause frame grabbing failure. Unfortunately is not possible for Gtuner to distinguish this error (resolution change) from others (e.g. removal of capture card).

Please try "MS DirectShow" backend to check if it handles better the resolution change.