ESP32-CAM Streaming Server: MJPEG, RTSP, and Home Assistant Integration
Two Streaming Approaches
The stock CameraWebServer example (from the setup guide) gives you MJPEG over HTTP out of the box — simplest option, works directly in a browser or Home Assistant's generic camera integration. RTSP requires additional library work but integrates more cleanly with dedicated NVR software (Frigate, Blue Iris) that expects RTSP specifically.
MJPEG: What You Already Have
The stock example exposes a stream endpoint at http://<esp32-ip>:81/stream (note: port 81, not 80 — the main web UI is on 80, the raw stream is separate). This URL works directly as an <img> tag source in any web page, or as a camera source in most home automation platforms.
Adding to Home Assistant (MJPEG)
camera: - platform: mjpeg name: ESP32-CAM mjpeg_url: http://<esp32-ip>:81/stream still_image_url: http://<esp32-ip>/captureAdd this to configuration.yaml, restart HA, and the camera appears as a standard entity — usable in dashboards, automations, and notifications with snapshots.
Setting Up RTSP
The stock firmware doesn't include RTSP — you need a library like Micro-RTSP added to your sketch. This is more involved: it requires modifying the CameraWebServer example to initialize an RTSP server alongside (or instead of) the HTTP stream, using the library's session/streaming API. Worth the effort specifically if you're feeding into Frigate or similar NVR software that's built around RTSP as its primary camera input format — check the companion Frigate NVR guide for how it expects camera sources configured.
Performance Tuning
- Lower the frame size (FRAMESIZE_VGA or below rather than UXGA) if you're seeing stuttering — the ESP32's single camera-handling core genuinely struggles with high resolution + high frame rate simultaneously.
- JPEG quality setting (0-63, lower number = higher quality = more bandwidth) — 10-12 is a reasonable balance for most streaming use cases.
- WiFi signal strength matters more than people expect — a weak connection causes visible stream stuttering that looks like a camera/CPU problem but is actually RF.
Multiple Camera Considerations
Each ESP32-CAM handles one stream — for a multi-camera setup, you're running one board per camera, each with its own IP, added as separate entities/sources in whatever platform you're feeding into. There's no built-in multi-camera aggregation at the ESP32 level; that coordination happens at the NVR/Home Assistant layer.
Stability for 24/7 Streaming
For always-on deployment, add a watchdog reset — the ESP32's built-in esp_task_wdt can catch and recover from the occasional hang that long-running WiFi+camera workloads are prone to, rather than requiring manual power-cycling when it eventually locks up after days/weeks of continuous operation.
Related Guides
- How to Use the ESP32-CAM: Video Streaming, Motion Detection, and Time-Lapse
- Build a Local AI Security Camera System with Frigate NVR on a Raspberry Pi
- Running Home Assistant on a Raspberry Pi 4
- ESPHome and Home Assistant Beginner Guide: Build Your First WiFi Sensor
- Raspberry Pi Security Camera/NVR with Frigate
- Home Assistant on Raspberry Pi: Complete Server Setup
- ESP32-CAM Complete Setup Guide: Flashing, FTDI Wiring, First Boot
- ESP32-CAM Motion Detection & Snapshot-to-Cloud