assurance-tunnel
assurance-tunnel
assurance-tunnel
assurance-tunnel

[ANSWERED] How to use Isadora to Change Scenes in OBS via Python and OSC on Windows?



  • hello all,

    we need help to get the phyton script for obs scene switch by osc getting to work?

    maybe someone can post a little tutorial for non programmer to switch obs scenes from izzy patch per osc?

    this would be very helpful for us, because after maybe 8 hours of trying, we stop.

    win 10 pro

    isadora 3.0.7

    i7

    newest obs studio

    thx,

    r.h.



  • @deflost said:

    this would be very helpful for us, because after maybe 8 hours of trying, we stop.

    OK, I did it. It was in fact pretty complex... and took me at least an 90 minutes to complete this myself and document it for you. I hope that this set of instructions will get you going.

    First, you must decide if you'll use OBS 32 bit or 64 bit. I am using the 32 bit version because it allows me to us the NDI virtual web cam. So, this procedure was done with the 32 bit version of OBS and the 32 bit version of Python. In theory you should be able to use the 64 bit version of OBS and the 64 bit version of Python using the same set of instructions; just make sure that they match!

    I had python and pip already installed. I didn't want to uninstall them to create this set of instructions. Hopefully the installation instructions for Python and pip will work fine for you.

    In the instructions below, items that are bold and underlined are things you need to type.

    INSTALL APPS + OHER ASSETS

    1) Install Python 32-bit version. (My version is 3.7 which is not the latest. You can get the latest version of Python here.)
    2) Install the Python Package manager pip as described here.
    3) Install OBS 32-bit.
    4) Go to the obs-websocket plugin page. Click the "Go to Download" button at the top right. Scroll down until you see "obs-websocket-X.X.X-Windows-Installer.exe" where X.X.X will be the current version number. Download that file and run the installer. It should automatically install the script in the correct location for OBS.
    5) Go to the OBsC github repository, click the "Clone or Download" button and choose "Download ZIP"
    6) Right click the downloaded file (ObSC-master.zip) and choose "Extract All..."
    7) Click the "Browse..." button and choose your documents folder and then click "Extract." You should now have a folder in your documents folder called "ObSC-master"
    8) Download my modified version of the ObSC script by clicking the link to the right ---> ObSC-mod.zip
    9) Unzip and drag the ObSC-mod.py file into the ObSC-master folder. You should now see both the original ObSC.py and ObSC-mod.py next to each other.

    TEST THAT PYTHON AND PIP ARE INSTALLED

    1) In the Windows search bar, type command and then select "Command Prompt" from the top of the list
    2) In the command prompt type python and hit return. If python is successfully installed, you will see something like "Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32" followed by the ">>>" prompt. If you see the ">>>" type exit() and hit return to leave python.
    3) In the command prompt type pip and hit return. You should see the help information for pip if it is correctly installed.

    If you see 'XXXX is not recognized as an internal or external command, operable program or batch file." for either of these, then you have not correctly installed python and/or pip.

    ADD PYTHON PACKAGES USING PIP

    1) In the Windows search bar, type command and then select "Command Prompt" from the top of the list
    2) In the Command Prompt window, type pip install python-osc==1.7.4 and hit return to install python OSC support. When finished you should see something like "Successfully installed python-osc-1.7.4" to indicate python-osc was installed properly.
    3) In the Command Prompt window, type pip install obs-websocket-py==0.5.1 and hit return to install OBS websockets support. When finished you should see something like "Successfully installed obs-websocket-py-0.5.1 six-1.14.0 websocket-client-0.57.0" to indicate obs-websocket-py was installed properly.

    OPEN OBS AND START THE OSC SERVICE

    1) Open OBS and setup your scenes, e.g., "Scene 1", "My Camera", whatever.
    2) The first time you run OBS after installing OBS websockets, you will be presented with a dialog saying that "Windows Firewall has blocked some features of this app". Click the "Allow Access" button. This setting is remembered and you shouldn't see it the next time you run OBS.
    3) In the Windows search bar, type command and then select "Command Prompt" from the top of the list
    4) Enter python "%UserProfile%\Documents\ObSC-master\ObSC-mod.py" (including the double quotes) and hit return
    5) The ObSC script should start running. It will print a bunch of text, but should end with "CURRENT SCENES IN OBS" followed by a list of all the Scene names you've defined in your OBS Setup. Note that if you change your scene list in OBS, you must should close the Command Prompt window and repeat Step 3 and 4 above.

    CONTROL OBS FROM ISADORA USING OSC

    The ObSC-mod.py script accepts the OSC Address "/Scene" followed by a zero-based scene index. By default the script expects the OSC data to arrive on port 5005. Thus /Scene 0 will select the first scene, /Scene 1 will select the second and so on. The following Isadora example file uses the number keys ('1', '2', '3', etc.) to select the corresponding scene.



    obs-osc-example.izz


    I have tried to be as precise as I can. Let me know if this procedure gets you up and running.

    Best Wishes,
    Mark



  • @mark

    thank you soooo much for your time.

    we try it tomorrow. 

    best wishes,

    r.h.



  • @deflost said:

    thank you soooo much for your time.

     I changed the name of this topic to better inform other users what I've answered here.

    Best Wishes,
    Mark



  • hello,

    evrything works till this point,

    "4) Enter python "%UserProfile%\Documents\ObSC-master\ObSC-mod.py" (including the double quotes) and hit return"

    the machine said:

    C:\Users\gerd\Downloads>C:\Users\gerd\Desktop\ObSC-maser_rene)\ObSC-master\ObSC-mod.py"
    INFO:obswebsocket.core:Connecting...
    INFO:obswebsocket.core:Connected!
    Adding Scene = 'Szene 2
    Adding Scene = 'Szene 3
    Adding Scene = 'meeting
    Adding Scene = 'Szene 4
    CURRENT SCENES IN OBS:
     ['Szene 2', 'Szene 3', 'meeting', 'Szene 4']
    Traceback (most recent call last):
      File "C:\Users\gerd\Desktop\ObSC-maser_rene)\ObSC-master\ObSC-mod.py", line 64, in <module>
        server = osc_server.ThreadingOSCUDPServer((args.ip, args.port), dispatcher)
      File "C:\Python38\lib\site-packages\pythonosc\osc_server.py", line 54, in __init__
        super().__init__(server_address, _UDPHandler)
      File "C:\Python38\lib\socketserver.py", line 452, in __init__
        self.server_bind()
      File "C:\Python38\lib\socketserver.py", line 466, in server_bind
        self.socket.bind(self.server_address)
    OSError: [WinError 10013] Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig

    C:\Users\gerd\Downloads>

    aftre this we move the master folder to hdd d:

    because we thought there is a problem with rights on c: .

    after this we redo the same with the new path and then nothing comes then the win prompt.

    is this right, till there? maybe.

    but,

    the test patch you do, does not switch obs scenes,

    both, obs and python are 64bit,

    can we check in any other way if some osc is received by the script, or by python in general?

    sorry, but never done bevor anything wtih python.

    so we wonder why there is no more text printed by the script on the new hdd location, but also no error from the windows cmd?

    thx, 

    r.h.



  • Dear @deflost 

    You are very close if the script is loading as far as it is. It is most definltey a permission's problem.

    One quick thing you can try is run the Command Prompt as an administrator.

    1. Press the Windows key and X key at the same time to open the Power Users
    2. Select the Command Prompt (Admin) option from the menu to run Command Prompt as admin.

    (Here are the instructions with pictures).

    @DusX - do you have any other advice? The error in English is "Access to a socket was not permitted due to the socket's access rights"

    Best Wishes,
    Mark



  • @mark

    thank you, we tried the admin thing already, no change.

    we also change the python versdion to 3.7.7, no change.

    thank you so long, maybe a friend of us can write a ofx tool for us.

     greeting to the team, 

    r.h.



  • this was the last state after do ervything again and as admin and again with python 3.8

    PS C:\WINDOWS\system32> python "d:\ObSC-Master\ObSC-mod.py"
    INFO:obswebsocket.core:Connecting...
    Traceback (most recent call last):
      File "C:\Program Files\Python38\lib\site-packages\obswebsocket\core.py", line 68, in connect
        self.ws.connect("ws://{}:{}".format(self.host, self.port))
      File "C:\Program Files\Python38\lib\site-packages\websocket\_core.py", line 222, in connect
        self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
      File "C:\Program Files\Python38\lib\site-packages\websocket\_http.py", line 121, in connect
        sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
      File "C:\Program Files\Python38\lib\site-packages\websocket\_http.py", line 201, in _open_socket
        raise err
      File "C:\Program Files\Python38\lib\site-packages\websocket\_http.py", line 176, in _open_socket
        sock.connect(address)
    ConnectionRefusedError: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "d:\ObSC-Master\ObSC-mod.py", line 16, in <module>
        ws.connect()
      File "C:\Program Files\Python38\lib\site-packages\obswebsocket\core.py", line 73, in connect
        raise exceptions.ConnectionFailure(str(e))
    obswebsocket.exceptions.ConnectionFailure: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte
    PS C:\WINDOWS\system32>

    thx,

    r.h.



  • last post:

    we fund this, it works super easy, we test the standing for longer time and will report.

    https://obsproject.com/forum/r...

    thx.

    r.h.