sbyang369 / esp32s2webcam

0 stars 0 forks source link

Question About Your esp-idf-video-streaming Tutorial #1

Open sbyang369 opened 1 month ago

sbyang369 commented 1 month ago

@nopnop2002 Hi! I'm working on following your esp-idf-video-streaming repo to stream webcam output onto my laptop but I've encountered an issue. I was wondering if you could possibly give a pointer or two.

All of the code works until the part where I have to open the URL and display the output. I believe there's an issue with the camera connection to my laptop, because when I open the link, there is an error. So, I was wondering if there's any camera configuration that needs to be done prior. I am using the Logitech C270 HD Webcam, which is one of the cameras that you said should work, connected to my ESP32-S2 Devkit C. Thanks so much!

image

Here's what appears when I open http://10.0.0.38:8080/.

image

nopnop2002 commented 1 month ago

What kind of logs are displayed when starting ESP32 with Logitech C270 HD Webcam connected?

sbyang369 commented 1 month ago

What kind of logs are displayed when starting ESP32 with Logitech C270 HD Webcam connected?

Where can I find the logs? Sorry, I'm new to this!

nopnop2002 commented 1 month ago

Log is this. 375196285-324159b1-a01d-4794-8282-2f4e72a7c84c

This is my log with Logitech C270 HD Webcam and ESP32-S3.

I (7393) HTTP: Start task_parameter=192.168.10.123
I (7393) HTTP: Starting HTTP server on http://192.168.10.123:8080
I (8293) wifi:<ba-add>idx:0 (ifx:0, f8:b7:97:36:de:52), tid:5, ssn:0, winSize:64
I (8343) wifi:<ba-add>idx:1 (ifx:0, f8:b7:97:36:de:52), tid:0, ssn:4, winSize:64
Waiting for device
Device found
DEVICE CONFIGURATION (046d:0825/2) ---
Status: idle
VideoControl:
        bcdUVC: 0x0100
VideoStreaming(1):
        bEndpointAddress: 129
        Formats:
        UncompressedFormat(1)
                  bits per pixel: 16
                  GUID: 5955593200001000800000aa00389b71 (YUY2)
                  default frame: 1
                  aspect ratio: 0x0
                  interlace flags: 00
                  copy protect: 00
                        FrameDescriptor(1)
                          capabilities: 01
                          size: 160x120
                          bit rate: 3072000-3072000
                          max frame size: 38400
                          default interval: 1/10
                          interval[0]: 1/10
END DEVICE CONFIGURATION
I (8873) example: format_desc->fourccFormat=(YUY2)
I (8883) example: frame_desc->wWidth=160
I (8883) example: frame_desc->wHeight=120
I (8893) example: format_desc->bDescriptorSubtype=4
I (8893) example: frame_desc->dwDefaultFrameInterval=1000000
I (8903) example: format_desc->bDescriptorSubtype == UVC_VS_FORMAT_UNCOMPRESSED
W (8913) example: FRAME SIZE=160x120 FRAME RATE=10
W (8913) example: FRAME FORMAT=YUYV
I (8923) example: format=3 width=160 height=120 fps=10
bmHint: 0001
bFormatIndex: 1
bFrameIndex: 1
dwFrameInterval: 1000000
wKeyFrameRate: 0
wPFrameRate: 0
wCompQuality: 0
wCompWindowSize: 0
wDelay: 4
dwMaxVideoFrameSize: 38400
dwMaxPayloadTransferSize: 512
bInterfaceNumber: 1
I (9113) example: uvc_start_streaming=0
Streaming...
I (10563) example: fps: 12, bytes per second: 460800
I (11653) example: fps: 11, bytes per second: 422400
I (12673) example: fps: 10, bytes per second: 384000
I (13763) example: fps: 11, bytes per second: 422400
sbyang369 commented 1 month ago

thanks so much. My issue is after I inserted the usb camera (after idf.py flash monitor), the device information didn't show up.

I (746) wifi_init: tcp rx win: 5760 I (746) wifi_init: tcp mss: 1440 I (756) wifi_init: WiFi/LWIP prefer SPIRAM I (756) wifi_init: WiFi IRAM OP enabled I (766) wifi_init: WiFi RX IRAM OP enabled I (766) phy_init: phy_version 2500,8368a9b,Mar 21 2024,19:51:06 I (806) wifi:mode : sta (80:65:99:41:04:5e) I (806) wifi:enable tsf I (816) example: wifi_init_sta finished. I (816) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1 I (816) wifi:state: init -> auth (b0) I (1656) wifi:state: auth -> assoc (0) I (1666) wifi:state: assoc -> run (10) I (1706) wifi:connected with jade, aid = 8, channel 6, BW20, bssid = c6:50:9c:43:e8:71 I (1706) wifi:security: WPA3-SAE, phy: bgn, rssi: -42 I (1706) wifi:pm start, type: 1

I (1706) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us I (1726) wifi:idx:0 (ifx:0, c6:50:9c:43:e8:71), tid:7, ssn:3, winSize:64 I (1796) wifi:AP's beacon interval = 102400 us, DTIM period = 1 I (1906) wifi:idx:1 (ifx:0, c6:50:9c:43:e8:71), tid:0, ssn:1, winSize:64 I (2716) esp_netif_handlers: sta ip: 10.0.0.38, mask: 255.255.255.0, gw: 10.0.0.1 I (2716) example: got ip:10.0.0.38 I (2716) example: connected to ap SSID:xxx password:xxxxxxx I (2726) example: mdns hostname set to: [esp-cam] I (2726) example: cparam0=[10.0.0.38] I (2726) HTTP: Start task_parameter=10.0.0.38 I (2736) HTTP: Starting HTTP server on http://10.0.0.38:8080 Waiting for device

========= at this point, I connected my camera to the esp32-s2, but nothing happens.

I noticed that you mentioned that "Stable power supply USB cameras consume a lot of electricity. If the power supplied to the USB port is insufficient, the camera will not operate and ESP32 resets."

My usb camera is just connected directly to the esp32-s2 board, and the board is connected to my computer via a usb connection. Would that be a problem?

sbyang369 commented 1 month ago

Here are some photos of my setup if that helps! Thank you so much!

nopnop2002 commented 1 month ago

Your photos were very helpful.

USB camera connects via USB connector.
USB connectors are available from AliExpress or eBay. I used it by incorporating it into a Universal PCB.

The USB port on the ESP32 board does not function as a USB-HOST.

+---------+  +-------------+  +----------+
|ESP BOARD|==|USB CONNECTOR|==|USB CAMERA|
+---------+  +-------------+  +----------+
ESP BOARD          USB CONNECTOR (type A)
                         +--+
5V        -------------> | || VCC
[GPIO19]  -------------> | || D-
[GPIO20]  -------------> | || D+
GND       -------------> | || GND
                         +--+

USBConnector

IMG_5982