ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
4.9k stars 1.2k forks source link

ONVIF Support #146

Closed skydiverscott closed 9 years ago

skydiverscott commented 10 years ago

Does the new version of ZM support ONVIF cameras?

knight-of-ni commented 10 years ago

It depends what you mean. Technically speaking all versions of zoneminder support acquiring a stream from an onvif camera as long as the camera does not require digest authentication. However, there are no plans that I am aware of to explicitly support any of the other features laid out in the onvif specification.

skydiverscott commented 10 years ago

I am getting a review version of a Plustek VS 540I video encoder http://plusteksecurity.com/products/video-servers/vs-540i/specs.html. 4 ports for 200, 120 fps. They have an open API for the device. If I get this to test who can help to craft a device plugin?

Scott R. Morgan 512-762-7675 Cell skydiver@srmservices.com www.scottrobertmorgan.com

Join my network on LinkedIn

It depends what you mean. Technically speaking all versions of zoneminder support acquiring a stream from an onvif camera as long as the camera does not require digest authentication. However, there are no plans that I am aware of to explicitly support any of the other features laid out in the onvif specification.

— Reply to this email directly or view it on GitHub.

skydiverscott commented 10 years ago

The ONVIF specification also provides for functionality like PTZ, setting configuration of the ONVIF devices, etc. I primarily want to try to get the very low cost ($275 USD) 8 port/120fps analog to IP based encoder to work so we can upgrade several sites to IP based monitors running the Zoneminder instance in a VM. This device supports RS485 for PTZ control, video out, etc. It has a very complete set of high end functionality at a price that is unbeatable. If I can get the API documentation for the device, how do I go about getting the code implemented like the Axis devices are implemented?

knight-of-ni commented 10 years ago

Generally speaking, Zoneminder is already capable of supporting devices like the one described. It doesn't matter if the device is ONVIF compliant or not.

The caveats one must look out for are: 1) Devices that will only work with IE running an ActiveX module (zoneminder will never support these) 2) Devices that require digest authentication (a valid deficiency that will be addressed in the future)

To go about getting your device to work with Zoneminder, you must determine the: 1) video stream url 2) ptz control url for each and every command accepted by the device

The API documentation is a valuable tool to figuring these out, as is looking directly at the html source of the device's web page and running a good ole' Wireshark session to see what is being sent to the camera.

Once you know the url's, enter the video stream url into your monitor configuration. The ptz control url's are a bit more complicated, however. You must write a ptz control script, in perl, to support the camera commands. This is often done by editing an existing ptz control script.

Lastly, if you do get this device working and post the programming steps into the forum, I will be glad to add this into the zoneminder source tree as a camera preset.

skydiverscott commented 10 years ago

I have the rtsp stream urls from eh manufacturer and have posted a support question on the forums but haven't been able to elicit any help yet. With the new git repository, where is the best place to seek assistance?

knight-of-ni commented 10 years ago

Yes, the best place for that kind of help is the forums. Care to post the link to the thread?

skydiverscott commented 10 years ago

http://www.zoneminder.com/forums/viewtopic.php?f=29&t=21447&p=81430#p81430

kylejohnson commented 10 years ago

@skydiverscott As @knnniggett mentioned, try using port 554. Also try using RTP/RTSP as the Source Method instead of RTP/RTSP/HTTP. I would try both Source Methods with port 554.

With that said, once #174 is merged, you may have better success with these cameras.

skydiverscott commented 10 years ago

I actually have the manufacturer/developers of this device working to get it to work with Zoneminder: "I got feedbacks from our developers: Both ZoneMinder v1.24.2 and 1.25.0, tested with rtsp and ffmpeg, all failed. It seems that ZoneMinder does not allow user to use user id and password to connect IP cam or video encoder. We also tested Axis camera by using RTSP, it also need to use anonymous to get connected. We also try to follow the discussions over at the forum, tried to add user id and password for the ffmpeg and rtsp but still not working. rtsp://username:password@serverip/v1m If we use VLC, everything is working as expected. Do you know if there is any other way to connect with Zoneminder? Or any technical person in Zoneminder who we can contact to address this issue? Another possibility is that our developer can create a commandline for link with Zoneminder, but this will also need to know Zoneminder syntax to follow…"

I think it is great that we have a manufacturer looking to be able to natively support Zoneminder. Anybody here that can assist with this product manufacturer with some troubleshooting?

knight-of-ni commented 10 years ago

Translation: The device's video stream is trying to use digest authentication, which zoneminder doesn't support.

That's why I suggested earlier to try and turn off authentication altogether during the testing process so we could see if there were any other issues.

As a workaround, I suggest you ask the manufacturer if they can release a firmware that allows you to turn off authentication. Yes, that means anyone can get into it (so make sure it is behind a firewall).

I acknowledge that this is an issue that ultimately should be addressed in zoneminder, but at the moment I am not aware of anyone who is working on it.

Labelling this a duplicate of issue #30

kylejohnson commented 10 years ago

Another user recommended that we switch over to use libcurl for authentication, which does support digest. This is a good idea (tm) howeer as @knnniggett said, no one is currently working on it. Feel free to contribute. ;)

mastertheknife commented 10 years ago

Adding libcurl is on my todo list. We definitely need it.

kylejohnson commented 10 years ago

So what exactly needs to be implemented in ZoneMinder to say that we support ONVIF cameras?

Referencing #238

skydiverscott commented 10 years ago

Johnson, Please see the thread in the GitHub thread at Zoneminder and the email forwarded here. They are looking for specifics of what Zoneminder would need to be able ot say that are ONVIF compatible.

On Sun, Nov 3, 2013 at 11:54 AM, Kyle Johnson notifications@github.comwrote:

So what exactly needs to be implemented in ZoneMinder to say that we support ONVIF cameras?

Referencing #238 https://github.com/ZoneMinder/ZoneMinder/issues/238

— Reply to this email directly or view it on GitHubhttps://github.com/ZoneMinder/ZoneMinder/issues/146#issuecomment-27649762 .

Scott R. Morgan 512-762-7675 Cell skydiver@srmservices.com www.scottrobertmorgan.com

Join my network on LinkedIn http://www.linkedin.com/in/skydiverscott Friend me on Facebook http://www.facebook.com/skydiverscott

kylejohnson commented 10 years ago

@skydiverscott Unfortunately none of us know the answer to that, which is why I asked here - what features, specifically, does ZoneMinder need in order to say that we are ONVIF compatible?

skydiverscott commented 10 years ago

Kyle are you at Plustek or are you a dev on the Zomeminder Github Site?

On Tue, Nov 5, 2013 at 9:55 AM, Kyle Johnson notifications@github.comwrote:

@skydiverscott https://github.com/skydiverscott Unfortunately none of us know the answer to that, which is why I asked here - what features, specifically, does ZoneMinder need in order tos ay that we are ONVIF compatible?

— Reply to this email directly or view it on GitHubhttps://github.com/ZoneMinder/ZoneMinder/issues/146#issuecomment-27784593 .

Scott R. Morgan 512-762-7675 Cell skydiver@srmservices.com www.scottrobertmorgan.com

Join my network on LinkedIn http://www.linkedin.com/in/skydiverscott Friend me on Facebook http://www.facebook.com/skydiverscott

kylejohnson commented 10 years ago

@skydiverscott I am one of the ZoneMinder devs.

web2wire commented 10 years ago

I have done some recent work with ONVIF so I have a little more knowledge than I did. Apologies if I have misunderstood the thread but I wanted to clarify. First is the discussion related to ZM being compliant as an ONVIF client or server. It could be either, ZM can either interrogate an ONVIF camera in order to determine characteristics of it and use that information to connect to streams etc, or ZM can be an ONVIF server and be queried by other network entities in order to obtain feeds or informaton from it, or to relay PTZ commands etc. In both cases the initial dialog (I believe) involves a short negotiation phase where capabilities can be queried and determined. This uses WSDL SOAP format so is not something current ZM will support (unless there have been MAJOR recent changes!). Adding ONVF capability to ZM as a server in the form of a php WSDL/SOAP server is pretty easy to do, and to relay commands onwards is not a big deal. Adding ONVIF queries to the binaries is much more fiddly in my opinion but adding an ONVIF discovery phase to when adding monitors via the web interface would be much more doable.

skydiverscott commented 10 years ago

I was forwarding your request to the company I was working with Johnson Yang at Plustek. They have an 8 input analog to IP camera server ($275 or $35/camera) that is ONVIF compatible that we were trying to get to work with Zoneminder. I was calling their attention to this thread to comment on what is needed for support of their device. The deivce is this one: http://plusteksecurity.com/products/video-servers/vs-580i/introduction.htmlIt support analog cameras up to D1 resolution along with a RS482 for PTZ control.

On Tue, Nov 5, 2013 at 10:19 AM, web2wire notifications@github.com wrote:

I have done some recent work with ONVIF so I have a little more knowledge than I did. Apologies if I have misunderstood the thread but I wanted to clarify. First is the discussion related to ZM being compliant as an ONVIF client or server. It could be either, ZM can either interrogate an ONVIF camera in order to determine characteristics of it and use that information to connect to streams etc, or ZM can be an ONVIF server and be queried by other network entities in order to obtain feeds or informaton from it, or to relay PTZ commands etc. In both cases the initial dialog (I believe) involves a short negotiation phase where capabilities can be queried and determined. This uses WSDL SOAP format so is not something current ZM will support (unless there have been MAJOR recent changes!). Adding ONVF capability to ZM as a server in the form of a php WSDL/SOAP server is pretty easy to do, and to relay commands onwards is not a big deal. Adding ONVIF queries to the binaries is much more fiddly in my opinion but adding an ONVIF discovery phase to when adding monitors via the web interface would be much more doable.

— Reply to this email directly or view it on GitHubhttps://github.com/ZoneMinder/ZoneMinder/issues/146#issuecomment-27786914 .

Scott R. Morgan 512-762-7675 Cell skydiver@srmservices.com www.scottrobertmorgan.com

Join my network on LinkedIn http://www.linkedin.com/in/skydiverscott Friend me on Facebook http://www.facebook.com/skydiverscott

skydiverscott commented 10 years ago

Hers is an open source library for the ONVIF systems: http://sourceforge.net/projects/onvifdm/?source=directory

web2wire commented 10 years ago

I think it's only an app, not a library but I could be wrong. I've used it to test things with. It's good but a bit flaky. I haven't found any alternative though.

sixdeuce062 commented 10 years ago

I am currently working with ONVIF at the camera end for Panasonic commercial cameras i have had some luck with ZM 1.25 haven't had time to build a machine for 1.26.4 yet i also have a nifty ONVIF query tool as well. the ONVIF commands work pretty good with 1.25 they use an ungodly amount of CPU space compared to going out of socket 554 havent played with the server side yet

skydiverscott commented 10 years ago

Looks like library code available here: http://sourceforge.net/p/onvifdm/code/HEAD/tree/trunk/libs/

knight-of-ni commented 10 years ago

That is written in C# (a.k.a. Micro$oft). Not sure how helpful that would be.

While making zoneminder officially understand ONVIF would make things like camera discovery easier, I just want to point out that, once we fix the rtsp issues and add digest authentication, zoneminder should support any camera advertised as ONVIF compliant. You would add the camera the same way you do now.

kylejohnson commented 10 years ago

This. This is what I think we need to do - "fully support" any camera advertised as ONVIF compliant.

On 11/5/13 12:45 PM, Andrew Bauer wrote:

That is written in C# (a.k.a. Micro$oft). Not sure how helpful that would be.

While making zoneminder officially understand ONVIF would make things like camera discovery easier, I just want to point out that, once we fix the rtsp issues and add digest authentication, zoneminder should support any camera advertised as ONVIF compliant. You would add the camera the same way you do now.

— Reply to this email directly or view it on GitHub https://github.com/ZoneMinder/ZoneMinder/issues/146#issuecomment-27795295.

sixdeuce062 commented 10 years ago

for the most part ONVIF (on the camera side) works the same way as a ffmpeg file i.e panasonic wv-series rtsp://admin:12345@1.2.3.4:554/MediaInput/h264...... instead you use the library or a query tool to pull file location on the camera and put it in the source line like so rtsp://1.2.3.4/ONVIF/MediaInput?profile=1_def_profile6 its just a standard compliance code to make it easier for the NSA spy on us i mean create a standard for surveillance developers

skydiverscott commented 10 years ago

Hi Scott,

Thank you so very much!! In the mean time I will try to setup a VS540 or VS580 with static IP for testing. I will keep you posted.

Thanks!

Johnson Yang

Plustek Security

O.714.670.7713 x8508

C.714.391.1069

JohnsonYang@PlustekUS.com

http://www.plusteksecurity.com/ http://www.PlustekSecurity.com

Member of ONVIF, ESA, SIA

From: Scott Morgan [mailto:skydiver@srmservices.com] Sent: Tuesday, November 05, 2013 7:54 AM To: ZoneMinder/ZoneMinder Cc: ZoneMinder/ZoneMinder; Johnson Yang Subject: Re: [ZoneMinder] ONVIF Support (#146)

Johnson,

Please see the thread in the GitHub thread at Zoneminder and the email forwarded here. They are looking for specifics of what Zoneminder would need to be able ot say that are ONVIF compatible.

On Sun, Nov 3, 2013 at 11:54 AM, Kyle Johnson <notifications@github.com mailto:notifications@github.com > wrote:

So what exactly needs to be implemented in ZoneMinder to say that we support ONVIF cameras?

Referencing #238 https://github.com/ZoneMinder/ZoneMinder/issues/238

Reply to this email directly or view it on GitHub https://github.com/ZoneMinder/ZoneMinder/issues/146#issuecomment-27649762 .

Scott R. Morgan 512-762-7675 Cell skydiver@srmservices.com mailto:skydiver@srmservices.com www.scottrobertmorgan.com http://www.scottrobertmorgan.com

Join my network on LinkedIn http://www.linkedin.com/in/skydiverscott Friend me on Facebook http://www.facebook.com/skydiverscott

xsmart commented 10 years ago

I have a ONVIF client library. https://github.com/xsmart/onvifc, it only depend QT5, And I can help port this Lib to Linux, and write a wrapper for ZM FFmpeg Camera. so and the VDC depend on this lib. I think Zm can use this lib to support ONVIF. User need input 4 or 5 param for ONIVF to work. IP Port User Password or the Profile Token.

Please refer: https://github.com/xsmart/vdc/blob/master/devices/include/device.hpp

inline void DeviceParam::UpdateUrlOnvif() { astring IP = m_Conf.data.conf.IP; astring Port = m_Conf.data.conf.Port; astring User = m_Conf.data.conf.User; astring Password = m_Conf.data.conf.Password; astring OnvifAddress = m_Conf.data.conf.OnvifAddress;

astring OnvifDeviceService = "http://" + IP + ":" + Port + "/" + OnvifAddress;
astring url = "rtsp://" + IP + ":" + "554" + "/";

DeviceManagement *pDm = new DeviceManagement(OnvifDeviceService.c_str(), 
                        User.c_str(), Password.c_str());

if (pDm  == NULL)
{
    VDC_DEBUG( "%s new DeviceManagement error \n",__FUNCTION__);
    return;
}

Capabilities * pMediaCap = pDm->getCapabilitiesMedia();
if (pMediaCap == NULL)
{
    VDC_DEBUG( "%s getCapabilitiesMedia error \n",__FUNCTION__);
    delete pDm;
    return;
}

MediaManagement *pMedia = new MediaManagement(pMediaCap->mediaXAddr(), 
                            User.c_str(), Password.c_str());
if (pMedia == NULL)
{
    VDC_DEBUG( "%s new MediaManagement error \n",__FUNCTION__);
    delete pDm;
    delete pMediaCap;
    return;
}

Profiles *pProfileS = pMedia->getProfiles();
if (pProfileS == NULL)
{
    VDC_DEBUG( "%s new getProfiles error \n",__FUNCTION__);
    delete pDm;
    delete pMediaCap;
    delete pMedia;
    return;
}
if (pProfileS->m_toKenPro.size() > 0)
{
    VDC_DEBUG( "%s m_toKenPro size %d \n",__FUNCTION__, pProfileS->m_toKenPro.size());
    QString strToken;
    if (m_Conf.data.conf.UseProfileToken == 1)
    {
        strToken = m_Conf.data.conf.OnvifProfileToken;
    }else
    {
        strToken = pProfileS->m_toKenPro[0];
    }
    StreamUri *pUri = pMedia->getStreamUri(strToken);
    if (pUri)
    {
        url = pUri->uri().toStdString();
        delete pUri;
    }

}
std::string strUrl = url;

/* rtsp://admin:12345@192.168.1.1:554/Streaming/Channels/1\
?transportmode=unicast&profile=Profile_1 */
astring urlWithUser = "rtsp://" + User + ":" + Password + "@";
Replace(strUrl, "rtsp://", urlWithUser.c_str());

m_strUrl = strUrl;

delete pDm;
delete pMediaCap;
delete pMedia;
delete pProfileS;
return;

}

xsmart commented 10 years ago

and I have test the ffmpeg camera to Hikvision ONVIF Camera. what we need do is change the source from onvif://admin:12345@192.168.0.123:80/Profile1 the Profile1 is the Profile1 user want use, to RTSP URL rtsp://admin:12345@192.168.0.123:554/Streaming/Channels/1

the UpdateUrlOnvif can done this.

xsmart commented 10 years ago

Also we can use the search function from the onvifc to probe the ONVIF camera

void VSCSearch::StartSearch() { if (m_bStarted == TRUE) { QMessageBox msgBox; //Set text msgBox.setText("Search is In Processing ..."); //Set predefined icon, icon is show on left side of text. //msgBox.setIcon(QMessageBox::Information); //set inforative text //msgBox.setInformativeText("Just show infornation."); //Add ok and cancel button. msgBox.setStandardButtons(QMessageBox::Ok); //Set focus of ok button msgBox.setDefaultButton(QMessageBox::Ok);

        //execute message box. method exec() return the button value of cliecke button
    int ret = msgBox.exec();

    return;
}
m_nSearchProcess = 0;
m_bStarted = TRUE;
m_nSearchCnt = 0;
QHostAddress host(ui.comboBox->currentText());
m_DeviceSearcher = DeviceSearcher::instance(host);
connect(m_DeviceSearcher, SIGNAL( receiveData(const QHash<QString, QString> &) ), 
            this, SLOT(SearchReceiveData(const QHash<QString, QString> &)));
m_DeviceSearcher->sendSearchMsg();

/* Fake */
//SearchCallback(this, "192.168.1.111", "/onvif/device_service", 0);
//SearchCallback(this, "192.168.1.112", "/onvif/device_service", 0);
//SearchCallback(this, "192.168.1.113", "/onvif/device_service", 0);

}

Marantz2600 commented 10 years ago

I got an Aote ONVIF camera over the weekend and spent some time trying to talk to it. It turns out you can do some things with just curl. You can put the Soap request into a file and then reference the file from the curl command line.

Here are some examples:

$ cat GetCapabilities.xml 
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <wsdl:GetCapabilities xmlns:wsdl="http://www.onvif.org/ver10/device/wsdl" />
  </soapenv:Body>
</soapenv:Envelope>

$ curl http://192.168.0.123/onvif/device_service --data @GetCapabilities.xml 

... Lots of XML output ...

$ cat network.xml
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <wsdl:GetNetworkInterfaces xmlns:wsdl="http://www.onvif.org/ver10/device/wsdl" />
  </soapenv:Body>
</soapenv:Envelope>

$ curl http://192.168.0.123/onvif/device_service --data @network.xml

... Again, lots more XML ...

So while ONVIF is a little hard, it does not necessarily require libraries and huge APIs to access.

knight-of-ni commented 10 years ago

@Marantz2600 Please read this thread here: #238 Please test the curl branch and provide feedback in that thread.

knight-of-ni commented 10 years ago

Just as a follow-up note, we are about to release zoneminder 1.27 which will have two new methods: libcurl and libvlc.

Following release, please test the devices in question with these new methods. While zoneminder still will not be "ONVIF Compliant", the libvlc method in particular should be able to support an RTSP stream with Digest authentication (which is what the OP really needs). Please provide us feedback as to the success or failure of these new methods.

altaroca commented 9 years ago

I am working on ZoneMinder support for my ONVIF camera. See here. It is still early work, though.

connortechnology commented 9 years ago

Looks like you are making great progress!

knight-of-ni commented 9 years ago

I am consolidating the number of open ONVIF-related threads. Please see #478 for continuation of the ONVIF discussion.

ricardo-pilcomayo-quenallata commented 2 years ago

Tengo un problema que mi camara en el protocolo ONVIF no conecta con ZoneMinder nose alquin tal vez me podra ayudar