Manage video playback

Playback controls comply with RTSP standards and the ONVIF Streaming Specification (https://www.onvif.org/profiles/specifications/).

Recording summary

You can get an overview of all recorded video available on the device by using the GetRecordingSummary command. This is not required, but it provides useful information prior to conducting a search.

You can use GetRecordingSummary and/or GetMediaAttributes to get the timestamp of the first and the last recording, but you must first enable the Use configurations from cameras setting on the Milestone Open Network Bridge plug-in in the XProtect Management Client.

Use configuration from cameras check box in the Open Network Bridge Information pane.

Create a proxy for the RecordingSearch service using the service endpoint returned by GetServices. Create request and response objects, then call GetRecordingSummary.

SearchBindingProxy searchProxy( &soapSearch );

std::string searchEndpoint = "http://" + host + "/onvif/recording_search_service";

_tse__GetRecordingSummary tse__GetRecordingSummary;

_tse__GetRecordingSummaryResponse tse__GetRecordingSummaryResponse;

result = searchProxy.GetRecordingSummary( searchEndpoint.c_str(), NULL,

   &tse__GetRecordingSummary, &tse__GetRecordingSummaryResponse );

Search for recordings

The Search service method FindRecordings starts an asynchronous search on the camera. FindRecordings returns a token that references the search results. Even though there is only one recording available, a search is the proper way to obtain a reference for that recording.

Send a FindRecordings request with the following mandatory parameters:

  • SearchScope > IncludedSources > Token – you must provide the camera GUID token
  • SearchScope > RecordingInformationFilter – string with the following parameters:
    • timestamp (in UTC format)
    • maxTimeBefore (the time before the requested timestamp, in milliseconds)
    • maxCountBefore (the maximum number of tracks before requested timestamp)
    • maxTimeAfter (the time after the requested timestamp, in milliseconds)
    • maxCountAfter (the maximum number of tracks after requested timestamp)

For example:

boolean(//Track[TrackType = “Video”]),2016-12-06T08:07:43Z,99999999,20,99999999,20

You will get a response with a SearchToken, which is unique for the search criteria.

Pass the SearchToken to GetRecordingSearchResults and you will get a list with all the tracks corresponding to the search criteria.

Initiating playback

When viewing video playback, the default speed is 1 (normal playback in the forward direction).

Playback is initiated by means of the RTSP PLAY method. A range can be specified. If no range is specified, the stream is played from the beginning and plays to the end, or, if the stream is paused, it is resumed at the point it was paused. In this example, “Range: npt=3-20” instructs the RTSP server to start playback from the third second until 20th second.

For example:

PLAY rtsp://user:1234@test01:554/vod/943ffaad-42be-4584-bc2c-c8238ed96373 RTSP/1.0

CSeq: 123

Session: 12345678

Require: onvif-replay

Range: npt=3-20

Rate-Control: no

Reverse playback

ONVIF devices MAY support reverse playback. Reverse playback is indicated using the Scale header field with a negative value. For example to play in reverse without data loss, a value of –1.0 would be used.

The Milestone Open Network Bridge supports values [-32 : 32].

PLAY rtsp://user:1234@test01:554/vod/943ffaad-42be-4584-bc2c-c8238ed96373 RTSP/1.0

CSeq: 123

Session: 12345678

Require: onvif-replay

Range: clock=20090615T114900.440Z

Rate-Control: no

Scale: -1.0

Change speed

Speed is controlled by the RTSP Rate-Control header. If "Rate-Control=yes", then the server is in control of the playback speed. The stream is delivered in real time using standard RTP timing mechanisms. If "Rate-Control=no", then the client is in control of the playback speed. Rate-controlled replay will typically only be used by non-ONVIF specific clients because they will not specify “Rate-Control=no”.

To control playback speed in a client, use the provided controllers. For example, with the VLC media player, select Playback > Speed > Faster or Slower. This increases or decreases the speed by 0.5.

Faster Fine and Slower Fine change the speed by 0.25.

Manage VLC media player playback with command line entries

You can manage video playback in the VLC media player by using command lines. Refer to the VLC command line help (https://wiki.videolan.org/VLC_command-line_help/) for details.

Such commands allow you to, for example, reverse playback and change the start time of the playback.

An example of a typical command line:

>vlc.exe --rate=-1.0 --start-time=3600 "rtsp://user:1234@test01:554/vod/943ffaad-42be-4584-bc2c-c8238ed96373"

Where:

  • Rate is the scale and speed parameter
  • Start-time is seconds after the database start

Following are the playback controls for VLC media player:

Code

What can I achieve with the code?

input-repeat=

<integer [-2147483648 .. 2147483647]>

Input repetitions

Number of times the same input will be repeated

start-time=

<float>

Start time

The stream will start at this position (in seconds)

stop-time=

<float>

Stop time

The stream will stop at this position (in seconds)

run-time=

<float>

Run time

The stream will run this duration (in seconds)

input-fast-seek

no-input-fast-seek

Fast seek (default disabled)

Favor speed over precision while seeking

rate=

<float>

Playback speed

This defines the playback speed (nominal speed is 1.0)

input-list=

<string>

Input list

You can give a comma-separated list of inputs that will be concatenated together after the normal one

input-slave=

<string>

Input slave (experimental)

This allows you to play from several inputs at the same time. This feature is experimental, not all formats are supported. Use a '#' separated list of inputs