Skip to main content

OBS WebSocket Client

A Python library for interacting with OBS Studio through its WebSocket protocol (v5.x.x). This client provides a simple async interface to control OBS Studio programmatically.

Features

Requirements

  • Python 3.9 or higher
  • OBS Studio 28.0.0 or higher with WebSocket server enabled

Installation

This package uses Poetry for dependency management. Make sure you have installed Poetry (v1.8.3). Then simply run:

poetry install

Setting up OBS WebSocket Server

  1. Open OBS Studio
  2. Go to Tools -> WebSocket Server Settings
  3. Enable WebSocket server
  4. Set the Server Port (default is 4455)
  5. Optionally set the password for authentication

Quickstart

Below is a simple code snippet that demonstrates the usage of ObsWsClient to start and stop recording in OBS Studio. For more examples, checkout the example folder.

from obswsc.client import ObsWsClient
from obswsc.data import Request

import asyncio

async def main():
  client = ObsWsClient(url='ws://localhost:4455')

  async with client:
    await client.request(Request('StartRecord'))
    await asyncio.sleep(10.0)
    res = await client.request(Request('StopRecord'))
    print(f'recorded video: {res.res_data["outputPath"]}')

asyncio.run(main())

License

This project is licensed under the MIT License.

Acknowledgments

  • Thanks to the OBS Studio team for creating the WebSocket protocol.

Release files for obs-ws-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obs-ws-client 0.1.0
File Size Uploaded
obs_ws_client-0.1.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for obs-ws-client 0.1.0
File Interpreter ABI Platform
obs_ws_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / obs_ws_client-0.1.0.tar.gz

Download URL obs_ws_client-0.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d3d0e5c2ba81e54458e0650575dce4db66e2e76b9c0befb3e0e80194eb048cf7
BLAKE2b-256 checksum
How to use checksums
a9f4b218564e082f2dd396c212064b20c587dd867341bd7ccb08f909806b6980
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.7 Windows/10

Release files / obs_ws_client-0.1.0-py3-none-any.whl

Download URL obs_ws_client-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab0bda953c20b73a54c2bfd3b1a60372face3b2d145cf13121df6bb6e0876fb3
BLAKE2b-256 checksum
How to use checksums
e7de624f268d48051f6ff614772f1fb9ee37ddcfae718f8235bf493c57d4759e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.7 Windows/10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page