Run command on camera connect

Forum for questions and support relating to the 1.29.x releases only.
Locked
Kalashnikova
Posts: 2
Joined: Fri Feb 26, 2016 7:10 am

Run command on camera connect

Post by Kalashnikova »

Hello,

I am using zoneminder in combination with two C7837WIP vstarcam's. On Ubuntu 14.04 server edition on a HP microserver.

The Vstarcam C7837WIP cam's are Cheap and Chinese camera's which come with horrible software and horrible firmware as was to be expected for a dome camera at 40 bucks a pop. Still good value for money. Been a project ever since. Eventually got it working in the following manner:
source
source
source.png (45.69 KiB) Viewed 3477 times
general
general
general.png (51.63 KiB) Viewed 3477 times
there is one catch with these camera's. By default the resolution on the camera is set to 320x180. So after a reboot it is always set back to 320x180.
So when I set my resolution to 640x360 on the camera and in zoneminder. It works a treat. Until the moment a camera reboots for whatever reason. At that time the resolution goes back to 320x180. Which does not play well with the "source" camera resolution settings of 640x360 in zoneminder.

To get around this and force the camera into the correct resolution after a reboot. I now made the following script.

Code: Select all

tail -f /var/log/syslog | while read LOGLINE
do
   [[ "${LOGLINE}" == *"'zmc -m 3' starting at"* ]] && curl 'http://192.168.1.10:81/camera_control.cgi?loginuse=admin&loginpas=888888&param=15&value=1' && sleep 30
done
In short. I figured out the CLI command to change the resolution on connection of the camera. I now tail the syslog file for 'zmc-m3 starting at'. Then it runs the command and waits for 30 seconds.

I am not a coder. Regex is not really my specialty. This is very crude, it works, but in my opinion it is butt ugly. And don't even want to know what will happen to my HP microserver when I start doing this trick with 10 camera's at a time lol. I do not know where to start searching as it usually works the other way around. Camera's alarm ----> action is triggered. And I want to trigger an action before the camera does anything. Just from an event in the log

Does anybody have a more elegant way to work around this problem ?

Thanks.
danilodb
Posts: 1
Joined: Sat Jan 14, 2017 11:48 am

Re: Run command on camera connect

Post by danilodb »

Hi... I have been struggling around trying to set a connection between zoneminder and a Vstarcam C7837WIP.
Reading this post seems you have been able to do that. May I ask you please how you set it? ...and what release of zoneminder are you using?
I have tried the settings in your screenshots but with no luck at all.

Thanks
User avatar
iconnor
Posts: 2900
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Run command on camera connect

Post by iconnor »

You know instead of parsing the logs and all that... just send the command before starting zmc every time. Doesn't matter if the camera is already functioning at the correct res....
Kalashnikova
Posts: 2
Joined: Fri Feb 26, 2016 7:10 am

Re: Run command on camera connect

Post by Kalashnikova »

Been a while since I fiddled with my camera setup. Has been working stable for the last year. Was looking into getting the vstarcam c7837 camera controls working in zoneminder and stumbled upon this post. So,sorry danilodb for the late reply, better late then never :mrgreen: .

Dropped this whole log parsing thing. Was thinking about it all wrong. Instead I changed to rstp instead of http.
To achieve this I did the following:

At the camera settings under the general tab Change the source type to ffmpeg.
Switch the source tab and use RTP/Unicast as Remote Method. and set the following source path:

Code: Select all

rtsp://username:password@camera_ip_address:10554/udp/av0_0
Set 32bit color and the resolution to 1280x720,

restart zoneminder.

That fixed it for me.

The following document came in handy for me as well in combination with the vstarcam
http://www.notesco.net/download/ipcamcgisdk21.pdf

For instance, the camera has the annoying habit to rotate around after a reboot.

Code: Select all

http://camera_ip_address:81/set_misc.cgi?ptz_center_onstart=0&user=admin&pwd=888888
Fixes this. Got that info from the cgisdk
Locked