glikely / obs-ptz

OBS Pan Tilt Zoom camera control plugin
GNU General Public License v2.0
143 stars 41 forks source link

Obs closes when saving usb port #162

Open Oluizlopes opened 1 year ago

Oluizlopes commented 1 year ago

Olá pessoal, o plugin está com bug quando seleciona a camera nas configurações e adiciona a porta usb o obs fecha, não consigo controlar a PTZ

jonata commented 1 year ago

Olá Luiz. Obrigado por reportar esse problema. Vejo que você é novo aqui no GitHub. Sempre é melhor se comunicar nos projetos usando o idioma que os desenvolvedores dominam. Nesse caso, te incentivo a escrever em inglês o seu relatório. Outra coisa que seria muito útil é ter mais informações, na verdade o máximo de informações que você consegue dar (sistema operacional, dispositivo, versão do OBS etc) e um log do sistema no momento em que esse erro acontece. Você facilmente consegue instruções de como informações e logs de erro pesquisando na internet. Novamente, muito obrigado. Ficamos no aguardo de seu novo relatório.

glikely commented 1 year ago

Hi @Oluizlopes

USB cameras are not supported but the plugin, but it still should not cause OBS to crash. Can you please attache the OBS log file so that I can see what is going on?

vishy-git commented 1 year ago

Hi @Oluizlopes

USB cameras are not supported but the plugin, but it still should not cause OBS to crash. Can you please attache the OBS log file so that I can see what is going on?

There are no crash logs or anything in log file when trying to save VISCA Serial configuration. Select the UART port and try saving. OBS just closes. That is a problem. Are you dropping VISCA serial support?

rodto commented 1 year ago

@glikely I had the same issue.

https://obsproject.com/logs/NA5ste8KWMQWJBCl

vishy-git commented 1 year ago

If VISCA serial support is not discontinued, we should fix this. If not, drop support for this. Either way, an update to the plugin is needed. This seems to have broken after OBS 28.1.1 and 29.

normen commented 1 year ago

Same issue here, OBS simply crashes when obs-ptz tries to connect to any serial port, no matter if USB, built-in or virtual.

sadale commented 1 year ago

Same problem here.

bradleypeterson commented 1 year ago

@glikely

I'm seeing the same thing. In my case, it's a Fomako camera. Been using it for a couple of years on two machines without problems. I then updated a computer from Windows 10 to Windows 11. Now it crashes exactly when I select the COM port and then click "Apply"

According to the logs, this is what it looks like on a computer that accepts the camera after clicking "Apply":

22:41:02.882: [obs-ptz] plugin loaded successfully (version 0.16.0-test2)  
22:41:03.078: [obs-ptz] Looking for UART object COM3  
22:41:03.078: [obs-ptz] Creating new VISCA object COM3  
22:41:03.104: [obs-ptz] COM3 --> 88:30:01:ff 22:41:04.255: [obs-websocket] [obs_module_load] you can haz websockets (Version: 5.1.0 | RPC Version: 1)  
22:41:04.255: [obs-websocket] [obs_module_load] Qt version (compile-time): 6.3.1 | Qt version (run-time): 6.3.1  
22:41:04.255: [obs-websocket] [obs_module_load] Linked ASIO Version: 101201  
22:41:04.262: [obs-websocket] [obs_module_load] Module loaded.  

And this is a computer that gives the crash when clicking "Apply":

22:44:30.090: [obs-ptz] Looking for UART object COM4   
22:44:30.090: [obs-ptz] Creating new VISCA object COM4
( the log file ends here )

I've been able to rule out the camera as being an issue, as OBS + obs-ptz plugin works on another Windows 11 computer.

I've also been able to rule out USB->serial cable driver. On the computer that crashes in OBS, I installed this tool: https://ptz-controller.software.informer.com/3.9/, and it read camera no problem on COM4 and controlled it with VISCA commands.

Seems something is going wrong loading up the com port.

log-working.txt log-not-working.txt

bradleypeterson commented 1 year ago

I was able to narrow it down to a line of code. I got the plugin to compile on Windows. (Build notes need updating btw, I had to use the github build scripts.) I updated the code below as follows

//In uart-wrapper.hpp
//... some code
bool PTZUARTWrapper::open()
{
    blog(LOG_INFO, "In PTZUARTWrapper::open(), preparing with uart.open(QIODevice::ReadWrite)",
             qPrintable(port_name));
    bool rc = uart.open(QIODevice::ReadWrite);
    blog(LOG_INFO, "In PTZUARTWrapper::open(), finished with uart.open(QIODevice::ReadWrite)",
             qPrintable(port_name));
//... more code          

Sure enough, the log file shows "preparing with uart.open..." and it never reaches "finished with uart.open..."

That means it's crashing at
bool rc = uart.open(QIODevice::ReadWrite);

bradleypeterson commented 1 year ago

I also narrowed it down to a certain configuration that always crashes.


Devices and cords

Computer A: HP pavilion Computer B: Dell Inspiron

Both running OBS PTZ v0.16.0 codebase and OBS 29

Cord 1: Oikwan, claims to be FTDI chipset, but computer immediately gave PL2303TA chip error “PL2032TA DO NOT SUPPORT WINDOWS 11 OR LATER, PLEASE CONTACT YOUR SUPPLIER” Cord 2: TRENDnet TU-S9 Prolific USB to serial. PL2303TA chip. Also generates PL2303TA chip error “PL2032TA DO NOT SUPPORT WINDOWS 11 OR LATER, PLEASE CONTACT YOUR SUPPLIER” Cord 3: DTech uses FT232RL chipset Cord 4: Keyspan Serial USB adapter, unknown chipset

Camera F - Fomako Camera C - Clear Touch RL400


Test setups and results

Computer A - Cord 1 - Camera F - Windows 11: Worked Computer A - Cord 2 - Camera F - Windows 11: Worked Computer A - Cord 3 - Camera F - Windows 11: Worked Computer A - Cord 4 - Camera C - Windows 11: Worked

Computer B - Cord 1 - Camera F - Windows 10: Worked

(I then updated Computer B to Windows 11)

Computer B - Cord 1 - Camera F - Windows 11: Did not work Computer B - Cord 2 - Camera F - Windows 11: Did not work Computer B - Cord 3 - Camera F - Windows 11: Did not work Computer B - Cord 4 - Camera C - Windows 11: Did not work

Computer B - Cord 1 - Camera F - Windows 11 - Used PTZ Controller 3.9: Worked Computer B - Cord 2 - Camera F - Windows 11 - Used PTZ Controller 3.9: Worked


As you can see, the only scenario that repeatedly didn't work was Computer B + Windows 11 + OBS PTZ plugin. Computer B can talk to the camera using another PTZ tool. Computer B could also talk to the camera in Windows 10 using OBS PTZ. It's just something about the three tuple of Computer B + Windows 11 + OBS PTZ plugin causing the problem.

At this point the only next step I can think of is to try and narrow down why QT6 crashes when trying to open any com port on computer B. I was able to get a QT6 hello world program to compile that uses the serial library, but merely including the library and doing nothing else seg faulted the program before it could even display "Hello world". So...I'm stuck and not sure how I can proceed.

vishy-git commented 1 year ago

To add to this, I have a computer with Windows 11, OBS 28.1.1 and PTZ Control 12.0 works.

Upgrade OBS to 29.* and it breaks.

Upgrade to PTZ Control 15.4 with OBS 28.1.1 and it breaks.

bradleypeterson commented 11 months ago

To add to this, I have a computer with Windows 11, OBS 28.1.1 and PTZ Control 12.0 works.

Upgrade OBS to 29.* and it breaks.

Upgrade to PTZ Control 15.4 with OBS 28.1.1 and it breaks.

Yes, I'm seeing something similar.

OBS 28.1.1 + Windows 11 works on all PTZ Control versions, including a custom build from the latest source code.

OBS 29 + Windows 11 still does not work.

I did not install the earliest 29 betas to see when the problem cropped up. But at this point I wonder if it's an OBS bug and not a QT bug or a PTZ Control bug.

djsmacedo commented 10 months ago

Same problem here with version 29. Working with version 28.

devinbost commented 10 months ago

I experienced this as well on Windows 11 (not on my M1 Macbook Pro), and the event viewer entry named Qt6Core.dll in the crash. If it's crashing, that indicates an unhandled exception being thrown.

@glikely If it's crashing at: bool rc = uart.open(QIODevice::ReadWrite); this is even more suspect.

From the docs, it appears that an error from an inability to open the device should show up here: https://doc.qt.io/qt-6/qserialport.html#error-prop

But, in the present case, that's not what's happening. Instead of returning false, it seems that the QSerialPort object is internally throwing an exception before it can return false (likely a bug in the library).

We could try to upgrade the library, but that might cause other trouble if there are breaking changes, so I'd like to see the exception so I can dig a bit further and see if there's a known issue that's been fixed in a more recent version. What about trying something like this?

    try {
        bool rc = uart.open(QIODevice::ReadWrite);
    } 
    catch(const std::exception& e) {
       blog(LOG_INFO, "Qt6 error when trying to open UART for VISCA (uart.open(QIODevice::ReadWrite))- Exception is %s",
             qPrintable(e.what()));
        throw; 
    } 
devinbost commented 10 months ago

I'm still working on getting my dev environment setup, but I started on this here: https://github.com/glikely/obs-ptz/pull/174 (Don't merge yet since I don't even know if it compiles yet.)

bradleypeterson commented 10 months ago

I recall putting in a try catch block, and it still crashed. (I unfortunately don't recall what datatype I was catching).

I also suspect it's a QT6 bug.

I wanted to narrow it down further, but I just couldn't get a QT6 hello world program to run without seg faulting. My hope was that if I could just have some small < 100 line program open up the serial port, then I'd have a much easier time moving forward.

If you want any help on my end, I'm more than happy to test out anything you've got.

GustavoAntonny commented 9 months ago

Hi guys, I was facing the same issue, you can fix it by adding this version (6.4.3.0) of QtSerialPort.dll to the OBS root folder, and the problem is gone! I hope it helps!

Qt6SerialPort.zip

devinbost commented 8 months ago

Is this a version upgrade of QtSerialPort? I'm trying to find where the versions are specified, but I'm not sure how to translate the way the version is specified (https://github.com/glikely/obs-ptz/blob/main/buildspec.json) with the way they're defined in Qt6. (Our project says we're using 2022-08-02, but I can't find which Qt6 version that release date maps to.)

devinbost commented 8 months ago

I found the old DLL in C:\Program Files\obs-studio\obs-plugins\64bit, and the metadata indicated it was version 6.3.1.0. That new file is version 6.4.3.0, and when I replaced the old version with the new one, it worked!!!

devinbost commented 7 months ago

After the latest upgrade of OBS, I'm getting a version incompatibility. How do I get the new Qt6SerialPort.dll? I'm not finding it after installing Qt6.

devinbost commented 7 months ago

I found it by installing both the MinGW version of Qt and the Qt Serial Port module in Additional Libraries in the Qt6 installer. After that, it was in the mingw_64/bin directory.

However, I couldn't get the plugin to load with the new version.

techwizard8391 commented 5 months ago

Anyone achieves a resolution to this, as even after the file is placed in the root directory, after applying the camera settings OBS crashes.

glikely commented 4 months ago

Hi everyone. Apologies, but I haven't been able to spend any time on this project in the last year. Yes, the problem is that OBS Studio updated the Qt6 libraries, but the qtserialport library shipped with the plugin is built against an older version. The way I've included the library is inherently fragile. Currently obs-ptz handles it by rebuilding all of obs-deps, and then packaging the resulting qtserialport. Fixing properly requires build system rework.

I might have to drop serial port support in the packaged versions

The ideal solution would be for OBS-Studio to build and ship qtserialport with the rest of qt6, but when I've asked for that to be done the patch has been rejected.

Regardless, sorry for not being able to do anything with this for the last year. I'll try to get it fixed, but I cannot make any promises.

Bluescooter42 commented 4 months ago

That you the update and honest.

Scott Lindsay

On Sun, Feb 25, 2024, 6:04 AM Grant Likely @.***> wrote:

Hi everyone. Apologies, but I haven't been able to spend any time on this project in the last year. Yes, the problem is that OBS Studio updated the Qt6 libraries, but the qtserialport library shipped with the plugin is built against an older version. The way I've included the library is inherently fragile. Currently obs-ptz handles it by rebuilding all of obs-deps, and then packaging the resulting qtserialport. Fixing properly requires build system rework.

I might have to drop serial port support in the packaged versions

The ideal solution would be for OBS-Studio to build and ship qtserialport with the rest of qt6, but when I've asked for that to be done the patch has been rejected.

Regardless, sorry for not being able to do anything with this for the last year. I'll try to get it fixed, but I cannot make any promises.

— Reply to this email directly, view it on GitHub https://github.com/glikely/obs-ptz/issues/162#issuecomment-1962933504, or unsubscribe https://github.com/notifications/unsubscribe-auth/A73GKBL4PGGHMEY6XCWOIQ3YVMZETAVCNFSM6AAAAAAYUY66DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSHEZTGNJQGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

devinbost commented 3 months ago

Is there a link to where they've rejected the ask to include qtserialport in the official build? I don't understand why that would be rejected upstream.

-- Devin Bost

On Thu, Mar 7, 2024, 8:57 PM Bluescooter42 @.***> wrote:

That you the update and honest.

Scott Lindsay

On Sun, Feb 25, 2024, 6:04 AM Grant Likely @.***> wrote:

Hi everyone. Apologies, but I haven't been able to spend any time on this project in the last year. Yes, the problem is that OBS Studio updated the Qt6 libraries, but the qtserialport library shipped with the plugin is built against an older version. The way I've included the library is inherently fragile. Currently obs-ptz handles it by rebuilding all of obs-deps, and then packaging the resulting qtserialport. Fixing properly requires build system rework.

I might have to drop serial port support in the packaged versions

The ideal solution would be for OBS-Studio to build and ship qtserialport with the rest of qt6, but when I've asked for that to be done the patch has been rejected.

Regardless, sorry for not being able to do anything with this for the last year. I'll try to get it fixed, but I cannot make any promises.

— Reply to this email directly, view it on GitHub https://github.com/glikely/obs-ptz/issues/162#issuecomment-1962933504,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/A73GKBL4PGGHMEY6XCWOIQ3YVMZETAVCNFSM6AAAAAAYUY66DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSHEZTGNJQGQ>

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/glikely/obs-ptz/issues/162#issuecomment-1984958126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYTBL5G2IXAGJROHZYBLTTYXESLBAVCNFSM6AAAAAAYUY66DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBUHE2TQMJSGY . You are receiving this because you commented.Message ID: @.***>