An easy way to capture and stream media from multiple cameras and from the screen
Project description
MediaCapture
MediaCapture is a simple, production-ready Python utility for screen and camera capture, screen/camera streaming, multi-camera compositing, and media normalization—using only a few lines of code.
Features
- Capture screenshots to file
- Record screen to video
- Capture images from one or more cameras (with optional normalization)
- Record video from multiple cameras to a single file (side-by-side)
- Real-time screen streaming (with auto-resize)
- Real-time multi-camera streaming (with auto-resize, optional normalization)
- Simple directory management
- No external dependencies beyond common imaging libraries
Installation
pip install MediaCapture
Usage
from MediaCapture import MediaCapture
import cv2
import numpy as np
mediaCapture = MediaCapture()
# Capture a screenshot
mediaCapture.captureScreen('screenshots/screen.jpg')
# Record the screen for 10 seconds
mediaCapture.recordScreen('videos/screen.mp4', duration=10)
# Capture from two cameras and save side-by-side
mediaCapture.captureMedia('images/cameras.jpg', 0, 1, normalize=True)
# Record from two cameras for 15 seconds
mediaCapture.recordMedia('videos/cameras.mp4', 0, 1, duration=15, normalize=True)
# Stream live screen preview (press 'q' to exit)
for frame in mediaCapture.streamScreen(fps=15):
cv2.imshow("Screen", cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
# Stream from cameras (press 'q' to exit)
for frames, frameCount in mediaCapture.streamCameras(0, 1, normalize=True):
if any(f is None for f in frames):
break
combined = np.hstack(frames)
cv2.imshow("Combined Cameras", combined)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
Methods
| Method | Description |
|---|---|
captureScreen(mediaFile) |
Capture screenshot to file |
recordScreen(mediaFile, duration=10) |
Record the screen to video file |
captureMedia(combinedFile, *cameras) |
Capture side-by-side from one or more cameras |
recordMedia(combinedFile, *cameras, ...) |
Record video from one or more cameras |
streamScreen(fps=10, maxWidth=1280, ...) |
Generator: live screen frames (resized) |
streamCameras(*cameras, ...) |
Generator: live camera frames (resized) |
normalizeImage(image) |
Normalize contrast/gamma of a frame |
Notes
ImageGrabrequires Windows/macOS or X11-based Linux.- For multi-camera capture, you must have multiple camera devices attached.
- Streaming windows can be exited by pressing the
qkey. - Output directories are created automatically if they don’t exist.
License
This project is licensed under the Apache License, Version 2.0. Copyright 2025 Tristan McBride Sr.
Acknowledgements
Project by:
- Tristan McBride Sr.
- Sybil
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mediacapture-0.1.0.tar.gz.
File metadata
- Download URL: mediacapture-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc832ff886b34931a70fc5fe2a3150d1108b948fad8443619338c0e65670912
|
|
| MD5 |
9b0f33bf3e2c506fe7e9e1ae17448e20
|
|
| BLAKE2b-256 |
04d0792549dab94d0abaa8d40040bbd9ddbbfbd2a049e8fbbb964a71f8ebfb6b
|
File details
Details for the file mediacapture-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mediacapture-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
415cbb6f90f981afea6c56c9b10720e4f766c01a53f9ff76b0bc5fc1d22af5e2
|
|
| MD5 |
6775c067c1433486d7aa9826920774ae
|
|
| BLAKE2b-256 |
207de02b6317025bced2b5652c2f3f385d222ce32c6501e43575d833df9fb450
|