EasyNVR web camera without plug-H5, Google Chrome broadcast program -Onvif (c) the use Onvif PTZ PTZ control protocol for device

Creative Commons License Creative Commons

background analysis

Familiar EasyNVR product basin faithful should know, EasyNVR mainly to complete the RTSP video streams RTMP / HLS / Flv transcoding, and provides a set of api and a visual management platform to facilitate calls. Supports ONVIF protocol for PTZ control. Boils down to this, I want to use EasyNVR must have the RTSP protocol support! Want to control PTZ must support the ONVIF! Of course, rtsp rtmp transcoding to this operation can also be self-fulfilling, for example, the most common is Red5 + ffmpeg, but needs its own hand line and a back-end management, we weigh this effort. Onvif protocol used is the most important application of the device PTZ PTZ control, PTZ control includes rotation, zoom and so on.

The blog post discusses common rotation and zoom (i.e. zoom)

1. Process

To control PTZ devices, we first need to get the user name password for the device Device Service Address and this device, both the process and get the same flow address.

  • The ability to obtain equipment Capabilities

Ability to obtain equipment, and can get to the URI Media and PTZ using both URL and PTZ operations can be streamed here if PTZ URI means that the device can not get less support PTZ control


    _tds__GetCapabilities* capabilities = soap_new__tds__GetCapabilities(proxyDevice, -1);
    tt__CapabilityCategory* category = new tt__CapabilityCategory;
    capabilities->Category = category;
    *(capabilities->Category) = tt__CapabilityCategory__All;
    _tds__GetCapabilitiesResponse* response = soap_new__tds__GetCapabilitiesResponse(proxyDevice, -1);
    if (SOAP_OK == proxyDevice->GetCapabilities(capabilities, response))
    {
	    if (response->Capabilities)
	    {
		    //Media URI: response->Capabilities->Media->XAddr;
		    //PTZ URI: response->Capabilities->PTZ->XAddr;
	    }
    }

  • Gets Media Profile

The use of step acquired Media URI acquisition device Media Profile


    _trt__GetProfiles* getProfiles = soap_new__trt__GetProfiles(proxyMedia, -1);
    _trt__GetProfilesResponse* response = soap_new__trt__GetProfilesResponse(proxyMedia, -1);
    if (SOAP_OK == proxyMedia->GetProfiles(getProfiles, response))
    {
	    int size = response->__sizeProfiles;
	    for (int i = 0; i < size; ++i)
	    {
		    if (response->Profiles[i])
		    {
			    //Media Profile Token: response->Profiles[i]->token;
			    //一般设备包含多个Profile Token,包含主码流、子码流、第三码流
		    }
	    }
    }

2.PTZ control

Using the acquired Media URI and Media Profile Token perform PTZ control, just to consider ContinuousMove, you need to send a command to stop in time to stop.


    _tptz__ContinuousMove* continuousMove = soap_new__tptz__ContinuousMove(ptzProxy, -1);
    _tptz__ContinuousMoveResponse* response = soap_new__tptz__ContinuousMoveResponse(ptzProxy, -1);
    continuousMove->ProfileToken = const_cast<char *>(profile.c_str());
    tt__PTZSpeed* velocity = soap_new_tt__PTZSpeed(ptzProxy, -1);
    continuousMove->Velocity = velocity;
    tt__Vector2D* panTilt = soap_new_tt__Vector2D(ptzProxy, -1);
    continuousMove->Velocity->PanTilt = panTilt;
    continuousMove->Velocity->PanTilt->space = "http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace";
    tt__Vector1D* zoom = soap_new_tt__Vector1D(ptzProxy, -1);
    continuousMove->Velocity->Zoom = zoom;
    switch (command)
    {
    case LEFT:
	    continuousMove->Velocity->PanTilt->x = -((float)speed / 10);
	    continuousMove->Velocity->PanTilt->y = 0;
	    break;
    case RIGHT:
	    continuousMove->Velocity->PanTilt->x = ((float)speed / 10);
	    continuousMove->Velocity->PanTilt->y = 0;
	    break;
    case UP:
	    continuousMove->Velocity->PanTilt->x = 0;
	    continuousMove->Velocity->PanTilt->y = ((float)speed / 10);
	    break;
    case DOWN:
	    continuousMove->Velocity->PanTilt->x = 0;
	    continuousMove->Velocity->PanTilt->y = -((float)speed / 10);
	    break;
    case ZOOMIN:
	    continuousMove->Velocity->Zoom->x = ((float)speed / 10);
	    break;
    case ZOOMOUT:
	    continuousMove->Velocity->Zoom->x = -((float)speed / 10);
	    break;
    default:
	    break;
    }

    if (ptzProxy->ContinuousMove(continuousMove, response) == SOAP_OK)
	    //转动成功

3. Stop PTZ control


    _tptz__Stop* stop = soap_new__tptz__Stop(ptzProxy, -1);
    _tptz__StopResponse* response = soap_new__tptz__StopResponse(ptzProxy, -1);
    stop->ProfileToken = const_cast<char*>(profile.c_str());

    bool* pantilt = new bool;
    stop->PanTilt = pantilt;
    *(stop->PanTilt) = true;
    bool* zoom = new bool;
    stop->Zoom = zoom;
    *(stop->Zoom) = true;

    if (SOAP_OK == ptzProxy->Stop(stop, response))
	    //停止成功

EasyNVR scenarios

  • The traditional decentralized campus monitoring system EasyNVR aggregated to achieve the traditional local surveillance to remote monitoring anytime, anywhere, to rise to the traditional pure management monitoring, video surveillance has become a powerful tool for school management. More important is the involvement of parents together to improve education initiative to enhance the reputation of the school and school brand.
    Safe campus
Safe campus
  • The camera site through an open platform for the construction side, supervision side and regulators to facilitate the understanding of the real-time progress of the project, site security personnel and property, the self into force and energy platform, built specifically for the site video surveillance platform.
    Ping site
Ping site
  • With the Internet and mobile Internet are accepted by the majority of consumers, "social cohabitation" will be lit kitchen stove Ming current core philosophy. The use of social cohabitation way, each catering enterprises Houchu video by EasyNVR system so that people can see real-time via cell phone case Houchu, both play the whole society oversight of the effect is to promote catering business.
    Mingchuliangzao
Mingchuliangzao
  • The company is a live environment, products, production processes and products within the enterprise in order to live out presented in a way to allow customers to see the environment and transparency of the production, we can clearly see the products purchased through Live process.
    Enterprise Live
Enterprise Live

About EasyNVR

EasyNVR have is a full, independent, controllable intellectual property rights, but also can have the function of security software and hardware integration of Internet streaming media server, network camera through a simple channel configuration, monitoring industry inside traditional high-definition network camera IP Camera , etc. with the NVR RTSP, Onvif protocol output device access to EasyNVR, EasyNVR these audio and video data can be video sources is a pull, is converted to RTMP / HLS, full internet terminal H5 live (Web, Android, iOS), and EasyNVR able to broadcast live video source of data to a third party CDN network, Internet-scale distributed. EasyNVR details you may visit the official website: http://www.easynvr.com

Guess you like

Origin blog.csdn.net/EasyNVR/article/details/91948478