A lightweight Python-based screen recording tool that captures your entire screen and saves it as a video file. Built with OpenCV and PyAutoGUI for seamless, cross-platform screen recording.
- Full Screen Recording: Capture your entire display in real-time
- Adjustable Frame Rate: Control recording quality and file size by adjusting FPS
- Easy-to-Use: Simple command-line interface with minimal configuration
- Cross-Platform: Works on Windows, macOS, and Linux
- Multiple Output Formats: Save recordings as MP4, AVI, or other supported video formats
- Lightweight: Minimal dependencies with efficient resource usage
- Python 3.7 or higher
- pip (Python package manager)
- Clone the repository:
git clone https://github.com/yourusername/screen-video-recorder.git
cd screen-video-recorder- Install required dependencies:
pip install -r requirements.txtThis tool only works on local systems with a display. Do NOT attempt to run this code on:
Remote servers (SSH, VPS, cloud instances) Docker containers without display forwarding Headless systems or CI/CD pipelines Any environment without a graphical interface
PyAutoGUI requires direct access to your system's display to capture screenshots. Running it on a remote environment will result in errors or unexpected behavior. Always run this recorder locally on your machine.
The project uses the following Python libraries:
- OpenCV (
opencv-python) - For video encoding and frame processing - PyAutoGUI (
pyautogui) - For capturing screenshots - NumPy - For array operations (usually installed as OpenCV dependency)
See requirements.txt for exact versions.
Run the script with default settings:
python screen_recorder.pyYou can specify output filename and frame rate:
python screen_recorder.py --output my_recording.mp4 --fps 30--outputor-o: Output video filename (default:recording.mp4)--fpsor-f: Frames per second for recording (default: 20)--durationor-d: Recording duration in seconds (leave blank for manual stop)
python screen_recorder.py -o gameplay.mp4 -f 30 -d 60This records 60 seconds of your screen at 30 FPS and saves it as gameplay.mp4.
The recorder operates by:
- Screen Capture: PyAutoGUI captures screenshots of your entire display at regular intervals
- Frame Encoding: OpenCV encodes these screenshots into a video stream using the specified codec
- Video Output: The encoded frames are written to a video file in your chosen format
This approach ensures compatibility across different operating systems while maintaining reasonable performance.
- FPS Impact: Higher FPS values result in smoother videos but consume more CPU and disk space. 20-30 FPS is recommended for most use cases.
- Resolution: Recording at higher resolutions (1440p+) may impact performance on older machines. Consider your system specs before adjusting settings.
- CPU Usage: Screen recording is CPU-intensive. Close unnecessary applications for optimal performance.
- File Size: A 1-hour recording at 20 FPS can be 500MB-2GB depending on resolution and codec.
- No Audio Recording: The current version captures video only. Audio recording is not supported.
- No Real-Time Compression: Large videos are generated during recording; ensure sufficient disk space.
- Single Monitor Only: Currently records from the primary display only.
- Performance Dependent: Recording speed depends on your system's CPU and GPU capabilities.
Q: The video is lagging or stuttering
- Reduce the FPS value or close other applications consuming CPU
Q: Recording uses too much disk space
- Decrease FPS or consider compressing the output file after recording
Q: Getting permission errors on macOS
- Grant accessibility permissions: System Preferences → Security & Privacy → Accessibility
- Audio recording capability
- GUI interface for easier configuration and recording controls
- Multi-monitor support
- Real-time video compression options
- Pause/resume recording functionality
- Region-specific recording (record only a portion of the screen)
This project is licensed under the MIT License. See the LICENSE file for details.
Created as a practical Python project exploring computer vision and screen automation libraries.
Contributions are welcome! If you have suggestions for improvements or encounter bugs, feel free to open an issue or submit a pull request.
Happy recording! 🎥