This script will regularly publish real-time (JSON-encoded) OBS status information to the configured MQTT host, port, and channel at the specified interval. I wrote this is so I could make my own fully-automated IoT "RECORDING" sign:
Examples of what gets published:
Right when OBS starts up (if the script is enabled) or if you "Exit" OBS without first stopping any recording/streaming:
It won't publish anything at all after that until you start recording or streaming (so it doesn't spam your MQTT server with unnecessary messages).
After recording starts:
(repeats messages like that every <interval> seconds)
When recording stops:
Note that I tried to add support for TLS but OBS currently has a bug (https://github.com/obsproject/obs-studio/issues/2222) that prevents binary Python modules (like ssl) from working (they throw exceptions like
). Once that's fixed I can add TLS support.
Examples of what gets published:
Right when OBS starts up (if the script is enabled) or if you "Exit" OBS without first stopping any recording/streaming:
JSON:
{"recording": false, "streaming": false, "paused": false, "replay_buffer": false, "fps": 0, "frame_time_ns": 0, "frames": 0, "lagged_frames": 0}
After recording starts:
JSON:
{"recording": true, "streaming": false, "paused": false, "replay_buffer": false, "fps": 60.0000024000001, "frame_time_ns": 4270780, "frames": 310, "lagged_frames": 2}
{"recording": true, "streaming": false, "paused": false, "replay_buffer": false, "fps": 60.0000024000001, "frame_time_ns": 4582892, "frames": 610, "lagged_frames": 2}
When recording stops:
JSON:
{"recording": false, "streaming": false, "paused": false, "replay_buffer": false, "fps": 60.0000024000001, "frame_time_ns": 6571491, "frames": 1511, "lagged_frames": 6}
Note that I tried to add support for TLS but OBS currently has a bug (https://github.com/obsproject/obs-studio/issues/2222) that prevents binary Python modules (like ssl) from working (they throw exceptions like
Code:
ImportError: /usr/lib/python3.8/lib-dynload/_ssl.cpython-38-x86_64-linux-gnu.so: undefined symbol: PyExc_OSError