Unified video capture for USB, RTSP, ESP32-CAM, HTTP MJPEG, and file sources with auto-reconnect.
Project description
📡 streamcap
Unified Video Capture — One API for Every Source
USB · RTSP · ESP32-CAM · HTTP MJPEG · Video Files
✨ Why streamcap?
| Feature | streamcap | cv2.VideoCapture | imageio |
|---|---|---|---|
| Universal source detection | ✅ | ❌ | ❌ |
| ESP32-CAM auto-discovery | ✅ | ❌ | ❌ |
| Auto-reconnect on failure | ✅ | ❌ | ❌ |
| Frame metadata (FPS, ID) | ✅ | ❌ | ✅ |
| Iterator interface | ✅ | ❌ | ✅ |
| Zero config needed | ✅ | ❌ | ❌ |
📦 Installation
pip install streamcap
🚀 Quick Start
import cv2
from streamcap import StreamCap
# USB Camera
cap = StreamCap(0)
# RTSP Stream
cap = StreamCap("rtsp://192.168.1.100:554/stream")
# ESP32-CAM (auto-find on network)
cap = StreamCap("esp32://auto")
# ESP32-CAM (specific IP)
cap = StreamCap("esp32://192.168.1.50")
# Video File
cap = StreamCap("drone_footage.mp4", resolution=(1280, 720))
# Iterate over frames
for frame, meta in cap:
cv2.putText(frame, f"FPS: {meta['fps']:.1f} | Frame: {meta['frame_id']}",
(10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
cv2.imshow("StreamCap", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
🔧 API Reference
StreamCap(source, resolution=None, max_retries=5, retry_delay=2.0)
| Source Format | Type | Example |
|---|---|---|
int or "usb://N" |
USB Camera | StreamCap(0) |
"rtsp://..." |
RTSP Stream | StreamCap("rtsp://ip/path") |
"esp32://IP" |
ESP32-CAM | StreamCap("esp32://192.168.1.50") |
"esp32://auto" |
ESP32 Auto | StreamCap("esp32://auto") |
"http://..." |
HTTP MJPEG | StreamCap("http://ip/stream") |
"path/to/file" |
Video File | StreamCap("video.mp4") |
find_esp32(ip=None, subnets=None, timeout=0.3)
Auto-discover ESP32-CAM devices on the local network by scanning common subnets.
📜 License
MIT License — use it anywhere.
Built with ❤️ by ByIbos
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
streamcap-1.0.0.tar.gz
(5.8 kB
view details)
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 streamcap-1.0.0.tar.gz.
File metadata
- Download URL: streamcap-1.0.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c4b6441fbd9dcda83c0bbf270ae7fff12d93e491cf25fd877366fb11c37014a
|
|
| MD5 |
5ce1c2de5072c301564b4862bd060f7f
|
|
| BLAKE2b-256 |
a52c20d0991b32cfcb7d09ee955b388afe0a9d7d98f1a0ce9ad615a2cd3180c0
|
File details
Details for the file streamcap-1.0.0-py3-none-any.whl.
File metadata
- Download URL: streamcap-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d219275657f1bfea0433f9da01f6c9fb59310b61ec32178b200a8aa6a50b7d5
|
|
| MD5 |
53708f971110575c3ca2db58c8be1ee9
|
|
| BLAKE2b-256 |
d1f99ac9eaae9daab3d33c53d4eba8c18c31a19de82c1f12bc689628b33f95d8
|