Does obs have save file name as feature popping up after clicking stop record?

godlyvex

New Member
Hey, 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.
I tried your method and I get this error:
[OBSrename.py] Traceback (most recent call last):
[OBSrename.py] File "C:\Users/godly/Desktop\OBSrename.py", line 3, in <module>
[OBSrename.py] import obswebsocket
[OBSrename.py] ModuleNotFoundError: No module named 'obswebsocket'

I don't understand how this is the case, I installed obswebsocket using the installer, which should be foolproof. I also installed obswebsocket-py.
 

Stretto

New Member
Hey, 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.
Can this be used before the file is created in any way?

Right now I'm setting the filename, in a script, by renaming it after it is recorded and saved. I would like to set the name before the file is created or possibly right after if obs can handle it.

That is,

def on_event(event):
if event == S.OBS_FRONTEND_EVENT_RECORDING_STARTING:
.... ?set filename here? ...

but I can't find anything on how to set the file name except what you have posted.

if I can simply call client.call(obswebsocket.requests.SetFilenameFormatting(title)) and it actually work then I could avoid having to set it on the stop event.
 
Top