77 lines
3.5 KiB
Markdown
77 lines
3.5 KiB
Markdown
# Instant Replay (With OBS)
|
|
This funny project allows you to have a instant replay from the last X seconds by just saying "replay that".
|
|
|
|
## Why
|
|
Why not? Try it out. It's fun.
|
|
|
|
Did not see how you died in that round? Just say "replay that" and see the last 30 seconds of your gameplay in a little overlay box that does not disturb your game.
|
|
|
|
## Configuration
|
|
|
|
Before starting, configure the application by creating a `config.json` file:
|
|
|
|
1. Copy the example configuration:
|
|
```sh
|
|
cp config.example.json config.json
|
|
```
|
|
2. Edit `config.json` to customize your settings:
|
|
- **directories.watch_dir**: Where OBS saves replay buffers (e.g., `E:\OBS`)
|
|
- **directories.moveto_dir**: Where processed replays are stored (default: `./replays`)
|
|
- **server.port**: HTTP server port for serving video files (default: `8000`)
|
|
- **server.websocket_port**: WebSocket port for Electron communication (default: `8001`)
|
|
- **replay.length_seconds**: Duration of replays in seconds (default: `20`)
|
|
- **replay.default_location**: Overlay position (`center`, `top_left`, `bottom_left`, `top_right`)
|
|
- **replay.default_size**: Overlay size from 1 (smallest) to 10 (largest)
|
|
- **voice_recognition.enabled**: Enable/disable voice commands (default: `false`)
|
|
- **hotkey.enabled**: Enable/disable hotkey (default: `true`)
|
|
- **hotkey.key**: Hotkey to trigger replays (default: `pagedown`)
|
|
- **commands**: Customize voice command phrases for activation, stop, replay last, and clear
|
|
|
|
## Start the thing
|
|
|
|
1. Clone this repository.
|
|
2. Configure the application (see Configuration section above).
|
|
3. Install Electron globally (if you don't have it):
|
|
```sh
|
|
npm i -g electron
|
|
```
|
|
4. Open multiple terminals and run the following commands:
|
|
1. **Terminal 1:** Start the Python server that listens for commands and communicates with OBS & the Electron app:
|
|
```sh
|
|
python main.py
|
|
```
|
|
2. **Terminal 2:** Start the Electron overlay window:
|
|
```sh
|
|
npx electron electron-main.js
|
|
```
|
|
3. **Terminal 3:** Serve the replays folder on the configured port (default 8000):
|
|
```sh
|
|
npx serve ./replays -p 8000
|
|
```
|
|
|
|
## Usage
|
|
1. Make sure OBS is running with a scene that has your game or desktop.
|
|
2. Make sure everything is running.
|
|
3. Make sure you have the WebSocket server configured correctly, check the code or change the port in OBS to 4455 and disable authentication.
|
|
4. Make sure the Replay Buffer is enabled in OBS and set to the same length as configured in `config.json` (default 20 seconds), else ffmpeg will clip to the duration set in your configuration.
|
|
5. Press your configured hotkey (default: Page Down) or say "replay that" to save the last X seconds of gameplay.
|
|
|
|
## Other commands
|
|
- **Hotkey Toggle:** Press your configured hotkey (default: Page Down) to trigger or stop replays
|
|
- **Activation (Voice):** Say "instant replay" to save the last X seconds
|
|
- **Stop (Voice):** Say "stop replay" to hide the replay overlay
|
|
- **Replay Last (Voice):** Say "replay last" to show the most recent replay
|
|
- **Clear Replays (Voice):** Say "clear replays" to delete all saved clips
|
|
|
|
All voice commands can be customized in `config.json`.
|
|
|
|
## Requirements
|
|
- OBS Studio with a working Websocket Server
|
|
- Python3 with the required packages (see `requirements.txt`)
|
|
- NodeJS with Electron installed globally
|
|
- A microphone for hotword detection
|
|
|
|
## Thank You
|
|
You're done reading. Yay. Thanks for trying if you did. Enjoy!
|
|
|
|
Mit license and all of that. |