Wednesday, February 19, 2025

Simple Replay built into OBS

Ok, here's how to make a simple replay in OBS.  

This will get you a simple replay that, when you press two buttons, it will replay the last 10 seconds at whatever speed you want.

1>    
Settings -> OUTPUT

Select "Output Mode" to be Advanced


2>
Enable the Replay Buffer and set it for 10 seconds (You can tune this, but its a reasonable starting point)


3>
Goto SETTINGS - ADVANCED and scroll down to Recording

This is the part that everyone gets messed up, and IMO, this is an OBS implementation issue.

READ THIS CAREFULLY.

By default the settings are as follows:


The big problem is with filename formatting.  You need to replace it with "Recording"


Click on "APPLY"

This now allows the replay file to always have the same name, and be overwritten with the different replays.  But this is something that will affect your normal recordings if you do them.  They will have the same name, and get over written every time you press "start recording" so be aware.

4>
Click on HOTKEYS

5>
Scroll down to "REPLAY BUFFER" and set a hotkey.  In my Example, I'm going to use F9



Apply your settings

6>
Now click on "START REPLAY BUFFER"

What is happening now is OBS is saving just the last 10 seconds of the program video into RAM.  
It just keeps recording to memory and dumps old video automatically.

7>
Now, with the replay buffer running, press your hotkey, in this example, "F9"
This tells OBS to save the current 10 seconds of video into a file that will be called "Recording Replay"

8>
Create a new scene, call it "Instant Replay".  
This will be the scene that you will activate to show the replay.

9>
Set up a Media Source


I called my "ReplayScene"

10>
Click on browse, and by default, you should be taken to the folder that now contains the replay file:
You wont see this file, however, if you didn't setup a hotkey and use the hot key as told in the above steps.

The file name should be "Replay Recording"


Here is what mine looks like:



11>
Disable "LOOP"
Enable "Restart playback when the source becomes active"
Disable "Show nothing when playback ends" (this is a personal preference.  with this disabled, and you come to the end of the 10 seconds, the video will pause automatically.   If enabled, a black screen appears.
Enable "Close file when inactive"  (if enabled it can lock the recording file out)
Speed = Whatever you like.  I set mine to 70%. This means the playback will be slower, playing 70% of a normal rate being 100%.

12>
Click on OK

13>
Click on TOOLS on the top menu of OBS and select Scripts




14>
At the top of OBS Studio, click on tools, then scripts and select “instant-replay.lua”  (it comes with OBS automatically)


15>
Goto SETTINGS - HOTKEYS again 

16>
Find the scene name you created, in our example it was called "Instant Replay"

I set mine to be F12



Now lets test it out!

OBS replay is going to record whatever is on your PROGRAM window.

So make sure you have some video in that window that is moving so that you have a reference.
Make sure that your replay buffer is recording.

Now wait 10 seconds so that the replay buffer is full.

Press "F9"

NOW, press "F12"

Now you might not notice a lot yet, BUT what you have done is told OBS to save the last 10 seconds to the Replay Record file.  Now make the "Instant Replay" scene live in program.  You should now see the 10 seconds that was saved playback, at 70% speed. 

When its done it will freeze, and you cut back to whatever camera you want.


One additional step.  When you are running a replay, it will play back the sound that was live as well.  So turn down/mute your Audio Media Source during a replay.  Else you will hear program audio replay...sometimes at a really slow souding speed.









Monday, February 3, 2025

Websockets using OBSCommand

Send commands to Websockets using OBScommander

So I'm using my goto program

obs-websocket - Remote-control OBS Studio using WebSockets | OBS Forums

Which generates the codes via a batch file in windows.

I got this solution running in 10 minutes

Situation:

Covering a sports event with OBS and need a clean feed (no graphics) sent to stadium LED wall but also a broadcast feed that has all my graphics.

To address this, the OBS switcher sends its output (no graphics) to the LED wall and also to a second OBS computer that does the overlays and also streams the video.

BUT

to add a bit of complexity, I want the score/clock graphics to be removed automatically when I key up an instant replay, so that stream viewers don't see that during replay.


1: So what I did was activate websockets on the graphics OBS, set a password.  I used "Password20"


2.  I setup two scenes
    
    One is called "Game" and this is the normal game.  Which contains the HDMI input from the switcher and the graphics overlay

The second one is called "Replay" which doesn't have any graphics, just the HDMI input


Now I installed 
obs-websocket - Remote-control OBS Studio using WebSockets | OBS Forums

(at time of writing it was version 5.0.1)

I also installed had to install the .Net 3.1 runtime for 
Download .NET Core 3.1 Runtime

There were a couple to select form Run console apps

Once that was installed I created 2 .BAT files in the directory that I extracted websockets remote control directory.  In my case, I put it in C:\OBSCommand_1.6.3


Using notepad I created 2 files.  

graphic-off.bat   contains this:

OBSCommand.exe /server=IPofGraphicsOBS:4455 /password="Password20" /scene="Replay"

graphic-on.bat   contains this:

OBSCommand.exe /server=IPofGraphicsOBS:4455 /password="Password20" /scene="Game"



4.
Now on my OBS instance running as a switcher, I installed 
Advanced Scene Switcher

This program does a bunch of tasks with OBS, but one of the ones I really like is that it can be used to detect when I trigger the instant replay scene, and send an approriate command to the graphics computer to turn the graphics on or off.

Once you install it, go into that OBS instance and we'll configure it.  On my switcher I have 2 camera inputs and a Replay input from our instant replay machine.


I started up Advanced Scene Switcher to make it active


On the Macro tab I created a new macro and this is what the configuration is:

The first macro, when it detects that the "Instant Replay" scene is live, will run the "graphics-off.bat" file, which will tell the graphics computer to switch to the scene with no graphics.




Then created a second one, this time we select "IF NOT" in the first section.
This says "if the active output is NOT instant replay, send a command to turn the graphics back on."



Now you can toggle back and forth between your scenes and graphics will turn on  and off.



Friday, January 31, 2025

Send commands to another OBS via Websockets

Why is there such poorly written non sensical information on how this thing works with its command structure.  Not that this document is any better, but I'll put what I know to make this work.

What I need is to use Advanced Scene Switcher to detect specific scenes are active, then send a command from one OBS, to another OBS computer using Websockets to deploy specific graphics.

For relevance of this description OBS 1 is the switcher and is sending video to OBS 2, the graphics machine.

I'm using Advanced Scene Switcher to monitor and detect for specific scenes to be active and then send web sockets to the other OBS when it detects it as active. 

Steps:

Make Websockets is active in your Second OBS.  Set a password and check the enable box.



In first OBS, create a macro in Advance Scene Switcher.

In this example, when first obs activates the "Replay" scene, Avance Scene Switcher detects this and will send a command to the second OBS machine to change to a scene on it caled "Replay" on that system.

This is what it looks like


This is the code that I used above if you want to copy / paste it.

You can change the word "Replay" in the code example to be one of your scenes on your SECOND obs. The request ID can be anything.  Its needed, but a debug purposes.

{
"op": 6,
"d": {
"requestType": "SetCurrentProgramScene",
"requestId": "12345",
"requestData": {
"sceneName": "Replay"
}
}
}

You can see that its sending the command to the Graphics Computer and in the icon when you add this feature you need to setup a connection.  This is what mine looks like.


Assuming you have activated the Websockets server in OBS on your second computer that will receive this commands, you should see "Connected and authenticated" displayed when you test the connection.


Monday, January 20, 2025

IIS upload file size

 "The page was not displayed because the request entity is too large"

Having an issue with uploading larger files to your IIS site?  There are a few posts about modifying the webapps/manager/web-info/web.xml in tomcat etc.


But this fixed my issue

Launch IIS Manager

Double click on your "Default Web Site" in the connections window and then double click on "Request Filtering"

on the right side select "Edit Feature Settings"

Then in "Request limits" set the byte count for the max size you want to upload in the 
"maximum allowed content length"



Wednesday, September 18, 2024

Setup FreePBX (AND Asterisk) in AZURE

This pretty much will work for any deployment I guess, but this is specifically written for AZURE, so there might be some tweaks in here that are specific for that environment.  This deployment was done via a Windows 10 machine.


In Azure, create a new virtual machine.

In my example i'm using a "PAY AS YOU GO" approach and have assigned it to a group called pbxtest1


I assigned it a virtual machine name and region


At time of writing this, the FreePBX deployment recommends Debian 12 "Bookworm"

Assign it with the appropriate CPU and RAM that you will need.  For testing, I'm using a minimal system



I'm leaving everything else default.  Select Review and Create

Select "CREATE" on the subsequent page, then you will be prompted "Generate new key Pair"

Download the private key


Your system should download the key file



Azure should start building your deployment


That will only take a few minutes to create normally.

Select "Go To Resource"


Note the IP address assigned to your instance


If you haven't already, install PUTTY from putty.org


Launch the APP " PuttyGEN


Select "CONVERSION" -> IMPORT KEY



Select the key file that you downloaded upon creation of the machine



Now select "FILE" -> "Save Private Key"


You'll get a PuttyGen warning about saving it without a passphrase, select YES


Give it a name and select SAVE


You can close the PuttyGEN app

Now open a regular PUTTY session


Enter in the IP provided to you by Azure.  Give it a name under "Saved Sessions"


Select "SSH" -> Auth -> Credentials to Authenticate with



In the Public-key authentication select  BROWSE and open up the key file you generated in PuttyGen



Scroll back up to "SESSION" then click on "SAVE

Now open your saved session.  If it works, you should get prompted with the similar security warning




Select "ACCEPT"

Logon with the default user " azureuser "

Should be prompted with something like this:


Lets update the system first (will take a few minutes depending on network and guest speed

sudo apt update && sudo apt upgrade -y

Now run the following to enter ROOT

sudo -i

Get the latest updates 

#################################################################################

The following command will install the latest release of FreePBX (at time of writing version 17) and the lastest GA of Aasterisk

cd /tmp

wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh  -O /tmp/sng_freepbx_debian_install.sh

bash /tmp/sng_freepbx_debian_install.sh

The script will now do a full install of all the necessary items to get FreePBX and Asterisk up and running.  Will take about 30 minutes

Will be something like this as you wait..

When all said and done, assuming no installation issues, you should be presented with this screen similar.


Goto your guest network settings:  
select "Create Port Rule"
then select InBound Port Rule

Create a rule with the service as HTTP.  You can use all the other default settings



Click on ADD

You should now be able to HTTP to the WAN IP that you used to SSH to the box.

And be presented with a screen like this:



Fill in the user name and email address that you want to logon to the system with and receive system status message in the future.

You have to change the System Identification name from the default provide to something new to continue.