Wednesday, February 19, 2025

Simple Replay built into OBS

Uses everything built into OBS, no scripts.  It will replay what is on your program feed, suitable for a single camera shoot where you want to have some sort of replay.

1 button to set an OUT point
2nd button goes back X seconds (replay buffer) from OUT point and replaying at speed you set

1>    
Settings -> OUTPUT -> 
"Output Mode" -> Advanced


2>
Enable Replay Buffer.  Set for 10 seconds


3>
SETTINGS -> ADVANCED -> Recording

READ THIS CAREFULLY.  This is a spot that trips up configuration

By default, the settings "Filename Formatting" is set as:  %CCYY-%MM-%DD %hh-%mm-%ss

Replace with the word "Recording"


Click on "APPLY"

Please note.  If you record your stream, it will not timestamp that recording as default in the filename.  It will now just add a (X) after the name for each recoding.  This is necessary for the replay.

4>
HOTKEYS -> REPLAY BUFFER -> SAVE REPLAY

Set it for F9



Click Apply
Click "OK"

6>
Select "START REPLAY BUFFER"

    IF you get this pop up, just select YES


7>
Press your hotkey, "F9".  

The lower left of the OBS should give an indication if and where the recording is saved. 

8>
Create a new scene, I called mine "Instant Replay".  
This is the scene that is triggered to view the replay during a show.

9>
Set up a Media Source
I called mine "ReplayScene"


10>
Select browse and go to the location your replay is saved 




Select the file "Replay Recording" and click "OK"

11>  Make the following changes:

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.

-This is very important-
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%.


HINT - You could add an additional text box in this sources window and put "REPLAY" in the corner if you want your viewers to know.

12>
Click on OK


15>
SETTINGS - HOTKEYS

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

Mine is set to F12



17>
Now, remember, this replay records the PROGRAM output.  So setup whatever video you want to replay, if its showing up on your program out window, that is what is recorded.

For the purposes of this demo, I've created a scene with a video that i used to test.



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"  - This sets an OUTpoint

Press "F12" - This says "go back to the beginning of the replay" 
You would press this when you are ready to show the replay.

Now make your "InstantReplay" scene live in program.  It should start playing automatically.

(To make the playback/show on program happen simultaneously make F12 a CUT short cut as well in your hotkeys and it will do it all at once)



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 sounding 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.