{"id":30715554,"url":"https://github.com/ciscoponce/pi-camera-streaming","last_synced_at":"2026-04-11T19:07:12.335Z","repository":{"id":312925331,"uuid":"1049320469","full_name":"CiscoPonce/pi-camera-streaming","owner":"CiscoPonce","description":"Professional Raspberry Pi 5 camera streaming solution with WebRTC support, Docker containerization, and automated setup. Optimized for Camera Module 3.","archived":false,"fork":false,"pushed_at":"2025-09-02T20:17:45.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T22:07:05.129Z","etag":null,"topics":["camera","camera-module-3","docker","embedded-systems","iot","nginx","portfolio","raspberry-pi","raspberry-pi-5","real-time","srs","streaming","video-streaming","webrtc"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoPonce.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-02T19:58:38.000Z","updated_at":"2025-09-02T20:17:48.000Z","dependencies_parsed_at":"2025-09-02T22:07:07.375Z","dependency_job_id":"bfceb979-2b3e-45cb-bacb-0d800979fc25","html_url":"https://github.com/CiscoPonce/pi-camera-streaming","commit_stats":null,"previous_names":["ciscoponce/pi-camera-streaming"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/CiscoPonce/pi-camera-streaming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoPonce%2Fpi-camera-streaming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoPonce%2Fpi-camera-streaming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoPonce%2Fpi-camera-streaming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoPonce%2Fpi-camera-streaming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoPonce","download_url":"https://codeload.github.com/CiscoPonce/pi-camera-streaming/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoPonce%2Fpi-camera-streaming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273403949,"owners_count":25099299,"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-03T02:00:09.631Z","response_time":76,"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":["camera","camera-module-3","docker","embedded-systems","iot","nginx","portfolio","raspberry-pi","raspberry-pi-5","real-time","srs","streaming","video-streaming","webrtc"],"created_at":"2025-09-03T07:00:30.397Z","updated_at":"2025-12-30T21:31:56.943Z","avatar_url":"https://github.com/CiscoPonce.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi 5 Camera Streaming Project\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Raspberry Pi 5](https://img.shields.io/badge/Raspberry%20Pi-5-red.svg)](https://www.raspberrypi.org/)\n[![Docker](https://img.shields.io/badge/Docker-Containerized-blue.svg)](https://www.docker.com/)\n\nA professional, low-latency camera streaming solution for Raspberry Pi 5 with Camera Module 3, featuring WebRTC support, Docker containerization, and an intuitive web viewer. Built with performance optimization and ease of deployment in mind.\n\n**Created by [CiscoPonce](https://github.com/CiscoPonce)**\n\n## 🎯 Project Showcase\n\nThis project demonstrates advanced skills in:\n- **Embedded Systems Development** with Raspberry Pi 5\n- **Real-time Video Streaming** using WebRTC and modern protocols\n- **Docker Containerization** for scalable deployment\n- **System Administration** with automated setup and monitoring\n- **Web Development** with responsive, modern interfaces\n- **Performance Optimization** for resource-constrained environments\n\nPerfect for **IoT applications**, **security monitoring**, **live streaming**, and **educational projects**.\n\n## 🛠️ Technologies Used\n\n- **Hardware**: Raspberry Pi 5, Camera Module 3\n- **Streaming**: SRS (Simple Realtime Server), WebRTC, RTMP, HTTP-FLV\n- **Containerization**: Docker, Docker Compose\n- **Web Server**: Nginx with optimized configuration\n- **Camera Interface**: libcamera, rpicam-vid\n- **Video Processing**: FFmpeg with hardware acceleration\n- **Frontend**: HTML5, JavaScript, WebRTC API\n- **System**: Linux, systemd, bash scripting\n- **Performance**: Hardware-accelerated encoding, optimized profiles\n\n## ✨ Features\n\n- **🚀 Low Latency Streaming**: WebRTC for sub-500ms latency with HTTP-FLV fallback\n- **🍓 Raspberry Pi 5 Optimized**: Specifically designed for Pi 5 with Camera Module 3\n- **🐳 Docker Containerized**: Easy deployment and management with Docker Compose\n- **🌐 Professional Web Viewer**: Responsive, modern web interface with real-time status\n- **📡 Multiple Protocols**: Support for WebRTC, HTTP-FLV, and RTMP streaming\n- **🔄 Auto-restart**: Container restart policies for reliability\n- **⚡ Performance Profiles**: Day/night/low-latency modes for different use cases\n- **🛠️ Easy Setup**: One-command installation with automated configuration\n- **📊 System Monitoring**: Built-in health checks and performance monitoring\n- **🔧 Highly Configurable**: Environment-based configuration with sensible defaults\n\n## 📋 Requirements\n\n### Hardware\n- **Raspberry Pi 5** (4GB+ RAM recommended)\n- **Raspberry Pi Camera Module 3**\n- **MicroSD card** (32GB+ Class 10 recommended)\n- **Network connection** (Ethernet recommended for stability)\n\n### Software\n- **Raspberry Pi OS** (64-bit recommended)\n- **Docker and Docker Compose**\n- **libcamera tools** (included in Pi OS)\n\n## 🚀 Quick Start\n\n### Option 1: Using Make (Easiest)\n\n```bash\n# Clone and setup everything\ngit clone https://github.com/CiscoPonce/pi-camera-streaming.git\ncd pi-camera-streaming\nmake setup\n\n# After reboot, start everything\nmake start\nmake start-camera\n\n# View stream at http://\u003cPI_IP\u003e/\n```\n\n### Option 2: Automated Setup (Recommended)\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/CiscoPonce/pi-camera-streaming.git\n   cd pi-camera-streaming\n   ```\n\n2. **Run the setup script**\n   ```bash\n   chmod +x scripts/setup.sh\n   ./scripts/setup.sh\n   ```\n\n3. **Reboot the system** (required for camera and Docker changes)\n   ```bash\n   sudo reboot\n   ```\n\n4. **After reboot, start the services**\n   ```bash\n   docker-compose up -d\n   ```\n\n5. **Start camera streaming**\n   ```bash\n   ./scripts/start-camera.sh\n   ```\n\n6. **Test the setup** (optional)\n   ```bash\n   ./scripts/test-setup.sh\n   ```\n\n7. **View the stream**\n   Open your browser and navigate to `http://\u003cPI_IP\u003e/`\n\n### Option 3: Manual Setup\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/CiscoPonce/pi-camera-streaming.git\n   cd pi-camera-streaming\n   ```\n\n2. **Install dependencies**\n   ```bash\n   sudo apt update\n   sudo apt install -y docker.io docker-compose-plugin libcamera-tools ffmpeg\n   sudo usermod -aG docker $USER\n   ```\n\n3. **Enable camera interface**\n   ```bash\n   sudo raspi-config\n   # Navigate to: Interface Options \u003e Camera \u003e Enable\n   ```\n\n4. **Configure environment**\n   ```bash\n   cp env.example .env\n   # Edit .env with your settings (optional)\n   ```\n\n5. **Start the streaming services**\n   ```bash\n   docker-compose up -d\n   ```\n\n6. **Start camera streaming**\n   ```bash\n   ./scripts/start-camera.sh\n   ```\n\n7. **Test the setup** (optional)\n   ```bash\n   ./scripts/test-setup.sh\n   ```\n\n8. **View the stream**\n   Open your browser and navigate to `http://\u003cPI_IP\u003e/`\n\n## 🏗️ Architecture\n\n### System Components\n\n- **SRS (Simple Realtime Server)**: Handles WebRTC, HTTP-FLV, and RTMP streaming\n- **Nginx**: Serves the professional web viewer interface\n- **Camera Publisher**: Uses `rpicam-vid` to capture and stream video with hardware acceleration\n- **Docker Containers**: Isolated, scalable, and easy-to-manage services\n\n### Network Architecture\n\n| Port | Service | Protocol | Description |\n|------|---------|----------|-------------|\n| 80 | Web Viewer | HTTP | Professional web interface |\n| 1935 | RTMP | TCP | Real-time streaming protocol |\n| 1985 | SRS API | HTTP | Server management and WebRTC signaling |\n| 8081 | HTTP Console | HTTP | FLV playback and server console |\n| 8000-8100 | WebRTC ICE | UDP | Interactive connectivity establishment |\n\n## Configuration\n\n### Camera Settings\n\nThe camera streaming can be configured in `scripts/start-camera.sh`:\n\n```bash\n# Resolution and framerate\nWIDTH=1280\nHEIGHT=720\nFPS=30\n\n# Bitrate (adjust based on network capacity)\nBITRATE=6000000  # 6 Mbps\n\n# Keyframe interval (affects latency)\nGOP=60  # 2 seconds at 30fps\n```\n\n### Performance Tuning\n\nFor optimal performance on Raspberry Pi 5:\n\n- **Day profile**: 1920×1080 @ 25-30 fps, 8-12 Mbps\n- **Night profile**: 1280×720 @ 30-60 fps, 4-8 Mbps\n- **Low latency**: Reduce GOP size to 1-2 seconds\n- **High quality**: Increase bitrate and resolution\n\n## Usage\n\n### Using Make Commands (Recommended)\n\n```bash\n# View all available commands\nmake help\n\n# Start all services\nmake start\n\n# Start camera streaming\nmake start-camera\n\n# Check status\nmake status\n\n# View logs\nmake logs\n\n# Run tests\nmake test\n\n# Stop everything\nmake stop\n```\n\n### Manual Commands\n\n```bash\n# Start all services\ndocker-compose up -d\n\n# Start camera streaming\n./scripts/start-camera.sh\n\n# Check status\ndocker-compose ps\n```\n\n### Stopping the Stream\n\n```bash\n# Stop camera streaming\npkill rpicam-vid\n\n# Stop all services\ndocker-compose down\n```\n\n### Viewing the Stream\n\n1. **Web Browser**: Navigate to `http://\u003cPI_IP\u003e/`\n2. **Direct FLV**: `http://\u003cPI_IP\u003e:8081/live/cam.flv`\n3. **WebRTC API**: `http://\u003cPI_IP\u003e:1985/rtc/v1/play/`\n\n## Troubleshooting\n\n### Common Issues\n\n**Setup Issues**\n- **Permission denied**: Make sure scripts are executable: `chmod +x scripts/*.sh`\n- **Docker not found**: Run `sudo usermod -aG docker $USER` and log out/in\n- **Camera not detected**: Enable camera in `sudo raspi-config` and reboot\n\n**No video in browser**\n- Check if camera is connected: `libcamera-hello --list-cameras`\n- Verify SRS is running: `docker logs srs`\n- Check camera streaming: `ps aux | grep rpicam-vid`\n- Test direct FLV stream: `http://\u003cPI_IP\u003e:8081/live/cam.flv`\n\n**High CPU usage**\n- Use night profile: `./scripts/start-camera.sh --profile night`\n- Reduce resolution or framerate\n- Lower bitrate settings\n- Check for background processes\n\n**Network issues**\n- Ensure ports are not blocked by firewall\n- Check network connectivity\n- Verify router port forwarding (if accessing remotely)\n- Test local access first: `http://localhost/`\n\n**Container issues**\n- Check container status: `docker-compose ps`\n- View logs: `docker logs srs` or `docker logs cam-viewer`\n- Restart containers: `docker-compose restart`\n\n### Testing Your Setup\n\nRun the test script to verify everything is working:\n\n```bash\n./scripts/test-setup.sh\n```\n\nThis will check:\n- Camera detection and availability\n- Docker installation and permissions\n- Container status\n- SRS API connectivity\n- Web viewer accessibility\n- Network ports\n- System resources (CPU temperature, memory)\n\n### Logs\n\n```bash\n# View SRS logs\ndocker logs srs\n\n# View nginx logs\ndocker logs cam-viewer\n\n# Check camera streaming\njournalctl -u camera-streaming\n```\n\n## Development\n\n### Project Structure\n\n```\npi-camera-streaming/\n├── Makefile               # Convenient commands for common tasks\n├── docker-compose.yml     # Container orchestration\n├── env.example            # Environment configuration template\n├── viewer/                # Web viewer files\n│   ├── index.html        # Main viewer page\n│   └── srs.player.js     # SRS WebRTC player\n├── scripts/\n│   ├── start-camera.sh   # Camera streaming script\n│   ├── setup.sh          # Initial setup script\n│   └── test-setup.sh     # System verification script\n├── config/\n│   ├── srs.conf          # SRS streaming server configuration\n│   ├── nginx.conf        # Nginx web server configuration\n│   └── mediamtx.yml      # MediaMTX configuration (alternative)\n└── docs/                 # Additional documentation\n    ├── PERFORMANCE.md    # Performance optimization guide\n    └── TROUBLESHOOTING.md # Troubleshooting guide\n```\n\n### Adding Features\n\n1. **New streaming protocols**: Modify SRS configuration\n2. **Enhanced viewer**: Update files in `viewer/` directory\n3. **Authentication**: Add nginx auth configuration\n4. **Recording**: Integrate with SRS recording features\n\n## Performance Monitoring\n\n### System Metrics\n\n```bash\n# CPU and temperature\nvcgencmd measure_temp\ntop -b -n1 | head -20\n\n# Network usage\niftop -i eth0\n\n# Disk usage\ndf -h\n```\n\n### Streaming Metrics\n\n- **Latency**: Measure from camera to viewer\n- **Bitrate**: Monitor actual vs configured\n- **Frame drops**: Check SRS logs for errors\n- **CPU usage**: Should stay below 25% average\n\n## Security Considerations\n\n- **LAN-only exposure**: Streaming services are not exposed to WAN\n- **Firewall**: Ensure only necessary ports are open\n- **Updates**: Keep system and containers updated\n- **Authentication**: Consider adding auth for production use\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly on Raspberry Pi 5\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Support\n\nFor issues and questions:\n- Check the troubleshooting section\n- Review the logs\n- Open an issue on GitHub\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👨‍💻 Author\n\n**CiscoPonce**\n- GitHub: [@CiscoPonce](https://github.com/CiscoPonce)\n- Project Link: [https://github.com/CiscoPonce/pi-camera-streaming](https://github.com/CiscoPonce/pi-camera-streaming)\n\n## 🙏 Acknowledgments\n\n- [SRS](https://github.com/ossrs/srs) for the streaming server\n- [Raspberry Pi Foundation](https://www.raspberrypi.org/) for the hardware\n- [libcamera](https://libcamera.org/) for camera support\n- [Docker](https://www.docker.com/) for containerization\n- [Nginx](https://nginx.org/) for the web server\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscoponce%2Fpi-camera-streaming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscoponce%2Fpi-camera-streaming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscoponce%2Fpi-camera-streaming/lists"}