A high-performance screen streaming sender written in Rust. The program captures the primary display, optionally compresses frames as JPEG, and streams them to a TCP receiver. It includes adaptive quality control, persistent configuration, auto-start on boot, and an auto-restart-on-crash mechanism.
This README documents the executable's CLI, configuration files, examples, and platform specifics found in the project's source.
Highlights
- Cross-platform screen capture using the
scrapcrate (Windows + Unix). - JPEG compression via the
imagecrate (configurable quality). - Adaptive quality adjustments based on measured FPS and connection issues.
- Auto-start integration (Windows registry or Linux
~/.config/autostart). - Auto-restart on crash with configurable delay and retry limit.
- Persists
connection_config.jsonandstartup_config.jsonnext to the executable.
Quick start
-
Install Rust and Cargo (if not already): https://rustup.rs
-
Build (release):
cargo build --release- Run (development):
cargo run -- <SERVER_IP> [PORT] [OPTIONS]- Or run the release binary (Windows example):
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 60 --quality 75CLI / Usage
Positional arguments:
- SERVER_IP (required on first run) — IP address of the receiver server.
- PORT (optional) — TCP port (default: 7878).
Flags / options:
- --fps Set target frames per second (1–120). Default: 60.
- --quality JPEG quality percentage (10–100). Default: 75.
- --no-compression Send raw frames (no JPEG compression).
- --no-adaptive Disable adaptive quality adjustments.
- --enable-startup Register the executable to auto-start on boot.
- --disable-startup Remove auto-start registration.
- --enable-restart Enable auto-restart on crash (writes to startup_config.json).
- --disable-restart Disable auto-restart.
- --status Print current startup/restart configuration.
- --auto-restart Internal flag used when restarting automatically (do not use manually).
Notes about saved configuration
- On first run the program expects SERVER_IP (and optionally PORT). After that it saves the connection into
connection_config.jsonnext to the executable and will use that saved config on subsequent runs. - Startup and restart preferences are stored in
startup_config.json. The program will create defaults if the file is missing.
Config file formats
connection_config.json example:
{
"ip": "192.168.1.100",
"port": "7878"
}startup_config.json example (defaults created by the app):
{
"auto_startup_enabled": true,
"auto_restart_enabled": true,
"restart_delay_seconds": 5,
"max_restart_attempts": 10
}Behavior summary
- If
startup_config.jsonhasauto_startup_enabled: true, the application will try to register itself for auto-start on first run. - If the app crashes and
auto_restart_enabledis true, it will attempt to restart itself up tomax_restart_attempts, waitingrestart_delay_secondsbetween attempts. - Adaptive quality reduces JPEG quality when connection issues or low FPS are detected.
Examples
- First-time setup (saves connection):
.\target\release\streaming_sender.exe 192.168.1.100 7878- High-quality 60 FPS stream:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 60 --quality 95- Low-bandwidth mode:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --fps 15 --quality 50- Disable compression and adaptive quality:
.\target\release\streaming_sender.exe 192.168.1.100 7878 --no-compression --no-adaptive- Enable / disable auto-start or auto-restart:
.\target\release\streaming_sender.exe --enable-startup
.\target\release\streaming_sender.exe --disable-startup
.\target\release\streaming_sender.exe --enable-restart
.\target\release\streaming_sender.exe --disable-restart
.\target\release\streaming_sender.exe --statusPlatform specifics
-
Windows
- Auto-start is implemented by adding an entry to
HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Runusing thewinregcrate. - The binary contains
#![windows_subsystem = "windows"]to prevent a console window when built as GUI; use the console build if you need console logging.
- Auto-start is implemented by adding an entry to
-
Linux / Unix
- Auto-start is implemented by writing a
.desktopfile to$HOME/.config/autostart.
- Auto-start is implemented by writing a
Dependencies
See Cargo.toml. Major crates used:
- scrap — screen capture
- image — jpeg encoding
- serde / serde_json — config serialization
- ctrlc — signal handling
- winreg (Windows only) — registry manipulation
Troubleshooting
- Cargo not found: install Rust via rustup (https://rustup.rs/) to get
cargo. - Capture errors: verify display permissions and that the
scrapcrate supports your environment. - If
connection_config.jsonis corrupted, delete it and re-run the program to recreate default config.
Security & notes
- This sender streams raw frames (or JPEG-compressed frames) without encryption. If you plan to use this over untrusted networks, add transport-level encryption (TLS) or a VPN.
--auto-restartis used internally; do not rely on it as a user-facing flag.
Contributing
Issues and PRs are welcome. If adding new public CLI flags, update the README examples and add tests where appropriate.
License
No license file is included. Add a LICENSE file if you intend to publish under a specific open-source license.
If you'd like, I can additionally:
- Extract and add the full help text (generated from source) into the README.
- Add a short
HOWTOshowing how to build a matching receiver server.