Resource icon

Advanced Scene Switcher 1.25.5

ItsThatGuyJD

New Member
I'm trying to use the File macro to show tuna music info on song change in that file but when I make the action it doesn't work is there a specific way to do this?
 

Warmuptill

Active Member
I'm trying to use the File macro to show tuna music info on song change in that file but when I make the action it doesn't work is there a specific way to do this?
Have you tried something similar to this?
SongInfo.PNG

If so, can you give more details what exactly is not working as you would expect?
 

thepoison606

New Member
Thinking off the top of my head.

Workaround might be to add 10 macros contained in the random selection ; 7 of which perform the function of Macro1 ( duplicate 6 times current macro ) ; 2 macros doing the function of Macro2 ( duplicate 1 time current macro ) and have 1 of Macro 3 ...

That's a good workaround idea! Thank you.

Thanks for the suggestion - I added it to the todo list.
The workaround suggested by @ottawafro should work in the meantime.


OBS 27 build is done, but I did not test it:
Let me know if you run into any issues.

Great, thanks a lot :)
 

kdarroch

Member
Warmuptill submitted a new resource:

Automatic Scene Switching - Switches to specified scenes depending on which window is in focus



Read more about this resource...
Love ultimate scene switcher. Wondering the best way to optimize macro execution to decrease time it takes to run thru macros? I have alot of macros that execute based on video source changes. For the most part it gets slower the more macros there are to execute/check logic but cpu usage never goes up. My pc has 12 cores and it sits at like 3%. Is there something in setup I am missing? Seams to not be using the computer resources like it should. Built this machine to do nothing but run OBS so nothing else is running and plenty of ram and cpu available based on windows performance. Any help would be appreciated
 

Warmuptill

Active Member
Love ultimate scene switcher. Wondering the best way to optimize macro execution to decrease time it takes to run thru macros? I have alot of macros that execute based on video source changes. For the most part it gets slower the more macros there are to execute/check logic but cpu usage never goes up. My pc has 12 cores and it sits at like 3%. Is there something in setup I am missing? Seams to not be using the computer resources like it should. Built this machine to do nothing but run OBS so nothing else is running and plenty of ram and cpu available based on windows performance. Any help would be appreciated
Can you describe what type of macros you are using in a bit more detail or export your settings to a file and share it?
That should make it easier to understand what exactly you are dealing with. :)

For most setups it is to be expected that the plugin does not use a considerable amount of system resources.
 

kdarroch

Member
So I look at a video source in a specific area and compare it to an image. The images are say #1-#50. When it finds a match it displays the overlay corresponding to that number. The macros keep watch for a change in number/letter/etc. And when it finds a match Turns off the current overlay and switches to new overlay. So I guess what I want to know is there a way to decrease the time it takes to cycle thru the 100 or so macros I have set up. In this case I want it to be fast so using system resources does not matter to me, that's why I built a standalone computer with plenty of cpu and memory to run obs.
 

Warmuptill

Active Member
So I look at a video source in a specific area and compare it to an image. The images are say #1-#50. When it finds a match it displays the overlay corresponding to that number. The macros keep watch for a change in number/letter/etc. And when it finds a match Turns off the current overlay and switches to new overlay. So I guess what I want to know is there a way to decrease the time it takes to cycle thru the 100 or so macros I have set up. In this case I want it to be fast so using system resources does not matter to me, that's why I built a standalone computer with plenty of cpu and memory to run obs.
How long does it usually / in the worst case take for the plugin to run through all your macros?
What types of actions are they performing? (In particular are any "Wait" actions or other time consuming actions used?)

The way the macro system currently operates is that it checks each macro's condition sequentially and in a second step then perform all actions.

So if the condition checks themselves are processed quickly, the main way to reduce the time it takes to recognize changes is to reduce the scene switcher interval on the General tab.

Interval.PNG


The default is 300ms - I guess you could try to use 50ms.

But with the video condition I could guess that the issue is not the switcher interval, but the time it takes to process each image.
Can you check if you see the following messages in your OBS log?
spent <number here> ms in <name here> condition check of macro <name here>

If that is the case you could try to set up some logic so that not all macros containing video conditions are active all the time.

The actions section of each macro is also performed sequentially by default, starting with the top most macro.
So if you have a set of macros that are waiting or performing other tasks for extended periods of time, you will run into the situation that other macros will be delayed.
To work around this you can enable the option to run the macros containing the "slow" action(s) in parallel the other macros, so it no longer blocks the execution of other actions.

Parallel.PNG
 

mikexilva

New Member
Hello,
I'm testing this plugin to trigger a camera change using it's audio on a multi camera setup on same room but since the cameras are close by, the audio going for one camera can still be heard on another camera, and if some one talks a bit lowder it will trigger more than one cameras at the same time.

Is there any way to make the switch according to higher audio level (compared to the other audio sources) instead of just a predefined trigger level?
 

AaronD

Active Member
Hello,
I'm testing this plugin to trigger a camera change using it's audio on a multi camera setup on same room but since the cameras are close by, the audio going for one camera can still be heard on another camera, and if some one talks a bit lowder it will trigger more than one cameras at the same time.

Is there any way to make the switch according to higher audio level (compared to the other audio sources) instead of just a predefined trigger level?
That sounds like a Dugan automixer, named for its inventor Dan Dugan. Except instead of controlling audio gain, you're using the internal control signals to switch cameras. Same logic to create those control signals.

Problem is, the patent is still valid, and the inventor is still making a living on it. So you'll have to either buy something that satisfies his license and figure out how to use it, or license it from him yourself. Probably not going to happen for this plugin.

The original invention was entirely analog, as a standalone 19-inch rackmounted thing to plug into the channel insert jacks of an analog mixing console. In terms of "conventional" audio processors, it's a cross-coupled ducker/expander. Each signal has a level detector and a gain element (analog VCA, or voltage controlled amplifier), but they're all connected so that each channel's increase causes its own gain to increase (expander) and all the others to decrease (ducker). That "voting" happens simultaneously for all channels, and the results are summed to control each VCA. The result is that the loudest one stands out and the rest fall away, and the rates are designed so that the total of all gains running in parallel stays constant.

I think for the plugin to do all of that directly, would infringe on the patent. But it would probably be okay to compare arbitrary things - it doesn't do that yet either - and it only happens that audio level is one of many arbitrary things. Better still, to avoid a mess of cross-comparisons, would be to do some math, store the result in a variable, and then compare anything to that variable.
For example, sum a bunch of audio levels, divide by a constant (start with the number of inputs used, and adjust as needed), store that, then compare each level to that (modified) average. But again, it would require some functionality that (to my knowledge) doesn't exist yet.



A long time ago, when @Warmuptill was switching from the old single-function tabs to macros, I made the case for arbitrary programming, like Python or similar. So there'd be a General tab, a Macro tab, and a Python tab, or whatever capable language. Still have a menu for everything that the API offers, but each menu item simply inserts the code required to use that API hook. The user still needs to make the connection.

I think the "compare multiple to an average" function would be one of the stronger arguments for that, because the menu structure to do all of that directly would get to be a mess pretty quick...unless that's *all* it does, which is getting dangerously close to the patent IMO.
 
Last edited:

ItsThatGuyJD

New Member
Have you tried something similar to this?
View attachment 89960
If so, can you give more details what exactly is not working as you would expectT

Have you tried something similar to this?
View attachment 89960
If so, can you give more details what exactly is not working as you would expect?
This is what I have and when the title changes the asset is still visible if I click run it will perform the action once but never again until I press run again
1672365814684.png
 

mikexilva

New Member
That sounds like a Dugan automixer, named for its inventor Dan Dugan. Except instead of controlling audio gain, you're using the internal control signals to switch cameras. Same logic to create those control signals.

Problem is, the patent is still valid, and the inventor is still making a living on it. So you'll have to either buy something that satisfies his license and figure out how to use it, or license it from him yourself. Probably not going to happen for this plugin.

The original invention was entirely analog, as a standalone 19-inch rackmounted thing to plug into the channel insert jacks of an analog mixing console. In terms of "conventional" audio processors, it's a cross-coupled ducker/expander. Each signal has a level detector and a gain element (analog VCA, or voltage controlled amplifier), but they're all connected so that each channel's increase causes its own gain to increase (expander) and all the others to decrease (ducker). That "voting" happens simultaneously for all channels, and the results are summed to control each VCA. The result is that the loudest one stands out and the rest fall away, and the rates are designed so that the total of all gains running in parallel stays constant.

I think for the plugin to do all of that directly, would infringe on the patent. But it would probably be okay to compare arbitrary things - it doesn't do that yet either - and it only happens that audio level is one of many arbitrary things. Better still, to avoid a mess of cross-comparisons, would be to do some math, store the result in a variable, and then compare anything to that variable.
For example, sum a bunch of audio levels, divide by a constant (start with the number of inputs used, and adjust as needed), store that, then compare each level to that (modified) average. But again, it would require some functionality that (to my knowledge) doesn't exist yet.



A long time ago, when @Warmuptill was switching from the old single-function tabs to macros, I made the case for arbitrary programming, like Python or similar. So there'd be a General tab, a Macro tab, and a Python tab, or whatever capable language. Still have a menu for everything that the API offers, but each menu item simply inserts the code required to use that API hook. The user still needs to make the connection.

I think the "compare multiple to an average" function would be one of the stronger arguments for that, because the menu structure to do all of that directly would get to be a mess pretty quick...unless that's *all* it does, which is getting dangerously close to the patent IMO.
Right.. I thought software patents weren't an universal issue (specially when hardware was required before and it isn't anymore, software has so many dimensions that shouldn't be caped), anyway I just wanted to switch the video, maybe include main camera in big size and other cameras in a smaller size, not necessarily excluding all other audio but isn't this what videoconferencing software do? Zoom, Teams, Webex, Google Meet, all of them show the speaker in based on who is talking, this would be doing the same on a local room instead of distributed over the internet.
 

AaronD

Active Member
Right.. I thought software patents weren't an universal issue (specially when hardware was required before and it isn't anymore, software has so many dimensions that shouldn't be caped), anyway I just wanted to switch the video, maybe include main camera in big size and other cameras in a smaller size, not necessarily excluding all other audio but isn't this what videoconferencing software do? Zoom, Teams, Webex, Google Meet, all of them show the speaker in based on who is talking, this would be doing the same on a local room instead of distributed over the internet.
All the platforms you mentioned are paid in some form or another. Either directly, or through ads or other products that the same company sells. What's to say that they didn't license a ton of tools to make them work, none of which for free?

OBS is entirely free, no paid licenses, and not even free licenses that are incompatible with open source, which is at least part of why we don't have native NDI support for a different example.

Also, patents (if written well) are tool-agnostic, so if something was patented as an analog circuit, then the same patent also covers software implementations of the same thing, hence the continuing need to license it.

If we only provide the building blocks that can't be IP-protected - generic math operations, variables, etc. - then we're not infringing anything, even if a user decides to make something out of them that does infringe something. At that point, the risk is entirely on the user, and generally isn't worth pursuing unless you're selling it or giving it away beyond your own use...or to make an example like the old music-sharing debacle, but even then it was the sharing part beyond themselves that triggered it.
 
Last edited:

Warmuptill

Active Member
This is what I have and when the title changes the asset is still visible if I click run it will perform the action once but never again until I press run again
View attachment 90089
You seem to be using an older version of the plugin.
In this version the "File" condition always required you to match the content of the file.
So in your current setup the condition will only ever be true if the file is empty.

If you want to stick with this old version please tick the "use regular expressions" checkbox and enter (.|\n)* in the textbox above.

Alternatively update to the newest version of the plugin an use this:
Content.PNG


Hello,
I'm testing this plugin to trigger a camera change using it's audio on a multi camera setup on same room but since the cameras are close by, the audio going for one camera can still be heard on another camera, and if some one talks a bit lowder it will trigger more than one cameras at the same time.

Is there any way to make the switch according to higher audio level (compared to the other audio sources) instead of just a predefined trigger level?
That is not possible at the moment unfortunately - I will try to to think of something.
 

mikexilva

New Member
mikexilva said:
Hello,
I'm testing this plugin to trigger a camera change using it's audio on a multi camera setup on same room but since the cameras are close by, the audio going for one camera can still be heard on another camera, and if some one talks a bit lowder it will trigger more than one cameras at the same time.

Is there any way to make the switch according to higher audio level (compared to the other audio sources) instead of just a predefined trigger level?
That is not possible at the moment unfortunately - I will try to to think of something.
Nice, maybe just allowing to compare 2 audio levels would be enough (instead of just comparing to a reference) then we would need program something like this conditions depending on the number of audio sources, like:
IF (optionally level of A> trigger reference) AND level of A>B AND level of A>C AND level of A>D THEN switch to scene A
IF (optionally level of B> trigger reference) AND level of B>A AND level of B>C AND level of B>D THEN switch to scene B
IF (optionally level of C> trigger reference) AND level of C>A AND level of C>B AND level of C>D THEN switch to scene C
IF (optionally level of D> trigger reference) AND level of D>A AND level of D>B AND level of D>C THEN switch to scene D
I don't know how CPU intensive this is but if it's too much it cold be done just every 500ms to reduce CPU load...

And it should allow to select a minimum period of time (like 1000ms) with the all conditions TRUE before triggering the scene switch to avoid quick confusing, unnecessary scene switching with momentary noises like coughing.. but this I think it's already implemented when comparing to a reference..

This was just a quick thought, maybe there are more elegant ways to do it, but just adding that possibility will allow for more freedom on user programming.

Thanks and happy new year ;)
 

mikexilva

New Member
Nice, maybe just allowing to compare 2 audio levels would be enough (instead of just comparing to a reference) then we would need program something like this conditions depending on the number of audio sources, like:
IF (optionally level of A> trigger reference) AND level of A>B AND level of A>C AND level of A>D THEN switch to scene A
IF (optionally level of B> trigger reference) AND level of B>A AND level of B>C AND level of B>D THEN switch to scene B
IF (optionally level of C> trigger reference) AND level of C>A AND level of C>B AND level of C>D THEN switch to scene C
IF (optionally level of D> trigger reference) AND level of D>A AND level of D>B AND level of D>C THEN switch to scene D
I don't know how CPU intensive this is but if it's too much it cold be done just every 500ms to reduce CPU load...

And it should allow to select a minimum period of time (like 1000ms) with the all conditions TRUE before triggering the scene switch to avoid quick confusing, unnecessary scene switching with momentary noises like coughing.. but this I think it's already implemented when comparing to a reference..

This was just a quick thought, maybe there are more elegant ways to do it, but just adding that possibility will allow for more freedom on user programming.

Thanks and happy new year ;)
mikexilva said:
Hello,
I'm testing this plugin to trigger a camera change using it's audio on a multi camera setup on same room but since the cameras are close by, the audio going for one camera can still be heard on another camera, and if some one talks a bit lowder it will trigger more than one cameras at the same time.

Is there any way to make the switch according to higher audio level (compared to the other audio sources) instead of just a predefined trigger level?
That is not possible at the moment unfortunately - I will try to to think of something.
Maybe it would be more efficient and elegant to set one variable per audio source and then just use them on the IF's comparisons... instead of "measuring" audio levels so many times repeatedly with all macros running at the same time, although I don't know if this adds too much complexity...
 
Love this plug-in. Cannot survive without it.

Using macros to auto-schedule streaming based on scene selection and day and time. Works perfect for multiple instances of OBS.

I'm using export and import to duplicate settings between the multiple instances of OBS. Wondering if there's an easy way to create the text files outside of OBS? Forgive me, I haven't looked too hard for something. The problem is that the schedules can be quite complicated and long and it would be easier to build in a spreadsheet or something. I also wonder if there might be a way too pull a schedule directly from a file on OBS launch?

Thanks so much for your work!
 

Warmuptill

Active Member
Love this plug-in. Cannot survive without it.

Using macros to auto-schedule streaming based on scene selection and day and time. Works perfect for multiple instances of OBS
Glad to hear the plugin is of use to you! :)

I also wonder if there might be a way too pull a schedule directly from a file on OBS launch?
Assuming the plugin is configured to run on OBS startup you achieve this using the "Import settings from" option of the "Plugin state" action.
Import.PNG


Wondering if there's an easy way to create the text files outside of OBS? Forgive me, I haven't looked too hard for something. The problem is that the schedules can be quite complicated and long and it would be easier to build in a spreadsheet or something.
Unfortunately I do no think there is a tool to create the settings file outside of OBS.
The settings format is a simple json file, so I guess you could theoretically set up a script to generate the settings file from a spreadsheet.
But I don't think that would be a trivial task.
 

alexanderrk

New Member
Hi Warmuptill,

I've tried to google and search through the thread but is there a way to repeat a condition before a macro triggers?

I am trying to use Media state Ended before a scene changes but i'm trying to get it to happen after 3 videos, not just 1.
Any macros I've set up just end up simultaneously triggering at once.

Thanks and happy new year!
 

Warmuptill

Active Member
Hi Warmuptill,

I've tried to google and search through the thread but is there a way to repeat a condition before a macro triggers?

I am trying to use Media state Ended before a scene changes but i'm trying to get it to happen after 3 videos, not just 1.
Any macros I've set up just end up simultaneously triggering at once.

Thanks and happy new year!

I am not sure I am understanding what you are trying to achieve correctly.

If your question is how to trigger the actions only if multiple media sources are in the ended state, something like this should do the trick:

MediaAnd.PNG


If you have the issue of multiple macros attempting to change the active scene at the same time you could use something similar to this:

MediaAnd2.PNG


The "Plugin state" condition could of course be replaced by other condition types as well depending on your setup.
For example you could check if the particular media source is even visible on the current scene using the scene item visibility condition.

Alternatively you could set up a variable containing the scene name, which you use in the action triggering the scene change, to avoid having multiple conflicting scene switch actions active at the same time.

I hope one of the points covered your question and helped solved the issue! :)
 
Glad to hear the plugin is of use to you! :)


Assuming the plugin is configured to run on OBS startup you achieve this using the "Import settings from" option of the "Plugin state" action.
View attachment 90175


Unfortunately I do no think there is a tool to create the settings file outside of OBS.
The settings format is a simple json file, so I guess you could theoretically set up a script to generate the settings file from a spreadsheet.
But I don't think that would be a trivial task.
Ahhh. Very helpful. Now to think about scripting. Would be even better to pull from a cloud platform. Hmmm.
 
Top