esp32.diy

ESP32-CAM-Video-Recorder: Build a Self-Contained AVI Camera

Oct 13, 2026 · 6 min read

Intermediate 527 stars 105 forks C++ GPL-3.0 Updated 2026-06-08

HTTP file manager lets you browse, download, and delete AVI recordings directly from the browser — no FTP client needed.

TL;DR ESP32-CAM-Video-Recorder transforms a bare ESP32-CAM module into a self-contained surveillance or timelapse camera that saves MJPEG AVI files to a microSD card. You control it entirely through a browser, download recordings with one click, and optionally receive Telegram alerts with a preview frame whenever a new clip starts.
What you need
  • ESP32-CAM
  • OV2640 camera module
  • microSD card
  • PIR sensor (optional)
BoardESP32-CAM
CameraOV2640
FrameworkArduino (arduino-esp32 2.0.2)
LanguageC++
LicenseGPL-3.0
DifficultyIntermediate

What You Will Build

This project turns an ESP32-CAM into a fully self-contained video recorder. It captures MJPEG frames from the OV2640 camera and writes them into a standard AVI container on a microSD card — no PC, no cloud service, and no extra microcontroller needed.

Once running, you reach the device at its local IP address (or via mDNS at a name like desklens.local) to see a live status page with a viewfinder snapshot, start or stop recordings, and browse the files already saved to the card. Recordings can be downloaded directly to a phone or laptop with a single browser click — no FTP client required in the current version.

Beyond basic recording, the firmware supports timelapse (adjustable interval between frames and a playback speed multiplier), grayscale mode, automatic deletion of the oldest day of videos when the card reaches 90% full, a live MJPEG stream you can open in a second browser tab or pull into VLC, and an optional Telegram bot that sends you the first frame of every new clip together with a one-click download link for the previous recording. A PIR sensor input can trigger recording automatically whenever motion is detected.

Good use cases include wildlife cameras, workshop security, slow-motion timelapse of plants or construction, and any remote monitoring situation where you want footage saved locally rather than streamed to a server.

Telegram alert showing the first frame of a new recording, sent automatically when the bot is enabled.\2
Telegram alert showing the first frame of a new recording, sent automatically when the bot is enabled.
Telegram message with a one-click download link for the previous completed AVI clip.\2
Telegram message with a one-click download link for the previous completed AVI clip.
v99 web status page showing camera viewfinder, recording status, and control links.\2
v99 web status page showing camera viewfinder, recording status, and control links.
v94 web interface displaying recording parameters and SD card usage.\2
v94 web interface displaying recording parameters and SD card usage.

What You Need

Hardware

Software and libraries

Optional for Telegram alerts

Typical use cases

Wildlife and Garden Camera

Mount the ESP32-CAM outdoors, enable the PIR input, and let the board record short AVI clips only when an animal or person enters the frame. Download footage with one browser click.

Timelapse Photography

Set a long interval between frames and a speed multiplier to compress hours of plant growth, construction, or weather into a short AVI saved directly to the SD card.

Telegram Remote Monitor

Enable the Telegram bot to receive a snapshot at the start of every new recording and a one-click download link for the previous clip, keeping you informed from anywhere on your phone.

Low-Cost Workshop or Office Security

Run continuous looped recordings with auto-deletion of the oldest files at 90% SD capacity, giving you a rolling local security archive without any cloud subscription.

How It Works

The firmware runs several concurrent FreeRTOS tasks at different priorities. The highest-priority tasks handle frame capture and AVI writing to the SD card, so recording is never starved by network activity. The HTTP server task sits at a lower priority, which means the live stream may slow down before recording quality suffers.

At startup the firmware reads configuration from EEPROM. If valid settings are found it uses them, so the device always reboots into the same recording mode it was in before a power cut. If the stored 'magic number' does not match what is compiled in settings.h, the firmware falls back to the hardcoded defaults and writes those to EEPROM — a convenient way to wipe stale settings after a firmware change.

WiFi credentials are handled by WiFiManager. Setting the SSID in settings.h to a single character triggers the captive-portal flow; the ESP32-CAM broadcasts its own access point, you connect and visit 192.168.4.1 to enter your home credentials, then reboot the board. After that it connects automatically.

Each recording session begins by snapping and saving a JPEG thumbnail. If the Telegram bot is enabled, that image is sent to your phone before recording starts — the SSL handshake for Telegram needs significant heap, so the design deliberately completes it before opening the AVI file to avoid memory conflicts with the SD card driver.

Build and Flash

  1. Clone or download the repository and open the files from the vA1 folder in Arduino IDE.
  2. Edit settings.h to set your startup parameters. For WiFiManager, set the SSID field to a single character. For Telegram, hardcode your bot token and chat ID here.
  3. Install the ESP32 board package at version 2.0.2 via Arduino IDE → Boards Manager → search "esp32".
  4. Install WiFiManager at version 2.0.3-alpha or later via Arduino IDE → Manage Libraries.
  5. Select the board: Tools → Board → AI Thinker ESP32-CAM (or your equivalent).
  6. Connect your USB-to-serial adapter, hold the GPIO0 boot button while powering on to enter flash mode, then upload the sketch.
  7. Open the Serial Monitor at the correct baud rate to read the assigned IP address after the board connects to WiFi.
  8. Browse to the IP address shown in the serial monitor. The status page displays a viewfinder snapshot and recording controls.

If you trigger WiFiManager on first boot, remember to reboot the board once after saving credentials — the README notes this is required for the credentials to take effect correctly.

Controlling the Recorder

All runtime control goes through HTTP URLs. The README uses the mDNS hostname desklens.local in its examples — substitute your board's IP address if mDNS does not resolve on your network.

http://desklens.local/
http://desklens.local/stop
http://desklens.local/start
http://desklens.local/start?framesize=VGA&length=1800&interval=250&quality=10&repeat=100&speed=1&gray=0&pir=0&bot=1
http://desklens.local/bot_enable
http://desklens.local/bot_disable
http://desklens.local/pir_enable
http://desklens.local/pir_disable

Key parameters explained

For the live stream, the README shows pulling it into VLC via Media → Open Network Stream using the URL http://192.168.1.90/stream (replace the IP with your board's address). Download any saved AVI by clicking its filename in the browser file manager.

Ideas to Extend and Limitations

Ideas to try

Limitations to keep in mind

Verdict

ESP32-CAM-Video-Recorder is one of the most complete firmware projects available for the ESP32-CAM, packing real AVI recording, browser-based controls, HTTP file transfer, live streaming, PIR triggering, Telegram alerts, and timelapse into a single sketch. The flip side is that there is meaningful setup involved — matching the arduino-esp32 version, configuring settings.h, and understanding the HTTP control API — so it sits firmly in intermediate territory. If you need something running in an afternoon with fewer knobs to turn, the author's own junior variant is worth a look; if you want the full feature set, this project delivers it.

Sources

github.comjameszah/ESP32-CAM-Video-Recorder — repository & README

Facts in this article come from the project's public README and GitHub metadata at the time of writing. Images belong to their respective owners and link back to the original source.