tryptech / obs-zoom-and-follow

Dynamic zoom and mouse tracking script for OBS Studio
Apache License 2.0
362 stars 63 forks source link

Ultrawide Monitor #90

Open MrJRules opened 1 year ago

MrJRules commented 1 year ago

I have used this script for almost a year and it is great!

I just upgraded monitors to a Samsung Odyssey G9 monitor and there are some issues. My desire is to share a section of my screen that has the software I wish to record, then activate the script to zoom and pan only the specified section that I cropped into. I have tried it through a crop filter, I have tried this through the transform... but every time I activate the script it changes either my transform or crop in a way that is not how I set it up to start, and it zooms into the whole screen instead of the cropped section.

If I set the whole screen to the full resolution, it works perfectly. This is only an issue when I desire for the capture to be of a specific area of the screen, not at the top left. Any way I can get this to work?

MrJRules commented 1 year ago

Below is a series of images showing my settings at each point in the process on the ultrawide: initial, while zooming, and after zooming settings. First, I experimented with every possible combination of settings and it all ends up failing in one way or the other. In the process I noticed a few things that almost worked, and the issues that are prevented these settings from working.

The first image below shows the initial crop settings in the crop filter. The second image shows the offset x and y settings being honored but with errors, and the third image shows the crop settings after deactivating the zoom.

ZoomPan_Before ZoomPan_DuringScale_Experiment2 ZoomPan_After_Experiment2

First, I am not quite sure which settings work best for the script as the Offset X and Y are only being applied to the mouse cursor, not the actual shown part on the monitor. Second, the offsets in the crop filter get reset to zero instead of using the initial settings I had set up. Third, while zooming with these settings, we get a zoom but it only scrolls vertically and gets stuck horizontally.

Again, my goal is to capture a part of the screen. Then to zoom and pan within that defined space, only. LMK if you need more info to help work out the bugs. Thanks!

maximillionfrday commented 1 year ago

hey message me. I spend weeks on what I think was very similar. I had to pay someone on fiverr to show me what I knew was a matter of faulty settings. My monitor is only 1920 x 1080 but the concept is surly the same. You are welcome to whatever I have learned.

MrJRules commented 1 year ago

hey message me. I spend weeks on what I think was very similar. I had to pay someone on fiverr to show me what I knew was a matter of faulty settings. My monitor is only 1920 x 1080 but the concept is surly the same. You are welcome to whatever I have learned.

I would appreciate any help you can provide. Honestly though, I am not sure how to DM you.

maximillionfrday commented 1 year ago

This worked.  Let's connect around 10 central if that works for you.   DavidSent from my Galaxy -------- Original message --------From: MrJRules @.> Date: 2/1/23 4:38 PM (GMT-06:00) To: tryptech/obs-zoom-and-follow @.> Cc: maximillionfrday @.>, Comment @.> Subject: Re: [tryptech/obs-zoom-and-follow] Ultrawide Monitor (Issue #90)

hey message me. I spend weeks on what I think was very similar. I had to pay someone on fiverr to show me what I knew was a matter of faulty settings. My monitor is only 1920 x 1080 but the concept is surly the same. You are welcome to whatever I have learned.

I would appreciate any help you can provide. Honestly though, I am not sure how to DM you.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

maximillionfrday commented 1 year ago

Hello? MrJ?

MrJRules commented 1 year ago

Hello? MrJ?

Hey Max!

maximillionfrday commented 1 year ago

Meet me on zoom?

From: MrJRules @.> Sent: Thursday, February 2, 2023 4:01 PM To: tryptech/obs-zoom-and-follow @.> Cc: maximillionfrday @.>; Comment @.> Subject: Re: [tryptech/obs-zoom-and-follow] Ultrawide Monitor (Issue #90)

Hey Max!

— Reply to this email directly, view it on GitHub https://github.com/tryptech/obs-zoom-and-follow/issues/90#issuecomment-1414432147 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ATK5K45YJWWI43YZIVOJECLWVQVBFANCNFSM6AAAAAAUCAP43A . You are receiving this because you commented. https://github.com/notifications/beacon/ATK5K43UAOS5RCLYSBQKX2LWVQVBFA5CNFSM6AAAAAAUCAP43CWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSUJ2CZG.gif Message ID: @. @.> >

maximillionfrday commented 1 year ago

https://us02web.zoom.us/j/8177089000

RVillani commented 1 year ago

@MrJRules I have the same monitor as you do. I submitted a pull request with changes that enable us to constrain the zoom to any specific area of the monitor. If you'd like to test it, get it from here: https://github.com/RVillani/obs-zoom-and-follow Cheers

MrJRules commented 1 year ago

@MrJRules I have the same monitor as you do. I submitted a pull request with changes that enable us to constrain the zoom to any specific area of the monitor. If you'd like to test it, get it from here: https://github.com/RVillani/obs-zoom-and-follow Cheers

Hi RV,

Can you provide a screenshot of your script settings and the source setting you are using. I tried every combination of settings to get this working but it does not work. When triggering the zoom, the screen goes black like turning off an old television. I tried the following settings in the transform:

ZoomMouseFollow_BoundingBoxSetup ZoomMouseFollow_SizeSetup

And I have tried these settings in the script: ZoomMouseFollow_Script Settings_AutoDefault ZoomMouseFollow_Script Settings_ManualOverride

I have tried every combination of the above, and more. Thanks for the assistance.

MrJRules commented 1 year ago

@MrJRules I have the same monitor as you do. I submitted a pull request with changes that enable us to constrain the zoom to any specific area of the monitor. If you'd like to test it, get it from here: https://github.com/RVillani/obs-zoom-and-follow Cheers

The video below will show the bug I am coming across when using the latest script you provided above. Thank you for the assistance.

ZoomAndFollowBugSnapshot

RVillani commented 1 year ago

Hi @MrJRules

These are my settings. The biggest differences I can spot are I use "Scale to outer bounds" and no crop, because that scaling does the cropping for me, so it fills the canvas, cropping out the excess. And "Center Right" for the alignment in the bounding box to align the right side of my screen inside the "cropped" box.

image image

The video was very useful. I believe what's happening is when you zoom in, your crop settings still count on top of the smaller source (when the crop filter kicks in). And because both "Left" and "Right" are bigger than the zoomed in source resolution of 1280, OBS ends up cropping the whole thing out, leaving you with the black (empty) canvas. So try not cropping. Your zoom settings look good. But if you want the precise right side of the screen, with a 16:9 proportion, 2560x1440 with 2560 offset on X (to offset the capture area to the right) works perfectly for me.

I guess what you need to keep in mind is that the source size will change, but your transform settings, apart from "Size", won't. So they need to work for both the full and the cropped monitor.

RVillani commented 1 year ago

On a side note, I also use PowerToys' Fancy Zones, to define an area with precisely 2560x1440 on the right side of my screen. That helps align any window I want to capture with a single Shift+drag of the window.

RVillani commented 1 year ago

I think you can keep the top 48 crop to hide the taskbar if you don't offset the zoom Y. Because then OBS will be cropping 48 pixels from both the original size and the zoomed in image, so you need to include the taskbar in the zoomed in version.

Edit: I just tested this theory. Simply set Crop Top to 48 and leave the rest untouched. OBS will be cropping those top 48px on both full-sized and zoomed in sources. However, to keep 16:9 ratio, I'd have to shrink my window to 2475 pixels on width. Then adjust the zoom settings to capture only that right 2475 pixels of the screen. I believe it would be size 2475x1440 (remember the top will be cropped by OBS, so leave it as full screen height) and offset X 2645 (= 5120 - 2475).

MrJRules commented 1 year ago

Awesome!!! In the transform settings for the source, zeroing out the crop values (leaving the top to 40 px for removing the task bar in both the source and zoom) and setting Scale to Outer Bounds worked! It was not perfect but did show signs of a solution. I then changed the values in the script settings as follows: Manual monitor width and height to 2560x1440, changing the X offset to 1280, and the y offset to 0. This worked like a charm. Now I have my source appropriately revealed on the canvas, and the zoom constrained to this boundary. I appreciate you!

Below are the capture of my settings. Keep in mind that I am not using the right side, I am using the middle of my screen so I can have obs and zoom on the left with chats, and a webpage on the right.

Regarding functionality, I think I get what is happening. The Settings, Manual Monitor Width define what happens to the source once it zooms back out. Everything below Enable Manual Offset defines what happens after zoom. So, for me, this defines the top left bounds, and the width and height bounds for zooming. In the Source Transform, cropping will stay the same even when the zoom happens. So, the new size will be displayed minus the transform crop factor. So, removing these crop settings allowed the zoom to zoom into the smaller area specified in the script setting without removing the transform crop as well. However, if I want something removed from both the original source and the zoomed version, I can add those crops in the transform. Does this sound correct?

PS: I am using AquaSnap for my windows management and it works great. Although, maybe I need PowerToys' fancy zones to define zones. I wonder if the two monitor managers will be in conflict. Either way, Aqua does the job for me.

image image

As a suggestion, maybe there should be more documentation that explains some of the nuances of the script? I am positive this would help edge cases like this in the future. Thank you again for fixing the issue and helping me get the proper settings setup for my instruction.

RVillani commented 1 year ago

Nice! I decided today to record the center too and my settings are the same as yours, except only for the top crop. I keep the taskbar on the left to use the whole real estate of the screen (the only reason why I'm avoiding Win 11 lol).

I think you described it well. I only disagree with

The Settings, Manual Monitor Width define what happens to the source once it zooms back out.

The manual size settings constrain the area the zoomed "window" will be able to move inside the source. So, in our case, with the source being 5120x1440, setting it to 2560 constrains it to the half left of it without an offset. If your non-zoomed view displays the center of the screen, you'd end up zooming into the left of your screen only, because that's what the crop filter would crop to and OBS would align the center of that into the source bounding box. Thus, it affects the zoomed in view.

If you meant the transition when zooming out, that's just the result of interpolating the crop filter's values to zero, all at once. The source grows back to its original size and every frame OBS re-aligns it inside the bounding box as defined in the source's transform settings.

One way to really see these things happening and make it easier to debug/understand is setting the zoom animation to the slowest possible setting. It helped me a lot together with reading the source code.

I didn't know about AquaSnap. But it makes sense that you already had a window manager. It's pretty much a must with this monitor haha.

Regarding the docs, I tried to keep the description in the Scripts window short while still adding some info. I forgot there's a README, where there could be more detailed examples and gotchas. I'll wait for the creator to merge my changes (he's checking if I it still works with his changes for Mac first) and then try to remember to add that.

MrJRules commented 1 year ago

@RVillani

Awesome! I am glad that I was able to inspire you to use the center of the monitor :).

Can I suggest a few things?

  1. Based on all the information you provided, I feel like I understand what the script is doing, and better understand the issues of logic I was having when setting up the script. I thought, intuitively speaking, the script was pulling transform data from the source, and storing it for use with the zoom operation. Why not just grab the transform information from the source for the monitor crop, offset and boundaries? That way the script is more automated---with less redundancy and less prone to user error---while placing the elements that are not available by default in OBS in the script properties (such as zoom width and height, the smoothness, active border, and duration.). I believe this would remove a lot of confusion. It is super easy to set the crop factors in the editor's transform, naturally, through alt clicking the borders of the source, and getting the source to look as intend. Zooming into the area provided in the transform, then restoring these settings after would be amazing.

  2. In addition, I believe it would be beneficial to store the monitor directly from the source, this way we do not need to select the monitor for the script. One less thing to cause trouble for users.

  3. If any of this should need to be overridden, just have the option to override default transform information in the script settings, then reveal all the override settings.

Thank you for all of you help and for providing an ultrawide fix. I hope the above suggestions help. Let me know if you need a future tester for any updates regarding usability and the ultrawide monitors. I am grateful for your work!

MrJRules commented 1 year ago

@RVillani

Perhaps, as a possible quick fix for the user experience, the following suggestions can be implemented?

  1. Script property label changes for clarity of purpose:
  1. Move the general tutorial text to the bottom, and the value/field-specific tutorial text above their appropriate sections. Perhaps even hide and show the tutorial text for each section with the values the text is referring too. This way it does not feel too overwhelming at first glance, but the text is there when needed.

  2. Direction change: Monitor Crop and offset: For Ultrawide Users or Users that desire to crop into a specific space within the selected monitor, you will be using the "Monitor Crop Override" check box, which will reveal 4 values when checked: "Crop Width", "Crop Height", "Offset X", and "Offset Y". These values define where the constrained space on your monitor will start (top left pixel), and the width and height of the constrained area. This area is where the zoom will happen. Since these settings are only used for the zoomed area.... you will still need to make sure your source is showing the same area using the following source transform settings:

Let me know if you need anyone to test any changes to the scripts. I would be happy to help and provide feedback. This is one of the most useful tools I have as a teacher and has already helped my lessons a great deal.

RVillani commented 1 year ago

Those are interesting proposals!

On source selection

I don't know how feasible it is in OBS to do the auto monitor selection, if at all, so I won't comment too much on that. The creator, @tryptech, is working on the source/monitor stuff and the code seems complex, because it has to work differently for Windows, Linux and Mac.

Crop settings

The description and help texts, I agree that most of it would be very good for the user experience. And I think it's possible to simplify cropping even more than you described.

First, the auto cropping from user settings. I don't know if it's possible to get the source transform settings on OBS scripts, but if so that'd be really useful. The script would be pretty much plug and play. Love the idea!

As for manual cropping, I think treating them as crop margins, same as OBS does, would be more effective because it's likely the user is already familiar with OBS crop settings, which act as margins, not size and offset. Thus, the options would become:

And then a text saying that these add to the OBS transform crop settings (because I don't know if it's possible to disable them and have OBS not crop the zoomed source). I think treating it as an addition would make it clearer that the user's crop settings will affect the zoomed in window and that they're just cropping more on top of that.

That, together with the script automatically detecting the initial crop from the transform settings would remove a lot of the guess work and necessity to understand the inner-workings of the script. It's a bunch of math a coder (me or anyone else) would have to figure out, do it right once, and everybody benefits after that. So definitely an improvement.

I called it extra crop because it would also be a crop on top of the automatic crop from OBS transform align settings, even if the user has no actual crop values in the transform settings. That way, the zoom crop settings are consistent: they'll always crop more on top of what you can already see when not zoomed in. It would never zoom into areas that the original source already crops out.

Getting it done

All of that said, I share your enthusiasm to enhance the script, but I'm not one of its creators. I'm just a user with some coding background in games, so I'm familiar with code for animation, timing, UI math, etc. And I wanted to have some features without writing the whole thing from scratch. I didn't even know Python, I can change it looking at the syntax that's there, but I wouldn't be able to do it from scratch, set it up etc.

I'm very thankful for this script and the fact that its creator accepts pull requests and I don't want to abuse their good will by piling up pull requests or the amount of changes they need to review. So I'll wait for my latest changes to be integrated (which were almost 20 commits at once already) to then work on the changes we're discussing here. Otherwise, the review work gets much harder, with so many things moved around that it becomes daunting to follow what was changed, or if it was just reordered, and making sure it all still works.