Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width50%
Panel
borderColor#CCCCCC
bgColor#FFFFFF
titleBGColor#F0F0F0
titleIn the section:
borderStylesolid
Table of Contents
Column
 

Video archive stream is received from the archive in the sent on the same format as live video.

Essential video frame fields when using the archive:

file.name – the value of this field is to be saved to navigate through the archive (frame-by-frame viewing, viewing by records, etc.)  

frm.total – total frames in the record

frm.id - id of current frame in the record (starts at 0)

Information on the records in the archive is sent using Msg:

  1. Msg=start\n
    type=CAM\n
    id=1\n
    action=SET_INTERVALSREC\n
    intervals=14-05-08 14:06:25 14-05-08 14:06:26;14-05-08 14:06:30 14-05-08 14:06:31;\n
    Msg=end\n
  2. Msg=start\n
    type=CAM\n
    id=1\n
    action=SET_INTERVALSREC\n
    intervals=14:06:25 14:06:26;14:06:30 14:06:31;\n
    date=14-05-08
    Msg=end\n

In both cases the information in messages is the same, though formatted in different ways.

Information on the beginning and ending of the record is comma-separated, information on records is semi-colon separated.

day-month-year hours:minutes:seconds

14-05-08 14:06:25 14-05-08 14:06:26

If the value of the intervals parameter is empty, then there are no records on this day.

If you have the list of records in the archive, as well as file.name, file.id and the set of commands below, you can make a kind of player on the client (pause, stop, forward/backward playback, etc.)

Entering the archive - arc.enter

Getting list of records  - "arc.intervals"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.79.80.0&sessionid=29101F1&cam.id=video_in=CAM:5&command=arc.enterintervals&intervals=true&date=15.05.10 09:51:07time_from=2013-03-20T00:00:00.000+04:00&time_to=2013-03-22T23:59:59.999+04:00&max_count=100&split_threshold=10399&login=XXX&password=YYY

Required parameters:

command=arc.enter – entering the archive command.

date – date per which the archive is to be received.

intervals – send information on records in the archive (the beginning and ending of the record).

After entering the archive, the client gets the message with intervals and and 1 (one frame).

Playing back one record in the archive - "arc.play"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.7.8.0&sessionid=29101F1&cam.id=5&command=arc.play&file.name=C%3A%5CVIDEO%5C20-05-10%2016%5C0._01&frame.id=0&login=XXX&password=YYY

file.name is taken from the received video frame, frame.id – frame starting at which the archive is to be played back.

Sequence of frames from the part of record is received; playback stops (this can be tracked by frame.id).

...

intervals – command to receive list of records

video_in – camera ID.

time_from – start of interested time range.

 

Optional parameters:

time_to – start and end of interested time range.

max_count – maximal number of records in reply

split_threshold – time for combining several intervals (in seconds). Intervals, distance between which will be less than specified value, will be combined in one.

 

In return XML will be received:

 

<?xml version="1.0" encoding="UTF-8"?>

<records>

    <record>

        <from>2011-09-01T00:00:00-05:00</from>

        <to>2011-09-01T00:00:35-05:00</to>

    </record>

    <record>

        <from>2011-09-01T00:00:35-05:00</from>

        <to>2011-09-01T00:01:10-05:00</to>

    </record>

</records>

 

Getting one frame from archive - "arc.frame"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.79.80.0&sessionid=29101F1&cam.id=video_in=CAM:5&command=arc.playnonstopframe&file.nametime=C%3A%5CVIDEO%5C202013-05-10%2016%5C0._01&frame.id=003-22T13:04:52.312+04:00&range=0.1&login=XXX&password=YYY

The command is the same as "arc.play", but the player does not stop at one record – it keeps playing back the records in the archive. Do not forget to update file.name and intervals that will be changed from time to time.

Playback stops when all the records are played back.

Going to one frame or one record backward - "arc.prev"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.7.8.0&sessionid=29101F1&cam.id=5&command=arc.prev&file.name=C%3A%5CVIDEO%5C20-05-10%2016%5C0._01&frame.id=0&login=XXX&password=YYY

If the frame.id parameter is specified, then system looks for the previous frame in the archive and sends it. If this parameter is not specified, then the first frame of the previous record is received.

Only one frame is sent in response.

Info
titleNote.
Msg can also be received.

When the beginning of the archive is reached and there are no records, then the following message is received:

Msg=start\n
type=CAM\n
id=1\n
action=ARCH_ERROR\n
Msg=end\n

...

Required parameters:

command=arc.frame - command for one frame;

video_in - camera ID;

time - interested time.

 

Optional parameters:

range - time in seconds to specify search range of the nearest frame relatively the time parameter (the nearest frame all over archive is searched if this parameter is not specified);

imageWidth - width in pixels (is counted automatically with saving proportions if it isn't specified or equal 0);

imageHeight - height in pixels (is counted automatically with saving proportions if it isn't specified or equal 0);

fps - maximal frame frequency per second (if it isn't specified or equal 0, frame frequency won't be limited if).

In return http-headings and the nearest frame from the [time - range, time + range] range in the jpeg format will be received. The reply body will be empty if there is no frame in the range.   

 

Getting video from archive - "arc.play"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.79.80.0&sessionid=29101F1&cam.id=video_in=CAM:5&command=arc.next&file.name=C%3A%5CVIDEO%5C20-05-10%2016%5C0._01&frame.id=0play&time_from=2013-03-22T13:04:52.312+04:00&time_to=2013-03-22T13:16:31.873+04:00&login=XXX&password=YYY

If the frame.id parameter is specified, then system looks for the next frame in the archive and sends it. If this parameter is not specified, then the first frame of the next record is received

Only one frame is sent in response.  

Info
titleNote.
Msg can also be received.

When the end of the archive is reached and there are no records, then the following message is received:

Msg=start\n
type=CAM\n
id=1\n
action=ARCH_ERROR\n
Msg=end\n

Stopping playback - "arc.stop"

GET

http://example.com:[port][/somecontext]/secure/video/action.do?version=4.7.8.0&sessionid=29101F1&cam.id=5&command=arc.stop&login=XXX&password=YYY

...

Required parameters:

command=arc.play - command to get video from archiveа;

video_in - camera ID;

time_from - start time of archive playing back.

 

Optional parameters:

time_to - completion time of archive playing back (if parameter is not specified, all archive will play back);

imageWidth - width in pixels (is counted automatically with saving proportions if it isn't specified or equal 0);

imageHeight - height in pixels (is counted automatically with saving proportions if it isn't specified or equal 0);

maximal frame frequency per second (if it isn't specified or equal 0, frame frequency won't be limited if).

 End packet with newstate=closed and errcode=100 will be received when stream completion.

 

Getting list of records (the second way)

GET

http://example.com:[port][/somecontext]/secure/archive/CAM:2/[2011-12-30|2011-12]?[?splitTresholdsplitThreshold=50]&[days=1]

splitTreshold splitThreshold – if the difference between the ending end of the previous record and beginning start of the next record and ending is less than this number specified value (in milliseconds), then records are merged into one. In order not to merge any records, set than records will be combined in one. Specify splitTreshold=0. By default the value is 50.[default: 50] not to combine records.

days - number of days from the current, for which archive is required. [default: 1]

All For the server time is interpreted as local .time for server.

Get records for 18 November 2013 and combine all records, interval between which less than 2000 milliseconds:Sample. Records per day (December 30, 2011):   

http://example.com:[port][/somecontext]/secure/archive/CAM:21/20112013-1210-3018/?splitTreshold=2000

Get records for 10 days from 18 November 2013:  

http://example.com:[port][/somecontext]/secure/archive/CAM:21/20112013-1210-0118/?days=10

XMLSample of response:XML:

 

<?xml

...

version="1.0"

...

encoding="UTF-

...

16"?>

<days>

    <day>

...

    <day>

        <id>2013-11-10T00:00:00-

...

02:00</id>

        <records>

...

        <records>

            <from>2013-11-10T18:44:01.579-02:00</from>

            <to>2013-11-10T18:44:09.717-02:00</to>

        </records>

    </day>

    <day>

        <id>2013-11-18T00:00:00-

...

02:00</id>

        <records>

            <from>2013-11-18T18:38:30.252-02:00</from>

...

            <to>2013-

...

11-

...

18T18:

...

38:

...

56.942-

...

02:00</to>

...

        </records>

        <records>

...

        <records>

            <from>2013-11-18T18:39:08.321-02:00</from>

...

            <to>2013-

...

11-

...

18T18:

...

39:10.080-

...

02:00</to>

...

        </records>

...

    </day>

</days>

 

JSON:

 

[

...

{

...

  "id"

...

:

...

"

...

2013-

...

11-

...

10T00:00:00.000-

...

02:00",

...

  "records"

...

:

...

[

...

{

...

    "from"

...

:

...

"

...

2013-

...

11-

...

10T18:44:01.579-02:00

...

",

...

    "to"

...

:

...

"

...

2013-11-10T18:44:09.717-02:00"

  } ]

}, {

  "id" : "2013-11-18T00:00:00.000-02:00",

  "records" : [ {

    "from" : "2013-11-18T18:38:30.252-02:00",

    "to" : "2013-11-18T18:38:56.942-02:00"

  }, {

    "from" : "2013-11-18T18:39:08.321-02:00",

    "to" : "2013-11-18T18:39:10.080-02:00"

  } ]

} ]

 

Getting records for a month (shows days of September at which there are records):

  }, {
    "from" : "2011-09-01T00:00:35-0500",
    "to" : "2011-09-01T00:01:10-0500"
  }, {
    "from" : "2011-09-01T01:26:24-0500",
    "to" : "2011-09-01T01:26:59-0500"
  } ]
} ]

Sample. Records per month (shows the days in September when there are records): 

http://example.com:[port][/somecontext]/secure/archive/CAM:2/2011-12/

XML:

 

<?xml

...

version="1.0"

...

encoding="UTF-8"?>

<days>

    <day>

...

    <day>

        <id>2011-09-02T00:00:00-05:00</id>

...

    </day>

    <day>

...

    <day>

        <id>2011-09-03T00:00:00-05:00</id>

...

    </day>

    <day>

...

    <day>

        <id>2011-09-05T00:00:00-05:00</id>

...

    </day>

</days>

 

JSON:

 

[

...

{

...

  "id"

...

:

...

"2011-09-01T00:00:00-0500",

...

  "records"

...

:

...

[

...

]

},

...

{

...

  "id"

...

:

...

"2011-09-03T00:00:00-0500",

...

  "records"

...

:

...

[

...

]

},

...

{

...

  "id"

...

:

...

"2011-09-01T00:00:00-0500",

...

  "records"

...

:

...

[

...

]

}

...

]

 

If there are no records, thenthe following will be received

XML:

<days/>

JSON:

[]