本文已参与「新人创作礼」活动,一起开启掘金创作之路。
一、设置编码参数
对于IPC默认的编码参数可能并不是我们所想要的,这时候可以设置IPC设备的编码参数,通过SetVideoEncoderConfiguration来设置
二、获取编码参数实现
1、创建tcp socket,IP为192.168.100.123,端口:8099;
2、填写token="000",Name="VideoE_000",编码格式Encoding = H264,视频分辨Resolution = 1280*720,帧率FrameRateLimit = 15,码流BitrateLimit = 1792,I帧间隔GovLength = 1,设备IP = 192.168.100.123,端口 Port = 8099;
3、通过ONVIF Device Test Tool工具SetVideoEncoderConfiguration数据:
4、发送(send)数据:
<?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:SetVideoEncoderConfiguration>
<trt:Configuration token="000">
<tt:Name>VideoE_000</tt:Name>
<tt:UseCount>1</tt:UseCount>
<tt:Encoding>H264</tt:Encoding>
<tt:Resolution>
<tt:Width>1280</tt:Width>
<tt:Height>720</tt:Height>
</tt:Resolution>
<tt:RateControl>
<tt:FrameRateLimit>15</tt:FrameRateLimit>
<tt:EncodingInterval>1</tt:EncodingInterval>"
<tt:BitrateLimit>1792</tt:BitrateLimit>
</tt:RateControl>
<tt:H264>
<tt:GovLength>1</tt:GovLength>
<tt:H264Profile>Main</tt:H264Profile>
</tt:H264>
<tt:Multicast>
<tt:Address>
<tt:Type>IPv4</tt:Type>
<tt:IPv4Address>192.168.100.123</tt:IPv4Address>
</tt:Address>
<tt:Port>8099</tt:Port>
<tt:TTL>1</tt:TTL>
<tt:AutoStart>true</tt:AutoStart>
</tt:Multicast>
<tt:SessionTimeout>PT1H1M1S</tt:SessionTimeout>
</trt:Configuration>
<trt:ForcePersistence>true</trt:ForcePersistence>
</trt:SetVideoEncoderConfiguration>
</soap:Body>
</soap:Envelope>
5、接受(recv)数据
HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2911
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:xs="http://www.w3.org/2000/10/XMLSchema"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
secext-1.0.xsd"
xmlns:wsa5="http://www.w3.org/2005/08/addressing"
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:ns1="http://www.w3.org/2005/05/xmlmime"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:ns7="http://docs.oasis-open.org/wsrf/r-2"
xmlns:ns2="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:dndl="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding"
xmlns:dnrd="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding"
xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"
xmlns:dn="http://www.onvif.org/ver10/network/wsdl"
xmlns:ns10="http://www.onvif.org/ver10/replay/wsdl"
xmlns:ns11="http://www.onvif.org/ver10/search/wsdl"
xmlns:ns13="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding"
xmlns:ns14="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding"
xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
xmlns:ns15="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"
xmlns:ns16="http://www.onvif.org/ver10/events/wsdl/EventBinding"
xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:ns17="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"
xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"
xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"
xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"
xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"
xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:ns3="http://www.onvif.org/ver10/analyticsdevice/wsdl"
xmlns:ns4="http://www.onvif.org/ver10/deviceIO/wsdl"
xmlns:ns5="http://www.onvif.org/ver10/display/wsdl"
xmlns:ns8="http://www.onvif.org/ver10/receiver/wsdl"
xmlns:ns9="http://www.onvif.org/ver10/recording/wsdl"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:trt2="http://www.onvif.org/ver20/media/wsdl"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:tns1="http://www.onvif.org/ver10/topics"
xmlns:tnsn="http://www.eventextension.com/2011/event/topics">
<SOAP-ENV:Body>
<trt:SetVideoEncoderConfigurationResponse>
</trt:SetVideoEncoderConfigurationResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
\