Resource icon

Advanced Scene Switcher 1.25.5

Warmuptill

Active Member
I have the same problem as mr. Urbanian.
My goal was to make promo inserts between the clips from the playlist.

The workaround is as follows:
Two scenes, A (A: VLC source with playlist; loop; paused on hiding)
And B (B: Source with simple media source with promo; restart on active)

I made two macros:
1) From A to B: If A:VLCSource is "ended" - switch to scene B
2) From B to A: If B:Source is "ended" - switch to scene A.

And it wasn't works. Plugin even not switched scene A to B at all. Only B to A.

Already I've tried use not macros but Media rules instead. They not work at all (tested with "ended" and "played to end" events)

BUT! I've founded the solution "from the reverse"
I changed macros 1) to next:
Code:
From A to B:
    If A:VLCSource is "playing" and "time remaining shorter" than 1-2 second:
         switch to scene B,
         switch next track in A:VLCSource,
         pause it at the moment.

Therefore, I came to the conclusions:
a) the "ended" event does not work for VLC Source (OBS level or plugin?)
b) Media rules do not work properly
c) When the "loop" setting is enabled in VLC, the "played to ended" event does not work either.
If a VLC source is containing a playlist that is looping forever it will never reach the state "ended" or "played to end". (Or at least that is my assumption)
As you have correctly identified you can use the "time remaining shorter" to identify individual playlist items coming to an end.

If you have suggestions on how to make this more clear I am all ears! :)
Should I maybe introduce a separate state called "playlist item ended" or something similar?


Below is an example on how to set up automated commercial breaks on fixed interval, but not interrupting individual playlist items.
Hope that helps.

I know you have already set up your media source correctly but for completeness in case others want to replicate the setup:

VLCSourceSettings.PNG

The important part is the "Pause if not visible, unpause when visible" so that the playback does not restart when switching away and back to the scene containing the VLC source.

Next we will need two macros.

  1. The first macro is responsible for detecting when a transition to the next playlist item takes place and if the specified time interval, after which a commercial shall be played, has passed.
    If both are the case a scene switch will take place.

    You can find a screenshot of the settings I used here:
    CommercialTimer.PNG
    The media condition with state "playing" and "time remaining shorter than 1 second" restriction will allow us to identify when the current playlist entry is about to end.

  2. The second macro is only responsible for automatically switching back to the scene containing the VLC video source playing back the playlist.

    A screenshot of the settings I used for testing can be found here:
    ReturnToPlaylist.PNG
    The important part is the macro action to reset the timer of the first macro described above.

    Note that the media action is probably not strictly necessary, but I added it just in case.
This setup allows to automatically switch to a "commercial" scene if at least 30 seconds have passed and when a playlist item just ended its playback.
 

ghaleon

New Member
Fresh win 10 x64 installed, fully updated. Fresh OBS install with streamlabs. Installed the latest version of Advanced Scene Switcher and OBS crashes on startup. Been having issues with OBS crashing for a while before this, I think ASS was always the main culprit?
 

Attachments

  • 2021-11-01 16-18-58.txt
    92.7 KB · Views: 35

Warmuptill

Active Member
Fresh win 10 x64 installed, fully updated. Fresh OBS install with streamlabs. Installed the latest version of Advanced Scene Switcher and OBS crashes on startup. Been having issues with OBS crashing for a while before this, I think ASS was always the main culprit?
Sorry if this a dumb question, but you do not mean Streamlabs OBS, do you? (As far as I know the plugin is not compatible with slobs)
Also can you please share the crash log file? The startup log is not of much use unfortunately.
 

ghaleon

New Member
Sorry if this a dumb question, but you do not mean Streamlabs OBS, do you? (As far as I know the plugin is not compatible with slobs)
Also can you please share the crash log file? The startup log is not of much use unfortunately.

apologies - thought that was the crash log. This should be it!
 

Attachments

  • Crash 2021-11-01 16-18-34.txt
    122.6 KB · Views: 24

ghaleon

New Member
Sorry if this a dumb question, but you do not mean Streamlabs OBS, do you? (As far as I know the plugin is not compatible with slobs)
Also can you please share the crash log file? The startup log is not of much use unfortunately.

Sorry again, I meant "Streamelements" is installed on my OBS Studio installation. I was using Advanced Scene Switcher with great success for a long while, after that I started having problems with OBS crashing. Sometimes right AFTER startup, sometimes 3-5 min after startup. I didn't know what was causing the crashes - upgrade to win 10? Upgrade to OBS?
 

Warmuptill

Active Member
Sorry again, I meant "Streamelements" is installed on my OBS Studio installation. I was using Advanced Scene Switcher with great success for a long while, after that I started having problems with OBS crashing. Sometimes right AFTER startup, sometimes 3-5 min after startup. I didn't know what was causing the crashes - upgrade to win 10? Upgrade to OBS?
OBS seems to be crashing in the graphics thread and as you mentioned almost instantly after startup.
Thread 1944: libobs: graphics thread (Crashed)

I don't see any obvious hint that the advanced scene switcher is causing the crash.
All that was done on scene switcher side was check installed version and ask if you want to backup your settings.
The plugin hasn't done any "actual work" yet and is waiting for user input before starting it's main thread.

But nevertheless can you maybe also share the settings you are using in the advanced scene switcher plugin just in case?
I will try if I can somehow reproduce a similar crash, although I find it to be very unlikely.
(You can export the settings to a file on the general tab)

I am not familiar with the stream elements plugin, but could that maybe be involved with this crash?
 

ghaleon

New Member
bizzare indeed. Couldnt even start OBS with ASS installed, and the second I uninstalled it OBS was working fine again.

I never used ASS for anything fancy really! I have 3 cameras for a streaming setup, 2 of them were set to rotate every 15 secs, and the other cam was manually cued before switching back to the other cams after 15 secs.

Streamelements is overlay related stuff, and some extras for twitch. I guess ill try uninstalling it, and resinstalling the switcher?
 

Warmuptill

Active Member
bizzare indeed. Couldnt even start OBS with ASS installed, and the second I uninstalled it OBS was working fine again.

I never used ASS for anything fancy really! I have 3 cameras for a streaming setup, 2 of them were set to rotate every 15 secs, and the other cam was manually cued before switching back to the other cams after 15 secs.

Streamelements is overlay related stuff, and some extras for twitch. I guess ill try uninstalling it, and resinstalling the switcher?
The only thing I could think of is that maybe streamelements "does not like" the scene switcher blocking the OBS UI and for some reason then causes some issue in the graphics thread - I will try to test this theory when I find the time.

You could also give testing this theory a try by first only installing the scene switcher, then confirming that you do / do not want to backup your settings and only after that reinstalling streamelements.
(This question comes up each time you install a new version of the scene switcher or install it for the fist time)
 

Warmuptill

Active Member
Nice tool.

64g6hmG.png


Whenever you update next, you can fix this :)
Just to clarify you are talking about the spelling issue, right? :)
Or is the functionality broken?

Also;
Is there a reason this is 'disable' instead of 'hide'? With this you cannot use the built-in transition on hide/show
View attachment 76798
This action is used to globally enable and disable sources.
If you just want to show / hide a source on a particular scene you can use the following action:
SceneItemVisibility.PNG
 

khaver

Member
Warmuptill, is there a way to trigger the start of one macro from another macro? Here's my problem. I've set up a macro to turn off recording when A) the recording has been running for at least 20 minutes "And" B) the audio on a certain device falls below 10% for at least 2 minutes. I'm trying to stop the recording after a certain mic is muted after our pastor's sermon. The problem is sometimes at the beginning of the 20 minutes after recording is started, the mic can be off for more than 2 minutes, so in the logs, this condition throws a 1. Then after the 20 minutes of recording, that macro throws a 1, and since both conditions are now true, the recording stops right at the 20 minute mark. What I want is the macro that checks for the 2 minutes of silence not begin checking the volume until after at least 20 minutes of recording has happened (this is well into the sermon so no silence until after the sermon is over).
 

khaver

Member
I did another test with the macros. This time I created 3 macros with the last one set to stop recording after at least 1 minute of silence (my audio source is muted all the time for the test). The first macro was set to pause the 3rd macro on startup (paused macro when startup scene is active). The second macro unpauses the 3rd macro after at least 2 minutes of recording. What I thought would happen is after 2 minutes of recording the 3rd macro would be unpaused and then only after at least 1 minute of silence the recording would stop. Instead the recording stopped after 2 minutes (as soon as the 3rd macro was unpaused).

The logs show the audio macro (the 3rd macro) is still keeping track of the time of silence even though it's paused. After 1 minute of silence it throws a 1. And after 2 minutes of recording, that macro throws a 1 and the recording stops.

Seems like a bug in the logic of your plugin. Any macro that's paused should not begin it's logic tests until it's unpaused. The audio macro should not throw a 1 until it's conditions have been met after unpausing.
 

AaronD

Active Member
Warmuptill, is there a way to trigger the start of one macro from another macro? Here's my problem. I've set up a macro to turn off recording when A) the recording has been running for at least 20 minutes "And" B) the audio on a certain device falls below 10% for at least 2 minutes. I'm trying to stop the recording after a certain mic is muted after our pastor's sermon. The problem is sometimes at the beginning of the 20 minutes after recording is started, the mic can be off for more than 2 minutes, so in the logs, this condition throws a 1. Then after the 20 minutes of recording, that macro throws a 1, and since both conditions are now true, the recording stops right at the 20 minute mark. What I want is the macro that checks for the 2 minutes of silence not begin checking the volume until after at least 20 minutes of recording has happened (this is well into the sermon so no silence until after the sermon is over).

I did another test with the macros. This time I created 3 macros with the last one set to stop recording after at least 1 minute of silence (my audio source is muted all the time for the test). The first macro was set to pause the 3rd macro on startup (paused macro when startup scene is active). The second macro unpauses the 3rd macro after at least 2 minutes of recording. What I thought would happen is after 2 minutes of recording the 3rd macro would be unpaused and then only after at least 1 minute of silence the recording would stop. Instead the recording stopped after 2 minutes (as soon as the 3rd macro was unpaused).

The logs show the audio macro (the 3rd macro) is still keeping track of the time of silence even though it's paused. After 1 minute of silence it throws a 1. And after 2 minutes of recording, that macro throws a 1 and the recording stops.

Seems like a bug in the logic of your plugin. Any macro that's paused should not begin it's logic tests until it's unpaused. The audio macro should not throw a 1 until it's conditions have been met after unpausing.

With a background in industrial ladder logic, it seems to me that its concept of timers would be both a more elegant solution to this specific problem and very useful in general:
Or for a more detailed timing diagram:
on.png
off.png
Chain this and my other idea together, so that the rising and falling edges of the combinatoric logic output, each have their own delays before triggering their respective independent actions. A time of 00:00 means "instant" or no delay.
(Of course, this also means that the condition itself should not "latch" once it's satisfied, but continue to check always. khaver's log seems to indicate a latching behavior, if I understand correctly.)

An example ladder rung for a slightly complex macro might look like this, graphically:
ladder.png

The input to both timers in this example, is equal to [C7 AND (C8 OR C9)]. When that becomes true, the off delay becomes true immediately, and the on delay requires it to remain true for 1 minute. When that condition becomes false, the on delay becomes false immediately, and the off delay requires it to remain false for 5.5 minutes. The output of the on delay would then feed a rising-edge-triggered action, and the output of the off delay would feed a falling-edge-triggered action.

Each of the two timers could be set to 0 to make it instant, and each of the two actions could be set to do nothing if only the other edge is required. (it would be silly to have both actions do nothing, but there's no reason to forbid it either) The UI would then have 3 sections:
1. Condition
2. When True (rising edge), Delay and Action
3. When False (falling edge), Delay and Action
 

AaronD

Active Member
Add some cross-macro variables, and we can solve khaver's problem exactly and directly:

Macro A watches the recording status, with an on delay of 20 minutes. The true and false actions are both used to control Global Variable 1. (set and clear, respectively; or on and off, true and false, whatever terminology you want to use there)

Macro B watches [Global Variable 1 AND Mic quiet], with an on delay of 2 minutes. The true action stops recording.

---

Or if you want the 2-minute timer to *only* apply to the mic, then Macro B can watch the mic alone, with that timer, and control Global Variable 2.
Then Macro C watches [Global Variable 1 AND Global Variable 2], with a time of 0.

I don't think it's worth the third Macro in khaver's case, but there are probably some other cases where this behavior is actually necessary.

---

Or if you want to keep the individual timers for the things that have them, then just one Macro can do [Recording for 20min AND Mic quiet], with an on delay of 2 minutes using the structure in my previous post.
 
Last edited:

Warmuptill

Active Member
I did another test with the macros. This time I created 3 macros with the last one set to stop recording after at least 1 minute of silence (my audio source is muted all the time for the test). The first macro was set to pause the 3rd macro on startup (paused macro when startup scene is active). The second macro unpauses the 3rd macro after at least 2 minutes of recording. What I thought would happen is after 2 minutes of recording the 3rd macro would be unpaused and then only after at least 1 minute of silence the recording would stop. Instead the recording stopped after 2 minutes (as soon as the 3rd macro was unpaused).

The logs show the audio macro (the 3rd macro) is still keeping track of the time of silence even though it's paused. After 1 minute of silence it throws a 1. And after 2 minutes of recording, that macro throws a 1 and the recording stops.

Seems like a bug in the logic of your plugin. Any macro that's paused should not begin it's logic tests until it's unpaused. The audio macro should not throw a 1 until it's conditions have been met after unpausing.
I agree that the behaviour, that paused macros are still running when paused, intuitively does not make much sense and I will change it.
It was actually implemented this way intentionally originally as to not mess with the timers certain conditions used to have, but since then generic time constraints have been added (the small clock icon) and this restriction is no longer in place.

Thanks for pointing that out!

You can find a test build where this is fixed here in a few minutes:
Note that you have to be logged into GitHub to be able to download it - if that is an issue for you let me know.

Add some cross-macro variables, and we can solve khaver's problem exactly and directly:

Macro A watches the recording status, with an on delay of 20 minutes. The true and false actions are both used to control Global Variable 1. (set and clear, respectively; or on and off, true and false, whatever terminology you want to use there)

Macro B watches [Global Variable 1 AND Mic quiet], with an on delay of 2 minutes. The true action stops recording.

---

Or if you want the 2-minute timer to *only* apply to the mic, then Macro B can watch the mic alone, with that timer, and control Global Variable 2.
Then Macro C watches [Global Variable 1 AND Global Variable 2], with a time of 0.

I don't think it's worth the third Macro in khaver's case, but there are probably some other cases where this behavior is actually necessary.

---

Or if you want to keep the individual timers for the things that have them, then just one Macro can do [Recording for 20min AND Mic quiet], with an on delay of 2 minutes using the structure in my previous post.
Thank you very much for the extensive explanation of these concepts!

Please correct me if I am wrong, but the on-/off-delay part can already be modelled using the existing time restrictions (condition true for at least x seconds / condition not true for at least x seconds).

Adding variables definitely is an interesting idea, but I feel like it might be too complicated for most users to find much use.
But I will add it to the todo list nevertheless in case I have some spare time to work on it. :)
 

AaronD

Active Member
Please correct me if I am wrong, but the on-/off-delay part can already be modelled using the existing time restrictions (condition true for at least x seconds / condition not true for at least x seconds).

If *every* condition has an both inverse and a timer, and you never need the *combination* to be true for X time regardless of the individual times, then I think you're right. But there are things you can do with an overall timer that can't be done with a combination of individual timers and vice-versa. To continue to use khaver's example, there could be a 2-minute difference between
[recording for 20min] AND [quiet for 2min]
and
[(recording for 20min) AND quiet] for 2min
The first of these uses two individual timers; the second uses one individual timer and one overall timer. Depending on the details of the situation, that difference could be inconsequential, significant, or critical.

Also, when using AND's and OR's (XOR's too? Maybe NAND's, NOR's, and XNOR's as well?) with multiple conditions, I still think it becomes well worth having an inverse action or false action. Even if it's possible to create the exact opposite logic condition, it's still confusing for a lot of people to use DeMorgan's Theorem in your head. Much easier for a user to define their condition the way that makes direct sense and then say NOT at the end, which is what the inverse or false action does.
Then, instead of just adding a final NOT button before the overall timer, why not have a separate timer and action for both the "straight" and inverted versions of the final combination? Far more flexible that way, and not much more complex for a user to understand IMO.

Adding variables definitely is an interesting idea, but I feel like it might be too complicated for most users to find much use.
But I will add it to the todo list nevertheless in case I have some spare time to work on it. :)

If the logic within each macro is powerful enough, you shouldn't need them. But they could still be useful to not repeat a bunch of things in a more complex setup. (and get one of the repeats wrong) If the user is doing something that complicated anyway, I think they'd be able to handle a few variables. :-)
 
Top