Skip to main content

Local camera feeds for development with HTTP, RTSP, and optional YOLO human detection.

Project description

devcam

PyPI Python License: MIT

Easy local camera feeds for development and testing. Expose a webcam as HTTP MJPEG or RTSP, with an optional built-in YOLO human detection overlay — all from one command.

Install

pip install devcam

To enable human detection (YOLOv8), install with the vision extra:

# quote the brackets in zsh
pip install 'devcam[vision]'

Quick Start

devcam http            # web UI + MJPEG stream on http://localhost:1080
devcam rtsp            # RTSP stream on rtsp://localhost:8554/cam

Open http://localhost:1080/ to view the live stream, switch cameras, change resolution/FPS, mirror the view, and toggle human detection. Detection is lazy-loaded: the YOLO model only loads when you first enable it.

Usage

devcam {http,rtsp} [--port PORT] [--camera INDEX] [--resolution WxH] [--fps FPS] [--backend {auto,cv2,zed}]
Flag Default Description
protocol (required) http or rtsp
--port 1080 / 8554 Stream port
--camera 0 Camera index
--resolution auto WxH e.g. 1280x720
--fps 30 Capture and stream frame rate
--backend auto auto (ZED first, then OpenCV), cv2 (V4L2/USB), zed (ZED SDK)

HTTP Endpoints

Endpoint Method Description
/ GET Web UI with live viewer and controls
/stream GET Raw MJPEG stream
/snapshot GET Single JPEG frame
/api/status GET Camera state and backend info
/api/cameras GET Available cameras
/api/modes GET Supported resolutions and FPS
/api/config POST Start, stop, mirror, or reconfigure capture

Human Detection Endpoints

Requires devcam[vision]. Without it, streaming works normally and detection endpoints return available: false.

Endpoint Method Description
/api/detection/status GET Detection state, confidence, interval, model loaded
/api/detection/config POST Enable/disable detection and update settings
/api/detection/run GET/POST Run detection on the latest frame

Example:

curl -X POST http://localhost:1080/api/detection/config \
  -H 'Content-Type: application/json' \
  -d '{"enabled":true,"confidence":0.55,"interval_ms":50}'

Detection response:

{
  "human_detected": true,
  "confidence": 0.87,
  "count": 1,
  "latency_ms": 42.1,
  "detections": [
    {"confidence": 0.87, "bbox": [420.0, 160.0, 780.0, 940.0]}
  ]
}

Camera Backends

Backend Description
cv2 OpenCV V4L2 for USB webcams
zed ZED SDK for ZED X / ZED X Mini on Jetson (requires pyzed)
auto (default) Tries ZED first, falls back to OpenCV

Jetson / ZED X Notes

  • If ZED cameras show as "NOT AVAILABLE": sudo systemctl restart zed_x_daemon
  • Resolution opens at the camera's native mode; --resolution downscales in software
  • --fps 5 or --fps 15 recommended for low-bandwidth use cases

RTSP Setup

RTSP requires ffmpeg and mediamtx. One-time setup:

# macOS
brew install ffmpeg && bash setup_mediamtx.sh

# Linux
sudo apt install ffmpeg && bash setup_mediamtx.sh

Then each time:

./mediamtx &             # media server in the background
devcam rtsp

Development

git clone https://github.com/GitAashishG/devcam.git
cd devcam
pip install -e '.[dev,vision]'
python -m pytest tests/ -v

Releases happen automatically when the version in pyproject.toml is bumped and merged to main.

macOS Notes

  • Camera permission: System Settings → Privacy & Security → Camera → Terminal
  • All ports are unprivileged (≥ 1024) — no sudo needed

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devcam-0.2.1.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devcam-0.2.1-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file devcam-0.2.1.tar.gz.

File metadata

  • Download URL: devcam-0.2.1.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for devcam-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5cbca656f663d03d0205ec66f170d4bf15d19a4823f795838cd09b204f999f50
MD5 cb2fcb82583847e7dbe31202809e4d04
BLAKE2b-256 83bb751fd6c3666b05f26179c3bbd34805a9b7959ba98624560523ef35d604f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for devcam-0.2.1.tar.gz:

Publisher: publish.yml on GitAashishG/devcam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file devcam-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: devcam-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for devcam-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ea785b33e9585830579ca8f95529da8b3ab4b6ac77627443168bfc2151e5d1b
MD5 df827ad4ab5f17212ec6c01eb7f329bf
BLAKE2b-256 7059c86da3483d64c7c3ef579670c8a188190e85f55610e5100059dbbfd908d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for devcam-0.2.1-py3-none-any.whl:

Publisher: publish.yml on GitAashishG/devcam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page