ESP32-CAM ONVIF RTSP Camera
Professional, Feature-Rich, and Network Camera Firmware for ESP32-CAM
Transform your affordable ESP32-CAM module into a powerful ONVIF-compatible network camera, ready for integration with professional NVR/DVR systems (Hikvision, Dahua, and more). This firmware provides RTSP streaming, ONVIF discovery, and a roadmap for advanced features like web configuration, SD card recording, and motion detection.
Note
🚧 Work in Progress:
This project is evolving rapidly. Contributions, feedback, and feature requests are welcome!
-Star the repo and join the project!
Features
- 📡 ONVIF Discovery:
Appears as a discoverable camera on ONVIF-compatible NVRs/DVRs for easy integration. - 🎥 RTSP Streaming (MJPEG):
Real-time video streaming for live view and recording. - ⚡ Lightweight:
Optimized for ESP32-CAM’s limited resources. - 🛠️ Easy Setup:
Simple Wi-Fi configuration (web-based setup coming soon). - 🌐 Web Configuration Interface:
(Planned) Configure camera, Wi-Fi, and storage via browser. - 🗂️ SD Card Recording:
(Planned) Record video directly to microSD card. - ↔️ Motion Detection:
(Planned) Basic motion detection for event-based recording. - 🔐 Secure Credential Storage:
(Planned) Store Wi-Fi credentials securely in SPIFFS. - 🌏 Access Point Fallback:
(Planned) Automatically creates an AP if unable to connect to Wi-Fi. - 🔒 Open Source:
MIT-licensed for personal and commercial use.
Hardware Requirements
- ESP32-CAM board (AI-Thinker or compatible)
- MicroSD card (optional, for recording)
- 5V power supply
- FTDI programmer/adapter (for initial flashing)
Software Dependencies
- Arduino IDE or PlatformIO
- ESP32 Arduino Core
- Required Libraries:
- ArduinoJson
- ESP32 Camera Driver
- SPIFFS file system
Installation
Arduino IDE
- Install Arduino IDE from arduino.cc
- Add ESP32 board support:
- File > Preferences > Add
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
to "Additional Board Manager URLs" - Tools > Board > Boards Manager > Search "ESP32" > Install latest version
- File > Preferences > Add
- Install required libraries:
- Tools > Manage Libraries > Search and install "ArduinoJson"
- Connect ESP32-CAM via FTDI adapter:
- GND → GND
- 5V → 5V
- TX → RX
- RX → TX
- GPIO0 → GND (for flashing mode)
- Select Board/Port:
Tools > Board > ESP32 Arduino > AI-Thinker ESP32-CAM
Tools > Port > [Your FTDI port] - Upload Firmware:
Click Upload. After upload, disconnect GPIO0 from GND and reset ESP32-CAM.
PlatformIO (VS Code)
- Install Visual Studio Code
- Install PlatformIO extension
- Create a new project:
- Board: AI Thinker ESP32-CAM
- Framework: Arduino
- Configure
platformio.ini:[env:esp32cam] platform = espressif32 board = esp32cam framework = arduino monitor_speed = 115200 lib_deps = bblanchon/ArduinoJson @ ^6.21.3 upload_speed = 921600 build_flags = -DCORE_DEBUG_LEVEL=5 - Import source files into
src/directory. - Flash firmware as above.
Quick Start
- Clone this repository
- Edit Wi-Fi credentials in the source code (web setup coming soon)
- Flash to your ESP32-CAM
- Connect your NVR/DVR and discover the camera via ONVIF, or add the RTSP stream manually:
rtsp://[camera-ip]:554/mjpeg/1
Usage
- Access the RTSP stream using compatible NVR/DVR software or VLC.
- (Planned) Access the web interface for live view, configuration, and SD card management.
- (Planned) On first boot, ESP32-CAM will create an access point ("ESP32-CAM-ONVIF") for initial setup.
Compatibility
- Hardware Support: ESP32-CAM (AI-Thinker or compatible)
- NVR/DVR Compatibility: Hikvision, Dahua, and most ONVIF-compliant recorders (MJPEG stream)
- Limitations: MJPEG only (no H.264); some recorders may require H.264 for recording
Project Structure
| File/Folder | Description |
|---|---|
ESP32-CAM-ONVIF.ino |
Main firmware sketch |
camera_control.* |
Camera initialization and settings |
rtsp_server.* |
RTSP streaming implementation |
onvif_server.* |
ONVIF protocol implementation |
web_config.* |
(Planned) Web interface |
wifi_manager.* |
(Planned) Wi-Fi setup and AP fallback |
sd_recorder.* |
(Planned) SD card recording |
motion_detection.* |
(Planned) Motion detection |
data/ |
(Planned) Web UI files (HTML, CSS, JS) |
Roadmap
- ONVIF WS-Discovery responder
/onvif/device_serviceendpoint (GetStreamUri, GetCapabilities)- RTSP video streaming (MJPEG)
- Web-based configuration interface
- SD card recording and management
- Motion detection
- Advanced ONVIF features (profiles, device info, etc.)
- Secure credential storage (SPIFFS)
- Access point fallback for Wi-Fi setup
Screenshots
Coming soon!
Contributing
Pull requests, issues, and feature suggestions are welcome!
See CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License.
Acknowledgments
- Micro-RTSP for RTSP streaming on ESP32
- ONVIF community for protocol documentation and inspiration
- Thanks to all contributors and the open-source community!
Stay tuned for updates, new features, and documentation as the project evolves! Star the repo to follow progress and contribute to making ESP32-CAM ONVIF the ultimate DIY network camera solution.