But its just date and video format, these types of things rather then actually customizable.The file is already written when you click the stop button. It's already done. OBS is just finalizing and closing it. The file name template can be configured in settings->Advanced->Recording->Filename Formatting. Hold the mouse over the input field and you will see a bunch of macro definitions you can use to customize the name.
obs-cli-win SetFilenameFormatting="{ ""filename-formatting"": ""TESTNAME %CCYY-%MM-%DD %hh-%mm-%ss"" }" && ^
obs-cli-win StartRecording && ^
obs-cli-win SetFilenameFormatting="{ ""filename-formatting"": ""%CCYY-%MM-%DD %hh-%mm-%ss"" }" && ^
obs-cli-win GetFilenameFormatting
client = obswebsocket.obsws("localhost", 4444, "")
client.connect()
print(client.call(obswebsocket.requests.GetFilenameFormatting()))
client.call(obswebsocket.requests.SetFilenameFormatting("TESTNAME" + " - %CCYY-%MM-%DD %hh-%mm-%ss"))
client.call(obswebsocket.requests.StartRecording())
print(client.call(obswebsocket.requests.GetFilenameFormatting()))
client.call(obswebsocket.requests.SetFilenameFormatting("%CCYY-%MM-%DD %hh-%mm-%ss"))
print(client.call(obswebsocket.requests.GetFilenameFormatting()))
client.disconnect()
I've managed to achieve this using obs-websocket and simple&dirty python script.
The obs-websocket plugin can get/set the pattern used by OBS to save recording files.
Steps:
Install/configure obs-websocket plugin.
Then use obs-cli (https://github.com/leafac/obs-cli) or obswebsocket (https://pypi.org/project/obs-websocket-py/).
cli example (under Windows os, beware of double quotes):
Code:obs-cli-win SetFilenameFormatting="{ ""filename-formatting"": ""TESTNAME %CCYY-%MM-%DD %hh-%mm-%ss"" }" && ^ obs-cli-win StartRecording && ^ obs-cli-win SetFilenameFormatting="{ ""filename-formatting"": ""%CCYY-%MM-%DD %hh-%mm-%ss"" }" && ^ obs-cli-win GetFilenameFormatting
python example:
Python:client = obswebsocket.obsws("localhost", 4444, "") client.connect() print(client.call(obswebsocket.requests.GetFilenameFormatting())) client.call(obswebsocket.requests.SetFilenameFormatting("TESTNAME" + " - %CCYY-%MM-%DD %hh-%mm-%ss")) client.call(obswebsocket.requests.StartRecording()) print(client.call(obswebsocket.requests.GetFilenameFormatting())) client.call(obswebsocket.requests.SetFilenameFormatting("%CCYY-%MM-%DD %hh-%mm-%ss")) print(client.call(obswebsocket.requests.GetFilenameFormatting())) client.disconnect()
import obswebsocket
from obswebsocket import obsws, events, requests
client = obswebsocket.obsws("localhost", 4444, "") #Change this if you have a different name, port or password
client.connect()
client.call(obswebsocket.requests.GetFilenameFormatting())
print("Hi! I'm your new video\nWhat's my name?\nFilename:")
client.call(obswebsocket.requests.SetFilenameFormatting(input() + " - %MM-%DD %hh-%mm")) #Custom name + date. The best of two worlds
client.call(obswebsocket.requests.StartRecording())
print(client.call(obswebsocket.requests.GetFilenameFormatting()))
client.call(obswebsocket.requests.SetFilenameFormatting("-%MM-%DD %hh-%mm-%ss"))
print(client.call(obswebsocket.requests.GetFilenameFormatting()))
client.disconnect()
This is also what I need for our lab use. OBS need to have a file name template other than only time & date as suffix, even just a numeric counter would be great as the suffix. Option to enter the file name after the recording would be ideal! OBS would save video in a temp file name then pop-up window would appear to enter new name. I'd like to give your code a try in the mean time. thanksHey, I created an account just for thanking you. I made some tweaks to your Python example and it worked great!
I want to clarify some things in case anyone wants to do exacly what the OP wanted. You should follow these steps:
1. Install the obs-websocket plugin
2. Install the obs-websocket-py which is the Python tool for the plugin (you can do this using pip)
3. Create a new .py file wth this code:
Python:import obswebsocket from obswebsocket import obsws, events, requests client = obswebsocket.obsws("localhost", 4444, "") #Change this if you have a different name, port or password client.connect() client.call(obswebsocket.requests.GetFilenameFormatting()) print("Hi! I'm your new video\nWhat's my name?\nFilename:") client.call(obswebsocket.requests.SetFilenameFormatting(input() + " - %MM-%DD %hh-%mm")) #Custom name + date. The best of two worlds client.call(obswebsocket.requests.StartRecording()) print(client.call(obswebsocket.requests.GetFilenameFormatting())) client.call(obswebsocket.requests.SetFilenameFormatting("-%MM-%DD %hh-%mm-%ss")) print(client.call(obswebsocket.requests.GetFilenameFormatting())) client.disconnect()
4. Open OBS and execute the code
And voilà! A new window will open and it should ask you for your video's name and then start recording.
I wanted to write this bc it took me a lot of time to figure this out. So let me know if it helped you too.
Hi!This is also what I need for our lab use. OBS need to have a file name template other than only time & date as suffix, even just a numeric counter would be great as the suffix. Option to enter the file name after the recording would be ideal! OBS would save video in a temp file name then pop-up window would appear to enter new name. I'd like to give your code a try in the mean time. thanks
Hi there! I'm glad my post helped you!Hi,
I found your post which should fulfill exactly my needs.
I tried to follow your explanation, but wasn't able to make it work.
I installed Python for Windows (version 3.10.2)
I installed obs websocket by using the Windows Installer version 4.9.1 .
I installed obs websockets python using the pip install command (version 0.5.3)
I created a .py file located in my C:\Users\user\AppData\Local\Python\Python310\Scripts folder with exactly the code you posted.
I start OBS and run the script using the cmd, navigating to the folder mentioned above just with the command "obs-changename.py".
Anything I'm doing wrong? There is no popup or cmd request, where I could insert my filename.
If I change your script from input() to "Test 1" + " - %MM-%DD %hh-%mm" it is working.
Waiting for your feedback!
Have a good one!
Thanks and best regards
I tried using your script but got no popup, am I missing something?As OBS v28 uses API 5+, which obs-websocket-py does not understand, I wrote a new version of this script using obs-api-python (and easygui for a popup).
My script asks for a name after the file is finished recording and renames it on disk. It can also remember the last name and automatically increment a number suffix. I added it to the OBS settings to be launched automatically with it.
https://github.com/ismslv/obs-scripts/blob/main/obs_rename_recording.py
Nevermind, I did it. Thanks for the script, it works wonders!I tried using your script but got no popup, am I missing something?
Installed Python, then installed easygui module and I loaded the script on OBS.
Ty this worked for me as well obs 28.0.3 python 3.10As OBS v28 uses API 5+, which obs-websocket-py does not understand, I wrote a new version of this script using obs-api-python (and easygui for a popup).
My script asks for a name after the file is finished recording and renames it on disk. It can also remember the last name and automatically increment a number suffix. I added it to the OBS settings to be launched automatically with it.
https://github.com/ismslv/obs-scripts/blob/main/obs_rename_recording.py
Possible to do some changes in script to include replay buffer file as well?As OBS v28 uses API 5+, which obs-websocket-py does not understand, I wrote a new version of this script using obs-api-python (and easygui for a popup).
My script asks for a name after the file is finished recording and renames it on disk. It can also remember the last name and automatically increment a number suffix. I added it to the OBS settings to be launched automatically with it.
https://github.com/ismslv/obs-scripts/blob/main/obs_rename_recording.py
How you did you manage to get this working? Python installed, easygui installed, script loaded on OBS but nothing.I tried using your script but got no popup, am I missing something?
Installed Python, then installed easygui module and I loaded the script on OBS.