Hi everyone. I am beginner to the Onvif topic. But this will not prevent me from asking the authors a question about the support of the T profile. Does this implementation of the library support the features of the T profile? If you have any good books on this protocol, I would be grateful to you. Thank you so much for your time)) P.S.: I would also be very grateful to you for the documentation on the compilation of requests to devices themselves: where do the templates for their compilation come...
I tried this library: https://github.com/kqbi/LibOnvifClient. The same thing: the methods I need work with different camera models, except SystemReboot. Apparently, the problem is in the cameras themselves (vstarcam) P.S. I need to reboot the camera from a script. Rebooting from the www-interface works.
Hello, Working with Onvif can be a frustrating experience as the standard is not well followed by camera makers. Just out of curiosity, I tested all of my cameras to see the response to the reboot command. Dahua - Success Hikvision - Success Amcrest - Success Axis - Success Foscam - Success Reolink - Success Lorex - Success HiKam - Success Trendnet - Success Utalert - Failure You could randomly select any Onvif parameter and find in this set of cameras at least one that does not properly implement...
"reboot" command in onvif-util doesn't work either. The rebootCamera() functions in both libraries are identical :)
Thank you for reaching out, sorry for your troubles. I can pretty much guarantee that this is an issue with the camera. Most cameras have improper implementation of onvif, so it not surprising that some functions don't work properly. As an aside, there is a more developed version of the program on github at https://github.com/sr99622/libonvif that includes a command line program and a GUI program for working with cameras. Best Regards, Stephen
rebootCamera() has no effect
Hello, Just wanted to let you know that I solved the issue. I have 2 network connections on my computer, wired and wireless, both of which get an ip address and the test program was selecting the wifi interface which a different subnet than the cameras are on. Once I turned my wifi off, all the cameras were found and everything worked well. Sorry for the confusion
Taking another look at your screenshot I notice that you are using Amcrest cameras. There are a couple of things that Ovif Device Manager does better with these cameras. One is the time setting regarding Daylight Savings Time. If the camera and the computer have different settings for DST, Amcrest will not respond. I think Onvif Device Manager has a routine that will test the camera with a modified time stamp to check for misalignment between the computer and the camera with regards to DST. You can...
Thanks for your reply, no worries on the timing... I have all firewalls disabled, in fact I created a small network that only included a router, my computer and 1 onvif camera and still nothing. This is not an urgent issue, I'll dig into the code further and see if I can isolate the problem. Thanks
Hi Stephen, Thanks for the response! I found the github repo you recommended, and I have verified that you do pull out the necessary tokens in that repo, here: https://github.com/sr99622/libonvif/blob/master/source/onvif.c#L665 I'm fairly certain that the code I downloaded from here at SourceForge does not. I encourage you to remedy this, so that others may enjoy this great contribution of yours readily upon download. Thanks, again! Kevin
Hi LH, Thank you so much for your message, I'm sorry to hear of the trouble. My best guess would be that there is some Windows firewall issue that is preventing libonvif from communicating over the network. It may not be immediately obvious as the library uses lower level UDP protocols which may be firewalled separately from standard TCP traffic. Libonvif uses messages which are virtually identical to Onvif Device Manager in most situations, so they should be able to communicate in much the same...
Hi Kevin, Thank you so much for your kind words, I'm glad you found the library to be useful. If I remember correctly, the fillRTSP command populates the data structure with the necessary tokens so that you can use other commands such as VideoEncoderConfiguration without further initialization. There is an existing copy of the code for libonvif on github if you would like to fork from there. My apologies for the late reply, I hadn't checked the comments for a while. If you need more help, feel free...
Hello, I was very excited to find your library and the build process under windows was flawless. I am certain that the lib works well based on other comments . Unfortunately, I have not been able to get the test program to find any cameras. I'm using windows 10 and I compiled with VS2017. I use the Onvif Device Manager and it finds quite a few cameras on my network. What could be the issue? I will be moving on to Unix to test the lib soon. Just though I'd run my windows experiences by you... I've...
Hi @sr99622, Let me start by saying I'm very impressed with your ONVIF Library! I really appreciate the fact that this is the first C++ usable library to implement the ONVIF standard that I have come across that actually works -- kudos on that! I particularly like how you simplified things by combining all data in a single struct and constraining profiles to a single H264 encoded profile. That really simplifies things over a diverse range of camera types. I'm just getting acquainted with it, so I...
Hi Nathan, Thank you so much for your comment. It looks like you are pretty close, so you have probably figured this out already, my apologies for the late response. I think what you are looking for is the ./configure CPPFLAGS="-I/usr/include/libxml2" setting for the build. You can also get a lot of information from the ./configure --help command which will give you information about the settings needed for the program.
I'm pretty darned green with -nix. Sorry. It took me all day to figure out two things: 1. setting environment variables means putting the variable assignments into the command line, not modifying a file 2. get the values for LIBXML2_CFLAGS and LIBXML2_LIBS from xml2-config --cflags and xml2-config --libs --libs returns a string with spaces, so putting that string in single quotes when running ./configure is what is expected, right? So ... ./configure --prefix=/usr --LIBXML2_CFLAGS='-I/usr/include/libxml2'...
I'm pretty darned green with -nix. Sorry. It took me all day to figure out two things: 1. setting environment variables means putting the variable assignments into the command line, not modifying a file 2. get the values for LIBXML2_CFLAGS and LIBXML2_LIBS from xml2-config --cflags and xml2-config --libs --libs returns a string with spaces, so putting that string in single quotes when running ./configure is what is expected, right? So ... ./configure --prefix=/usr --LIBXML2_CFLAGS='-I/usr/include/libxml2'...
"System Integrity Protection" on the Mac now prevents writing to /System, /bin, /sbin, and /usr (but not /usr/local) I'm still pretty green with -nix, so I won't know how to fix something if I muck it up. Would it work to start with ./configure --prefix=/usr/local If that works, do I need to change something, somewhere else, to refer to the installation in /usr/local? Thank you!
Hi Bruce, Thank you so much for your message, my apologies for the late reply. I have not implemented the event subscriber in the library. It certainly would be possible to add it, as I had gone through the exercise during the development process. The command to subscribe is the same format as for the other ONVIF commands. There are a number of issues with using this feature however, which dissuaded me from incorporating it into the release version. I found that many cameras do not have this feature....
Hi Bruce, Thank you so much for your message, my apologies for the late reply. I have not implemented the event subscriber in the library. It certainly would be possible to add it, as I had gone through the exercise during the development process. The command to subscribe is the same format as for the other ONVIF commands. There are a number of issues with using this feature however, which dissuaded me from incorporating it into the release version. I found that many cameras do not have this feature....
Hi, I need to change audio related(encoding, volume) parameters. Is it possible to change these parameters by using this library. Thanks in advance.
Hi Stephen, I am using libonvif library. Using this i can change video related parameters(Resolution, bit rate,frame rate etc). Now i want to modify audio related parameters(Audio Encoding, Audio Input, Input Volume). Please suggest how to modify audio related parameters. Thank you.
Hi, I am using libonvif library. Using this i can change video related parameters(Resolution, bit rate,frame rate etc). Now i want to modify audio related parameters(Audio Encoding, Audio Input, Input Volume). Please suggest how to modify audio related parameters. Thank you.
Hi, I am using libonvif library. Using this i can change video related parameters(Resolution, bit rate,frame rate etc). Now i want to modify audio related parameters. Please suggest how to modify audio related parameters. Thank you.
Hi, I have your library compiled on Windows and am running the test app and everything works great! I am trying to puzzle through the ONVIF events. I have looked at other examples but the structure is different so I am struggling. I ran the get capabilities function and saw this in the response structure. + device_service 0x01384e6c "POST /onvif/device_service HTTP/1.1\r\n" char[1024] + media_service 0x0138526c "POST /onvif/Media HTTP/1.1\r\n" char[128] + imaging_service 0x013852ec "POST /onvif/imaging...
Hi Stephen, Thanks a lot for your answer. I'll look into live555 then. Thanks a lot for the PTZ code. For me, it will actually be a lot simpler: I don't need a GUI on the RPI, just to send the commands to the cameras. Thanks a lot for your answer, again! Best regards, Kateline From: Stephen Rhodes sr99622@users.sourceforge.net Sent: mardi 13 août 2019 16:16 To: [libonvif:tickets] 1@tickets.libonvif.p.re.sourceforge.net Subject: [libonvif:tickets] #1 Functions description Hi Kat, If you are interested...
Hi Kat, If you are interested in recording the stream, you can use the library live555 to do so. The library is very well developed and has a number of good examples. It's a bit quirky so it takes some getting used to, but once you get started it will serve you well. The basic idea is that you supply the RTSP string and the live555 library will manage the connection and stream the raw data to disk. You will need to make a few modifications to the sample program but they are not too hard. Once you...
Hello Stephen, Thank you so much for your complete answer. I've been digging ONVIF for quite a while myself and I know that for a protocol that is supposed to be widely used and to bring some conformity among cameras, we are far from the expected result! In fact, I already have something that works on Windows but I would like to try and port some simple functions to Linux (on a Raspberry Pi). I would simply need a code capable of recording a ONVIF stream and send PTZ commands. The example that you...
Hi Kat, Thank you for your message. Admittedly, the documentation for libonvif is a bit sparse. You can find a list of all the functions exported by the library in the header file, onvif.h For the most part, these functions are wrappers around the onvif protocol and will follow the convention set in the wsdl files. For example. getVideoEncoderConfigurationOptions is derived from the media wsdl https://www.onvif.org/ver10/media/wsdl/media.wsdl and uses the same parameters set in there. You will need...
Hi Kat, Thank you for your message. Admittedly, the documentation for libonvif is a bit sparse. You can find a list of all the functions exported by the library in the header file, onvif.h For the most part, these functions are wrappers around the onvif protocol and will follow the convention set in the wsdl files. For example. getVideoEncoderConfigurationOptions is derived from the media wsdl https://www.onvif.org/ver10/media/wsdl/media.wsdl and uses the same parameters set in there. You will need...
Functions description
I have implemented a list of the xaddrs in my application without changing libonvif. However, this is not quite so easy as you also have to keep a record of the camera index, because prepareOnvifData() requires the index to return the OnvifData structure for that camera. Basically, I build a list containing xaddrs and their corresponding libonvif indices. Sure, feel free to use any or all of this in the next version.
The issue of cameras responding twice is easily fixed by keeping track of the xaddrs sent by the camera in the main program using libonvif. This is really more of a higher level function which is why it is not addressed by libonvif itself. It's interesting that there is a camera that takes too long to respond. Your approach may be correct, it's hard to tell without testing. I guess if your fix doesn't affect otherwise properly functioning cameras then you should be good to go. Checking for the 169...
Hi Stephen, Ok, so I've written some code to take the second Ip address if the first one is a 169 subnet address and that fixed that particular issue. Other cameras return an Ipv6 address in addition to the Ipv4 address so I may also have to check for this too. Another camera on the network was responding too slowly for libonvif and the responses were being ignored. I changed this line in the sendCommandToCamera function in onvif.c to wait for a response. valread = recv( sock, buffer, 4096, MSG_WAITALL);...
Hi David, Good to hear from you, hope you enjoyed your break. It looks like the axis camera has both a wireless and wired Ethernet connection. The 169 subnet IP address looks to be the unconnected port. Libonvif only checks the first address and uses that one. If you reboot the axis camera in it's current state it should come back with the 10 subnet address as the first address. Give the axis camera a reboot to try that and see if it works. It will probably be worthwhile to add some code to libonvif...
Hi Stephen , I'm back on this project now. I added all of your debug stuff and I think I can see the problem with the camera which returns "Error getting camera uri - No XML reply". In the broadcast response section for a good camera I get this: <soap-env:envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:soap-enc="http://www.w3.org/2003/05/soap-encoding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><soap-env:header><wsa:messageid>urn:uuid:e1279c3b-6659-405b-8fec-fd32d244bc43</wsa:messageid><wsa:relatesto>urn:uuid:fecfb31b-6e7d-9041-56e4-390df1d28082</wsa:relatesto><wsa:to...
Thanks again, I have to take a break from this work for a few weeks but I'll let you know when I get back to it
Establishing communication with the cameras is a multi step process, so I guess the first troubleshooting effort would be identifying where in the process the failure is occurring. The first step is the broadcast and response via UDP between the PC and the camera, If the libonvif_test program sees the camera and prompts for the username and password, you know this step has been successful. The next step is for the PC to query the camera for its date and time info. Note that this step does not require...
Establishing communication with the cameras is a multi step process, so I guess the first troubleshooting effort would be identifying where in the process the failure is occurring. The first step is the broadcast and response via UDP between the PC and the camera, If the libonvif_test program sees the camera and prompts for the username and passord, you know this step has been successful. The next step is for the PC to query the camera for its date and time info. Note that this step does not require...
Hi Stephen, Many thanks for the repsonse. The problem with the Axis camera was indeed the date-time and daylight-saving settings which didn't match the PC client, this camera is now working with libonvif. I have another camera which does not have a daylight-saving setting and which cannot currently be authenticated. I also have other cameras which are returning "No XML reply" which I wil need to debug.
Hi David, thank you for your message. It's helpful to know the type of camera that you are working with as they all are somewhat different in their implementations. If I have to guess, I would say that it is Axis cameras you are working with. I have seen them repeated on discovery as sometimes they will answer twice to the discovery message. Something I have seen with that camera is that authentication can fail if the Daylight Savings Time setting is not consistent between the camera and the computer....
Hi David, thank you for your message. It's helpful to know the type of camera that you are working with as they all are somewhat different in their implementations. If I have to guess, I would say that it is Axis cameras you are working with. I have seen them repeated on discovery as sometimes they will answer twice to the discovery message. Something I have seen with that camera is that authentication can fail if the Daylight Savings Time setting is not consistent between the camera and the computer....
Hi there, I've just built the libraries for my hardware and I'm running the test_onvif program. It finds 7 cameras (some are repeated) and it returns the rtsp url for the camera which does not have authentication enabled. However it fails wih the message "ter:NotAuthorized" on cameras which have authentication enabled. I have checked the username and password are correct using OnvifDeviceManager. Any suggestions for what might be the problem? Many thanks
Discovery
Discovery
Discovery
Discovery
Discovery
Rationale
Home
Home
PTZ Functions
Home
Rationale
Home
Rationale
Discovery
Home
Discovery
PTZ FUNCTIONS
Home
Home
PTZ control is implemented by libonvif. The simplest example would be a gotoPreset call which will position the camera at one of the preset positions. It takes a string argument indicating the position which will usually be a string representation of an integer, e.g. "1", and the camera's OnvifData structure which has been initialized by the discovery function illustrated in the example program. The example commands shown below assume that there is an initialized struct OnvifData *onvif_data int...
I am working on a linux project that (among other things) streams video from cameras. Until now the majority of the cameras we use are USB and most of what we need we do with gstreamer and/or v4l2 using /dev/video. We now have a requirement to stream from various IP-PTZ cameras (I am currently working with a LINGSEE). That being said, I installed libonvif and built the 'discovery' example and it worked like a charm; returning the RTSP URI that I was able to then immediately use with gstreamer. So...