Advanced Scene Switcher

Advanced Scene Switcher 1.30.1

Warmuptill

Active Member
Sorry, some more clarification on my part:
If I want to display a variable in a scene, is there any alternative to writing the file to a variable and then reading that variable? I suspect the answer is no, just wondering if there was a feature available to skip the disk process.

View attachment 113581
Ah sorry, then I misunderstood your request.
That should already be possible by modifying the appropriate setting of the relevant text source:

1747932048382.png


So you can save the step of first writing the value to disk and reading it back out from the text source.

Let me know, if you have further questions / run into any problems! :)

Did this, it actually shows up in the "conditional" test however if I hit run macro, it still causes this issue, it just seems to be ignoring the "NOT" and still processes it through, although the strange thing is that it's not recognizing the Streamer/Speaker bot processes, and I've triple, quadruple checked that they show up.
Just to avoid a possible misunderstanding:
The "Run macro" button will run the macro action regardless of the condition state.
It is intended to be used to test the action sequence not as a means of "activating" the macro.

Are you facing the issue of the process being started unexpectedly also when *not* using the "Run macro" button and letting the plugin check the conditions?

If you want we can also try to figure out what the problem is in a quick call / screenshare session.
(If so, feel free to send me a DM)
 
This seems like a problem of the "Media Source" behavior on OBS side and is outside of the control of the Advanced Scene Switcher.

Pausing a media source, then immediately stopping it before triggering a restart seems to result in that behavior.
If this specific sequence of steps is performed the source will always report the status "stopped".
This is also the reason why the media source controls seem to misbehave (the timeline / progress bar will no longer move, because it too "thinks" that the media source is stopped)

So this will have to be fixed on OBS side.
I will try to submit a PR myself, if I can find an easy fix / find the time to.

However, what you can do to avoid this situation is simply remove the redundant "Stop" action, as it won't have any effect if you restart the media source right after anyway.

View attachment 113583


Thanks for the suggestion!

Unfortunately, I am not sure how I could implement something like this easily.

I would have to check the positions of all display capture sources on the OBS canvas and figure out if they are cropped / zoomed in, by gathering this information from all filters applied to those sources, and relate this information to the current cursor position.
This seems rather difficult to do reliably.

What if you would only need to interrogate/monitor a specific few source objects?
 

yukon92

Member
Ah sorry, then I misunderstood your request.
That should already be possible by modifying the appropriate setting of the relevant text source:

View attachment 113604

So you can save the step of first writing the value to disk and reading it back out from the text source.

Let me know, if you have further questions / run into any problems! :)


Just to avoid a possible misunderstanding:
The "Run macro" button will run the macro action regardless of the condition state.
It is intended to be used to test the action sequence not as a means of "activating" the macro.

Are you facing the issue of the process being started unexpectedly also when *not* using the "Run macro" button and letting the plugin check the conditions?

If you want we can also try to figure out what the problem is in a quick call / screenshare session.
(If so, feel free to send me a DM)
Thank You, exactly the trick i was looking for
 

enovasoft

New Member
I found a solution, playing after each other more “Miedia”, below are the details.

But I have another problem, why is it that randomly when playing consecutive “MEDIA” in between, once it shows a black background for a few ms, and when executing the same Macro once it plays fine, without a black screen?

Like in the Google video: FILM with black screen

This random black screen between MEDIA also occurs on several computers. Once it is there, once it is not. Why?

Is there any solution?


---
AND for proper playback of media in succession, such as on “Hotkey” the key is to set the Macr activity:

1748500710404.png

.
and settings:

1748500819378.png
 

videohobby_guy

New Member
Hi All,
Still pretty new to Advanced Scene Switcher, but have had some success automatically muting some audio and unmuting others when switching to / from certain scenes.

What I wan to do now I suspect may be impossible. I want to completely abort a transition if one is requested when certain conditions are met.

I tried setting up a condition on any transition from X of exactly 0.3s duration (my default) and on that transition, instead do a cut transition to X. That doesn't seem to do what I want and I'm thinking it's a bit of a lost cause.

I also have a lua script running and I have a frontend_event_callback and it seems I get PREVIEW_CHANGED, SCENE_CHANGED and TRANSITION_STOPPED, but no real way to know if the preview changed was a prelude to a transition or not.

Maybe if I can check some global to know that at the time of the preview changed, a transition is already underway, I could just change it to X, otherwise let the new preview stay. Seems maybe changing a preview during a preview change event callback may be a bad idea.

Anyway, I know it seems like a really stupid stupid thing to want to do, but I have a reason, so if anyone can suggest a way Advanced Scene Switcher can help, or any other approach that might be viable. I want (under certain conditions) to allow the user to press transition and do some side action that will affect the source on Program instead of an actually transitioning the special scene to Program. Maybe imagine a scenario where I can modify the source on Program before it arrives in OBS in a way that I can't by an OBS transition or filter, etc.
 

videohobby_guy

New Member
Maybe if I can check some global to know that at the time of the preview changed, a transition is already underway, I could just change it to X, otherwise let the new preview stay. Seems maybe changing a preview during a preview change event callback may be a bad idea.
Yeah, that didn't work. Turns out the preview set is not the new preview to transition to, but instead the program scene being first moved to the preview as the transition kicks off.

I think I'll have to resort to some kind of a hotkey which acts on the preview and not actually using the transition. It eliminates the option of not using studio mode for this, but I don't see any hooks in transition to modify the behavior.
 

Warmuptill

Active Member
I found a solution, playing after each other more “Miedia”, below are the details.

But I have another problem, why is it that randomly when playing consecutive “MEDIA” in between, once it shows a black background for a few ms, and when executing the same Macro once it plays fine, without a black screen?

Like in the Google video: FILM with black screen

This random black screen between MEDIA also occurs on several computers. Once it is there, once it is not. Why?

Is there any solution?


---
AND for proper playback of media in succession, such as on “Hotkey” the key is to set the Macr activity:

View attachment 113697
.
and settings:

View attachment 113698
This is probably happening because of how the "wait for playback to stop" functionality is implemented.
It will check if the media source's state is not "playing" for at least a time span of 10ms.
The reason it is implemented like this is, that media sources which are set to loop or are playing back a playlist will switch states from "playing" to e.g "ended" for a brief amount of time and this would otherwise stop the waiting.
Hi All,
Still pretty new to Advanced Scene Switcher, but have had some success automatically muting some audio and unmuting others when switching to / from certain scenes.

What I wan to do now I suspect may be impossible. I want to completely abort a transition if one is requested when certain conditions are met.

I tried setting up a condition on any transition from X of exactly 0.3s duration (my default) and on that transition, instead do a cut transition to X. That doesn't seem to do what I want and I'm thinking it's a bit of a lost cause.

I also have a lua script running and I have a frontend_event_callback and it seems I get PREVIEW_CHANGED, SCENE_CHANGED and TRANSITION_STOPPED, but no real way to know if the preview changed was a prelude to a transition or not.

Maybe if I can check some global to know that at the time of the preview changed, a transition is already underway, I could just change it to X, otherwise let the new preview stay. Seems maybe changing a preview during a preview change event callback may be a bad idea.

Anyway, I know it seems like a really stupid stupid thing to want to do, but I have a reason, so if anyone can suggest a way Advanced Scene Switcher can help, or any other approach that might be viable. I want (under certain conditions) to allow the user to press transition and do some side action that will affect the source on Program instead of an actually transitioning the special scene to Program. Maybe imagine a scenario where I can modify the source on Program before it arrives in OBS in a way that I can't by an OBS transition or filter, etc.
Yeah, that didn't work. Turns out the preview set is not the new preview to transition to, but instead the program scene being first moved to the preview as the transition kicks off.

I think I'll have to resort to some kind of a hotkey which acts on the preview and not actually using the transition. It eliminates the option of not using studio mode for this, but I don't see any hooks in transition to modify the behavior.
Unfortunately, aborting an already active transition is not something, which works well in OBS, as far as I know.
So, you did not miss anything and resorting to some other method, like the hotkey you mentioned, is probably a better approach.
 

daisycody

New Member
I just downloaded OBS 31.0.3 Advanced Scene Switcher 1.30.0

I want to switch between two media-sources (mp4 video files) when each ends.

Looping a set of media sources



scene-1 contains media-source mp4-1
scene-2 contains media-source mp4-2

Macro 1 waits for mp4-1 to end and then restarts mp4-2
Macro 2 waits for mp4-2 to end and then restarts mp4-1
Both have perform actions on condition changed.

I looked at the log and this is what I got:

13:15:30.114: User switched to scene 'scene-2'
13:15:45.517: [adv-ss] running actions of Macro 2
13:15:45.517: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-1"

It just hangs here. Not other output. Screen shows a very dimmed image of scene-2. mp4-1 video does not start!
Help!
 

Warmuptill

Active Member
I just downloaded OBS 31.0.3 Advanced Scene Switcher 1.30.0

I want to switch between two media-sources (mp4 video files) when each ends.

Looping a set of media sources



scene-1 contains media-source mp4-1
scene-2 contains media-source mp4-2

Macro 1 waits for mp4-1 to end and then restarts mp4-2
Macro 2 waits for mp4-2 to end and then restarts mp4-1
Both have perform actions on condition changed.

I looked at the log and this is what I got:

13:15:30.114: User switched to scene 'scene-2'
13:15:45.517: [adv-ss] running actions of Macro 2
13:15:45.517: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-1"

It just hangs here. Not other output. Screen shows a very dimmed image of scene-2. mp4-1 video does not start!
Help!
Unfortunately, it is difficult to tell what the problem might be just from your description.
Can you please export your macros and share a log with verbose logging enabled?
Could it be that one of the media source was manually paused?
 

daisycody

New Member
Ok, here are the logs. Thanks! I tried same thing on another computer with same results.
 

Attachments

  • 2025-06-03 11-30-52.txt
    67 KB · Views: 6
  • macro1.txt
    1.9 KB · Views: 5
  • macro2.txt
    1.9 KB · Views: 3

Warmuptill

Active Member
Ok, here are the logs. Thanks! I tried same thing on another computer with same results.
I think you might have accidentally configured your macros incorrectly.

Instead of restarting the playback of the "mp4-1" source when the playback of "mp4-2" has ended you have configured the macro to restart it when "mp4-2" is still playing.

1749027340558.png


You probably intended to check for the state "ended" instead:

1749027482167.png


The same problem exists in "Macro 1".
 
Last edited:

daisycody

New Member
I changed both Macros to playing and here is log results with no change when mp4-1 video ends. This just continues on and on.
What does this mean? "skip actions for Macro Macro 2 (on change)"

10:44:03.844: [adv-ss] condition media returned 0
10:44:03.844: [adv-ss] Macro Macro 1 returned 0
10:44:03.844: [adv-ss] condition media returned 1
10:44:03.844: [adv-ss] Macro Macro 2 returned 1
10:44:03.844: [adv-ss] skip actions for Macro Macro 2 (on change)
10:44:03.845: [adv-ss] try to sleep for 300

It seems to me that when the 1st video ends, then it should play the 2nd video? and vice-versa.

I looked at sample macros in site for media switching and they used 'ended'. I even imported them and changed media-names but still does not work. I saw when it detects the video ending and issues command to start the new video but the output screen remains blank.
 

Warmuptill

Active Member
What does this mean? "skip actions for Macro Macro 2 (on change)"
This means that while all the conditions of the macro are true the actions are not executed again, as they have already been executed when the macro's conditions did initially evaluate to true.

This behavior can be toggled with the highlighted setting:

1749145189818.png


For what you want to set up this setting should be enabled (as it already is), as you don't want to "mp4-1" source to restarted over and over continuously.

I looked at sample macros in site for media switching and they used 'ended'. I even imported them and changed media-names but still does not work. I saw when it detects the video ending and issues command to start the new video but the output screen remains blank.
What type of sources are you using?
Does the media source properly if you click the "Run macro" button, which can be used to manually execute the actions of the currently selected macro?

If you want we can also hop on a quick call where you share your screen and we figure out what the problem is live instead of sharing comments here every couple of days :)
If so, feel free to send me a direct message.
 

daisycody

New Member
Ok, here is what I tried. ASS is not running and I manually turned on Scene1 - mp4-1 video playing. Then I opened ASS window, clicked on Macro1 and clicked Run Macro. Here is result.

10:20:03.012: User switched to scene 'Scene1'
10:20:03.337: [adv-ss] current scene: Scene1
10:20:03.337: [adv-ss] previous scene: Scene2
10:20:11.026: [adv-ss] running actions of Macro 1
10:20:11.026: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-2"

The mp4-2 video did not play, so I then started Scene2 video manually and did same for Macro 2. Stiil no video output.

10:20:29.277: User switched to scene 'Scene2'
10:20:29.571: [adv-ss] current scene: Scene2
10:20:29.571: [adv-ss] previous scene: Scene1
10:20:36.174: [adv-ss] running actions of Macro 2
10:20:36.174: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-1"

On the expanded horizontal menu on ASS under Media, I tried another a 1st line macro and it did switch, however when I entered a 2nd line to switch back, it did not work.
 

daisycody

New Member
I tried the horizontal menu Media again and this time it worked. When I tried to add a 3rd video, it went crazy. Here log for working with 2 videos.
10:32:51.549: [adv-ss] try to sleep for 299
10:32:51.850: [adv-ss] Macro Macro 1 is paused
10:32:51.850: [adv-ss] Macro Macro 1 returned 0
10:32:51.850: [adv-ss] Macro Macro 2 is paused
10:32:51.850: [adv-ss] Macro Macro 2 returned 0

10:32:51.850: [adv-ss] match for 'media' - switch to scene 'Scene2'
10:32:51.863: User switched to scene 'Scene2'
10:32:51.863: [adv-ss] switched scene

10:32:51.863: [adv-ss] try to sleep for 287
10:32:52.151: [adv-ss] Macro Macro 1 is paused
10:32:52.151: [adv-ss] Macro Macro 1 returned 0
10:32:52.151: [adv-ss] Macro Macro 2 is paused
10:32:52.151: [adv-ss] Macro Macro 2 returned 0
.
.
.
10:33:39.763: [adv-ss] try to sleep for 299
10:33:40.063: [adv-ss] Macro Macro 1 is paused
10:33:40.063: [adv-ss] Macro Macro 1 returned 0
10:33:40.063: [adv-ss] Macro Macro 2 is paused
10:33:40.063: [adv-ss] Macro Macro 2 returned 0

10:33:40.063: [adv-ss] match for 'media' - switch to scene 'Scene1'
10:33:40.075: User switched to scene 'Scene1'
10:33:40.075: [adv-ss] switched scene
 

Warmuptill

Active Member
Ok, here is what I tried. ASS is not running and I manually turned on Scene1 - mp4-1 video playing. Then I opened ASS window, clicked on Macro1 and clicked Run Macro. Here is result.

10:20:03.012: User switched to scene 'Scene1'
10:20:03.337: [adv-ss] current scene: Scene1
10:20:03.337: [adv-ss] previous scene: Scene2
10:20:11.026: [adv-ss] running actions of Macro 1
10:20:11.026: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-2"

The mp4-2 video did not play, so I then started Scene2 video manually and did same for Macro 2. Stiil no video output.

10:20:29.277: User switched to scene 'Scene2'
10:20:29.571: [adv-ss] current scene: Scene2
10:20:29.571: [adv-ss] previous scene: Scene1
10:20:36.174: [adv-ss] running actions of Macro 2
10:20:36.174: [adv-ss] performed action "AdvSceneSwitcher.action.media.type.restart" for source "mp4-1"

On the expanded horizontal menu on ASS under Media, I tried another a 1st line macro and it did switch, however when I entered a 2nd line to switch back, it did not work.
If even clicking the "Run macro" button has no effect at all, but using a different action type like "switch scene" works as expected, I am at a loss. :(
What types of sources are you using? (VLC source , media source, image slide show, something else)
Are you sure you have selected the correct media sources?
When I tried to add a 3rd video, it went crazy
What do you mean by that?
 
Top