An end-to-end, high-performance Computer Vision and Video Streaming Studio for the AI-Thinker ESP32-CAM (OV2640) powered by Ultralytics YOLOv8 real-time object detection, MJPEG serial/Wi-Fi streaming, interactive glassmorphic web dashboard, and instant snapshot capture.
- π§ Real-Time YOLOv8 AI Object Detection:
- Live inferencing using
yolov8n.ptwith bounding boxes, class labels, and confidence tags. - 1-click YOLOv8 toggle switch with live adjustable confidence threshold slider (10%β100%).
- Real-time detected object count & category metadata badge panel.
- Live inferencing using
- β‘ High-Speed Dual Streaming:
- Serial/USB Binary Streaming: Ultra-stable 460,800 baud binary framed stream (
0xAA 0x55 0xAA 0x55) direct to browser via Flask MJPEG server (/video_feed). - Wi-Fi Hotspot / AP Stream: ESP32 creates its own dedicated hotspot (
ESP32-CAM-HD/12345678) hosting a standalone high-speed MJPEG stream onhttp://192.168.4.1/stream.
- Serial/USB Binary Streaming: Ultra-stable 460,800 baud binary framed stream (
- πΈ High-Resolution Capture & Gallery:
- Capture one-click full-resolution snapshots directly saved into
uploads/. - Annotated snapshots saved with YOLOv8 bounding boxes when AI detection is enabled.
- Interactive photo gallery with download, preview modal, and delete actions.
- Capture one-click full-resolution snapshots directly saved into
- π‘ Hardware Control & Studio UI:
- Onboard High-Power Flashlight LED toggle (GPIO 4).
- Glassmorphic dark cyberpunk dashboard with real-time FPS counter, resolution indicator, and system health status.
- Automated Timelapse capture mode.
βββββββββββββββββββ Serial (460800 baud) ββββββββββββββββββββββββββ
β AI-Thinker β ββββββββββββββββββββββββββββββββ> β Python Streaming Engineβ
β ESP32-CAM β β (video_streamer.py) β
β (OV2640 Sensor)β <ββ Flash & Commands βββββββββββ βββββββββββββ¬βββββββββββββ
βββββββββββββββββββ β Frame Buffer
βΌ
βββββββββββββββββββ MJPEG Stream (HTTP) ββββββββββββββββββββββββββ
β Modern Web UI β <ββββββββββββββββββββββββββββββββ β Flask Web Server β
β Dashboard (5000)β β + YOLOv8 Detector β
βββββββββββββββββββ ββββββββββββββββββββββββββ
βββ app.py # Flask backend & MJPEG / API server
βββ yolo_detector.py # Ultralytics YOLOv8 inference & annotation engine
βββ video_streamer.py # High-speed binary serial frame receiver
βββ capture_and_save.py # Standalone CLI capture script
βββ upload.py # Automated Arduino CLI / ESP32 flasher
βββ requirements.txt # Python dependencies
βββ esp32_cam_capture/
β βββ esp32_cam_capture.ino # High-efficiency C++ firmware for AI-Thinker OV2640
βββ templates/
β βββ index.html # Modern glassmorphism web studio UI
βββ static/
β βββ app.js # Frontend logic & real-time polling
β βββ style.css # Responsive cyberpunk styling
βββ uploads/ # Directory where captured images are stored
git clone https://github.com/ashishvegan/esp32-cam-yolov8-ai-stream-studio.git
cd esp32-cam-yolov8-ai-stream-studiopip install -r requirements.txtUpload esp32_cam_capture/esp32_cam_capture.ino using Arduino IDE (Board: AI Thinker ESP32-CAM) or via the helper script:
python upload.pypython app.pyOpen your browser and navigate to: π http://localhost:5000
| ESP32 Pin | Function |
|---|---|
| GPIO 4 | High-Power Flash LED |
| GPIO 33 | Onboard Status LED (Inverted) |
| GPIO 1 | UART TX0 (To USB-TTL RX) |
| GPIO 3 | UART RX0 (To USB-TTL TX) |
| GPIO 0 | GND during flashing / Float for normal boot |
| 5V / GND | External 5V 2A Power Supply |
| Endpoint | Method | Description |
|---|---|---|
/video_feed |
GET |
Live multipart MJPEG video stream with YOLOv8 annotations |
/api/status |
GET |
System telemetry (FPS, YOLO status, detections, resolution) |
/api/snapshot |
POST |
Captures current frame and saves to uploads/ |
/api/yolo/toggle |
POST |
Turn YOLOv8 detection ON/OFF or update confidence threshold |
/api/flash |
POST |
Toggle onboard Flashlight LED |
/api/images |
GET |
List all saved snapshots |
/api/delete/<file> |
DELETE |
Delete a snapshot |
This project is licensed under the MIT License.