2022-07-26 22:18:32 +01:00
|
|
|
# A Python SDK for OBS Studio WebSocket v5.0
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-25 23:51:30 +01:00
|
|
|
This is a wrapper around OBS Websocket.
|
2022-07-26 22:18:32 +01:00
|
|
|
Not all endpoints in the official documentation are implemented.
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 03:31:32 +01:00
|
|
|
## Requirements
|
|
|
|
|
|
|
|
- [OBS Studio](https://obsproject.com/)
|
|
|
|
- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0)
|
|
|
|
- Python 3.11 or greater
|
|
|
|
|
2022-06-05 12:40:55 +01:00
|
|
|
### How to install using pip
|
|
|
|
|
|
|
|
```
|
|
|
|
pip install obsstudio-sdk
|
|
|
|
```
|
|
|
|
|
|
|
|
### How to Use
|
|
|
|
|
2022-07-26 23:08:07 +01:00
|
|
|
Load connection info from toml config. A valid `config.toml` might look like this:
|
2022-07-25 23:51:30 +01:00
|
|
|
|
|
|
|
```toml
|
|
|
|
[connection]
|
|
|
|
host = "localhost"
|
|
|
|
port = 4455
|
|
|
|
password = "mystrongpass"
|
|
|
|
```
|
|
|
|
|
|
|
|
It should be placed next to your `__main__.py` file.
|
|
|
|
|
2022-07-26 23:08:07 +01:00
|
|
|
#### Otherwise:
|
|
|
|
|
2022-07-28 00:12:45 +01:00
|
|
|
Import and start using, keyword arguments are as follows:
|
2022-07-26 23:08:07 +01:00
|
|
|
|
|
|
|
- `host`: obs websocket server
|
|
|
|
- `port`: port to access server
|
|
|
|
- `password`: obs websocket server password
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 22:05:09 +01:00
|
|
|
Example `__main__.py`
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 22:05:09 +01:00
|
|
|
```python
|
2022-07-26 22:25:31 +01:00
|
|
|
import obsstudio_sdk as obs
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 22:05:09 +01:00
|
|
|
# pass conn info if not in config.toml
|
2022-07-28 00:12:45 +01:00
|
|
|
cl = obs.ReqClient(host='localhost', port=4455, password='mystrongpass')
|
2022-06-05 12:40:55 +01:00
|
|
|
|
2022-07-26 22:05:09 +01:00
|
|
|
# Toggle the mute state of your Mic input
|
2022-07-26 22:06:06 +01:00
|
|
|
cl.toggle_input_mute('Mic/Aux')
|
2022-07-25 23:51:30 +01:00
|
|
|
```
|
2022-07-26 22:18:32 +01:00
|
|
|
|
|
|
|
### Official Documentation
|
|
|
|
|
|
|
|
- [OBS Websocket SDK](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#obs-websocket-501-protocol)
|