Jump to content

Added a Zoneminder mjpeg stream to IP cameras


3gdigital

Recommended Posts

Here is an example of how I added a live streaming zoneminder Camera to my ISY994i.

 

1. Access the isy via http and login.

2. Click New Camera

3. Change Brand to "Other"

4. Enter the following: http://MyZoneminderServerAddress.com(IPaddress)/zm/cgi-bin/nph-zms?mode=single&monitor=3&scale=100&user=MyUser&pass=MyPassword

 

You will need to modify the following within the url:

MyZoneminderAddress.com to you fqdn, or server ip address : Allows access to the zoneminder Server

Monitor= : change the number to point to the camera you wish to monitor within zoneminder.

Scale= : is the percentage to scale the picture

User= : must change to the zoneminder username used to login

pass= : change to your password

 

5. Press Ok

 

Note:  The username must have at least view access to the monitors you would like to stream.

 

Hope someone finds this helpful.

Link to comment
  • 5 months later...

Sorry to revive a stale thread, but I have a ZoneMinder related question.    

 

BACKGROUND

 

I recently looked at NVR solutions compatible with my existing infrastructure and IP cameras.  Since I can't run new wires to all my locations coupled with the fact I did not want to scrap my existing IP cameras for P2P PoE cameras, I ended up repurposing a 5 year old Core 2 Quad machine as a ZM NVR and upgraded my router to a dual core AC1900 to handle the additional traffic.  I got everything up and running fairly quickly and even purchased the ZmView native iOS app.   Works like charm!

 

I have three cameras, 2 exterior and 1 interior.   I have set up ZM to MODECT (motion record only) mode to limit abuse on the hard drives.  Now I find that I want to further limit the recoding to only when my Elk is armed.  For example enable recording of all cameras in AWAY mode, but only exterior cameras in STAY mode.  

 
The ZM API documentation allows one to use CURL and JSON to change the state of each camera individually.   

 

https://github.com/ZoneMinder/ZoneMinder/blob/master/docs/api.rst#change-state-of-monitor-1

curl -XPOST http://server/zm/api/monitors/1.json -d "Monitor[Function]=Modect&Monitor[Enabled]:true"

QUESTION

 

Using the ISY Network Resources, how do I emulate the CURL command?  I also have ZM authentication enabled, so I assume I would need to pass the ID/PW in.  

 

 

Thanks in advance

 

Elvis

 

 

 

UPDATE

 

ZM apparently supports XML if that makes a difference.

 

https://github.com/ZoneMinder/ZoneMinder/blob/master/docs/api.rst#examples

Here be a list of examples. Some results may be truncated.
You will see each URL ending in either .xml or .json. This is the format of the request, and it determines the format that any data returned to you will be in. I like json, however you can use xml if you'd like.
(In all examples, replace 'server' with IP or hostname & port where ZoneMinder is running)
Link to comment

I think I figured it out with some help. Unfortunately ZM 1.26.5 I have installed from packages does not support the API. It's still a WIP even in 1.28.1, although I read someone was successful getting the API install by installing ZM from source. Ugh!

POST /zm/api/monitors/1.json HTTP/1.1Host: 192.168.69.85:80
User-Agent: curl/7.37.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 47
Accept: */*
Authorization: Basic ***************************

Monitor[Function]=Monitor&Monitor[Enabled]:true
Link to comment
  • 4 weeks later...

For anyone interested in controlling a ZM camera mode based on an ISY event while the ZM API is still a WIP, I figured out how to control the camera mode using ISY network resources with HTTP POST.  

 

 

I have ZM built in authentication enabled, thus needed to generate a cookie I could reuse in the ISY. 

curl -d "username=username&password=password&action=login&view=console" http://192.168.69.85/zm/index.php -c zm.cookie

Then you can examine HTTP headers sent by the curl command to reverse engineer what needs to populated in the ISY.  

curl -v -d "view=none&action=function&mid=1&newFunction=Modect&newEnabled=1" http://192.168.69.85/zm/index.php -b zm.cookie
* Hostname was NOT found in DNS cache
*   Trying 192.168.69.85...
* Connected to 192.168.69.85 (192.168.69.85) port 80 (#0)
> POST /zm/index.php HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 192.168.69.85
> Accept: */*
> Cookie: zmSkin=classic; ZMSESSID=*************************
> Content-Length: 63
> Content-Type: application/x-www-form-urlencoded

Below is what the ISY network resource module HTTP looks like.

POST /zm/index.php HTTP/1.1
Host: 192.168.69.85:80
Content-Length: 63
User-Agent: curl/7.38.0
Content-Type: application/x-www-form-urlencoded
Accept: */*
Cookie: zmSkin=classic; ZMSESSID=**************************

view=none&action=function&mid=1&newFunction=Modect&newEnabled=1 

Let me know if there is a better method. 

 

Elvis.

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.6k
    • Total Posts
      368.3k
×
×
  • Create New...