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.1.1.tar.gz (23.0 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.1.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for devcam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 486d4b37f52c769f33266db7aa53576976254692a8d1e7a459a146c432aab880
MD5 6b53c023e5064ecb4d3e7bbe5e886f7b
BLAKE2b-256 0a97c95c8e8a7d74e8d65901c1013a88383bd882cda5cf9e82934bad8aefcbdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for devcam-0.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: devcam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6cee3349cb2f0d1cf221b0a4a4cb7aed2f2746b53876533d9148bef559972673
MD5 927fccd9691e6f833b155a1dca8edc8e
BLAKE2b-256 0bda4ed1d5510c4a815502ab5c67aad1b20b8805a606f6172e2d3e3084284126

See more details on using hashes here.

Provenance

The following attestation bundles were made for devcam-0.1.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