Woperator is a containerized solution for streaming a virtual desktop environment through a web interface. The project creates a complete virtual desktop environment inside a Docker container and streams both video and audio output via WebSocket protocol, providing a low-latency interactive experience.
- Virtual X11 desktop environment running in a container
- Low-latency WebSocket-based streaming
- Interactive mode for mouse control
- Audio streaming support
- Modern web interface with chat functionality
- Firefox browser running in kiosk mode
-
Frontend:
- Modern responsive web interface
- WebSocket client for real-time communication
- Interactive controls and chat system
- Audio/Video stream handling
-
Backend:
- aiohttp WebSocket server
- FFmpeg for screen and audio capture
- X11 environment with Xvfb
- PulseAudio for audio handling
src/
├── __init__.py
├── app.py # Main application server
├── config.py # Configuration settings
├── ffmpeg_stream.py # FFmpeg streaming functionality
├── logger.py # Logging configuration
├── websocket_handler.py # WebSocket communication
├── x11_utils.py # X11 utilities
├── static/ # Static assets
│ ├── css/
│ │ └── style.css # Application styles
│ └── js/
│ └── app.js # Frontend JavaScript
└── templates/ # HTML templates
└── index.html # Main application template
- Docker
- Docker Compose
- x86_64 architecture support
- Clone the repository:
git clone https://github.com/yourusername/woperator.git
cd woperator- Start the service:
docker-compose up --build
- Access the web interface:
http://localhost:8000
- Click the "Interactive Mode" button to enable mouse control
- Mouse movements and clicks are transmitted to the virtual desktop
- Real-time cursor position display
- Toggle audio streaming with the "Enable Audio" button
- Automatic audio initialization and buffering
- Support for system audio capture
- Real-time chat functionality
- Persistent chat history during session
- Clean and intuitive interface
- Support for future extensibility
- Placeholder for future settings implementation
- Modular design for easy feature addition
- WebSocket-based communication
- Binary frame transmission for video
- MP3-encoded audio streaming
- JSON-based control messages
- FFmpeg x11grab for screen capture
- MJPEG encoding for low latency
- Configurable quality and frame rate
- Efficient frame buffering
- PulseAudio virtual sink
- MP3 encoding for compatibility
- Configurable audio quality
- Buffer management for smooth playback
- Ubuntu-based image
- Xvfb virtual framebuffer
- Fluxbox window manager
- Supervisor process management
Key settings in src/config.py:
# Server settings HOST = '0.0.0.0' PORT = 8000 # Video settings FFMPEG_VIDEO_SETTINGS = { 'framerate': 60, 'video_size': '1920x1080', 'quality': 3, 'threads': 4 } # Audio settings FFMPEG_AUDIO_SETTINGS = { 'bitrate': '128k', 'sample_rate': 44100, 'channels': 2 }
-
Code Style
- Follow PEP 8 guidelines
- Use type hints where applicable
- Maintain modular structure
-
Adding Features
- Create new modules in
src/ - Update configuration in
config.py - Add frontend components in
static/
- Create new modules in
-
Testing
- Test WebSocket connectivity
- Verify audio/video sync
- Check browser compatibility
-
Connection Issues
- Verify port 8000 is available
- Check WebSocket connection status
- Review server logs
-
Stream Problems
- Check FFmpeg process status
- Verify X11 configuration
- Monitor resource usage
MIT License
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request