ESP32-CAM format

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
chuck8530
Posts: 23
Joined: Sun Nov 21, 2021 2:45 am

ESP32-CAM format

Post by chuck8530 »

I've gotten a ESP32-CAM working - displays on Firefox and VLC but not in ZM. I think the problem is the incoming data:
^M
--123456789000ccc000000987654321^M
Content-Type: image/jpeg^M
Content-Length: 123200^M
^M
ÿØÿà^@^PJFIF^@^A^A^A^@^@^@^@^@^@ÿÛ^@C^@
^G^H ^H^F
^H ^K^K
^L^O^Y^P^O^N^N^O^_^V^W^R^Y$ &&$ #"(-:1(+6+"#2D36;=@A@'0GLF?K:?@>ÿÛ^@C^A^K^K^K^O^M^O^]^P^P^]>)#)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ÿÄ^@^_^@^@^A^E^A^A^A^A^A^A^@^@^@^@^@^@^@^@^A^B^C^D^E^F^G^H
^KÿÄ^@µ^P^@^B^A^C^C^B^D^C^E^E^D^D^@^@^A}^A^B^C^@^D^Q^E^R!1A^F^SQa^G"q^T2<81><91>¡^H#B±Á^URÑð$3br<82>
^V^W^X^Y^Z%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz<83><84><85><86><87><88><89><8a><92><93><94><95><96><97><98><99><9a>¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚ...

I've tried every combination I can think of to add it - no joy. Suggestions?
mikb
Posts: 519
Joined: Mon Mar 25, 2013 12:34 pm

Re: ESP32-CAM format

Post by mikb »

chuck8530 wrote: Wed May 11, 2022 8:38 pm
--123456789000ccc000000987654321^M
Content-Type: image/jpeg^M

JFIF
Looks like a MIME attachment of a JPEG (JFIF is the first 4 characters of a JPEG image).

Reminiscent of the data served up by "/video.cgi" on my DCS900 D-link Cameras, which claims to be MJPEG -- it's a really odd way of encoding an MJPEG. FFMPEG will accept it [edit: Oops. See Follow Up], if told format is "mjpeg" ... as a hint. Otherwise, I don't think it knew what to do with it.

D-Link: Attach a JPEG, attach a JPEG, attach a JPEG .... (each of which fully describes a single discrete JPG image/frame).

Proper MJPEG: A common header for *all* frames about to follow, then a stream of JPG coded data ... (more efficient in that all frames refer back to that first header). Oh, and not MIME encoded ... either!

Try JPEG or MJPEG?

Example output below ...

Code: Select all

/usr/bin/echo -e "GET /VIDEO.CGI HTTP/1.1\n" | nc 192.168.0.XX 80 | more

HTTP/1.0 200 OK
Server: Camera Web Server/1.0
Auther: Steven Wu
MIME-version: 1.0
Cache-Control: no-cache
Content-Type: multipart/x-mixed-replace;boundary=--video boundary--

--video boundary--Content-length: 25006
Content-type: image/jpeg

ÿØÿâJFIF .... blah blah

Code: Select all

 /usr/bin/echo -e "GET /IMAGE.JPG HTTP/1.1\n" | nc 192.168.0.XX 80 | more
HTTP/1.0 200 OK
Server: Camera Web Server/1.0
Auther: Steven Wu
MIME-version: 1.0
Cache-Control: no-cache
Content-Type: image/jpeg
Content-Length: 24646

ÿØÿâJFIF ... blah blah
Last edited by mikb on Fri May 13, 2022 5:35 pm, edited 1 time in total.
chuck8530
Posts: 23
Joined: Sun Nov 21, 2021 2:45 am

Re: ESP32-CAM format

Post by chuck8530 »

First, thanks for the help. Sorry for the delay - events and trying other things.

/usr/bin/echo -e "GET /stream HTTP/1.1\n" | nc 192.168.0.33 81 | more
screams

ZM log says Found unsupported content type. I've searched for ZM & JFIF - no joy. My biggest problem is I'm an end user and I don't know/understand ZM internals. And Google has not been any help at all.
--------------------------------
5 min later - grep'n for JFIF - ZM knows about it. - ./skins/classic/views/monitor.php has the entry:
fourcc('J','P','E','G') => '*JPEG', /* JFIF JPEG */
But in /usr/bin/zm* - nada
mikb
Posts: 519
Joined: Mon Mar 25, 2013 12:34 pm

Re: ESP32-CAM format

Post by mikb »

Update :-

I'm using ZM 1.ancient -- and I set up :-

Code: Select all

Source Type "Remote"
Protocol "HTTP/Simple"
And it just worked. Now, at some point no doubt "Remote" is deprecated and using FFMPEG etc. is the way to go.

However -- I just looked at my old scripts for capturing from these cameras outside of ZoneMinder (which spit JPEGs as MIME headered stuff, in place of proper video) and FFMPEG did *NOT* understand it at all.

I (badly) wrote a C hack filter, to strip out all the one-time-header and repeating-per-frame-headers rubbish, leaving only the meat of the JPEG images -- and put this in line between the "netcat" (nc) and FFMPEG reading from stdin, at which point it was happy. I still had to tell it "-f mjpeg" so it knew what was coming in. It tolerated that just fine!

So -- if you are using FFMPEG as your camera type, it may not support this camera without extra work, unless FFMPEG has become much more tolerant in terms of the garbage fed in ;)
chuck8530
Posts: 23
Joined: Sun Nov 21, 2021 2:45 am

Re: ESP32-CAM format

Post by chuck8530 »

Ver 1.34.26
I purchased a pair: Frienda 2 Pieces ESP32-CAM WiFi Board ESP32-CAM-MB Micro USB to Serial Port CH340G with OV2640 2MP Camera Module Compatible with Arduino IDE Arduino Raspberry Pi via Amazon.

Then using Ardunio I loaded it with code for CAMERA_MODEL_AI_THINKER. It outputs 2 different pages: 80 which has a large menu - res, bright, contrast, flip, and another 20 settings. #2 is IP:81/stream which gives just the image. In Firefox, VLC it pops right up and runs fine. I have tried every ZM configuration possible and - no joy. Logs: Protocol not found - and Google hasn't been my friend. Education please.
tks
Post Reply