PTZ with onvif

Forum for questions and support relating to the 1.30.x releases only.
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

PTZ with onvif

Post by sharkspear »

Dear ladies and gentlemen,

actually I am testing several optronical devices. my main intend is to use onvif for controlling motors. to make sure everything works over onvif I used several tools. I ended up with iSpy, which is able to probe my onvif devices and correctly passes the commands to the underlying pelco-d system (onvif device mgr works too).

the system (T38G006-ONVIF-P2P) is actually equipped with a zoom-motor and now I want to run it with zoneminder.

according to the docs I am using zmonvif-probe.pl over a ubuntu 16.04 console. the probe finds every device and lists some soap-structures.

my settings in zm:
ffmpeg - modect - rtsp/unicast (i'll provide the login with the uri in 'source'
the cams rtsp-channel works fine it's port is 554 and its also attached to the uri. (rtsp://admin:123456@192.168.1.204:554/mpeg4)
the PTZ-command port is 8091

in zoneminder the zm_opt_controls flag is enabled the version is 1.30.0 (onvif-probe enabled).
in the monitors-settings the controllable-flag is enabled.

I tested the following configs:
onvif-camera
netcat-onvif
Pelco-D (local && ffmpeg)

with empty 'control device' or set to the path /onvif/device_service (according to the identifaction given by 'onvif dvc mgr'). (I also tested the combination of usr/user & pwd - according to some foscam settings)
as address I used: [IP]:8091 or [IP]:80

but i have no success. my best result was 'connection reseted by peer'. every other tool works and i bet there is some mistake i made.

hope someone can help me...

with kind regards
Last edited by sharkspear on Tue Aug 09, 2016 11:41 am, edited 1 time in total.
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

Anyone out here using PTZ? I need to get this to work for further plugin development.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: PTZ with onvif

Post by bbunge »

Have done limited testing of the ONVIF features. Sorry to report that I was mostly unsuccessful so far. Other projects will occupy my time for the next few days so it may take me a while to get to testing again. My thoughts are that PTZ may have to be configured manually.

bb
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: PTZ with onvif

Post by knight-of-ni »

At the moment, the Netcat control script I wrote is the only script in the zoneminder project which sends actual Onvif SOAP messages.
The control script called "onvif" actually is not onvif at all and should either be deleted or replaced.

In your Control Address field, put your ip address and the onvif port the camera responds to e.g. 192.168.1.83:8899
You have to figure out the onvif port for your camera. It is probably in the url you used to get the stream.

Also, put a value in to Auto Stop Timeout e.g. 0.50

Don't add user credentials because they aren't supported. My netcat camera accepted all onvif commands regardless of the authentication I used (scary) thus preventing me from adding authentication to the script. I leave that portion up to someone else with the time and a camera that supports it.

If that still does not work, then you have to do this the hard way. Fire up wireshark, watch the onvif soap messages go to the camera and see what the soap response is. Welcome to development.
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/
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

foa: thanks for the response!

I traced the network comm with wireshark

this is the tcp-paket over port 8091

[255][0][0][0]
<?xml version="1.0" encoding="GB2312" ?>
<XML_TOPSEE>[10]
<MESSAGE_HEADER[10]Msg_type="PTZ_CONTROL_MESSAGE"[10]Msg_code="PTZ_CMD"[10]Msg_flag="0"[10]/><MESSAGE_BODY>[10]<xml><cmd>zoomtele</cmd><panspeed>5</panspeed><tiltspeed>5</tiltspeed></xml>[10]</MESSAGE_BODY>[10]</XML_TOPSEE>

(please ignore the [10] this a result of a hexToAnsii conversion of delimiters)
I started with Auto-Stop value of 1.0 (will correct that to 0.5)
address: 192.168.1.204:8091
control-type: actually tried with pelco-d_ffmpeg, onvif aso (thanks for the update, that onvif is not realy implemented).
If i know how to puzzle a new control-type which will fit to the given data-format i would go this way. would be glad about any information!

by the way....this camera also accepts command without beeing logged in. scary - of course. but i mainly followed your multiserver-architecture and have the video-lan separated from the db-lan.

how to figure out which control-type fits for that format?
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

dear knnniggett, using the onvif_netcat script produces the following ZM-log-error:

2016-08-09 14:47:56.190920 zmcontrol 3290 ERR After sending PTZ command, camera returned the following error:'500 Status read failed: Connection reset by peer' zmcontrol.pl
2016-08-09 14:47:56.143370 zmcontrol 3290 ERR Unable to retrieve camera image settings:'500 Status read failed: Connection reset by peer'
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: PTZ with onvif

Post by knight-of-ni »

Welcome to development. Looks like you will have to blaze a new trail.

For reference, this is what an ONVIF SOAP message response looks like and what you need to retrieve:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Invalid SOAP message or SOAP version mismatch</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> Error deserializing message. No message returned from deserializer. Probing for SOAP 1.2 Received message: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Header><wsa:MessageID>uuid:5e0b7340-c161-4f3e-9a15-248f06a1a597</wsa:MessageID><wsa:RelatesTo>urn:uuid:7AEFC286-348A-11E6-B2A8-B82B3739669A</wsa:RelatesTo><wsa:To SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><d:ProbeMatches><d:ProbeMatch><wsa:EndpointReference><wsa:Address>urn:uuid:HZD-125019-AAEED-4adf-8702-3c330041408b</wsa:Address></wsa:EndpointReference><d:Types>dn:NetworkVideoTransmitter</d:Types><d:Scopes>onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/location/global onvif://www.onvif.org/name/NetworkCamera onvif://www.onvif.org/hardware/HDIPC </d:Scopes><d:XAddrs>http://192.168.0.103:8000/onvif/device_service</d:XAddrs><d:MetadataVersion>1267264204</d:MetadataVersion></d:ProbeMatch></d:ProbeMatches></SOAP-ENV:Body></SOAP-ENV:Envelope> l_xaddr = http://192.168.0.103:8000/onvif/device_service http://192.168.0.103:8000/onvif/device_service, 1.2, (type='video_encoder', type='audio_encoder', type='ptz', location='global', name='NetworkCamera', hardware='HDIPC')
Use wireshark, filter your wireshark session by setting the destination or source ip to be that of the camera.
Then, right click one of the packets in the transfer, then do a Follow -> TCP Stream. This will assemble the soap messages for you from the packets. Note that you need a fairly recent version of Wireshark to use the Follow -> TCP Stream feature.

Another thing you should try is to download onvif device manager https://sourceforge.net/projects/onvifdm/ and install it on a windows pc. If the onvif device manager can control camera, then fire up Wireshark and monitor both the command sent to the camera and the response. Compare that to what the netcat script is sending.
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/
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: PTZ with onvif

Post by iconnor »

I just made an attempt with my TrendNet IP862 and the authentication does not appear to work.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: PTZ with onvif

Post by knight-of-ni »

If you are trying to use the netcat control scipt with the ip862, then that is correct. Authentication will not work. See previous post.
If you are trying to use the tvip862 control script, then I don't know. I've never used that script. Actually, I think you wrote that one.
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/
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

knnniggett wrote:Welcome to development. Looks like you will have to blaze a new trail.

For reference, this is what an ONVIF SOAP message response looks like and what you need to retrieve:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Invalid SOAP message or SOAP version mismatch</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> Error deserializing message. No message returned from deserializer. Probing for SOAP 1.2 Received message: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Header><wsa:MessageID>uuid:5e0b7340-c161-4f3e-9a15-248f06a1a597</wsa:MessageID><wsa:RelatesTo>urn:uuid:7AEFC286-348A-11E6-B2A8-B82B3739669A</wsa:RelatesTo><wsa:To SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><d:ProbeMatches><d:ProbeMatch><wsa:EndpointReference><wsa:Address>urn:uuid:HZD-125019-AAEED-4adf-8702-3c330041408b</wsa:Address></wsa:EndpointReference><d:Types>dn:NetworkVideoTransmitter</d:Types><d:Scopes>onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/location/global onvif://www.onvif.org/name/NetworkCamera onvif://www.onvif.org/hardware/HDIPC </d:Scopes><d:XAddrs>http://192.168.0.103:8000/onvif/device_service</d:XAddrs><d:MetadataVersion>1267264204</d:MetadataVersion></d:ProbeMatch></d:ProbeMatches></SOAP-ENV:Body></SOAP-ENV:Envelope> l_xaddr = http://192.168.0.103:8000/onvif/device_service http://192.168.0.103:8000/onvif/device_service, 1.2, (type='video_encoder', type='audio_encoder', type='ptz', location='global', name='NetworkCamera', hardware='HDIPC')
Use wireshark, filter your wireshark session by setting the destination or source ip to be that of the camera.
Then, right click one of the packets in the transfer, then do a Follow -> TCP Stream. This will assemble the soap messages for you from the packets. Note that you need a fairly recent version of Wireshark to use the Follow -> TCP Stream feature.

Another thing you should try is to download onvif device manager https://sourceforge.net/projects/onvifdm/ and install it on a windows pc. If the onvif device manager can control camera, then fire up Wireshark and monitor both the command sent to the camera and the response. Compare that to what the netcat script is sending.
allready using both (-: thanks for the hint with the whole tcp-stream. atm I am using two ways for the tcp-trace: the plugin of the cam itself, and the onvifdm. the plugin comunicates directly over the 8091 port. the onvifdm instead uses port 80. to be more exact: i have exactly your reference structure here (onvifdm) and it gives me the following target-URI: http://192.168.1.204/onvif/ptz

the plugin instead sends commands to 8091 (the ptz-controll port according to the camera settings) as seen in my last post with the xml-structure.

result of the tcp-stream made by onvifdm:

Code: Select all

 
 <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">Eib43rI2zFsFZM1aw+Z8OcLxLLg=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">i/L55IIo0Ua3sa1LBOZYbDgAAAAAAA==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2016-08-09T14:45:09.026Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Stop xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>MainStream</ProfileToken><PanTilt>false</PanTilt><Zoom>true</Zoom></Stop></s:Body></s:Envelope>HTTP/1.1 200 OK
Server: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/Stop"
Content-Length: 2624
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics"><SOAP-ENV:Header><wsse:Security><wsse:UsernameToken><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">Eib43rI2zFsFZM1aw+Z8OcLxLLg=</wsse:Password><wsse:Nonce>i/L55IIo0Ua3sa1LBOZYbDgAAAAAAA==</wsse:Nonce><wsu:Created>2016-08-09T14:45:09.026Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><tptz:StopResponse></tptz:StopResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
I tried figuring out with: >> /usr/bin/zmonvif-probe.pl move "http://192.168.1.204:80/onvif/ptz" 1.2 admin 123456 << but GetNodes-Method fails here.
But maybe I make something wrong. this feeling, that I missed only a tiny detail wont go away...
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

Good morning, I decided to follow the onvifdm way sending commands.

according to the trace, and to the onvif specs the onvifdm sends a request to
http://192.168.1.204/onvif/device_service on port 80

I tried to probe that URI but failed. so i tested it with the port 80 and the configure PTZ-command port 8091

>> /usr/bin/zmonvif-probe.pl move "http://192.168.1.204:8091/onvif/device_service" 1.2 admin 123456 <<

this command succeeds.

how to setup the controls now? do i have to edit the netcat.pm
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: PTZ with onvif

Post by knight-of-ni »

zmonvif-probe will only determine the video streaming url. You can't use it to determine ptz control.
The SOAP commands returned from zmonvif-probe are different than the commands you need to figure out.

You have to watch what SOAP message goes out and what comes back, when sending ptz commands, using wireshark like I said previously.
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/
sharkspear
Posts: 14
Joined: Mon Aug 08, 2016 3:07 pm

Re: PTZ with onvif

Post by sharkspear »

well. i was going to write a long text. I traced all and well, I am more used to can, flexray and most, but the work is always the same. after checking the perl-scripts onvif.pm and netcat.pm the things got clearer.

it's now working. thanks for your support. will provide some new plugins soon (-:
sebr
Posts: 4
Joined: Sun Oct 29, 2017 7:02 pm

Re: PTZ with onvif

Post by sebr »

sharkspear wrote: Wed Aug 10, 2016 2:10 pm it's now working. thanks for your support. will provide some new plugins soon (-:
Mind to share your findings? I also struggle to get a ONVIF working with PTZ in ZM.
Here is what Wireshark give me:

Code: Select all

POST /onvif/device_service HTTP/1.1
Authorization: Basic YWRtaW46Wm9uZW1pbmRlcjRldmVy
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/ContinuousMove"
Host: 192.168.0.230:5000
Content-Length: 1053
Accept-Encoding: gzip, deflate

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">nWNPeDa5sxUU87+VxApsNSby1hU=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">yo+UopEuUvHZvUdmSjmc6XwOcJQ=</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2017-10-31T14:03:37.010Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ContinuousMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>IPCProfilesToken0</ProfileToken><Velocity><PanTilt x="-0.5" y="0" xmlns="http://www.onvif.org/ver10/schema"/></Velocity></ContinuousMove></s:Body></s:Envelope>HTTP/1.1 200 OK
Server: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/ContinuousMove"
Content-Length: 1240
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><tptz:ContinuousMoveResponse></tptz:ContinuousMoveResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
pat2
Posts: 156
Joined: Fri Sep 16, 2016 6:35 pm

Re: PTZ with onvif

Post by pat2 »

hi knigget, sharkspear,

i'm trying to pass PTZ commands to my IPCAM through ZM. I discovered that the camera works with cgi_api commands like:

Code: Select all

http://admin:admin@192.168.1.200/cgi/sys_get?Group=DeviceInfo
http://admin:admin@192.168.1.200/cgi/ptz_set?Channel=1&Group=PTZCtrlInfo&Direction=1&PanSpeed=2&TiltSpeed=3
http://admin:admin@192.168.1.200/cgi/ptz_set?Channel=1&Group=PTZCtrlInfo&Stop=0
simply inserting the url in firefox url field. I'm trying to modify the ONVIF ZM scripts to work accordingly.

Recently I discovered too that the camera works (I'm able to see video and move the camera through the app) with the windows app located at https://sourceforge.net/projects/onvifdm/ , answering on 8999 port without authentication (and using onvif version 2.40).

Image

I started a Wireshark session and monitored the TCP flow (while moving the camera) with between the camera and the win app on my PC and pls see below the flow:

Code: Select all

POST /onvif/ptz_service HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/ContinuousMove"
Host: 192.168.1.200:8999
Content-Length: 394
Accept-Encoding: gzip, deflate
Connection: Close

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ContinuousMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>MainStream</ProfileToken><Velocity><PanTilt x="0" y="0.5" xmlns="http://www.onvif.org/ver10/schema"/></Velocity></ContinuousMove></s:Body></s:Envelope>
or

Code: Select all

POST /onvif/ptz_service HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/Stop"
Host: 192.168.1.200:8999
Content-Length: 328
Accept-Encoding: gzip, deflate
Connection: Close

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Stop xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>MainStream</ProfileToken><PanTilt>true</PanTilt><Zoom>false</Zoom></Stop></s:Body></s:Envelope>
Note: i'm not able to monitor on Wireshark (running on my PC) the flow between the camera and and ZM (that is running on another linux device)!! :(

So, I'm using in ZM control tab:

Control Type = Netcat ONVIF
Control Address = 192.168.1.200:8999
(nothing for Control Device).

It seems i'm able to reach the camera since, when I send a PTZ command (pushing the arrows in the ZM control view), in ZM LOG it appears a message like:

2018-03-30 20:03:18.630160 zmcontrol 4710 ERR After sending PTZ command, camera returned the following error:'400 Bad Request' zmcontrol.pl

could you suggest me how to solve the issue?
---------------------------------------------------------------------------
ZM 1.36.34 - 14 cameras on Orange Pi 5 (arm64) - Ubuntu Jammy 22.04
Locked