Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Camera & Vision Modules

RTSP Stream with ESP32-CAM and VLC: Step-by-Step Guide

RTSP Stream with ESP32-CAM and VLC: Step-by-Step Guide

March 11, 2026 /Posted byJayesh Jain / 0

The ESP32-CAM streaming RTSP video to VLC is one of the most practical IoT camera projects. With less than ₹500 in hardware, you can build a Wi-Fi video camera that streams live video to any VLC player, smartphone, or browser on your home or office network. This step-by-step guide covers the complete ESP32-CAM setup, Arduino code, and VLC configuration for Indian makers.

Table of Contents

  • Hardware: ESP32-CAM Overview
  • Arduino IDE Setup for ESP32-CAM
  • RTSP Streaming Code
  • Viewing in VLC
  • Browser-Based Streaming Alternative
  • SD Card Recording
  • India-Specific Network Tips
  • Frequently Asked Questions

Hardware: ESP32-CAM Overview

The ESP32-CAM is a ₹250–450 module combining an ESP32-S chip with an OV2640 2MP camera sensor and microSD card slot. It’s one of the most cost-effective ways to add video streaming to any IoT project.

Key Specs

  • MCU: ESP32-S (single-core), 240 MHz
  • Camera: OV2640, up to 2MP (1600×1200)
  • Flash: 4MB
  • PSRAM: 4MB (required for video buffering)
  • Wi-Fi: 802.11b/g/n 2.4 GHz
  • MicroSD: SPI, up to 4GB reliable (some 16GB cards work)

Required Hardware

  • ESP32-CAM module: ₹250–450
  • FTDI USB-to-TTL programmer: ₹80–200 (needed for flashing — ESP32-CAM has no USB)
  • Jumper wires
  • 5V 1A USB power supply
Recommended: Arducam 2MP Mini Camera Shield with OV2640 — Same OV2640 sensor as ESP32-CAM but in a modular form for Arduino SPI integration when you need camera without the ESP32.

Arduino IDE Setup for ESP32-CAM

// Arduino IDE Setup for ESP32-CAM:
// 1. Add ESP32 board manager URL in Preferences:
//    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
// 2. Tools > Board > ESP32 Arduino > AI Thinker ESP32-CAM
// 3. Upload Speed: 115200
// 4. Flash Frequency: 80MHz
// 5. Flash Mode: QIO

// Wiring for programming:
// FTDI GND  -> ESP32-CAM GND
// FTDI TX   -> ESP32-CAM U0R (RXD)
// FTDI RX   -> ESP32-CAM U0T (TXD)  
// FTDI 5V   -> ESP32-CAM 5V
// GPIO0     -> GND (programming mode, remove after upload)

RTSP Streaming Code

The simplest approach uses the micro-RTSP-server library:

#include "esp_camera.h"
#include 
#include "OV2640.h"
#include "SimStreamer.h"
#include "OV2640Streamer.h"
#include "CRtspSession.h"

// AI Thinker ESP32-CAM pin definitions
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27
#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

const char* ssid = "YOUR_WIFI_SSID";       // Change to your network
const char* password = "YOUR_WIFI_PASS";   // Change to your password

OV2640 cam;
WiFiServer rtspServer(554);

void setup() {
  Serial.begin(115200);
  
  // Camera configuration
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG;
  config.frame_size = FRAMESIZE_VGA;   // 640x480 for smooth RTSP
  config.jpeg_quality = 15;
  config.fb_count = 2;
  
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed: 0x%x", err);
    return;
  }
  
  cam.init(config);
  
  // Connect to WiFi
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("ESP32-CAM IP: rtsp://");
  Serial.print(WiFi.localIP());
  Serial.println(":554/mjpeg/1");
  
  rtspServer.begin();
}

CStreamer *streamer;
CRtspSession *session;
WiFiClient client;

void loop() {
  uint32_t msecPerFrame = 100;  // 10 FPS
  static uint32_t lastimage = millis();
  
  if (rtspServer.hasClient()) {
    client = rtspServer.accept();
    streamer = new OV2640Streamer(&client, cam);
    session = new CRtspSession(&client, streamer);
    Serial.printf("RTSP client connected: %s
", 
                  client.remoteIP().toString().c_str());
  }
  
  if (session) {
    session->handleRequests(0);
    uint32_t now = millis();
    if (now > lastimage + msecPerFrame || now broadcastCurrentFrame(now);
      lastimage = now;
    }
    if (!session->m_stopped) return;
    delete session; session = nullptr;
    delete streamer; streamer = nullptr;
    client.stop();
  }
}

Viewing in VLC

Steps to view ESP32-CAM RTSP stream in VLC:

1. Open VLC Media Player
2. Go to Media > Open Network Stream (Ctrl+N)
3. Enter URL: rtsp://[ESP32-CAM-IP]:554/mjpeg/1
   (Replace [ESP32-CAM-IP] with the IP shown in Serial Monitor)
4. Click Play

Alternatively via command line:
  vlc rtsp://192.168.1.105:554/mjpeg/1

For Android (VLC for Android, free on Play Store):
  Open VLC > Network > New stream
  Enter same RTSP URL

Note: ESP32-CAM and your viewing device must be on the same
WiFi network. For remote viewing, set up port forwarding on
your router (port 554 TCP) - but be aware of security implications.
Recommended: Arducam 5MP 1080p PTZ Camera for Raspberry Pi — For a more capable streaming camera with pan-tilt-zoom control, this Arducam module is a significant upgrade from the ESP32-CAM’s fixed 2MP OV2640.

Browser-Based Streaming Alternative

The easiest ESP32-CAM streaming uses the built-in CameraWebServer example from Arduino IDE (Examples > ESP32 > Camera > CameraWebServer). This streams MJPEG over HTTP — viewable directly in any browser by visiting http://[ESP32-IP]/. No VLC needed. Frame rate is typically 5–15 FPS at VGA resolution on Indian home Wi-Fi networks.

SD Card Recording

#include "SD_MMC.h"

// Save JPEG frames to SD card
void saveFrameToSD(camera_fb_t *fb) {
  static int fileNum = 0;
  char filename[32];
  sprintf(filename, "/image_%04d.jpg", fileNum++);
  
  File file = SD_MMC.open(filename, FILE_WRITE);
  if (!file) {
    Serial.println("SD write failed");
    return;
  }
  file.write(fb->buf, fb->len);
  file.close();
  Serial.printf("Saved: %s (%d bytes)
", filename, fb->len);
}

// In setup(): SD_MMC.begin()
// Then call saveFrameToSD(cam.getFrame()) in loop

India-Specific Network Tips

  • BSNL/MTNL routers: Some older BSNL routers block RTSP port 554. Try HTTP streaming (CameraWebServer example) on port 80 if RTSP doesn’t work.
  • JioFi hotspot: ESP32-CAM connects reliably to JioFi 4G hotspots — useful for field deployments. Static IP assignment via JioFi web interface helps with consistent RTSP URLs.
  • Static IP configuration: Assign a static IP to your ESP32-CAM in your router’s DHCP settings so the RTSP URL doesn’t change across reboots.
  • Range: ESP32-CAM’s Wi-Fi range is approximately 20–30m indoors in a typical Indian concrete building. Use a Wi-Fi repeater for longer distances.

Frequently Asked Questions

Why is my ESP32-CAM stream choppy or disconnecting?

Common causes: (1) Power supply insufficient — ESP32-CAM needs 5V at least 500mA; cheap phone chargers often drop voltage under load; use a quality 5V 1A supply. (2) Wi-Fi signal too weak — the ESP32-CAM’s tiny PCB antenna has short range, especially through thick Indian concrete walls; move closer to the router or use an external antenna variant. (3) Buffer overflow — reduce resolution to QVGA (320×240) or SVGA (800×600) if VGA causes issues.

Can I add IR night vision to ESP32-CAM?

The standard ESP32-CAM has an OV2640 sensor that is sensitive to near-infrared light. Adding 850nm IR LEDs (₹5–20 each) around the camera provides illumination invisible to the human eye but visible to the camera. The camera will show a black-and-white image in IR-illuminated darkness. For better night performance, use a Pi NoIR camera with a proper IR illuminator instead.

What is the resolution and frame rate of ESP32-CAM?

ESP32-CAM at VGA (640×480): approximately 10–15 FPS via RTSP, 15–20 FPS via HTTP MJPEG. At QVGA (320×240): 20–30 FPS. Maximum resolution (UXGA, 1600×1200) at only 1–3 FPS — practical only for still image capture. The single-core ESP32-S processor limits real-time video to VGA or lower resolutions.

Shop Camera Modules at Zbotic →

Tags: ESP32 video streaming, ESP32-CAM RTSP, ESP32-CAM tutorial, ESP32-CAM VLC stream, IoT camera India
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
EV Conversion for Royal Enfiel...
blog ev conversion for royal enfield bullet is it possible india 598860
blog i2s audio protocol explained digital sound for esp32 598867
I2S Audio Protocol Explained: ...

Related posts

Svg%3E
Read more

Endoscope Camera Module: PCB Inspection and Industrial Use

April 1, 2026 0
An endoscope camera module is an invaluable tool for PCB inspection, industrial equipment maintenance, and quality control tasks where direct... Continue reading
Svg%3E
Read more

Number Plate Recognition System: ESP32-CAM ANPR Project India

April 1, 2026 0
Building a number plate recognition system with ESP32-CAM is an affordable approach to automatic number plate recognition (ANPR) for Indian... Continue reading
Svg%3E
Read more

Machine Vision with OpenCV: Raspberry Pi Object Detection Guide

April 1, 2026 0
Running OpenCV on a Raspberry Pi for object detection opens up countless applications, from industrial quality inspection to smart doorbell... Continue reading
Svg%3E
Read more

Arducam vs Raspberry Pi Camera: Which Camera Module to Choose

April 1, 2026 0
Choosing between Arducam and Raspberry Pi camera modules is one of the first decisions for any vision project. Both connect... Continue reading
Svg%3E
Read more

360-Degree Camera Stitching Project with OpenCV and Pi

March 11, 2026 0
Creating a 360-degree camera using OpenCV image stitching with Raspberry Pi is an ambitious computer vision project that combines multiple... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now