nopnop2002 / esp-idf-video-streaming

Capture video from a USB camera using ESP-IDF
MIT License
49 stars 6 forks source link

webserver unreachable [and papalook AF925 working] #14

Closed halie412 closed 1 year ago

halie412 commented 1 year ago

Hi nopnop2002 your code is awesome, i wasted 3 days with anothers... With your code i get stream worked (or almost that)

I´m using an ESPRESSIF ESP32-S3-WROOM-1

This is my trouble, i hope would you help me:

When i start the server this apparently is started but is unrecheable, i already tested with 3 different routers (all of they working, and with differents ssid, different password, network, etc), also tested differents ports everytime is same thing

When i run the code get this on console:

I (1031) example: wifi_init_sta finished.
I (1101) wifi:new:<10,2>, old:<1,0>, ap:<255,255>, sta:<10,2>, prof:1
I (1101) wifi:state: init -> auth (b0)
I (1101) wifi:state: auth -> assoc (0)
I (1111) wifi:state: assoc -> run (10)
I (1221) wifi:connected with (my ssid), aid = 7, channel 10, 40D, bssid = (an router mac)
I (1221) wifi:security: WPA2-PSK, phy: bgn, rssi: -52
I (1221) wifi:pm start, type: 1

I (1221) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 0, mt_pti: 25000, mt_time: 10000
I (1241) wifi:<ba-add>idx:0 (ifx:0, b0:95:75:fa:0b:8e), tid:0, ssn:3, winSize:64
I (1301) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (2731) esp_netif_handlers: sta ip: 192.168.2.54, mask: 255.255.255.0, gw: 192.168.2.1
I (2731) example: got ip:192.168.2.54
I (2731) example: connected to ap SSID:(my ssid) password:(my pass)
I (2741) example: mdns hostname set to: [esp-cam-test]
I (2741) example: cparam0=[192.168.2.54]
I (2751) HTTP: Start task_parameter=192.168.2.54
I (2751) HTTP: Starting HTTP server on http://192.168.2.54:8080
Waiting for device

but in browser i can´t get any bit of response when i try to open or connect whith the url (http://192.168.2.54:8080) image

i tested with terminal with get command and this stucked here: image

 wget http://192.168.2.54:8080
--2023-03-07 16:47:27--  http://192.168.2.54:8080/
Connecting to 192.168.2.54:8080... 

sometimes i got this, but i can´t read any bit become from the esp32-s3:

wget http://192.168.2.54:8080/
--2023-03-07 17:46:00--  http://192.168.2.54:8080/
Connecting to 192.168.2.54:8080... connected.
HTTP request sent, awaiting response... 

if try to connect with the mdns i get: DNS_PROBE_FINISHED_NXDOMAIN

I tested this before and afeter of connect the cammera (papalook AF925) and always is same thing the server is unreacheable

I setup the cammera in resolution 160 x 120, 5 FPS and actived MJPEGFormat and work fine as your example: image

In the terminal got:

END DEVICE CONFIGURATION
I (767971) example: format_desc->fourccFormat=(YUY2)
I (767971) example: frame_desc->wWidth=160
I (767981) example: frame_desc->wHeight=120
I (767981) example: format_desc->bDescriptorSubtype=4
I (767991) example: frame_desc->dwDefaultFrameInterval=500000
I (768001) example: format_desc->bDescriptorSubtype == UVC_VS_FORMAT_UNCOMPRESSED
W (768001) example: FRAME SIZE=160x120 FRAME RATE=5
W (768011) example: FRAME FORMAT=MJPEG
I (768011) example: format=7 width=160 height=120 fps=5
bmHint: 0001
bFormatIndex: 2
bFrameIndex: 1
dwFrameInterval: 2000000
wKeyFrameRate: 0
wPFrameRate: 0
wCompQuality: 61
wCompWindowSize: 0
wDelay: 0
dwMaxVideoFrameSize: 39528
dwMaxPayloadTransferSize: 512
bInterfaceNumber: 1
I (768061) example: uvc_start_streaming=0
Streaming...
I (770341) example: fps: 4, bytes per second: 156112
I (771751) example: fps: 3, bytes per second: 117084
I (773161) example: fps: 3, bytes per second: 117084
I (774561) example: fps: 3, bytes per second: 117084
I (775941) example: fps: 3, bytes per second: 117084
I (777351) example: fps: 3, bytes per second: 117084
I (778761) example: fps: 3, bytes per second: 117084
I (780161) example: fps: 3, bytes per second: 117084
I (781541) example: fps: 3, bytes per second: 117084
I (782951) example: fps: 3, bytes per second: 117084
nopnop2002 commented 1 year ago

After this message appears, start your browser.

I (770341) example: fps: 4, bytes per second: 156112
I (771751) example: fps: 3, bytes per second: 117084
I (773161) example: fps: 3, bytes per second: 117084
I (774561) example: fps: 3, bytes per second: 117084
I (775941) example: fps: 3, bytes per second: 117084
I (777351) example: fps: 3, bytes per second: 117084
I (778761) example: fps: 3, bytes per second: 117084
I (780161) example: fps: 3, bytes per second: 117084
I (781541) example: fps: 3, bytes per second: 117084
I (782951) example: fps: 3, bytes per second: 117084
halie412 commented 1 year ago

Thanks nopnop2002 i try in this way but the browser don´t received any bit of info, i also tested with /favicon.ico and same thing no response, but in code are an handler for that url

httpd_uri_t _favicon_get_handler = {
        .uri         = "/favicon.ico",
        .method      = HTTP_GET,
        .handler     = favicon_get_handler,
        //.user_ctx  = "Hello World!"
    };
    httpd_register_uri_handler(server, &_favicon_get_handler);

This is an network debug on chrome: image

nopnop2002 commented 1 year ago

Is your browser running on the Linux or Windows?

Do you get a response when you ping to your ESP32?

ping 192.168.2.54

Do you see the following in your browser when you run this on your ESP32? hello

halie412 commented 1 year ago

Hi nopnop2022, forget my error your code is great... The mistake was corrupted data from the camera i just buy an logitech C270 and Microsoft HD 3000 and now can work.

I only may work the Microsoft HD 3000 at 15FPS in 640x480 with MPEJFormat ¿do you can recommed config for the logitech C270?

nopnop2002 commented 1 year ago

do you can recommed config for the logitech C270?

It can stream at 160x120 10FPS YUYV.

Other than this setting it doesn't work.

It is very hard to find a camera that works with ESP-IDF.