ESP32 Cam not working properly with ZM

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
GTA
Posts: 2
Joined: Mon May 03, 2021 11:01 pm

ESP32 Cam not working properly with ZM

Post by GTA »

This is my first experience with ZM and currently using the latest 1.34.25 on Ubuntu 18.04 LTS installed on an Odroid C1+ SBC. I've mounted an external 250G USB HDD which I intend to store recorded events. I can expand the storage if necessary but it'll suffice for now.

Unfortunately, there's little to no information on matching up the ESP32 Cam with ZM to be found online. Ultimately I tried the Tasmota FW and flashed it with the infomation found here: https://cgomesu.com/blog/Esp32cam-tasmo ... troduction

It's a pretty nifty build and I am able to view the ESP32 Cam from it's built-in web server. I can view it correctly in all supported video resolutions with decent frame rates and good results in ZM using:

Function = Monitor
Source URL = http://DEVICE_IP:81/stream
Source Type = Web Site

Great start! I though. But after hours of messing around, I couldn't get it to detect and record any motion. With some more digging, I found out that recording is not supported with this Source Type - Bummer!

So I tried other modes and the only Source Type that is producing anything resembling a stream is using Source Type = cURL (HTTP(S) only).

https://i.imgur.com/SkLyU7G.jpg

In the ZM Console, everything seems to be working and green with the Monitor Function indicating it's capturing at 12 fps, depending on the resolution selected. So it seems happy enough.

https://i.imgur.com/CBXXZxZ.jpg

However, in this Source type, the monitor view is all distorted and fills only a portion of the monitor field window. It reminds me of an old analog CRT TV with an anlalog tuner connected to rabbit ear antenna. One bright spot is that I can definitely discern motion when I wave my hand in front of the camera, though can't determine what is moving because of the distortion.

https://i.imgur.com/5nSCCOy.jpg

No amount of mucking around am I able to get beyond this point. I'm not sure where to go from here and I believe that it is indeed working but the video stream being decoded or rendered but is a bit skewed. It may record properly but I haven't tried that yet.

I have a real outdoor security camera on order but haven't received it yet. Though it is a wired POE camera as I intend to hardwire it in. But this ESP32 cam will be placed where I can't string a wire to, which is why I want to use it in that location.

Can anyone point me in the right direction?
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: ESP32 Cam not working properly with ZM

Post by alabamatoy »

GTA wrote: Mon May 03, 2021 11:45 pm But this ESP32 cam will be placed where I can't string a wire to, which is why I want to use it in that location.
How do you power it? with batteries?

I hear people say "I cant run a wire to it, I want to use wireless" and I ask how they get power to the wireless device, and most of the time the answer is, "I run a wire". :roll: Wallwarts everywhere = fugly. If you are going to run a wire, run a wire and ditch the wifi. POE injectors, splitters and switches are pretty cheap, and have the secondary positive of being able to power your cameras off a central UPS that's also powering your ZM server, so when the power blips (which happens a LOT at my place) nothing goes down.
GTA
Posts: 2
Joined: Mon May 03, 2021 11:01 pm

Re: ESP32 Cam not working properly with ZM

Post by GTA »

What I really meant was that I can't easily run an ethernet cable to it, hence I'm using Wifi for the stream.

Powering it won't be a problem as there's a mains outlet nearby and the least of my concerns right now. It's currently running a tiny cube type wallwart that supplies up to 400mA @ 5V. Enough current to make it work. Yes, it's a cap-dropper based on it's size but no one will be messing with it.

I'd love to be able to solve the distorted video stream that ZM if producing though.
User avatar
burger
Posts: 386
Joined: Mon May 11, 2020 4:32 pm

Re: ESP32 Cam not working properly with ZM

Post by burger »

ESP32 is not commonly used. You are somewhat on your own. Better off getting a known working and stable brand, unless you want a project to dig into. See https://wiki.zoneminder.com/Hardware_Compatibility_List

Feel free to post your findings with the ESP32 there.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
chuck8530
Posts: 94
Joined: Sun Nov 21, 2021 2:45 am

Re: ESP32 Cam not working properly with ZM

Post by chuck8530 »

I have a RasPi cam - works great - remote, etc. If I curl http://[rpcam] it seems to start right into the image. Whereas the ESP32 seems to have a different ?header?data? after the "ÿØÿà^@^PJFIF^@^A^A...".

Now the ESP32 displays just fine in Firefox & VLC, but not ZM. That says to me that ZM is ?expecting? format X for data and the 32 is outputting format Y - jpg, yes but just a shade different.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: ESP32 Cam not working properly with ZM

Post by knight-of-ni »

Without knowing how the code running on the ESP32 does the streaming, it is going to be hard to tell you what the right settings in zoneminder will be.

You may have some luck with the way we used to figure this out for gen 1 ip cameras (pre-Onvif)... load the camera web page, right click on the stream, copy the url to your clipboard, then use that URL as a monitor of type Remote with a protocol of HTTP. No guarantees, but it is worth a shot.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
chuck8530
Posts: 94
Joined: Sun Nov 21, 2021 2:45 am

Re: ESP32 Cam not working properly with ZM

Post by chuck8530 »

And with that - Ta-Da!
Monitors (6,'Monitor-6',
'',0,0,'Libvlc','Mocord,1,NULL,'','',0,0,NULL,1,'http','rtpRtsp','sg34','81','','http://sg34:81/stream',NULL,NULL,NULL,1 ... ,NULL,NULL,'# Lines beginning with # are a comment \r\n# For changing quality, use the crf option\r\n# 1 is best, 51 is worst quality\r\n#crf=23',0,0,-1,-1,-1,-1,'Event-','%N - %d/%m/%y %H:%M:%S',0,0,1,20,0,5,5,0,1,600,10,0,0,7.00,0,10.00,10.00,100,6,6,0,NULL,NULL,NULL,NULL,0,NULL,-1,NULL,100,100,'auto',0,'#0000BE','#92ab03',0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,NULL);

Key is: Source type: Libvlc, TCP, 24 bit color. and it works. Why nothing else does ...???
Not the best image, no sun, 12" of snow overnight Sat May 21 07:37:47 AM MDT 2022 - Ho, Ho, Ho - Bah, humbug!

Source code: loaded arduino-esp32-master.zip - File - Examples - ESP32 - Camera - CameraWebServer
and added
-----------------
IPAddress ip(192, 168, 0, 34);
IPAddress gateway(192, 168, 0, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress DNS(8, 8, 8, 8);

WiFi.config (ip, gateway, subnet);
------------------
Amazon: Frienda 2 Pieces ESP32-CAM WiFi Board
Wish I knew more of the internals of ZM. If I haven't answered everything ...
Attachments
esp32-cam.jpg
esp32-cam.jpg (15.06 KiB) Viewed 3779 times
chuck8530
Posts: 94
Joined: Sun Nov 21, 2021 2:45 am

Re: ESP32 Cam not working properly with ZM

Post by chuck8530 »

New project. So I've read that a ESP32-cam draws 180mAh. If I use a 30000ma solar battery bank (amazon $25) my math says 166 hours - just need overnight. https://www.youtube.com/watch?v=0uz-YrfaSO8 says by using 2 18650 batteries he get 24h+. Not his case, a thingiverse 3D case.

Film at 11
Post Reply