A robust Go utility to toggle between two OBS Studio scenes with configurable options and improved error handling.
- Quick switching between two predefined scenes in OBS Studio
- Configurable connection settings (host, port, timeout)
- Scene validation to prevent errors
- Verbose logging option for debugging
- Connection timeout protection
- Lightweight and easy to use
- Uses OBS WebSocket for secure scene management
- OBS Studio
- OBS WebSocket plugin installed and configured
- Go programming environment (1.13 or higher recommended)
- Clone the repository:
git clone https://github.com/your-username/obs_switchscene.git
cd obs_switchscene
- Build the project:
go build
./obs_switchscene <scene1> <scene2>
./obs_switchscene [options] <scene1> <scene2>
-host string
OBS WebSocket host (default "localhost")
-port int
OBS WebSocket port (default 4444)
-timeout duration
Connection timeout (default 5s)
-verbose
Enable verbose logging
Basic scene switching:
./obs_switchscene "Gaming" "Streaming"
Custom host and port:
./obs_switchscene -host=192.168.1.100 -port=4445 "Gaming" "Streaming"
With longer timeout and verbose logging:
./obs_switchscene -timeout=10s -verbose "Gaming" "Streaming"
The program supports various configuration options through command-line flags:
Flag | Description | Default |
---|---|---|
host | OBS WebSocket host address | localhost |
port | OBS WebSocket port number | 4444 |
timeout | Connection timeout duration | 5s |
verbose | Enable detailed logging | false |
The program includes robust error handling for common scenarios:
- Connection timeouts
- Invalid scene names
- OBS connection failures
- Scene switching failures
When running with -verbose
, detailed error information and operational status will be logged.
Contributions are welcome! Here are some ways you can contribute:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Configuration file support
- WebSocket authentication
- Scene transition effects
- Connection health monitoring
- Multiple scene group support
-
Connection Timeout
- Verify OBS is running
- Check if OBS WebSocket plugin is installed
- Confirm the correct host and port settings
-
Scene Not Found
- Verify scene names match exactly (case-sensitive)
- Check for extra spaces in scene names
- Use
-verbose
flag to see available scenes
-
Port Already in Use
- Verify no other instance is running
- Check if the specified port is available
For support, please:
- Check the troubleshooting section
- Enable verbose logging with
-verbose
flag - Open an issue on GitHub with the error logs