{"id":31375949,"url":"https://github.com/oa-device/oacambridge","last_synced_at":"2026-04-14T23:33:05.964Z","repository":{"id":316301955,"uuid":"1062688452","full_name":"oa-device/oaCamBridge","owner":"oa-device","description":"Dual-pipeline camera bridge for macOS - RTSP streaming + local frame generation for AI detection","archived":false,"fork":false,"pushed_at":"2025-09-23T20:24:37.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-23T21:21:16.767Z","etag":null,"topics":["ai-detection","camera","dual-pipeline","ffmpeg","macos","orangead","rtsp","video-processing"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oa-device.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-23T15:32:18.000Z","updated_at":"2025-09-23T20:24:40.000Z","dependencies_parsed_at":"2025-09-23T21:21:19.463Z","dependency_job_id":"47256346-c722-44bc-a591-b4b7c1499523","html_url":"https://github.com/oa-device/oaCamBridge","commit_stats":null,"previous_names":["oa-device/oacambridge"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/oa-device/oaCamBridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oa-device%2FoaCamBridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oa-device%2FoaCamBridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oa-device%2FoaCamBridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oa-device%2FoaCamBridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oa-device","download_url":"https://codeload.github.com/oa-device/oaCamBridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oa-device%2FoaCamBridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277318707,"owners_count":25798184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-28T02:00:08.834Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-detection","camera","dual-pipeline","ffmpeg","macos","orangead","rtsp","video-processing"],"created_at":"2025-09-28T02:52:23.810Z","updated_at":"2025-09-28T02:52:24.670Z","avatar_url":"https://github.com/oa-device.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oaCamBridge\n\nA lightweight Python-based camera streaming service that captures frames from camera devices and provides HTTP/MJPEG streaming. Designed for macOS with robust camera access handling and frame output for AI processing pipelines.\n\n## Features\n\n- **Direct Camera Access**: OpenCV-based camera capture with macOS permission handling\n- **HTTP/MJPEG Streaming**: Live video stream accessible via web browser\n- **Frame Capture**: Saves JPEG frames to disk at configurable intervals\n- **No Cleanup**: Stable version accumulates frames without automatic deletion\n- **macOS Optimized**: Multiple camera backend attempts for reliable macOS operation\n- **LaunchAgent Ready**: Service configuration for automatic startup\n\n## Quick Start\n\n### 1. Installation\n\n```bash\n# Install dependencies\n./scripts/setup.sh\n\n# Or manually:\npip3 install opencv-python-headless\n```\n\n### 2. Start Camera Streamer\n\n```bash\n# Start with default configuration\npython3 camera_streamer.py --config config.json\n\n# Or use helpers\nsource scripts/helpers.sh\nstart_streamer\n```\n\n### 3. Access Stream\n\n- **Live Stream**: http://localhost:8086/stream\n- **Single Frame**: http://localhost:8086/frame\n- **Status JSON**: http://localhost:8086/status\n\n## Configuration\n\nEdit `config.json` to customize settings:\n\n```json\n{\n  \"camera_index\": \"0\",\n  \"width\": 1280,\n  \"height\": 720,\n  \"fps\": 10,\n  \"frame_fps\": 5,\n  \"frame_dir\": \"/tmp/webcam\",\n  \"quality\": 95,\n  \"http_port\": 8086\n}\n```\n\n## Camera Permissions (macOS)\n\nOn first run, macOS will request camera permissions:\n\n1. **Via VNC/Direct Access**: Run in Terminal, click \"OK\" when permission dialog appears\n2. **Via SSH**: Camera permissions won't trigger - use VNC first\n3. **Manual Grant**: System Settings → Privacy \u0026 Security → Camera → Enable for Terminal\n\n### Troubleshooting Permissions\n\n```bash\n# Reset camera permissions\ntccutil reset Camera\n\n# Test camera access\nsource scripts/helpers.sh\ntest_camera_access\n```\n\n## Monitoring\n\n### Real-time Monitor\n```bash\n./monitor.sh\n```\n\nShows:\n- Frame count and latest files\n- Directory size\n- Camera streamer status\n- Timestamp updates\n\n### Helper Functions\n```bash\n# Load helper functions\nsource scripts/helpers.sh\n\n# Check status\nshow_streamer_status\n\n# View configuration\nload_config config.json\nshow_config\n\n# Manage service\nstart_streamer\nstop_streamer\nrestart_streamer\n```\n\n## Frame Management\n\n### Output Location\nFrames are saved to `/tmp/webcam/` as:\n```\nimg_000001.jpg\nimg_000002.jpg\nimg_000003.jpg\n...\n```\n\n### Cleanup (Manual)\n```bash\n# Clean frames older than 60 minutes\nsource scripts/helpers.sh\ncleanup_frames 60\n\n# Remove all frames\nrm -f /tmp/webcam/img_*.jpg\n```\n\n## LaunchAgent Setup\n\nFor automatic startup on macOS:\n\n```bash\n# Install LaunchAgent (if available)\ncp com.orangead.cambridge.plist ~/Library/LaunchAgents/\nlaunchctl load ~/Library/LaunchAgents/com.orangead.cambridge.plist\n```\n\n## HTTP API\n\n### Endpoints\n\n| Endpoint | Description | Response |\n|----------|-------------|----------|\n| `/stream` | MJPEG video stream | `multipart/x-mixed-replace` |\n| `/frame` | Single JPEG frame | `image/jpeg` |\n| `/status` | Service status | JSON with stats |\n\n### Status Response\n```json\n{\n  \"running\": true,\n  \"frame_count\": 1234,\n  \"files_on_disk\": 1234,\n  \"frame_dir\": \"/tmp/webcam\",\n  \"config\": { ... }\n}\n```\n\n## Architecture\n\n### Core Components\n- **camera_streamer.py**: Main streaming service\n- **CameraStreamer Class**: Handles capture, streaming, and frame saving\n- **ThreadedHTTPServer**: Concurrent HTTP request handling\n- **macOS Camera Detection**: Multiple backend fallback methods\n\n### Design Principles\n- **Stability Over Features**: No automatic cleanup to prevent frame loss\n- **Simple Dependencies**: Only OpenCV required\n- **Platform Awareness**: macOS-specific camera handling\n- **AI Pipeline Ready**: Frame output optimized for processing\n\n## Troubleshooting\n\n### Common Issues\n\n**Camera not detected**:\n```bash\n# Check available cameras\npython3 -c \"import cv2; [print(f'Camera {i}: {cv2.VideoCapture(i).isOpened()}') for i in range(5)]\"\n```\n\n**Permission denied**:\n- Run via VNC/Terminal (not SSH) to trigger permission dialog\n- Check System Settings → Privacy \u0026 Security → Camera\n\n**Port already in use**:\n```bash\n# Check what's using the port\nlsof -i :8086\n\n# Or change port in config.json\n```\n\n**Frames not saving**:\n```bash\n# Check frame directory\nls -la /tmp/webcam/\n\n# Check process is running\npgrep -f camera_streamer.py\n```\n\n### Logs\nService logs are written to stdout. For LaunchAgent, check:\n```bash\ntail -f ~/Library/Logs/com.orangead.cambridge/camera_streamer.log\n```\n\n## Requirements\n\n- **Python 3.8+**\n- **OpenCV (opencv-python-headless)**\n- **macOS** (optimized, other platforms may work)\n- **Camera device** (USB/built-in)\n\n## License\n\n[License file](LICENSE)\n\n---\n\n**Note**: This is the stable version focused on reliability. No automatic frame cleanup is performed to ensure no data loss for downstream AI processing.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foa-device%2Foacambridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foa-device%2Foacambridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foa-device%2Foacambridge/lists"}