Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

This plugin is more than just a auto scene switcher. I been using this to trigger sources visibility on specific conditions.

There is however one thing that I wish you could explain is the run and arguments on Macro. I want one of my scene change to trigger a bat file to open, but it won't. When I put an exe program to run, it runs multiple instances of that program infinitely until I disable the Macro. I hope you could provide a little tutorial on that.


1655174838604.png
 

AaronD

Active Member
Have you considered using a macro setup similar to this one in combination with the hotkeys for unpausing macros?

View attachment 84151

Once this macro is unpaused it will wait for the end of the looping media source by checking the remaining time.
If the remaining time is below the specified threshold a scene switch to "Scene" will be triggered.
As final step the macro will "disarm" itself again by pausing itself.

The hotkey to unpause and thus enable this macro can be bound in the OBS settings menu.

View attachment 84152

Hope that helps!
Would this also work?:
1655219040736.png

Click "Get current settings", then change "looping": to false.

Would the originally-desired end-of-video then work?
 

AaronD

Active Member
Would this also work?:
View attachment 84180
Click "Get current settings", then change "looping": to false.

Would the originally-desired end-of-video then work?
UPDATE: It does...sorta.

It takes two macros to do it. Both start paused, and then "something" unpauses the first:
1655253471511.png

The order of the pause/unpause at the end is important. Get it backwards, and it never unpauses the second one.

The second one does the transition, and ends with everything as it was to start with:
1655253612704.png




It becomes a little bit simpler to use the "Played to End" condition instead of "Ended". The difference is that "Ended" remains true indefinitely, so a macro that depends on that will run constantly; while "Played to End" is only true at the moment when it ends, so a macro that depends on that will only run once.

So the Transition macro can stay unpaused now, which eliminates those actions from both macros:
1655254181360.png
1655254200374.png

Essentially, yes, my idea does work. It just takes one macro to translate a hotkey into disabling the loop (plus some housekeeping to not re-trigger), which then allows the normal transition in another macro to happen (plus some more housekeeping to make it do the same thing again next time: loop, and then transition at the next end after a hotkey instead of immediately on that hotkey).
 

knifoon

New Member
Any chance profile can be used as a condition? i want different chat boxes to be enabled depending where im streaming to.
 

MiamiPDScanner

New Member
Hello everyone. Thank you in advance for any assistance or guidance that you can provide regarding this matter.

I have an issue that is plaguing me on Ubuntu 20.04 and the OBS snap (edge - 27.2.1-modified (64 bit)) that comes pre-packaged with Advanced Scene Switcher 1.17.2

Skip to "HERE IS THE PROBLEM" below, if you're easily bored.

Before I get into it, let me give you a bit of background. I currently run four separate instances of OBS from parallel installations. In other words, I have installed 4 separate snaps of OBS, each one with it's own directory and configuration files etc. Despite the fact that they are parallel installs, they are each configured exactly the same with the exception of Sources and Scenes. I use 4 parallel installations because I have 4 separate live streams on YouTube, one for each police district in the City of Miami, that run 24/7. Running these four channels works flawlessly with few exceptions and those are typically due to local ISP or other non-OBS-related issues like power outages, etc.

I have been running this channel for about a year now, maybe slightly less, and I have decided to try and add some automation. I have some python running in the background that listens for a 1000MHz tone on the audio on each one of the channels and when this tone happens, my script goes to work via YouTube API to get the exact time code where it happened, compile a URL pointing to that timecode and then subsequently sends out notifications to both Twitter and Telegram via their respective APIs. It's not a huge deal but I'm proud of it. The issue with these links is that they effectively expire after about 12 hours. YouTube live does not keep historical video feed data after 12 hours. So, essentially, after 12 hours, every single link that was posted to Twitter or Telegram will ultimately fail. I set out to solve this problem by chopping up my 24/7 live feeds into smaller 8 hour chunks that start and stop with the corresponding shifts A, B and C at Miami PD, i.e. 08:00:00, 16:00:00 and 00:00:00, daily.



HERE IS THE PROBLEM:

I have added two macros within Advanced Scene Switcher. One named "Auto Stop Stream" the other named "Auto Start Stream"

Auto Stop Stream has three conditions for the same action:

If Date [ignore date component] 07:58:00; Streaming:Stop streaming
or Date [ignore date component] 15:58:00; Streaming:Stop streaming
or Date [ignore date component] 23:58:00; Streaming:Stop streaming

Auto Start Stream also has three conditions for the same action:

If Date [ignore date component] 08:00:00; Streaming:Start streaming
or Date [ignore date component] 16:00:00; Streaming:Start streaming
or Date [ignore date component] 00:00:00; Streaming:Start streaming

The STOP macro works every time on all 4 instances...
The START macro fails intermittently on all 4 instances...



There are no errors, no entries in syslog, nothing... The macro to start the streaming simply doesn't run whenever it doesn't "want" to! HAHA

I have moved "macro" to the top of the priority list from suggestions on other discussions. I have plenty of available RAM (over 90% available) and processing power (over 70% available). I have quintuple checked the times and settings. I have tried using "repeat every 8 hours" instead of using three separate "or" conditions. The result is always the same; The STOP streaming is 100% reliable, the START streaming has a mind of its own.

I make absolutely certain that the stream endpoints on the YouTube side are scheduled for the correct time and that they are configured to receive a "start" parameter etc... However, even if these endpoints were not configured properly, OBS simply makes no attempt to start the stream as you can see by the fact that the "Start Streaming" button isn't even depressed. Again, no errors, no syslog, nothing. Screen savers are off, sleep is off, snooze is off, monitor stays on 24/7 etc etc...

I'm at my wit's end and I need someone's help. Again, thank you in advance for reading this and I appreciate any assistance or guidance that anyone can provide.
 

Attachments

  • Screenshot from 2022-06-20 17-57-14.png
    Screenshot from 2022-06-20 17-57-14.png
    105.5 KB · Views: 40
  • Screenshot from 2022-06-20 17-59-00.png
    Screenshot from 2022-06-20 17-59-00.png
    112.1 KB · Views: 38

AaronD

Active Member
Hello everyone. Thank you in advance for any assistance or guidance that you can provide regarding this matter.

I have an issue that is plaguing me on Ubuntu 20.04 and the OBS snap (edge - 27.2.1-modified (64 bit)) that comes pre-packaged with Advanced Scene Switcher 1.17.2

Skip to "HERE IS THE PROBLEM" below, if you're easily bored.

Before I get into it, let me give you a bit of background. I currently run four separate instances of OBS from parallel installations. In other words, I have installed 4 separate snaps of OBS, each one with it's own directory and configuration files etc. Despite the fact that they are parallel installs, they are each configured exactly the same with the exception of Sources and Scenes. I use 4 parallel installations because I have 4 separate live streams on YouTube, one for each police district in the City of Miami, that run 24/7. Running these four channels works flawlessly with few exceptions and those are typically due to local ISP or other non-OBS-related issues like power outages, etc.

I have been running this channel for about a year now, maybe slightly less, and I have decided to try and add some automation. I have some python running in the background that listens for a 1000MHz tone on the audio on each one of the channels and when this tone happens, my script goes to work via YouTube API to get the exact time code where it happened, compile a URL pointing to that timecode and then subsequently sends out notifications to both Twitter and Telegram via their respective APIs. It's not a huge deal but I'm proud of it. The issue with these links is that they effectively expire after about 12 hours. YouTube live does not keep historical video feed data after 12 hours. So, essentially, after 12 hours, every single link that was posted to Twitter or Telegram will ultimately fail. I set out to solve this problem by chopping up my 24/7 live feeds into smaller 8 hour chunks that start and stop with the corresponding shifts A, B and C at Miami PD, i.e. 08:00:00, 16:00:00 and 00:00:00, daily.



HERE IS THE PROBLEM:

I have added two macros within Advanced Scene Switcher. One named "Auto Stop Stream" the other named "Auto Start Stream"

Auto Stop Stream has three conditions for the same action:

If Date [ignore date component] 07:58:00; Streaming:Stop streaming
or Date [ignore date component] 15:58:00; Streaming:Stop streaming
or Date [ignore date component] 23:58:00; Streaming:Stop streaming

Auto Start Stream also has three conditions for the same action:

If Date [ignore date component] 08:00:00; Streaming:Start streaming
or Date [ignore date component] 16:00:00; Streaming:Start streaming
or Date [ignore date component] 00:00:00; Streaming:Start streaming

The STOP macro works every time on all 4 instances...
The START macro fails intermittently on all 4 instances...



There are no errors, no entries in syslog, nothing... The macro to start the streaming simply doesn't run whenever it doesn't "want" to! HAHA

I have moved "macro" to the top of the priority list from suggestions on other discussions. I have plenty of available RAM (over 90% available) and processing power (over 70% available). I have quintuple checked the times and settings. I have tried using "repeat every 8 hours" instead of using three separate "or" conditions. The result is always the same; The STOP streaming is 100% reliable, the START streaming has a mind of its own.

I make absolutely certain that the stream endpoints on the YouTube side are scheduled for the correct time and that they are configured to receive a "start" parameter etc... However, even if these endpoints were not configured properly, OBS simply makes no attempt to start the stream as you can see by the fact that the "Start Streaming" button isn't even depressed. Again, no errors, no syslog, nothing. Screen savers are off, sleep is off, snooze is off, monitor stays on 24/7 etc etc...

I'm at my wit's end and I need someone's help. Again, thank you in advance for reading this and I appreciate any assistance or guidance that anyone can provide.
The only thing I can think of is that it takes more than 2 seconds to guarantee that all of the end-of-stream housekeeping is finished. Until then - if the housekeeping isn't finished yet - OBS completely ignores another START command, as if it were never sent. It would be good for this to appear in a log, but I can see how it might not.

What happens if you increase the "dead time"? Does it become more reliable? If so, then how much "dead time" are you okay with?
 

MiamiPDScanner

New Member
The only thing I can think of is that it takes more than 2 seconds to guarantee that all of the end-of-stream housekeeping is finished. Until then - if the housekeeping isn't finished yet - OBS completely ignores another START command, as if it were never sent. It would be good for this to appear in a log, but I can see how it might not.

What happens if you increase the "dead time"? Does it become more reliable? If so, then how much "dead time" are you okay with?
Thanks for the quick reply AaronD!

I'm assuming by "dead time," you mean the time between the stop and start macros. If you look again, you'll notice its a full 2 minutes. I'm ok with any reasonable amount of time to be honest. You think I should increase it to 5 minutes? 10?

BTW, as an aside, as I sit there and watch it, waiting for the start macro to fire off and it ultimately doesn't, I can click START manually and it works every time.
 

MiamiPDScanner

New Member
Thanks for the quick reply AaronD!

I'm assuming by "dead time," you mean the time between the stop and start macros. If you look again, you'll notice its a full 2 minutes. I'm ok with any reasonable amount of time to be honest. You think I should increase it to 5 minutes? 10?

BTW, as an aside, as I sit there and watch it, waiting for the start macro to fire off and it ultimately doesn't, I can click START manually and it works every time.
Come to think of it... It seems like every time I'm sitting there watching it, the START streaming macro seems to work... It's only after I've left the computer alone for a while that it seems to fail me every time. Like when I go to bed and wake up expecting the new feeds to have fired off at 8am but they haven't. The STOP stream works while I'm sleeping though. I wonder if the START streaming requires the OS or OBS to be in a certain state like (not sleeping)... Although, I made sure that there is nothing sleeping anywhere....

That said, I am getting this weird, repeated warning in syslog from OBS:

obs-studio: warning: Failed to create xdg-screensaver: 2

This happens like every minute or so...
 

Attachments

  • Screenshot from 2022-06-20 19-21-06.png
    Screenshot from 2022-06-20 19-21-06.png
    433.7 KB · Views: 45

AaronD

Active Member
Thanks for the quick reply AaronD!

I'm assuming by "dead time," you mean the time between the stop and start macros. If you look again, you'll notice its a full 2 minutes. I'm ok with any reasonable amount of time to be honest. You think I should increase it to 5 minutes? 10?
Oh! I must have read that wrong. Sorry! 2 minutes should be way more than enough, at least for your local machine.

I was wondering too, as I posted that, if the receiving end either:
  • Rejected it for a similar reason (maybe it takes longer to wrap up a stream on that end?), or
  • Considered it to be a continuation of the previous stream, and so provided the wrong feedback, which caused OBS to drop it. With a legitimate network glitch, OBS *expects* the feedback to be from the previous stream and so it gracefully restarts. But that's not what you're doing. OBS is now running a *new* stream, but the server thinks it just saw a network glitch in the old stream and continues to provide that feedback. Because the old feedback doesn't match the new attempt, OBS drops it.
But I rejected those ideas because the 2-second dead time (as I thought) seemed more pressing.
 

MiamiPDScanner

New Member
Oh! I must have read that wrong. Sorry! 2 minutes should be way more than enough, at least for your local machine.

I was wondering too, as I posted that, if the receiving end either:
  • Rejected it for a similar reason (maybe it takes longer to wrap up a stream on that end?), or
  • Considered it to be a continuation of the previous stream, and so provided the wrong feedback, which caused OBS to drop it. With a legitimate network glitch, OBS *expects* the feedback to be from the previous stream and so it gracefully restarts. But that's not what you're doing. OBS is now running a *new* stream, but the server thinks it just saw a network glitch in the old stream and continues to provide that feedback. Because the old feedback doesn't match the new attempt, OBS drops it.
But I rejected those ideas because the 2-second dead time (as I thought) seemed more pressing.
That makes sense except that YouTube automatically ends the old feed after 60 seconds of loss of data. That's why I use 2 minutes.

When I do this manually, I just stop the streams in obs, wait till the old streams drop off of YouTube, schedule the new streams in YouTube, start streaming in OBS...

I gave myself an extra minute of padding in the macros just to be sure the old streams fall off.

Either way, this issue seems to be a local environmental issue to me, to be honest. YouTube isn't really doing much in the way of allowing or disallowing a stream to start or stop on the local side. Even if I don't have the correct endpoints actively waiting for a stream on the YouTube side, I can still manually click on "start streaming" on the OBS side. So long at the endpoint exists, OBS will start streaming with no errors despite the stream not actually being visible on the YouTube side.
 

AaronD

Active Member
Come to think of it... It seems like every time I'm sitting there watching it, the START streaming macro seems to work... It's only after I've left the computer alone for a while that it seems to fail me every time. Like when I go to bed and wake up expecting the new feeds to have fired off at 8am but they haven't. The STOP stream works while I'm sleeping though. I wonder if the START streaming requires the OS or OBS to be in a certain state like (not sleeping)... Although, I made sure that there is nothing sleeping anywhere....

That said, I am getting this weird, repeated warning in syslog from OBS:

obs-studio: warning: Failed to create xdg-screensaver: 2

This happens like every minute or so...
Is the screen still on when you wake up? I wonder if something is still timing out.

That makes sense except that YouTube automatically ends the old feed after 60 seconds of loss of data. That's why I use 2 minutes.

When I do this manually, I just stop the streams in obs, wait till the old streams drop off of YouTube, schedule the new streams in YouTube, start streaming in OBS...

I gave myself an extra minute of padding in the macros just to be sure the old streams fall off.

Either way, this issue seems to be a local environmental issue to me, to be honest. YouTube isn't really doing much in the way of allowing or disallowing a stream to start or stop on the local side. Even if I don't have the correct endpoints actively waiting for a stream on the YouTube side, I can still manually click on "start streaming" on the OBS side. So long at the endpoint exists, OBS will start streaming with no errors despite the stream not actually being visible on the YouTube side.
I don't schedule a stream at all on YouTube. Seems like an unnecessary step, at least for an audience that knows the regular schedule already. If your schedule is irregular, then I could see it as an on-platform announcement.

I just start throwing data at it, and YT picks it up and runs with it. When I'm done, I just stop it from OBS and let YT figure that out. Each of those becomes its own recording, with whatever title, description, etc. it had at the time of stopping.
 

MiamiPDScanner

New Member
Is the screen still on when you wake up? I wonder if something is still timing out.


I don't schedule a stream at all on YouTube. Seems like an unnecessary step, at least for an audience that knows the regular schedule already. If your schedule is irregular, then I could see it as an on-platform announcement.

I just start throwing data at it, and YT picks it up and runs with it. When I'm done, I just stop it from OBS and let YT figure that out. Each of those becomes its own recording, with whatever title, description, etc. it had at the time of stopping.
The screen is always on. 24/7 No screensaver, no sleep, no power saving... Just on 24/7

I schedule the streams because each one of the 4 has a different description, i.e. North, Central, West, and South... It's a nightmare I'm trying to work out with YouTube API at the moment but suffice to say that OBS, when left to its own devices, will just pick up some old description from some unrelated feed that I don't use anymore. Unless you have some way for me to configure and pass stream parameters from OBS to YouTube? That's a topic for another thread though.
 

AaronD

Active Member
The screen is always on. 24/7 No screensaver, no sleep, no power saving... Just on 24/7

I schedule the streams because each one of the 4 has a different description, i.e. North, Central, West, and South... It's a nightmare I'm trying to work out with YouTube API at the moment but suffice to say that OBS, when left to its own devices, will just pick up some old description from some unrelated feed that I don't use anymore. Unless you have some way for me to configure and pass stream parameters from OBS to YouTube? That's a topic for another thread though.
Ah. Okay, I can see that being a problem. I'm pretty sure YT assumes one stream at a time (How would a typical content creator manage multiple at once? Why would they want to? Why not switch cameras into one stream? Etc.), so your ability to do 4 simultaneous streams on one account is probably a hack already.

For the original problem of not restarting, I'm stumped now...unless it's connected to the multiple streams problem.
 

MiamiPDScanner

New Member
Ah. Okay, I can see that being a problem. I'm pretty sure YT assumes one stream at a time (How would a typical content creator manage multiple at once? Why would they want to? Why not switch cameras into one stream? Etc.), so your ability to do 4 simultaneous streams on one account is probably a hack already.

For the original problem of not restarting, I'm stumped now...unless it's connected to the multiple streams problem.
I’m going to try to do it with only one instance of OBS running and see what happens. I wanted to avoid bringing down the streams but if I must, I must…
 

AaronD

Active Member
I’m going to try to do it with only one instance of OBS running and see what happens. I wanted to avoid bringing down the streams but if I must, I must…
Could you bring all 4 cameras into one instance of OBS, and do a "quad view" into a single stream? Maybe a huge canvas, like 4k, to avoid losing resolution for each camera.
 

AaronD

Active Member
They’re not cameras. It’s a Police Radio Scanner feed. I’ll post a link of you want but I prefer not to be dinged for self promotion. Maybe I can DM it to you?
I don't think an example of the problem would count as self-promotion. You should be okay to post it here. Maybe it sparks a good idea in someone else too.
 

AaronD

Active Member
I don't think an example of the problem would count as self-promotion. You should be okay to post it here. Maybe it sparks a good idea in someone else too.
Okay, so the real purpose is audio. The video is mostly to keep that part of a viewer's brain entertained. Technically, I think you *could* have 4 channels of audio in a single stream, but good luck making sense of it at the other end, as most viewers probably don't have 4 speaker channels that can be turned off independently, and probably can't connect an arbitrary channel *by itself* to a basic system.

So you do want to keep the 4 separate streams, and "just make that work". I wish I had something for you. Maybe someone else can look at what *is* in the logfile and come up with something.

Or maybe you can have the macro try again if it failed? Adjust the condition to match a range of times that practically becomes a timeout, and add a condition for "not streaming". Thus, it keeps trying until it either starts streaming or it times out.
 

MiamiPDScanner

New Member
Okay, so the real purpose is audio. The video is mostly to keep that part of a viewer's brain entertained. Technically, I think you *could* have 4 channels of audio in a single stream, but good luck making sense of it at the other end, as most viewers probably don't have 4 speaker channels that can be turned off independently, and probably can't connect an arbitrary channel *by itself* to a basic system.

So you do want to keep the 4 separate streams, and "just make that work". I wish I had something for you. Maybe someone else can look at what *is* in the logfile and come up with something.

Or maybe you can have the macro try again if it failed? Adjust the condition to match a range of times that practically becomes a timeout, and add a condition for "not streaming". Thus, it keeps trying until it either starts streaming or it times out.
I was wondering about conditioning the start stream on not steaming… I haven’t really looked too much into it. “Time” seemed so much easier to be honest. Can you even condition a start stream on a stopped condition? If so, can this been done AFTER 2 minutes? Off the top of my head I can see the “after” option but I’m not at my computer right now.
 
Top