c++soaponvif

Onvif profile G video retrieve


I need to get a stream video from one time to another time. I take the video from a device with an SD, and I need to get just a subpart of the video recorded on the SD.

I use GetReplayUri that gives me the url of the stream video. It doesn't permit to get a subpart of the video but just have all video.

    AddUsernameTokenDigest(deviceReplayBindingProxy, NULL, GetUser(), GetPwd(), deltaT);
    if (deviceReplayBindingProxy->GetReplayUri(&GetReplayUri_tmp, GetReplayUriResponse_tmp) != SOAP_OK)
    {
        return NC_INTERNAL_ERROR;
    }

std::string RTSP_url{ "" };
RTSP_url += GetReplayUriResponse_tmp.Uri;
RTSP_url += "?start=" + boost::lexical_cast<std::string>(startTime)  + "&end=" + boost::lexical_cast<std::string>(endTime);

It doens't work at all. Any suggestion?


Solution

  • It's possible with an RTSP command, introducing the range parameter.

    example:

    PLAY rtsp://192.168.0.1/path/to/recording RTSP/1.0
    Cseq: 123
    Session: 12345678
    Require: onvif-replay
    Range: clock=20090615T114900.440Z-20090615T115000Z
    Rate-Control: no
    PLAY rtsp://192.168.0.1/path/to/recording RTSP/1.0
    Cseq: 123
    Session: 12345678
    

    For full reference see https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf