Esp32 Camera Video Stream at Blynk

I need help on how to video stream in esp32 camera inside the blynk iot app thank you

Have you tried searching the forum?

Pete.

i didnt found anything about esp32 camera videostreaming on blynk iot can you help me with that?

I don’t think you searched very well…

https://community.blynk.cc/search?q=Esp32%20cam%20video%20order%3Alatest

Pete.

Hi, I already see the discussion but can you give me a step by step on how to do it im not really familliar on how to use the blynk app, Thank you so much for understanding

If you read some of those 50+ topics on the subject you’ll see that your first task is to make the url for the video stream publicly accessible.
How you do that will depend on the port you’re using, whether you have a static public IP address, and the make/model of router you have.
If you have a normal domestic internet setup then you’re likely to need to use a DDNS service and a DDNS updater client, and to add inbound port forwarding to your ESP32 for the port you’re using.

None of this has anything to do with Blynk.

Once you have a DDNS url and port then you’ll use these in the video streaming app in Blynk.

Pete.

So i need to stream the camera over to internet first?
should i use ngrok?

Yes, you need to provide a publicly accessible url

I don’t know, it depends on your setup. I’ve never use ngrok myself so can’t comment.

Pete.

Can you recommend any platform?

I’ve explained the approach I use, which doesn’t require a “platform”.

Pete.

hello sir can esp8266 and esp32 camera use in one console?

I don’t understand the question.
What do you mean by “console”.

Pete.

what i ment was if im using esp8266 and esp32 camera it can work together on singe console(project) inside the blynk

is it possible to use esp32 camera and nodemcu in one project on blynk?

I’ve merged your latest topic into this one, as they are about the same issue.
Please don’t create new topics about the same issue, it makes things messy and creates additional work for the moderators.

The reason why your previous question didn’t get an answer is because it makes no sense. Neither does your lates question.

“Projects” were a Blynk Legacy concept, and don’t exist in Bynk IoT.

Blynk IoT uses Templates, Devices and Dashboards.
Rather than coming-up with non-Blynk IoT phrases such as “console” and “project” it would be far better if you explained, in detail and in plain English, what it is that you are hoping to achieve.

Pete.

hello sir sorry that, i am planning to use esp32 camera and nodemcu for school project can you help me with that?
Thank you sir!

im still stuck on how to conncet it to my blynk videostream

Maybe you should explain in detail what you’ve achieved so far, what you’ve tried, what you’ve done in terms of DDNS and port forwarding, and what it is that you’re trying to achieve.

I’ve given you lots of info so far, and all I get in return is one-line answers that don’t really help.
I’m on the verge of stepping-back from your tooic because of this, so if you want to keep my attention then I’d suggest changing your communication approach.

Pete.

hello sir, I achieve to stream my esp32 camera on a local network, also i connected it on the project its connecting but the problem is the camera was not showing up even i declare the virtual pin 0

heres my code:



#define BLYNK_TEMPLATE_ID "TMPL6ICcpd93u"
#define BLYNK_TEMPLATE_NAME "camera"
#define BLYNK_AUTH_TOKEN "C_8EycEn2ecTruaAtQsKNi1nsXxAfZoK"

#include "src/OV2640.h"
#include <WiFi.h>
#include <WebServer.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h> // Use the correct library for your hardware

#define CAMERA_MODEL_AI_THINKER

#include "camera_pins.h"

#define SSID1 ""
#define PWD1 ""

OV2640 cam;
WebServer server(80);

const char HEADER[] = "HTTP/1.1 200 OK\r\n" \
                      "Access-Control-Allow-Origin: *\r\n" \
                      "Content-Type: multipart/x-mixed-replace; boundary=123456789000000000000987654321\r\n";
const char BOUNDARY[] = "\r\n--123456789000000000000987654321\r\n";
const char CTNTTYPE[] = "Content-Type: image/jpeg\r\nContent-Length: ";
const int hdrLen = strlen(HEADER);
const int bdrLen = strlen(BOUNDARY);
const int cntLen = strlen(CTNTTYPE);

BlynkTimer timer;
bool streamingEnabled = false; // Control camera streaming

void handle_jpg_stream(void)
{
  char buf[32];
  int s;

  WiFiClient client = server.client();

  if (streamingEnabled) {
    client.write(HEADER, hdrLen);
    client.write(BOUNDARY, bdrLen);

    while (true)
    {
      if (!client.connected()) break;
      cam.run();
      s = cam.getSize();
      client.write(CTNTTYPE, cntLen);
      sprintf(buf, "%d\r\n\r\n", s);
      client.write(buf, strlen(buf));
      client.write((char *)cam.getfb(), s);
      client.write(BOUNDARY, bdrLen);
      delay(100); // Control streaming speed
    }
  }
}

void toggleStream() {
  streamingEnabled = !streamingEnabled; // Toggle streaming on/off
}

void handleNotFound()
{
  String message = "Server is running!\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  server.send(200, "text/plain", message);
}

void setup()
{
  Serial.begin(115200);

  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; // Replace with your desired XCLK frequency
  config.pixel_format = PIXFORMAT_JPEG; // Set to the desired pixel format
  config.frame_size = FRAMESIZE_QVGA; // Set to the desired frame size
  config.jpeg_quality = 12; // Set the JPEG quality (0-63)
  config.fb_count = 2; // Number of frame buffers (usually 2 is fine)

  cam.init(config);

  // WiFi connection
  WiFi.mode(WIFI_STA);
  WiFi.begin(SSID1, PWD1);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println(F("WiFi connected"));

  Blynk.begin(BLYNK_AUTH_TOKEN, WiFi);
  Blynk.syncVirtual(V0); // Sync the camera stream control with Blynk

  server.on("/mjpeg/1", HTTP_GET, handle_jpg_stream);
  server.onNotFound(handleNotFound);
  server.begin();

  // Attach a timer to check Blynk VP0 for stream control
  timer.setInterval(1000L, toggleStream);
}

void loop()
{
  Blynk.run();
  server.handleClient();
  timer.run();
}

@chester Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.