Resource icon

Advanced Scene Switcher 1.23.1

Enko63

New Member
You can use a single File condition to match multiple patterns using regular expressions.
For example, the regular expression (pattern1)|(pattern2)|(pattern3) would match if the file only contains either of the following lines:
  • pattern1
  • pattern2
  • pattern3
View attachment 91194

Regular expressions can be very powerful, but also complicated.
I would suggest testing them on https://regex101.com/.

And sorry about the delayed response.
I somehow missed your message.
Thanks. That's exactly what I was looking for.
 

AaronD

Active Member
I am by no means a programmer so I tend to break things often either by accident or just because I don't know what I am doing and just try stuff till it works
I'm a programmer too. People like you are both annoying and necessary to us.
  • Annoying because you break our carefully-crafted house of cards.
  • Necessary because our stuff really needs to be stronger than that, and we're so used to how we thought it should be used that we can't see anything different anymore.
So keep hammering on it and reporting problems. :-)
 

kdarroch

Member
I apologize for this :(
I will try to look into this further on the weekend.

Just to clarify:
Is the crash / freeze issue only happening when interacting with the setting dialog of the plugin?
Or does this also happen when the settings window is closed?


I think that is unlikely.
So going to go back to OBS 28 and try again.
Crashes every time I select area to check.
here is a crash report, had window open to select area and just moved sliders around a few times and it crashed moving horizontal slider. never pick in window to select anything

did notice that if I change the values without picking anything it moves the box and as long as I don't do anything other than look at it (do not pick in window other than close, no slider movement) then it seams to not crash, at lest for a moment or two, have not let it sit open for more that a few minutes to see if it crashes.

Second crash file: crashed when resizing selection window to make it bigger.

Curious question: Why not just have screen maximized when selecting the area to look in?

Anyway, hope some of this helps, maybe I am the only one having issues like this.
 

Attachments

  • Crash 2023-02-03 07-28-12.txt
    133 KB · Views: 8
  • Crash 2023-02-03 07-34-55.txt
    137.9 KB · Views: 7

kdarroch

Member
Added info, I know each post is like notes but documenting before I try new stuff

So OBS (28.1.2), ASS (1.19.2)
Fresh load of everything, only one scene, one source, and one macro
Macro looks at video source for change in area

Big Clue: works fine pausing a macro, but starts crashing if it does anything with Replay Buffer

Change back to pause macro, problem goes away as far as I can tell

Replay buffer the issue? it is writing a file so maybe that is the conflict?

Going to do same thing with latest OBS an ASS, Stay tuned
 

kdarroch

Member
I am at a loss

can't reproduce in newest versions. In fact all it does is crash OBS

Could it be windows 11 causing the issue? Hard to believe that alot of people are not having this issue considering how easy I can crash it
 

Warmuptill

Active Member
I am at a loss

can't reproduce in newest versions. In fact all it does is crash OBS

Could it be windows 11 causing the issue? Hard to believe that alot of people are not having this issue considering how easy I can crash it
Thank you for your efforts in narrowing down the root cause!

I think I have an idea what could be causing the issue.
I am directly modifying widgets from an non UI thread.
I believe that is something you are not supposed to do in Qt and could explain why the crashlogs point to random points in the Qt libs.

I reworked the preview / area selection dialog so it no longer does this, but instead uses the Qt signal / slot mechanism.

A build with this change should be available here in a few minutes:

I would appreciate if you could give this a try.
 
Last edited:

kdarroch

Member
Thank you for your efforts in narrowing down the root cause!

I think I have an idea what could be causing the issue.
I am directly modifying widgets from an non UI thread.
I believe that is something you are not supposed to do in Qt and could explain why the crashlogs point to random points in the Qt libs.

I reworked the preview / area selection dialog so it no longer does this, but instead uses the Qt signal / slot mechanism.

A build with this change should be available here in a few minutes:

I would appreciate if you could give this a try.
will get it loaded and see if I can break it. Hopefully not
 

kdarroch

Member
will get it loaded and see if I can break it. Hopefully not
Ok,

You are a Rock Star, the selection window has never been more responsive and I have tried everything to get it to crash with no luck.
It would appear that you hit the nail on the head with the fix

Will let you know if it rears it's ugly head again but it seams to work better now than any of the previous releases and I have crashes is all of them but the newest. The fix seams to be rock solid
 

AaronD

Active Member
I think I have an idea what could be causing the issue.
I am directly modifying widgets from an non UI thread.
I believe that is something you are not supposed to do in Qt and could explain why the crashlogs point to random points in the Qt libs.

I reworked the preview / area selection dialog so it no longer does this, but instead uses the Qt signal / slot mechanism.
I had a project years ago with Qt, and I can confirm that doing UI stuff from non-UI threads is indeed problematic. And the signal/slot mechanism is indeed the correct way to do it.

I've since moved from Qt to wxWidgets for my own stuff, but that general rule still applies: only the single UI thread reads and writes the UI. All other threads use the provided mechanism to communicate with the UI thread; they never touch the UI directly.

It *is* okay to have the UI thread do other stuff as well, so it's entirely possible (and often practical for small apps) to do everything in that one thread. But it also risks slowing down the UI for the more complicated stuff.
 

kdarroch

Member
Any suggestions on how to trigger the ASS to write the replay buffer

video source changes by flashing a number (I want to trigger on this, wait 1/2/3 seconds, then write the buffer)
number goes away to a white screen until some time later a new number is displayed and cycle repeats

For some reason I get 3 and 4 triggers with 1 number display. Currently trigger is if source changes in defined area. So I could see two triggers as the number shows up and goes away but I get 3 and 4 or more triggers

Any ideas would be appreciated

Thanks again for all that you do. It is simply amazing what the ASS can do
 

Warmuptill

Active Member
Ok,

You are a Rock Star, the selection window has never been more responsive and I have tried everything to get it to crash with no luck.
It would appear that you hit the nail on the head with the fix

Will let you know if it rears it's ugly head again but it seams to work better now than any of the previous releases and I have crashes is all of them but the newest. The fix seams to be rock solid
That is great news! :)
Thank you for your patience in getting this sorted out!

Any suggestions on how to trigger the ASS to write the replay buffer

video source changes by flashing a number (I want to trigger on this, wait 1/2/3 seconds, then write the buffer)
number goes away to a white screen until some time later a new number is displayed and cycle repeats

For some reason I get 3 and 4 triggers with 1 number display. Currently trigger is if source changes in defined area. So I could see two triggers as the number shows up and goes away but I get 3 and 4 or more triggers

Any ideas would be appreciated

Thanks again for all that you do. It is simply amazing what the ASS can do
I have to suggestions that might help here:
  • I would enable pattern matching to prevent any video compression artefacts incorrectly triggering this condition.
  • Adding a duration modifier of the type "with the last ..." to the video condition in combination with macro option "Perform actions only on condition change" will result in the macro only executing its actions at most every X seconds. (Assuming there are no other conditions that might conflict with this setting)
DurationModifier.PNG


Hope that helps!
 

kdarroch

Member
That is great news! :)
Thank you for your patience in getting this sorted out!


I have to suggestions that might help here:
  • I would enable pattern matching to prevent any video compression artefacts incorrectly triggering this condition.
  • Adding a duration modifier of the type "with the last ..." to the video condition in combination with macro option "Perform actions only on condition change" will result in the macro only executing its actions at most every X seconds. (Assuming there are no other conditions that might conflict with this setting)
View attachment 91350

Hope that helps!
here is a video


Might help explain
 

Warmuptill

Active Member
here is a video


Might help explain
The condition being highlighted in green does not mean that the actions are being necessarily being executed as well.

If you enable all highlighting options you will see if the action is executed, when it is highlighted in green. (Just like a condition would be if it is true).
If the "Perform actions only on condition change" checkbox is flashing yellow that means that the execution of the actions was prevented due to that checkbox being ticked.

For example:

Prevent.PNG
 

kdarroch

Member
Will play around with it some more. All I know is every time it flashes it writes a file.

Found a possible solution but more complicated than it should be.
I un-pause a separate macro (Replay) , Run it , then wait a second (or 2) , pause the macro (Replay)

Replay: If Macro1 count = 1, It will wait a second, write the buffer, wait another second, then reset the counter

Seems to work, will need to work on the delays a little. goal it end up with say 7 seconds before # and 1 or 2 after.

your idea is cleaner if I can make it work

now if I can just get the replay buffer to be the length it is told. 7 seconds ends up being 4-8 seconds randomly
 

AaronD

Active Member
here is a video


Might help explain
Just a side-note for device compatibility: I often read this forum and comment with a Raspberry Pi (still use the main rig to test stuff and get screenshots), and for some reason ClipChamp doesn't work on the Pi. It just hangs on the first frame. YouTube does work.

I don't think I *need* to see that particular video - looks like Warmuptill has you covered already - but just FYI for future reference, and for anyone else that might happen to see this.
 

kdarroch

Member
So like I said, not a programmer

How do I use variables?

Want to set a variable in a macro and then use it to write a file with that name

What would be even better (probable no way to do it) is to set a variable in a macro, then use that variable as the file name prefix and write the replay buffer with the prefix and other stuff
 

kdarroch

Member
So through much trial and error I have a way to Change the name of the replay buffer file automatically.

So I have ASS write a text file with the prefix I want name the file (This will be dynamically changing)
Then when condition is met to write the replay buffer
Ass writes the replay buffer,
waits 1 second to make sure it is saved
Runs a batch file to rename the file with the prefix stored in text file previously written and delete original file (might just move it to a new folder but will see how it goes)

I do change the prefix on the replay buffer to make the file start with "Replay" and then use that to find the file to rename.

Did it on a test case now just have to add it into my macros
 

AaronD

Active Member
So I have ASS write a text file with the prefix I want name the file (This will be dynamically changing)
Then when condition is met to write the replay buffer
Ass writes the replay buffer,
waits 1 second to make sure it is saved
Runs a batch file to rename the file with the prefix stored in text file previously written and delete original file (might just move it to a new folder but will see how it goes)
I wonder if you can simplify it a little bit by passing a variable as an argument to the batch file. So you'd skip the "name file", and call the batch file with the desired name instead. You could also pass it the (constant) path to the raw file, just to keep all of the change-able stuff inside of OBS. (but still in two places)
 

r3-14

New Member
I'm using OBS to record snail locomotion from multiple angles with overlays to improve speed measurements for a research project. I'd like to use advanced scene switcher to make an "alarm system" that changes the scene briefly to flash red and play an alarm sound when the snail ventures off the desired path to let me know I need to reset and abandon the run. My current macro is set up to switch to a different scene if the video feed on either side of the main track has changed. While this recognises when my hand crosses through the area, the snail appears to enter the restricted section too slowly for the software to notice the change. Is there a way to improve the accuracy of this set-up? Or are there different macro conditions that might work better?
 
Top