use-go / onvif Goto Github PK
View Code? Open in Web Editor NEWfull and enhanced onvif protocol stack in golang.
License: MIT License
full and enhanced onvif protocol stack in golang.
License: MIT License
Hello!
Answer please how can i get video files from a camera flash card?
GetVideoEncoderConfigurationsResponse.Configurations
in onvif document defined as unbounded, I understand it should be defined as an array. But in the file media/types.go
it is not defined as an array.
So I noticed when trying to use the media queries (sdk/media/*), that some of the structs are prefixed by onvif:
for the xml parsing tags (example https://github.com/use-go/onvif/blob/master/xsd/onvif/onvif.go#L361).
When getting an actual response from a camera, I noticed the structs did not unmarshal properly because of this prefix. From my understanding, the prefixes should be different according to the ONVIF media spec.
Regardless, I have forked the repo and dropped the prefix for my uses, but was curious if you would like a PR and the tests I wrote, or if I am headed in the wrong direction
使用Call_GetStatus时,使用:
type PTZVector struct {
PanTilt Vector2D xml:"onvif:PanTilt"
Zoom Vector1D xml:"onvif:Zoom"
} 无法绑定xml数据,
在我修改为:
type PTZVector struct {
PanTilt Vector2D xml:"PanTilt"
Zoom Vector1D xml:"Zoom"
}后正常绑定数据
I'm trying to read out the relay outputs and digital input, but looks like missing from the library. Any plans to add this functionality? Looks like it's currently added to the device pkg, but that won't work.
When try call Subscribe
with wrong InitialTerminationTime
parameter value server return error response with status code 500
:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tst="http://www.onvif.org/ver10/storage/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12" xmlns:http="http://schemas.xmlsoap.org/wsdl/http" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:tnshik="http://www.hikvision.com/2011/event/topics" xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema" xmlns:tas="http://www.onvif.org/ver10/advancedsecurity/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:axt="http://www.onvif.org/ver20/analytics"><env:Header><wsa:Action>http://docs.oasis-open.org/wsrf/fault</wsa:Action>
</env:Header>
<env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value>
</env:Code>
<env:Reason><env:Text xml:lang="en">wsnt:UnacceptableInitialTerminationTimeFault</env:Text>
</env:Reason>
<env:Detail><wsnt:UnacceptableInitialTerminationTimeFault><wsrf-bf:Timestamp>2023-11-24T08:17:18Z</wsrf-bf:Timestamp>
</wsnt:UnacceptableInitialTerminationTimeFault>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
In this Call_Subscribe doesn't check status code of response and try parse (unmarshaling) a corresponding response type. But if http status code not equal 200
response has <env:Fault>
type.
I think this relevant (http status code checking is missing) for all methods, not only for Call_Subscribe
.
Onvif profile M relates to metadata, events and analytics. Is profile M supported by this library?
currently there is soap xml marshaling tags only for the request structs.
for response structs there are no xml unmarshal capabilities.
planning to add that support? there is any technical limitation to have that implemented or its only a matter of mapping each struct?
This package doesn't show up on the pkgsite because there's no license: https://pkg.go.dev/github.com/use-go/onvif
Looks like a broken dependency on https://github.com/yakovlevdmv/goonvif
..\xsd\built_in.go:14:2: cannot find package "github.com/yakovlevdmv/Golang-iso8601-duration" in any of:
C:\Go\src\github.com\yakovlevdmv\Golang-iso8601-duration (from $GOROOT)
Hi everyone,
Can someone please provide an Event example ?
TIA
Hello,Is onvif2.02 supported?
ONVIF Device Test Tool 19.06:
Error in desenalizing body of reply message for operation GetService
In gosoap/ws-security.go
In func NewSecurity
created := time.Now().UTC().Format(time.RFC3339Nano)
Output in mac
2024-08-08T10:05:42.785935Z
Output in linux
2024-08-08T10:06:17.763359929Z
In the Linux output, the time is formatted using a higher level of precision, including 9 digits after the decimal point, representing nanoseconds.
Because of this, when I try connecting to my Hikvision Camera/DVR, it is throwing 401 unauthorised error.
When I changed the code to
created := time.Now().UTC().Format(time.RFC3339) // removed Nano
It started working fine.
Please fix this issue, so that it works everywhere.
Thank you.
Is possible to make multicast in different subnet?
If I provide NewDevice() with an IPaddr and port that reference a web server, it will return success as long as the website hosted on that server does not return an http error. The issue is in "func (dev *Device) getSupportedServices(resp *http.Response)" This function does not check that the response is a valid SOAP response.
why Authenticate function has been deleted?
if GetAvailableDevicesAtSpecificEthernetInterface return devices, if the device need user/passwd, i can't use that device
i must need to use the device probed to newDevice
devices, err := goonvif.GetAvailableDevicesAtSpecificEthernetInterface("en7")
if err != nil {
log.Println(err)
return nil
}
for _, dev := range devices {
newDev := onvif.NewDevice(onvif.DeviceParams{Xaddr: dev.params.Xaddr, Username: "username", Password: password})
}
I noticed while debugging that the xml request is having tags <onvif rather than <tt , why is <onvif used everywhere... ? Can you fix this issue?
memery leak many socket not close for latest version
dev, err := goonvif.NewDevice(addr)
if err != nil {
log.Errorf(this.tag, "[ONVIF]:sync time to addr:%s error: %s", addr, err.Error())
return
}
dev.Authenticate(userName, password)
res, err := dev.CallMethod(device.SetSystemDateAndTime{
XMLName: "",
DateTimeType: "Manual",
DaylightSavings: false,
TimeZone: onvif.TimeZone{
TZ: "CST-8:00:00",
},
UTCDateTime: onvif.DateTime{
Time: onvif.Time{
Hour: (xsd.Int)(time.Now().UTC().Hour()),
Minute: (xsd.Int)(time.Now().UTC().Minute()),
Second: (xsd.Int)(time.Now().UTC().Second()),
},
Date: onvif.Date{
Year: (xsd.Int)(time.Now().UTC().Year()),
Month: (xsd.Int)(time.Now().UTC().Month()),
Day: (xsd.Int)(time.Now().UTC().Day()),
},
},
})
IP Camera Company Named Syntel All other endpoints are working fine: but profile request is asking for authentication but dahua cameras are working fine.
Here is request :-
<?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:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:onvif="http://www.onvif.org/ver10/schema" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"><soap-env:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <UsernameToken xmlns=""> <Username>admin</Username> <Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">tmD70TuteOMdpVIqXhSzkx1/w+M=</Password> <Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">n1115yhlqt6di7bme8ea54xq6mqun47h</Nonce> <Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2023-11-24T07:54:33.429776418Z</Created> </UsernameToken> </Security></soap-env:Header><soap-env:Body><tds:GetCapabilities> <tds:Category>All</tds:Category> </tds:GetCapabilities></soap-env:Body></soap-env:Envelope>
Response Provided By the camera :-
<?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:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" 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://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:ttr="http://www.onvif.org/ver20/analytics/radiometry" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 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:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tand="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tdisp="http://www.onvif.org/ver10/display/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:timg20="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz20="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:trt20="http://www.onvif.org/ver20/media/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tnshik="http://www.hikvision.com/2011/event/topics" xmlns:ter="http://www.onvif.org/ver10/error"><SOAP-ENV:Header><wsse:Security SOAP-ENV:mustUnderstand="true"></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:NotAuthorized</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">Sender not Authorized</SOAP-ENV:Text></SOAP-ENV:Reason><SOAP-ENV:Detail>The action requested requires authorization and the sender is not authorized.</SOAP-ENV:Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
I'am trying to fetch snapshot url here. so i need to fetch all profiles.
Same Request Gives Success with Dahua Camera:-
<?xml version="1.0" encoding="utf-8" standalone="yes" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema"><s:Body><trt:GetProfilesResponse><trt:Profiles token="Profile000" fixed="true"><tt:Name>Profile000</tt:Name><tt:VideoSourceConfiguration token="VideoSource000"><tt:Name>VideoSource000</tt:Name><tt:UseCount>2</tt:UseCount><tt:SourceToken>VideoSource000</tt:SourceToken><tt:Bounds x="0" y="0" width="1920" height="1080"></tt:Bounds></tt:VideoSourceConfiguration><tt:VideoEncoderConfiguration token="VideoEncoder000"><tt:Name>VideoEncoder000</tt:Name><tt:UseCount>1</tt:UseCount><tt:Encoding>H265</tt:Encoding><tt:Resolution><tt:Width>1920</tt:Width><tt:Height>1080</tt:Height></tt:Resolution><tt:Quality>4.000000</tt:Quality><tt:RateControl><tt:FrameRateLimit>1</tt:FrameRateLimit><tt:EncodingInterval>1</tt:EncodingInterval><tt:BitrateLimit>1536</tt:BitrateLimit></tt:RateControl><tt:H265><tt:GovLength>2</tt:GovLength><tt:H265Profile>Main</tt:H265Profile></tt:H265><tt:Multicast><tt:Address><tt:Type>IPv4</tt:Type><tt:IPv4Address>224.1.2.4</tt:IPv4Address></tt:Address><tt:Port>40000</tt:Port><tt:TTL>64</tt:TTL><tt:AutoStart>false</tt:AutoStart></tt:Multicast><tt:SessionTimeout>PT60S</tt:SessionTimeout></tt:VideoEncoderConfiguration><tt:VideoAnalyticsConfiguration token="Analytics000"><tt:Name>Analytics000</tt:Name><tt:UseCount>2</tt:UseCount><tt:AnalyticsEngineConfiguration><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule></tt:AnalyticsEngineConfiguration><tt:RuleEngineConfiguration><tt:Rule Name="Region1" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="0P8A8A=="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region2" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region3" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region4" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule></tt:RuleEngineConfiguration></tt:VideoAnalyticsConfiguration><tt:PTZConfiguration token="PTZ000" MoveRamp="0" PresetRamp="0" PresetTourRamp="0"><tt:Name>PTZ000</tt:Name><tt:UseCount>2</tt:UseCount><tt:NodeToken>PTZ000</tt:NodeToken><tt:DefaultRelativeZoomTranslationSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace</tt:DefaultRelativeZoomTranslationSpace><tt:DefaultContinuousZoomVelocitySpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace</tt:DefaultContinuousZoomVelocitySpace><tt:DefaultPTZSpeed><tt:Zoom space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace" x="0.800000"></tt:Zoom></tt:DefaultPTZSpeed><tt:DefaultPTZTimeout>PT10S</tt:DefaultPTZTimeout></tt:PTZConfiguration><tt:MetadataConfiguration token="Metadata000" CompressionType="None" GeoLocation="false"><tt:Name>Metadata000</tt:Name><tt:UseCount>1</tt:UseCount><tt:PTZStatus><tt:Status>false</tt:Status><tt:Position>false</tt:Position></tt:PTZStatus><tt:Events><tt:Filter><wsnt:TopicExpression Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tns1="http://www.onvif.org/ver10/topics">tns1:Media/ConfigurationChanged</wsnt:TopicExpression></tt:Filter></tt:Events><tt:Analytics>true</tt:Analytics><tt:Multicast><tt:Address><tt:Type>IPv4</tt:Type><tt:IPv4Address>224.1.2.4</tt:IPv4Address></tt:Address><tt:Port>40000</tt:Port><tt:TTL>64</tt:TTL><tt:AutoStart>false</tt:AutoStart></tt:Multicast><tt:SessionTimeout>PT60S</tt:SessionTimeout></tt:MetadataConfiguration></trt:Profiles><trt:Profiles token="Profile001" fixed="true"><tt:Name>Profile001</tt:Name><tt:VideoSourceConfiguration token="VideoSource000"><tt:Name>VideoSource000</tt:Name><tt:UseCount>2</tt:UseCount><tt:SourceToken>VideoSource000</tt:SourceToken><tt:Bounds x="0" y="0" width="1920" height="1080"></tt:Bounds></tt:VideoSourceConfiguration><tt:VideoEncoderConfiguration token="VideoEncoder001"><tt:Name>VideoEncoder001</tt:Name><tt:UseCount>1</tt:UseCount><tt:Encoding>H264</tt:Encoding><tt:Resolution><tt:Width>704</tt:Width><tt:Height>576</tt:Height></tt:Resolution><tt:Quality>4.000000</tt:Quality><tt:RateControl><tt:FrameRateLimit>1</tt:FrameRateLimit><tt:EncodingInterval>1</tt:EncodingInterval><tt:BitrateLimit>256</tt:BitrateLimit></tt:RateControl><tt:H264><tt:GovLength>2</tt:GovLength><tt:H264Profile>Main</tt:H264Profile></tt:H264><tt:Multicast><tt:Address><tt:Type>IPv4</tt:Type><tt:IPv4Address>224.1.2.4</tt:IPv4Address></tt:Address><tt:Port>40016</tt:Port><tt:TTL>64</tt:TTL><tt:AutoStart>false</tt:AutoStart></tt:Multicast><tt:SessionTimeout>PT60S</tt:SessionTimeout></tt:VideoEncoderConfiguration><tt:VideoAnalyticsConfiguration token="Analytics000"><tt:Name>Analytics000</tt:Name><tt:UseCount>2</tt:UseCount><tt:AnalyticsEngineConfiguration><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule><tt:AnalyticsModule Name="MyCellMotionEngine" Type="tt:CellMotionEngine"><tt:Parameters><tt:SimpleItem Name="Sensitivity" Value="60"></tt:SimpleItem><tt:ElementItem Name="Layout"><tt:CellLayout Columns="22" Rows="18"><tt:Transformation><tt:Translate x="-1.000000" y="1.000000"></tt:Translate><tt:Scale x="0.000244" y="0.000244"></tt:Scale></tt:Transformation></tt:CellLayout></tt:ElementItem></tt:Parameters></tt:AnalyticsModule></tt:AnalyticsEngineConfiguration><tt:RuleEngineConfiguration><tt:Rule Name="Region1" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="0P8A8A=="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region2" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region3" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule><tt:Rule Name="Region4" Type="tt:CellMotionDetector"><tt:Parameters><tt:SimpleItem Name="MinCount" Value="20"></tt:SimpleItem><tt:SimpleItem Name="AlarmOnDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="AlarmOffDelay" Value="1000"></tt:SimpleItem><tt:SimpleItem Name="ActiveCells" Value="zwA="></tt:SimpleItem></tt:Parameters></tt:Rule></tt:RuleEngineConfiguration></tt:VideoAnalyticsConfiguration><tt:PTZConfiguration token="PTZ000" MoveRamp="0" PresetRamp="0" PresetTourRamp="0"><tt:Name>PTZ000</tt:Name><tt:UseCount>2</tt:UseCount><tt:NodeToken>PTZ000</tt:NodeToken><tt:DefaultRelativeZoomTranslationSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace</tt:DefaultRelativeZoomTranslationSpace><tt:DefaultContinuousZoomVelocitySpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace</tt:DefaultContinuousZoomVelocitySpace><tt:DefaultPTZSpeed><tt:Zoom space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace" x="0.800000"></tt:Zoom></tt:DefaultPTZSpeed><tt:DefaultPTZTimeout>PT10S</tt:DefaultPTZTimeout></tt:PTZConfiguration><tt:MetadataConfiguration token="Metadata001" CompressionType="None" GeoLocation="false"><tt:Name>Metadata001</tt:Name><tt:UseCount>1</tt:UseCount><tt:PTZStatus><tt:Status>false</tt:Status><tt:Position>false</tt:Position></tt:PTZStatus><tt:Events><tt:Filter><wsnt:TopicExpression Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tns1="http://www.onvif.org/ver10/topics">tns1:Media/ConfigurationChanged</wsnt:TopicExpression></tt:Filter></tt:Events><tt:Analytics>true</tt:Analytics><tt:Multicast><tt:Address><tt:Type>IPv4</tt:Type><tt:IPv4Address>224.1.2.4</tt:IPv4Address></tt:Address><tt:Port>40016</tt:Port><tt:TTL>64</tt:TTL><tt:AutoStart>false</tt:AutoStart></tt:Multicast><tt:SessionTimeout>PT60S</tt:SessionTimeout></tt:MetadataConfiguration></trt:Profiles></trt:GetProfilesResponse></s:Body></s:Envelope>
Please Help Me out Here.
i need to see the playback , is there any way to help me and give an example
Id just like to prefix this with the fact that Im using a cheap ONVIF camera.
But wondering whether Im doing something wrong, response returns "false" however I cant connect to the camera on the new IP address.
Ive have managed to do other Get calls, but unable to perform this Set call.
dev, err := onvif.NewDevice(onvif.DeviceParams{
Xaddr: "192.168.1.10:8899",
Username: "admin",
Password: "",
HttpClient: new(http.Client),
})
if err != nil {
panic(err)
}
prefxedIpv4Address := xsdonvif.PrefixedIPv4Address{Address: "192.168.1.2", PrefixLength: 24}
ipv4NetworkInterfaceSetConfiguration := xsdonvif.IPv4NetworkInterfaceSetConfiguration{Enabled: true, Manual: prefxedIpv4Address, DHCP: true}
networkInterfaceSetConfiguration := xsdonvif.NetworkInterfaceSetConfiguration{Enabled: true, IPv4: ipv4NetworkInterfaceSetConfiguration}
setNetworkInterfaces := device.SetNetworkInterfaces{InterfaceToken: "eth0", NetworkInterface: networkInterfaceSetConfiguration}
setNetworkInterfaceResponse, err := sdk.Call_SetNetworkInterfaces(ctx, dev, setNetworkInterfaces)
if err != nil {
log.Println(err)
} else {
fmt.Println(setNetworkInterfaceResponse)
}
I need to list presets from camera for my project and noticed, that GetPresetsResponse is not contains slice of preset, but store one Preset
Needs to be improved
could give a ptz example please
As the name implies we are expecting a list of profiles.
In fact in the onvif documentation we are also told we should expect a list.
RESPONSE:
• Preset - optional, unbounded [tt:PTZPreset]
List of presets for the requested MediaProfile.
Reference here: https://www.onvif.org/specs/srv/ptz/ONVIF-PTZ-Service-Spec.pdf
The video address I got from this library is “rtsp://192.168.123.211 :554/user=admin_ password=tlJwpbo6_ channel=1_ stream=0.sdp?real_ Stream”, using VLC playback, as long as the sound has no image, the image is black, but the address obtained by another dart library is “rtsp://192.168.123.211 :554/user=admin_ password=tlJwpbo6_ channel=1_ stream=1.sdp?real_ stream” has sound and video. I don't know the difference between them. Is there an example of getting video address.
my test Code:
s := onvif.GetAvailableDevicesAtSpecificEthernetInterface("en7")
log.Printf("%s", s)
for _, d := range s {
d.Authenticate("admin", "")
log.Println(d.GetServices())
log.Println(d.GetEndpoint("media"))
resp, err := d.CallMethod(media.GetProfilesResponse{})
if err != nil {
log.Fatal(err)
}
bytes, _ := ioutil.ReadAll(resp.Body)
log.Println(string(bytes))
resp, err = d.CallMethod(media.GetStreamUri{
StreamSetup:onvif2.StreamSetup{
Stream: "RTP-Unicast",
Transport: onvif2.Transport{Protocol:"HTTP",Tunnel:nil},
},
ProfileToken: "000",
})
if err != nil {
log.Fatal(err)
}
bytes, _ = ioutil.ReadAll(resp.Body)
log.Println(string(bytes))
}
output Uri:
rtsp://192.168.123.211:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream :
dart Code get Uri:
rtsp://192.168.123.211:554/user=admin_password=tlJwpbo6_channel=1_stream=1.sdp?real_stream
I don't known the difference between 1.sdp and 0.sdp,Is there an example of getting video address?
After I searched for the device through onvif.GetAvailableDevicesAtSpecificEthernetInterface("eth0"), I cannot fill in the account and password for the returned device, which prevents me from operating the device through the CallMethod method. Is there any good method to solve this problem?
thanks
Because in some places the omitempty tag is there and most places it isnt where it should have been , also if the spec updates , one can themselves update the structs..
As I known, this package can act as an ONVIF CLIENT to find and interact with other onvif devices (like IPC ect.). It works like ONVIF Device Manager
.
However, I wonder if it can act as an ONVIF SERVER which can answer probe message from others or provide WS-Discovery service. I want to make my device act as an onvif IPC to be found by others.
thanks
Code does not match what is received when issuing go get and when cloning via git
Device.go differs seems DeviceParams has been added but this does not reflect in downloaded package from go get.
Hi. I am new to your library, and can't figure out how to use it to send backchannel audio to a device.
Does your library support Profile T (if not, this is a feature request)? And if so, how would I accomplish this?
https://www.onvif.org/profiles/profile-t/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.