Resource icon

Zoom and Follow 0.1.0

Does anyone have any success with windows 10 monitor in 'portrait' orientation [obs on the top (or bottom) -- and the 'subject' of the Zoom and Follow on the other half?

- im aware that this is not the most efficient setup, however, I haven't a choice in this studio.

NOTE:: I have successfully set up a similar (at least with OBS and the subject both having half) in landscape orientation.
- It does take a little math (for the ratios) and the forced (manual?) offset in the scripts settings to get it right.
- Im happy to share. (screenshots and settings)
 
Incidentally, I have noticed a bunch of errors and logs being shared. Most of them I have experienced (working on getting this plugin to work (with focus being 1/2 of the screen & obs on the other side). I have installed obs and this plugin on almost every computer I own trying to figure out why I couldn't make it work.

what I did that worked (irrespective to any scientific method) was to repeat the steps in the Youtube video link I posted. I repeated the steps over and over untill the logs stopped fussing.

This is NOT my advice to you (as your situation is not the same (But, it worked for me on several versions of OBS and several versions of pyton)

By the way, I love this plugin BIGLY..
 

Matt Reiner

New Member
I'm running into issues using this script on Mac. Based on the log, it looks like I can enable/disable mouse tracking without an issue, but when I try to enable zoom, I get the following:
Code:
[zoom_and_follow_mouse.py] Key 'source' does not exist | {'Border': 0.03, 'follow.toggle': [{'control': True, 'key': 'OBS_KEY_F11'}], 'zoom.toggle': [{'control': True, 'key': 'OBS_KEY_F10'}]}
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 806, in script_load
[zoom_and_follow_mouse.py]     zoom.update_sources()
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 64, in update_sources
[zoom_and_follow_mouse.py]     self.windows = pwc.getAllWindows()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 157, in getAllWindows
[zoom_and_follow_mouse.py]     titleList = _getWindowTitles()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 475, in _getWindowTitles
[zoom_and_follow_mouse.py]     res = ast.literal_eval(ret)
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 64, in literal_eval
[zoom_and_follow_mouse.py]     node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 50, in parse
[zoom_and_follow_mouse.py]     return compile(source, filename, mode, flags,
[zoom_and_follow_mouse.py]   File "<unknown>", line 1
[zoom_and_follow_mouse.py]     [[696, 699, 700, 704, 38603, 46663, 47076], [[[], [], [], [], [missing value], [], []], [[], [], [], [], [[0, 25]], [], []], [[[1920, 1080]], [], [], [], [], [], []]]]
[zoom_and_follow_mouse.py]                                                                    ^^^^^^^^^^^^^
[zoom_and_follow_mouse.py] SyntaxError: invalid syntax. Perhaps you forgot a comma?

When I try to reload the script, I get this:

Code:
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 712, in script_properties
[zoom_and_follow_mouse.py]     populate_list_property_with_source_names(zs)
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 634, in populate_list_property_with_source_names
[zoom_and_follow_mouse.py]     zoom.update_sources()
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 64, in update_sources
[zoom_and_follow_mouse.py]     self.windows = pwc.getAllWindows()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 157, in getAllWindows
[zoom_and_follow_mouse.py]     titleList = _getWindowTitles()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 475, in _getWindowTitles
[zoom_and_follow_mouse.py]     res = ast.literal_eval(ret)
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 64, in literal_eval
[zoom_and_follow_mouse.py]     node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 50, in parse
[zoom_and_follow_mouse.py]     return compile(source, filename, mode, flags,
[zoom_and_follow_mouse.py]   File "<unknown>", line 1
[zoom_and_follow_mouse.py]     [[696, 699, 700, 704, 38603, 46663, 47076], [[[], [], [], [], [missing value], [], []], [[], [], [], [], [[0, 25]], [], []], [[], [], [], [], [[890, 954]], [], []]]]
[zoom_and_follow_mouse.py]                                                                    ^^^^^^^^^^^^^
[zoom_and_follow_mouse.py] SyntaxError: invalid syntax. Perhaps you forgot a comma?

Any ideas?

My setup:
macOS 13.1
OBS 29.0.1
Python 3.10
zoom_and_follow_mouse.py v.2022.10.21
pywinctl (not sure the version, but it was installed Feb 3, 2023)
 

UroDoc

New Member
I am getting the following error message when I click the hotkey to enable zoom, and I get no response when i click the hot key for follow.
[zoom_and_follow_mouse.py] File "D:\Church\Computer Software\OBS Software\OBS Scripts\Python\OBS.PYTHON\OBS PYTHON\zoom_and_follow_mouse.py", line 371, in toggle_zoom
[zoom_and_follow_mouse.py] zoom.update_source_size()
[zoom_and_follow_mouse.py] File "D:\Church\Computer Software\OBS Software\OBS Scripts\Python\OBS.PYTHON\OBS PYTHON\zoom_and_follow_mouse.py", line 66, in update_source_size
[zoom_and_follow_mouse.py] data = loads(data)['monitor']
[zoom_and_follow_mouse.py] KeyError: 'monitor'

I have 2 monitors both 1080P. I also tried it on another 2 monitor setup (4k and 1080p) with the same error message. Do the fields "Manual X Offset" and "Manual Y Offset" need to be filled in? Same error whether applying it to Display Capture 1 (Monitor 1) or Display Capture 2 (Monitor 2. Python 3.6 and PyWinCtl installed. OBS 29.0.1. Windows 10. I am new to Python.
Thanks
 

nishyp

New Member
I'm running into issues using this script on Mac. Based on the log, it looks like I can enable/disable mouse tracking without an issue, but when I try to enable zoom, I get the following:
Code:
[zoom_and_follow_mouse.py] Key 'source' does not exist | {'Border': 0.03, 'follow.toggle': [{'control': True, 'key': 'OBS_KEY_F11'}], 'zoom.toggle': [{'control': True, 'key': 'OBS_KEY_F10'}]}
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 806, in script_load
[zoom_and_follow_mouse.py]     zoom.update_sources()
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 64, in update_sources
[zoom_and_follow_mouse.py]     self.windows = pwc.getAllWindows()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 157, in getAllWindows
[zoom_and_follow_mouse.py]     titleList = _getWindowTitles()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 475, in _getWindowTitles
[zoom_and_follow_mouse.py]     res = ast.literal_eval(ret)
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 64, in literal_eval
[zoom_and_follow_mouse.py]     node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 50, in parse
[zoom_and_follow_mouse.py]     return compile(source, filename, mode, flags,
[zoom_and_follow_mouse.py]   File "<unknown>", line 1
[zoom_and_follow_mouse.py]     [[696, 699, 700, 704, 38603, 46663, 47076], [[[], [], [], [], [missing value], [], []], [[], [], [], [], [[0, 25]], [], []], [[[1920, 1080]], [], [], [], [], [], []]]]
[zoom_and_follow_mouse.py]                                                                    ^^^^^^^^^^^^^
[zoom_and_follow_mouse.py] SyntaxError: invalid syntax. Perhaps you forgot a comma?

When I try to reload the script, I get this:

Code:
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 712, in script_properties
[zoom_and_follow_mouse.py]     populate_list_property_with_source_names(zs)
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 634, in populate_list_property_with_source_names
[zoom_and_follow_mouse.py]     zoom.update_sources()
[zoom_and_follow_mouse.py]   File "/Applications/OBS.app/Contents/PlugIns/frontend-tools.plugin/Contents/Resources/scripts/zoom_and_follow_mouse.py", line 64, in update_sources
[zoom_and_follow_mouse.py]     self.windows = pwc.getAllWindows()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 157, in getAllWindows
[zoom_and_follow_mouse.py]     titleList = _getWindowTitles()
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/site-packages/pywinctl/_pywinctl_macos.py", line 475, in _getWindowTitles
[zoom_and_follow_mouse.py]     res = ast.literal_eval(ret)
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 64, in literal_eval
[zoom_and_follow_mouse.py]     node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
[zoom_and_follow_mouse.py]   File "/Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ast.py", line 50, in parse
[zoom_and_follow_mouse.py]     return compile(source, filename, mode, flags,
[zoom_and_follow_mouse.py]   File "<unknown>", line 1
[zoom_and_follow_mouse.py]     [[696, 699, 700, 704, 38603, 46663, 47076], [[[], [], [], [], [missing value], [], []], [[], [], [], [], [[0, 25]], [], []], [[], [], [], [], [[890, 954]], [], []]]]
[zoom_and_follow_mouse.py]                                                                    ^^^^^^^^^^^^^
[zoom_and_follow_mouse.py] SyntaxError: invalid syntax. Perhaps you forgot a comma?

Any ideas?

My setup:
macOS 13.1
OBS 29.0.1
Python 3.10
zoom_and_follow_mouse.py v.2022.10.21
pywinctl (not sure the version, but it was installed Feb 3, 2023)

I just updated to OBS 29.0.1 on macOS 10.15 to try to replicate this and it happened on launch for me.
After going to Tools -> Scripts and clicking on the zoom_and_follow_mouse.py and reloading it, I didn't have an error.

Note: there are still a few issues with the code for macOS users including myself if you check on the GitHub
 

nishyp

New Member
I am getting the following error message when I click the hotkey to enable zoom, and I get no response when i click the hot key for follow.
[zoom_and_follow_mouse.py] File "D:\Church\Computer Software\OBS Software\OBS Scripts\Python\OBS.PYTHON\OBS PYTHON\zoom_and_follow_mouse.py", line 371, in toggle_zoom
[zoom_and_follow_mouse.py] zoom.update_source_size()
[zoom_and_follow_mouse.py] File "D:\Church\Computer Software\OBS Software\OBS Scripts\Python\OBS.PYTHON\OBS PYTHON\zoom_and_follow_mouse.py", line 66, in update_source_size
[zoom_and_follow_mouse.py] data = loads(data)['monitor']
[zoom_and_follow_mouse.py] KeyError: 'monitor'

I have 2 monitors both 1080P. I also tried it on another 2 monitor setup (4k and 1080p) with the same error message. Do the fields "Manual X Offset" and "Manual Y Offset" need to be filled in? Same error whether applying it to Display Capture 1 (Monitor 1) or Display Capture 2 (Monitor 2. Python 3.6 and PyWinCtl installed. OBS 29.0.1. Windows 10. I am new to Python.
Thanks

Apparently, if you change line 227 to
Code:
monitor_id = data.get('monitor_id', None)
instead of
Code:
monitor_id =data.get('monitor', None)

That should solve this issue based on this GitHub ticket:
 

Howard Day

New Member
Hello, folks! I'm using this for a presentation tomorrow, and I've run into a minor snag - I can't use the mouse follow on my second monitor - apparently PyWinCtl only tracks the mouse on my main monitor! I've got two 4K displays, laid out like [ #2 ] [ #1 ], and when my mouse cursor exists on the #1 monitor, the zoomed in portion moves around - but I'm attempting to capture the #2 screen only, and it does not track the mouse on that monitor. Any ideas on how to fix this? My suspicion is that it's clamping the mouse coordinate values with the assumption that it can't go below "0".
Thanks in advance!
 

roqq

New Member
Somehow my zoom source stays empty. Not sure why this is happening.
Script log seems to be fine. Anybody an idea?

OBS 29.0.2
Mac OS 13.1 Ventura
 

Attachments

  • Screenshot 2023-02-20 at 15.10.42.png
    Screenshot 2023-02-20 at 15.10.42.png
    260 KB · Views: 55

roqq

New Member
Noticed in the log that the key 'source' doesn't exist. Anybody has the same issue? Having enough sources in my OBS profile...
 

Attachments

  • Screenshot 2023-02-20 at 15.33.10.png
    Screenshot 2023-02-20 at 15.33.10.png
    68.2 KB · Views: 40

roqq

New Member
Okay, it seems you need to use 'Display Capture' as a source. So NOT macOS Screen Capture or other screen/window capture sources.
 

roqq

New Member
Bumping up to the next error:


[zoom_and_follow_mouse.py] Source loaded successfully: display_capture

[zoom_and_follow_mouse.py] Source Type: display_capture

[zoom_and_follow_mouse.py] Retrieving monitor 0

[zoom_and_follow_mouse.py] Traceback (most recent call last):

[zoom_and_follow_mouse.py] File "/Users/admin/Downloads/obs-zoom-and-follow-master/zoom_and_follow_mouse.py", line 875, in toggle_zoom

[zoom_and_follow_mouse.py] zoom.update_source_size()

[zoom_and_follow_mouse.py] File "/Users/admin/Downloads/obs-zoom-and-follow-master/zoom_and_follow_mouse.py", line 335, in update_source_size

[zoom_and_follow_mouse.py] self.monitor_capture_mac(data)

[zoom_and_follow_mouse.py] File "/Users/admin/Downloads/obs-zoom-and-follow-master/zoom_and_follow_mouse.py", line 198, in monitor_capture_mac

[zoom_and_follow_mouse.py] if (monitor['id'] == monitor_index):

[zoom_and_follow_mouse.py] TypeError: tuple indices must be integers or slices, not str

Anybody has some ideas?
 

marcob8986

New Member
Hi,
I have setup everything successfully but the mouse follows on the "wrong" screen.
I'm on a dual monitor and screen recording the second one. It zooms in perfectly but doesn't follow mouse movement. While moving things around I noticed that it does follow the movement when the mouse is on screen1.

So, movement of mouse on screen 1 makes the zoom following on screen 2....

How can I fix this?
 

marcob8986

New Member
Hi,
I have setup everything successfully but the mouse follows on the "wrong" screen.
I'm on a dual monitor and screen recording the second one. It zooms in perfectly but doesn't follow mouse movement. While moving things around I noticed that it does follow the movement when the mouse is on screen1.

So, movement of mouse on screen 1 makes the zoom following on screen 2....

How can I fix this?
solved, I'm a fish...

Now I would like to use this zoom and follow on a "already cropped" desktop as a source.
Is this doable by tweaking the script?
 

nichuvj

New Member
Hi all
I installed python 3.6 and installed all the dependant pluggins. I'm still gettin the following error. Please help!
1678869539345.png
 

DENS92

New Member
I am having trouble running the script and I don't have enough knowledge to understand what I did wrong in following the steps to install the elements.

I'm using OBS 27.2.4 and python-3.6.8-amd64


1680914421504.png
 
Top