Resource icon

Zoom to Mouse 1.0.1

B2Run

New Member
There isn't anything more to it than just deleting the script from OBS, it's just the single Lua file.

What version of OBS are you using? Is it 29? Do you have any other scripts or plugins that might be interfering with it? I'm not sure what else to suggest. Did you restart OBS between removing and re-adding the script? Maybe something got cached.
OBS version is 30.0.02. I have few plugin but all worked fine until I switched phisically 2 of my screen and then I changed the screen capture source. Anyway, I'll continue to try. Thanks again
 
OBS version is 30.0.02. I have few plugin but all worked fine until I switched phisically 2 of my screen and then I changed the screen capture source. Anyway, I'll continue to try. Thanks again
My guess is that OBS is reporting the size/position of your monitors incorrectly after you switched them.

Have you tried enabling set manual source position and filling in the x/y/width/height values?
 

B2Run

New Member
The screen I need to zoom has a negative value as the Y coordinate, and currently, it seems that it's not possible to insert it into the script
 
The screen I need to zoom has a negative value as the Y coordinate, and currently, it seems that it's not possible to insert it into the script
You must have a really old version of the script, even before v1.0.0, where did you even get it from?

If you can't download and use the latest from GitHub, try looking in your version for a line that looks like:

Lua:
local override_x = obs.obs_properties_add_int(props, "monitor_override_x", "X", 0, 10000, 1)
local override_y = obs.obs_properties_add_int(props, "monitor_override_y", "Y", 0, 10000, 1)

And then change the 0 to -10000 on both lines
 

B2Run

New Member
Got it! Finally I resolved! It seems that even if I overwrited the old version of script, it continue to be present. Now all it's fine. Thanks again!
 

sawizzle

New Member
Thank you for this amazing script! I might be over looking something and forgive me if I am, but was there any way for multiple sources to be used in conjunction with this script? As of right now I can only have one lua script of zoom-to-mouse added for all sources. I was hoping to add two more monitors but was not able to since one instance of the script can be applied for any given source at a time. Thank you for any advice or guidance and thank you again for this amazing script!
I wish to have this feature as well and also this script is incredible! Thank you!!! Even just a second monitor option would be incredible if there is a way.
 
I wish to have this feature as well and also this script is incredible! Thank you!!! Even just a second monitor option would be incredible if there is a way.
You should be able to add a second copy of the script (with a rename) and add that to obs too. Then in the second copy just point it at a different zoom source.

There isn't a great way to handle it beyond that right now. I did have plans to use a custom filter you could apply to different sources to mark it as command, but OBS has bugs with Lua made filters that made it unworkable.
 

Chubbuluss

New Member
The second I switch scene with the display capture within a group, then come back, the plugin just ceases to function until I remove it from the group, re-apply the plugin to that display capture and then re-add it to the group. Therefore rendering the entire script useless.
 

Daameer

New Member
I'm trying to combine your script with Aitum Vertical so all parts of the screen can be seen during vertical streaming with games where mouse moves. The script works well with the source if I wanted to zoom in on the horizontal stream (game source that remained as "jackbox game" on a 1080p monitor), but I can't make it go to all the corners on the vertical screen of Aitum Vertical.

Been trying to play with parameters to get it to work but no success... Do I need to change something in the script?


[obs-zoom-to-mouse.lua] Zoom crop filter removed
[obs-zoom-to-mouse.lua] Transform info reset back to original
[obs-zoom-to-mouse.lua] Transform crop reset back to original
[obs-zoom-to-mouse.lua] OBS Version: 30.1

[obs-zoom-to-mouse.lua] Current settings:
[obs-zoom-to-mouse.lua] {
[obs-zoom-to-mouse.lua] use_auto_follow_mouse = true,
[obs-zoom-to-mouse.lua] use_follow_outside_bounds = false,
[obs-zoom-to-mouse.lua] follow_speed = 0.4,
[obs-zoom-to-mouse.lua] follow_border = 50,
[obs-zoom-to-mouse.lua] follow_safezone_sensitivity = 2,
[obs-zoom-to-mouse.lua] use_follow_auto_lock = false,
[obs-zoom-to-mouse.lua] zoom_value = 1.83,
[obs-zoom-to-mouse.lua] zoom_speed = 0.02,
[obs-zoom-to-mouse.lua] use_monitor_override = true,
[obs-zoom-to-mouse.lua] monitor_override_x = 0,
[obs-zoom-to-mouse.lua] monitor_override_y = 0,
[obs-zoom-to-mouse.lua] monitor_override_w = 1920,
[obs-zoom-to-mouse.lua] monitor_override_h = 1080,
[obs-zoom-to-mouse.lua] monitor_override_sx = 1,
[obs-zoom-to-mouse.lua] monitor_override_sy = 1,
[obs-zoom-to-mouse.lua] monitor_override_dw = 1080,
[obs-zoom-to-mouse.lua] monitor_override_dh = 1920,

[obs-zoom-to-mouse.lua] debug_logs = true,
[obs-zoom-to-mouse.lua] }
[obs-zoom-to-mouse.lua] Adding transition_start listener to Cut
[obs-zoom-to-mouse.lua] Adding transition_start listener to Fade
[obs-zoom-to-mouse.lua] Adding transition_start listener to Stinger
[obs-zoom-to-mouse.lua] Adding transition_start listener to Luma Wipe
[obs-zoom-to-mouse.lua] Adding transition_start listener to Swipe
[obs-zoom-to-mouse.lua] Adding transition_start listener to Fade to Color
[obs-zoom-to-mouse.lua] Adding transition_start listener to stinger advanced
[obs-zoom-to-mouse.lua] Adding transition_start listener to Move

[obs-zoom-to-mouse.lua] Finding sceneitem for Zoom Source 'jacbox game'
[obs-zoom-to-mouse.lua] Looking in scene 'ingame'
[obs-zoom-to-mouse.lua] Found sceneitem 'jacbox game'
[obs-zoom-to-mouse.lua] Using source size: 1920, 1080
 
I'm trying to combine your script with Aitum Vertical so all parts of the screen can be seen during vertical streaming with games where mouse moves. The script works well with the source if I wanted to zoom in on the horizontal stream (game source that remained as "jackbox game" on a 1080p monitor), but I can't make it go to all the corners on the vertical screen of Aitum Vertical.

Been trying to play with parameters to get it to work but no success... Do I need to change something in the script?
Try taking a look at the GitHub issue (which actually links to another one)

Someone made a change that fixed it for their vertical case, hopefully it will also work for you.
 

Daameer

New Member
Thanks @BlankSourceCode, I wanted to reply since I figured it last night but was too busy by now.

My solution was changing the line that sets boundries when it crops. Since I don't need zoom (using zoom 1x in the end for max coverage in vertical layout) but I needed the "scroll left and right effect" I changed the line for crop.x with numbers that work out for my setup.

Lua:
crop.x = math.floor(clamp(-540, pos.x, 540))


If I knew how to watch variables for LUA I would probably make it using your logic... but this worked out for my setup.
People using actual zoom and not just scrolling will need to play more with the same line.
 

roqq

New Member
Does anybody know why this script is only moving the X axis and not really actually following the mouse, but just moves the screen, sortasay... :(
 

polugreen

New Member
Thought I would share my experience - hope it'll help the developers perfect the plugin. Installed on macOS Sonoma with ultrawide Samsung G9 monitor (49", 5120x1440). Switched between window/application/display capture several times, but always with the same result: it seems that the plugin relies on the mouse pointer's position on the screen as opposed to its position in the app window. In other words, if the app is sitting in the right half of the screen, to zoom in on it, you have to move the mouse outside of the window, to the left half of the screen. When you place the app window in the left half, zooming seems to work correctly, although I only tested it briefly. As a workaround, I ran an additional HDMI cable between the CPU and the monitor and turned on PbP on the monitor. It worked for some time, but after a while it stopped working altogether. I tried removing the plugin, restarting the computer, and reinstalling the plugin/assigning hotkeys, but to no avail. I wonder if adding extra layers has anything to do with it. I have a couple of scenes with images on the foreground. I'll try creating a scene with just one element (screen capture) and see how it goes. Anyway, thanks to the developer for making OBS better!
 

appa6513

New Member
M1 Macbook Pro - Sonoma 14.4.1 user here. It almost works! Can't quite get it to follow my mouse 100% though unfortunately. It's as if the zoom is stuck on a certain axis point. The zoom POV will move around as I cross my mouse over the x and y axes, but it won't stay fixated on the mouse and it is limited in how far it will move. It won't extend completely to the far right of my screen. I also noticed that it only functions whilst I'm actively on OBS. If I move to another application, it will not function no matter what hot key I assign. I hope some fixes can be done for this sometime as I would love to use this feature. Until then, props for you even taking this on. Much appreciated!
 
OBS on Mac has an issue with how it reports the display size for retina displays (or maybe the issue is with Mac not OBS? I don't exactly know). The point is, the script isn't able to figure out the size of your monitor automatically, and it gets worse if you are using different canvas sizes, non display capture sources, etc. So it doesn't track the mouse as it should.

For those with issues on Mac, try checking out this bug in the GitHub repo where someone managed to alter the script to make it work for their setup. Hopefully you can do something similar to fix it for you:

 

jenks_

New Member
I'm having an issue where my display capture "flickers" after scene transitions. I've isolated the issue to the zoom-to-mouse script -- if I disable that script, the flickering goes away. I'm using the latest version of the script.

 

jenks_

New Member
I also have a second unrelated question: How does the zoom speed convert to milliseconds? I’m trying to figure out the exact speed of the zoom animation.
 
@BlankSourceCode works great on Mac - Had to fandangle things a bit to get it to follow properly (Main monitor is 4k, but set to 2560x1440 + MacBook Pro 14" on the right side = lots of fun messing around in manual settings). Appreciate your hard work on a super useful little plugin/script!

I did have a "feature request" or possibly some help figuring out how to mod your code and do it myself - I'm looking to do Photoshop/After Effects tutorial type stuff, and I'd like the ability to change the zoom factor using a hotkey so I can get closer to certain UI elements or show closer views of things. The janky way would be to just duplicate my scene + increase the size of the source + use the Move plugin to get smooth transitions between the zoomed scenes, but was hoping for a... well... less janky solution. Appreciate your help!

UPDATE: My janky solution is so janky it doesn't actually work, so ignore that haha.
 

3dfromzero

New Member
Hi @BlankSourceCode

Thanks for making this fantastic script!

I'm having trouble getting it to correctly follow my mouse position in Mac OS 13.6 (M1 MacBook Pro)
I am working on a secondary LG Ultrafine monitor which is 3840 x 2160 (mac os is scaling the display to 3008 x 1692)
The source window S I'm trying to zoom in on, when I measure it is 1929 x 1110

The zoom does not work as expected, I have to go way off to the right of the large monitor to get it to zoom in anywhere on the right hand side of the source.

I have tried scaling up and scaling down but no luck so far.

What would be your approach?

Many thanks,

Matt
 

Attachments

  • Screenshot 2024-07-01 at 08.42.30.jpg
    Screenshot 2024-07-01 at 08.42.30.jpg
    231.4 KB · Views: 19
Top