这是我从google找到的
If you have a ONVIF compatible security camera the following may help: -
1.
Create file named getProfiles.xml with the following: -
--- Code: ---<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl">
<soap:Body>
<trt:GetProfiles/>
</soap:Body>
</soap:Envelope>
--- End code ---
2. Run the following curl command: -
--- Code: ---curl http://<INSERTIPADDRESSHERE>/onvif/device_service --data @getProfiles.xml |xmllint --pretty 1 -
--- End code ---
This should list all the profiles on that camera. Choose the profile that you are interested in, for me it is MainStream: -
--- Code: ---<trt:Profiles fixed="false" token="MainStream">
--- End code ---
3. Create file named getSnapshotUri.xml with the following: -
--- Code: ---<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:tt="http://www.onvif.org/ver10/schema">
<soap:Body>
<trt:GetSnapshotUri>
<trt:ProfileToken>MainStream</trt:ProfileToken>
</trt:GetSnapshotUri>
</soap:Body>
</soap:Envelope>
--- End code ---
Where ProfileToken = token from previous response.
4. Run the following curl command: -
--- Code: ---curl http://<INSERTIPADDRESSHERE>/onvif/device_service --data @getSnapshotUri.xml |xmllint --pretty 1 -
--- End code ---
Hopefully you will get something like this: -
--- Code: --- <SOAP-ENV:Body>
<trt:GetSnapshotUriResponse>
<trt:MediaUri>
<tt:Uri>http://192.168.0.205:80/cgi-bin/snapshot.cgi?stream=0</tt:Uri>
<tt:InvalidAfterConnect>false</tt:InvalidAfterConnect>
<tt:InvalidAfterReboot>false</tt:InvalidAfterReboot>
<tt:Timeout>PT0H12M0S</tt:Timeout>
</trt:MediaUri>
</trt:GetSnapshotUriResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--- End code ---
If you want to file the RTSP stream: -
Create file named getStreamURI.xml with the following, using same token or token from another profile: -
--- Code: ---<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:tt="http://www.onvif.org/ver10/schema">
<soap:Body>
<trt:GetStreamUri>
<trt:StreamSetup>
<tt:Stream>RTP-Unicast</tt:Stream>
<tt:Transport>
<tt:Protocol>UDP</tt:Protocol>
</Transport>
</trt:StreamSetup>
<trt:ProfileToken>MainStream</trt:ProfileToken>
</trt:GetStreamUri>
</soap:Body>
</soap:Envelope>
--- End code ---
Then run the following curl command:-
--- Code: ---curl http://<INSERTIPADDRESSHERE>/onvif/device_service --data @getStreamURI.xml |xmllint --pretty 1 -
--- End code ---
This was done under linux so not sure if the same will work under windows. Hopefully this helps somebody.