Skip to content

A high-performance Python screen sharing application with client-server architecture for remote desktop viewing. Features multi-monitor support, real-time streaming with configurable FPS/quality, cross-platform compatibility, and intelligent display detection.

License

Notifications You must be signed in to change notification settings

Jiahong-Guan/Screenshare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Screenshare

A high-performance, modular screen sharing application built with Python and OpenCV. Features a robust client-server architecture designed for professional use cases requiring efficient remote desktop viewing with minimal latency.

Python OpenCV NumPy LICENSE


Overview

ScreenShare provides a reliable, cross-platform solution for remote screen viewing with enterprise-grade features. The application leverages multiple capture methodologies to ensure compatibility across diverse system configurations while maintaining optimal performance through configurable streaming parameters.


Key Features

  • Multi-Display Support: Intelligent display detection with seamless switching between monitors

  • Adaptive Performance: Configurable frame rate and quality settings for network optimization

  • Cross-Platform Compatibility: Comprehensive support for Windows, Linux, and macOS environments

  • Resilient Architecture: Multiple fallback capture methods and automatic reconnection handling

  • Comprehensive Monitoring: Real-time performance metrics and connection statistics

  • Extensible Design: Modular codebase with clear separation between capture, encoding, and transmission layers


Prerequisites

  • Python 3.7 or newer

  • pip package manager

  • Network connectivity between client and server systems


Installation

Standard Installation

# Clone the repository
git clone https://github.com/Jiahong-Guan/Screenshare.git
cd Screenshare

# Install dependencies
pip install -r requirements.txt

Dependency Details:

  • opencv-python - Computer vision operations and display management
  • mss - High-performance screen capture (primary method)
  • pyautogui - Cross-platform mouse position tracking
  • screeninfo - Display configuration detection
  • Pillow - Alternative image capture and processing
  • colorama - Enhanced terminal output formatting
  • numpy - Efficient array manipulation and image processing

Quick Start

Server (Viewing System)

Initialize the server component to begin listening for connections:

python server.py

Client (Source System)

Connect the client to the server from the system to be viewed:

python client.py --host=SERVER_IP_ADDRESS

Replace SERVER_IP_ADDRESS with the IP address or hostname of the server system.


Detailed Usage

Server Configuration

python server.py [options]

Available Options:

Option Description Default Value
--host=HOST Network interface to bind 0.0.0.0 (all interfaces)
--port=PORT TCP port for incoming connections 8080
--log-level=LEVEL Logging verbosity level silent
-l=LEVEL Short form for log level silent

Example Configuration:

python server.py --host=192.168.1.100 --port=9000 --log-level=info

Client Configuration

python client.py [options]

Available Options:

Option Description Default Value
--host=HOST Server address for connection localhost
--port=PORT Server port for connection 8080
--log-level=LEVEL Logging verbosity level silent
-l=LEVEL Short form for log level silent

Example Configuration:

python client.py --host=192.168.1.100 --port=9000 --log-level=warning

Logging Levels

Level Description Use Case
silent No logging output Production environments
critical Critical errors only Minimal debugging
error Error conditions Error monitoring
warning Warning conditions System monitoring
info Informational messages General operation
debug Detailed debugging information Development and troubleshooting

Interface Controls

Server Viewer Controls

Key Function Description
Q Quit Terminate the application
I Info Overlay Toggle performance statistics display
M Mouse Tracking Toggle client mouse cursor display
F Full Screen Toggle full-screen display mode
A Actual Size Toggle 1:1 pixel display mode
+ / = Zoom In Increase display window size
- Zoom Out Decrease display window size
R Reset Window Size Reset window to default size
1-9 Switch Displays Switch between available display

Client Features

  • Automatic Display Detection: Supports complex multi-monitor configurations

  • Adaptive Capture Methods: Primary (MSS) with graceful fallbacks

  • Performance Configuration: Adjustable frame rate and compression quality

  • Command Processing: Real-time response to server control commands


System Architecture

Client Component (client.py)

The client implements a sophisticated capture pipeline:

  1. Display Detection: Automatically identifies available displays using multiple detection methods

  2. Screen Capture: Employs MSS as the primary capture mechanism with PIL fallback

  3. Frame Processing: Optimizes image data through JPEG encoding with configurable quality

  4. Network Transmission: Implements efficient TCP socket communication with metadata framing

  5. Command Handling: Processes server-side control commands in real-time

Server Component (server.py)

The server provides a comprehensive viewing experience:

  1. Connection Management: Listens for and maintains client connections

  2. Frame Reception: Receives and reconstructs frame data with error handling

  3. Display Management: Renders frames with configurable viewing options

  4. User Interaction: Processes keyboard input for display control

  5. Performance Monitoring: Tracks and displays connection statistics


Performance Optimization

Network Considerations

  1. Frame Rate Adjustment: Reduce FPS settings for bandwidth-constrained networks

  2. Quality Configuration: Lower JPEG quality for improved transmission speed

  3. Network Infrastructure: Prefer wired Ethernet connections for stable performance

System Configuration

  1. Resource Allocation: Ensure adequate CPU resources for encoding/decoding

  2. Display Configuration: Match client and server display resolutions where possible

  3. Background Processes: Minimize competing system resource consumption


Troubleshooting Guide

Connection Issues

Symptoms: Connection failures or timeouts

  • Verification Steps:

    1. Confirm network connectivity between systems

    2. Validate firewall configuration for specified port

    3. Verify server IP address and port configuration

    4. Check for conflicting applications using the same port

Display Detection Problems

Symptoms: Incorrect or missing display detection

  • Resolution Steps:

    1. Install required dependencies: pip install mss screeninfo

    2. Execute with appropriate system privileges

    3. Verify display driver functionality

    4. Check system-specific display configuration

Performance Concerns

Symptoms: Low frame rates or high latency

  • Optimization Steps:
  1. Adjust client quality setting: self.quality = 70

  2. Reduce frame rate: self.fps = 5

  3. Monitor network bandwidth utilization

  4. Evaluate system resource availability

Functional Issues

Symptoms: Missing mouse cursor or control problems

  • Diagnostic Steps:
  1. Verify pyautogui installation

  2. Use M key to toggle mouse display

  3. Check client-server command communication

  4. Review application logs for error messages


Contributing

We welcome contributions to enhance ScreenShare's functionality and reliability. Please follow these guidelines to ensure a smooth collaboration process.

Development Process

  1. Fork the Repository: Create your personal copy of the repository

  2. Create a Feature Branch: Use descriptive naming conventions (e.g., feature/display-optimization)

  3. Implement Changes: Follow existing code style and architectural patterns

  4. Testing Protocol:

    • Validate changes across multiple platforms

    • Include appropriate unit tests where applicable

    • Document new features and configuration options

  5. Submit Pull Request: Provide comprehensive description of changes and testing methodology

Contribution Focus Areas

  1. Performance Optimization: Enhanced frame processing or transmission efficiency

  2. Platform Compatibility: Extended support for additional operating systems or configurations

  3. Feature Enhancements: New functionality aligned with project objectives

  4. Documentation Improvements: Enhanced user guides or technical documentation

  5. Bug Resolution: Identification and correction of system defects

Code Standards

  • Adhere to PEP 8 style guidelines

  • Include comprehensive docstrings for new functions and classes

  • Maintain backward compatibility for existing functionality

  • Update documentation to reflect interface changes


License

This project is licensed under the Lesser GNU General Public License (LGPL). See the LICENSE file for details.

About

A high-performance Python screen sharing application with client-server architecture for remote desktop viewing. Features multi-monitor support, real-time streaming with configurable FPS/quality, cross-platform compatibility, and intelligent display detection.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages