Skip to content

CyberneticsMan/CybersScreenShare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–₯️ Ultra-High Performance Screen Share

A real-time, high-performance screen sharing solution built with Python Flask and WebSocket technology. Share your screen instantly over local WiFi networks with ultra-low latency and automatic fallback support.

πŸš€ Features

  • ⚑ Ultra-Low Latency: Real-time screen sharing at up to 60 FPS
  • 🌐 Offline Operation: Works completely offline on local WiFi networks
  • πŸ”„ Smart Fallback: Automatic WebSocket β†’ HTTP polling fallback
  • πŸ“± Multi-Device Support: Access from any device on the same network
  • πŸŽ›οΈ Dynamic Quality Control: Adjustable quality and resolution settings
  • πŸ“Š Performance Monitoring: Real-time FPS, latency, and bandwidth stats
  • πŸ”§ Cross-Platform: Supports Linux, Windows, and macOS
  • πŸ“‘ Multiple Connection Modes: WebSocket, HTTP streaming, and polling

πŸ› οΈ Technology Stack

  • Backend: Python Flask + Flask-SocketIO
  • Frontend: Vanilla JavaScript with WebSocket support
  • Screen Capture: MSS (Multi-Screen Shot) library
  • Real-time Communication: Socket.IO with eventlet
  • Image Processing: PNG format with base64 encoding

πŸ“‹ Requirements

  • Python 3.7+
  • X11 display server (Linux)
  • Local WiFi network

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/CyberneticsMan/screenshare.git
cd screenshare

2. Set Up Virtual Environment

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Run the Server

python main.py

5. Access the Screen Share

  • Local machine: http://127.0.0.1:5000
  • Other devices: http://[YOUR_IP]:5000

The server will automatically display your IP address when starting.

πŸ“¦ Dependencies

Flask==3.0.0
Flask-SocketIO==5.3.6
mss==9.0.1
python-socketio==5.9.0
eventlet==0.33.3
psutil==5.9.6

🎯 Usage

Basic Screen Sharing

  1. Start the server with python main.py
  2. Note the displayed IP addresses
  3. Open the URL in any browser on the same network
  4. Your screen will appear in real-time

Quality Controls

  • Ultra (95%): Highest quality, more bandwidth
  • High (85%): Balanced quality and performance
  • Medium (75%): Good quality, lower bandwidth
  • Low (60%): Fastest performance, minimal bandwidth

Resolution Scaling

  • Full (100%): Original resolution
  • High (75%): 3/4 original size
  • Medium (50%): Half resolution
  • Low (25%): Quarter resolution for maximum speed

Performance Monitoring

Click "Toggle Stats" to view:

  • Real-time FPS counter
  • Network latency measurements
  • Bandwidth usage statistics
  • Connected client count
  • Frame processing time

πŸ”§ Configuration

Server Configuration

Edit the performance settings in main.py:

# High-performance configuration
TARGET_FPS = 60          # Target frames per second
FRAME_INTERVAL = 1.0 / TARGET_FPS
MAX_FRAME_SIZE = 1920 * 1080 // 4
COMPRESSION_QUALITY = 30  # Lower = faster, higher = better quality
SCALE_FACTOR = 0.3       # Frame scaling factor

Network Configuration

The server automatically binds to all interfaces (0.0.0.0:5000). To change the port:

socketio.run(app, host='0.0.0.0', port=YOUR_PORT)

🌐 Connection Modes

1. WebSocket (Primary)

  • Lowest latency
  • Real-time bidirectional communication
  • Automatic reconnection

2. HTTP Streaming (Fallback)

  • Multipart streaming for continuous frames
  • Works when WebSocket fails
  • Browser-native support

3. HTTP Polling (Emergency)

  • JSON API with base64 encoded frames
  • Maximum compatibility
  • Automatic quality adjustment

πŸ–₯️ Platform Support

Linux

  • Requires X11 display server
  • Automatic DISPLAY environment detection
  • Multi-monitor support

Windows

  • Native screen capture support
  • Multiple display handling
  • No additional configuration needed

macOS

  • Compatible with Quartz display services
  • Retina display support
  • Permission handling for screen recording

πŸ” Troubleshooting

Common Issues

Black Screen or No Image

  • Ensure X11 is running (Linux)
  • Check display permissions
  • Verify DISPLAY environment variable

High Latency (>1 second)

  • Reduce quality settings
  • Lower resolution scaling
  • Check network bandwidth
  • Try different connection modes

Connection Failures

  • Verify firewall settings
  • Check port 5000 availability
  • Ensure devices are on same network
  • Try HTTP fallback mode

WebSocket Errors

  • The system automatically falls back to HTTP
  • Check browser WebSocket support
  • Verify Socket.IO library loading

Performance Optimization

For Maximum Speed:

TARGET_FPS = 30
COMPRESSION_QUALITY = 20
SCALE_FACTOR = 0.25

For Best Quality:

TARGET_FPS = 15
COMPRESSION_QUALITY = 85
SCALE_FACTOR = 1.0

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebSocket/HTTP    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client(s)     │◄────────────────────►│   Flask Server  β”‚
β”‚   (Browser)     β”‚                      β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                   β”‚
                                                   β–Ό
                                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                         β”‚  Screen Capture β”‚
                                         β”‚     (MSS)       β”‚
                                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

  • Screen Capture Thread: Continuous frame grabbing
  • Broadcast Thread: Frame distribution to clients
  • WebSocket Handler: Real-time client communication
  • HTTP Fallback: Alternative streaming methods
  • Performance Monitor: Statistics and optimization

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™‹β€β™‚οΈ Author

CyberneticsMan (Cyber)

πŸš€ Future Enhancements

  • Audio streaming support
  • Multi-user screen sharing
  • Recording functionality
  • Mobile app support
  • Cloud deployment options
  • Advanced compression algorithms
  • Bandwidth adaptive streaming

⭐ Support

If you find this project helpful, please give it a star! ⭐

For issues and feature requests, please use the GitHub Issues page.


Built with ❀️ for the open-source community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors