Giter VIP home page Giter VIP logo

obs-cmd's Introduction

obs-cmd - a minimal obs CLI for obs-websocket v5

I was used to obs-cli but it doesn't support obs-websocket 5

release

Usage

Just a minimal API is supported

obs-cmd --help
obs-cmd scene switch <scene>
obs-cmd scene switch @cam-front
obs-cmd scene-collection switch <collection>
obs-cmd scene-item toggle <scene> <item>
obs-cmd toggle-mute Mic/Aux
obs-cmd recording toggle
obs-cmd recording status
obs-cmd streaming start
obs-cmd virtualcam start
obs-cmd save-screenshot <source> <format> <file_path> [--width WIDTH] [--height HEIGHT] [--compression-quality COMPRESSION_QUALITY]
obs-cmd replay toggle
obs-cmd replay save
obs-cmd replay status
obs-cmd replay last-replay
obs-cmd info
obs-cmd --websocket obsws://localhost:4455/secret info # You can override the default `obsws` url

You can override the websocket URL, which can be found in OBS -> Tools -> WebSocket Server Settings. localhost for the hostname will work for most, instead of the full IP address. If you set the password as secret you can avoid to specify the --websocket argument.

Installation

Using the provided Binaries

Download obs-cmd, pick the correct binary for your OS, example obs-cmd-linux-amd64

https://github.com/grigio/obs-cmd/releases/latest

type in the terminal:

chmod +x obs-cmd-linux-amd64 && sudo mv obs-cmd-linux-amd64 /usr/local/bin/obs-cmd

Installing From Source

First ensure that Rust is installed on your system. Clone the repo to your local system:

git clone https://github.com/grigio/obs-cmd.git

Next cd into the cloned directory then at the top-level of the directory run:

cargo build --release

Once the build is complete you may move the produce binary into an approriate binary location, such as /usr/local/bin:

sudo cp target/release/obs-cmd /usr/local/bin/obs-cmd

Installing on Arch Linux

The obs-cmd package is maintained on the Arch User Repository.

Ensure that rust is installed for access to cargo.

To install obs-cmd you can either use an AUR helper of your choice such as yay or aurman or download the PKGBUILD directly and use makepkg to produce the finished package:

wget https://aur.archlinux.org/cgit/aur.git/snapshot/obs-cmd.tar.gz

Untar the .tar.gz file:

tar xvzf obs-cmd.tar.gz

cd into the directory:

cd obs-cmd

Run makepkg to produce the installable package:

makepkg -s

And finally use pacman to install the produced package (your version number may vary):

sudo pacman -U obs-cmd-0.15.3-1-x86_64.pkg.tar.zst

Example Usage

$ obs-cmd recording start 
Recording started
Result: Ok(())
$ obs-cmd recording stop 

$ obs-cmd info
Version: Version { obs_version: Version { major: 29, minor: 1, patch: 1 }, obs_web_socket_version: Version { major: 5, minor: 2, patch: 2 }, rpc_version: 1, available_requests: ..

$ obs-cmd save-screenshot "OBS Source" "jpg" "/home/user/screenshot/test.jpg" --width 1920 --height 1080 --compression-quality 100
Saved screenshot to path: "/home/user/screenshot/test.jpg"

Donations

Donations are welcome and will go towards further development of this project

monero:88LyqYXn4LdCVDtPWKuton9hJwbo8ZduNEGuARHGdeSJ79BBYWGpMQR8VGWxGDKtTLLM6E9MJm8RvW9VMUgCcSXu19L9FSv
bitcoin:bc1q6mh77hfv8x8pa0clzskw6ndysujmr78j6se025
lightning:[email protected]

obs-cmd's People

Contributors

adiharif avatar cyrv6737 avatar dependabot[bot] avatar dhtseany avatar duckduckwhale avatar grigio avatar lukitsche avatar mansman12 avatar orowith2os avatar steffen-samseth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

obs-cmd's Issues

RUSTSEC-2023-0065

$ cargo audit
    Fetching advisory database from `https://github.com/RustSec/advisory-db.git`
      Loaded 590 security advisories (from /home/user/.cargo/advisory-db)
    Updating crates.io index
    Scanning Cargo.lock for vulnerabilities (133 crate dependencies)
Crate:     tungstenite
Version:   0.19.0
Title:     Tungstenite allows remote attackers to cause a denial of service
Date:      2023-09-25
ID:        RUSTSEC-2023-0065
URL:       https://rustsec.org/advisories/RUSTSEC-2023-0065
Severity:  7.5 (high)
Solution:  Upgrade to >=0.20.1
Dependency tree:
tungstenite 0.19.0
└── tokio-tungstenite 0.19.0
    └── obws 0.11.2
        └── obs-cmd 0.1.1

error: 1 vulnerability found!

[Request] Add command option to input Websocket Password

Hey there! I'd like to recommend adding a command option for specifying the websocket password to eliminate the need for the ~/.config/obs-cmd.toml config file. My previous scripts, based on obs-cli, already specified this info using my own global config file and it'd be nice if I could continue this trend as I have 5 live streaming rigs with their own unique configs. Thanks!

Awesome Project

Hi,

Great project! I had the same issue last year with websockets v5, so I quickly hacked together this: https://github.com/tbocek/obs-cli5x. Since your project does what I need, and it seems well maintained, I'm going to switch to use your version.

There is even an aur version, which makes my life easier. Awesome!

Thomas
(this is not an issue, so you can close it, just wanted to say thanks)

[feature request] toggle or set source visibility

First, this client works so well. When I use it with my streamdeck, I'm able to fire off a command to OBS whenever I sneeze or have to do something else at a moments notice. Now that obs-cmd can toggle mute,

Is there any possibility to add a command to toggle the visibility of a source?

I would like to be able hide my camera specifically. I know that this is supposed to be minimal.

How minimal are you wanting the project to be?

I find this project amazing and saves me implementing a basic interface in python, and adding to this is easy as I'm very familiar with rust. I ask this as would plan on adding extra bits as time goes on (and I have time), and wonder how much I should open PRs for (I would probably mainly add other Requests stuff and helpers around them).

Amazing work!!

Authentication failed after update

OBS Version: OBS 30.0.0-rc1-82-gba25bc65c-modified (linux)
obs-cmd Version: 17.1

Failing to use the obs-cmd, getting auth errors. The password is added in obs-cmd.toml. It had worked before I have updated obs-cmd, I think.

obs-cmd output:
Error: Handshake(ConnectionClosed(Some(CloseDetails { code: Library(4009), reason: "Authentication failed." })))

obs socket output with debug enabled:

info: [obs-websocket] [WebSocketServer::onOpen] New WebSocket client has connected from [::1]:33744
info: [obs-websocket] [debug] [WebSocketServer::onOpen] Sending Op 0 (Hello) message:
{
  "d": {
    "authentication": {
      "challenge": "[REDACTED]",
      "salt": "[REDACTED]"
    },
    "obsWebSocketVersion": "5.3.3",
    "rpcVersion": 1
  },
  "op": 0
}
info: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
{
  "d": {
    "authentication": "[REDACTED]",
    "rpcVersion": 1
  },
  "op": 1
}
info: [obs-websocket] [WebSocketServer::onClose] WebSocket client `[::1]:33744` has disconnected with code `1006` and reason: End of File

Reported version incorrect

It would appear that the package version in Cargo.toml (and thus reported by --version/-V) is incorrect, still being at 0.1.1.

Adding Source Selection

Any thoughts on adding Scenes so the end-user can enable/disable them like how you can mute Audio Sources?

RUSTSEC-2024-0019

Caught one more as a routine check:

$ cargo audit
Crate:     mio
Version:   0.8.10
Title:     Tokens for named pipes may be delivered after deregistration
Date:      2024-03-04
ID:        RUSTSEC-2024-0019
URL:       https://rustsec.org/advisories/RUSTSEC-2024-0019
Solution:  Upgrade to >=0.8.11
Dependency tree:
mio 0.8.10
└── tokio 1.35.1
    ├── tokio-tungstenite 0.20.1
    │   └── obws 0.11.5
    │       └── obs-cmd 0.1.1
    ├── obws 0.11.5
    └── obs-cmd 0.1.1

error: 1 vulnerability found!

From what is said over at RUSTSEC-2024-0019, looks like this could only affect Windows user and may result in a use-after-free in tokio.

Request: allow reading websocket secret from a text file.

I post my OBS websocket bash scripts to my codeburg. I want to be able to read the websocket secret from a file outside the repository so i dont have to include it. with possible options for plain text or hashed/salted - however, plain text is a fine start right now though -- i mean, obs-websocket stores password in plain text currently as well, as bad a security practice as that is.

hey wait! maybe we could read it direct from there if possible. or at least add the option to read direct from the OBS config.

Flatpak package

In working on obs-cmd, I noticed that it's a fairly niche tool, and the status of its development puts it into a bit of a weird situation with packaging - not to mention that it being in Rust makes some distros (Fedora) angry.

I'd love to help develop this (such that it's feature complete), and having a Flatpak package for it would help in getting it out to users faster.

If you're fine with it, I can submit obs-cmd to Flathub and automate the updating and maintenance of it.

[feature request] toggle a scene filter

Hi. First of all, thanks for this piece of software 💚.

I have tried it and it works so well for me when I try to toggle a scene item with

obs-cmd scene-item toggle <scene> <item>.

But it doesn't have any option (as far as I know) to toggle a scene filter.

Is there any possibility to add a command to toggle that? Something like:

obs-cmd scene-filter toggle <scene> <filter-item>.

That would be pretty useful, specially to allow to automate usage of some specific plugins, like obs-move-transition. I want to do that using the streamdeck, but I could only achieve that if I'm able of doing such thing via commands and there is no simple/practical way of achieve that.

I know that this is supposed to have a minimal API, with I think this feature could be useful enough to be considered.

Authentication issue

Hi, first word, awesome project! Thank you so much for the effort to create the tool.

I'm using Windows and with my current WebSocket server settings, I'm putting authentication on. After fiddling with the tools for a while, I realized that the authentication should be disabled for obs-cmd interaction. Is there any settings in the tools which help for the authentication, or should I disable it by default from now to use obs-cmd?
image

It's requiring a password here.
image

I prefer keeping the authentication on, so if there is any method for the tool to work with my current settings, it would help a lot.

Thanks for your work. Hope you have a great day.

Please consider adding recording pause

Please consider adding a command argument to pause and unpause the recording, for me its important.
obs-cli has this feature but i rather not rely on a progamm that is build on a old standard,
also please add the paused status to recording status
so this would be nice:
obs-cmd recording status

Recording Status
Recording: false
Paused: false

Paused is not a thing right now of couse,
also for the pausing i think
obs-cmd recording pause should pause
obs-cmd recording unpause should unpause
obs-cmd recording togglepause should toggle pause (toggle_pause might also be a good option)

Unclear on where to add websockets password

I had to do a reinstall of my OS. I'm trying to remember where to input the websockets password.

I know it's a file named obs-cmd.toml and its contents are:

OBS_WS_PASSWORD="trCYeMhv9k50e01s"

but i don't know where to leave the file. So far I've tried in the home folder and ~/.config

typing in the password in terminal allows for a connection, but otherwise I'm getting a handshake error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.