I have a few cheap ESP32-based cameras for home NVR.
- Find esp32cam model
The cameras run ESPHome firmware and stream video into Frigate.
- Find original guide for this…
ESPHome setup
The ESPHome configuration is as follows:
esphome:
name: esp32-camera-outside-01
platformio_options:
build_flags: -DBOARD_HAS_PSRAM
board_build.arduino.memory_type: qio_opi
board_build.f_flash: 80000000L
board_build.flash_mode: qio
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
platform: esphome
wifi:
ssid: "MyWiFi-IoT"
password: "wifi password goes here"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp32-co01-fallback"
password: "different wifi password goes here"
captive_portal:
# Configuration for the ESP32 Camera
esp32_camera:
id: espcam
name: My Camera
external_clock:
pin: GPIO10
frequency: 20MHz
i2c_pins:
sda: GPIO40
scl: GPIO39
data_pins: [GPIO15, GPIO17, GPIO18, GPIO16, GPIO14, GPIO12, GPIO11, GPIO48]
vsync_pin: GPIO38
href_pin: GPIO47
pixel_clock_pin: GPIO13
resolution: 800x600
test_pattern: false
# these are default true! you'll have to disable them,
# not enable them, if you want to flip your video
vertical_flip: false
horizontal_mirror: false
# Configuration for the ESP32 Camera Web Server
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
switch:
- platform: restart
name: "ESP32 Camera Restart"
sensor:
- platform: uptime
name: "ESP32 Camera Uptime Sensor"
- platform: wifi_signal
name: "ESP32 Camera WiFi Signal"
update_interval: 60sSee also
esp32_cameraoptions: https://esphome.io/components/esp32_camera/
- I had to explicitly set
test_patternback to false after I used it to test… seems like some of these options may be “remembered” between builds, even if you do an explicit clean?
To build it:
$ esphome clean esp32cam-outside.yaml
$ esphome compile esp32cam-outside.yaml
$ esphome upload esp32cam-outside.yaml --device <ip-address>You don’t need to specify --device if you have working mDNS, but I don’t, as the camera is on a different network than the device I’m using esphome on.
Frigate config
Frigate took some convincing and I have never been able to flip video on the go2rtc side, no matter what I try.
Still broken
This config still has issues when trying to view recorded video. I’m not sure why and have just accepted failure.
Only relevant snips to this camera are listed.
ffmpeg:
hwaccel_args: preset-vaapi
gp2rtc:
streams:
esp32_cam_outside_01:
- http://<ip address>:8080
- "ffmpeg:esp_cam_outside_01#video=h264#hardware"
cameras:
esp_cam_outside_01:
enabled: true
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/esp_cam_outside_01
input_args: preset-rtsp-restream
roles:
- detect
- record