Skip to main content

Parameters for Positional Media Access

These are the parameters supported in ApertureDB for referincing positions in media which has a time component.

frame_number

The frame_number parameter is the position in a video defined by zero-based frame number. Type is Number.

Example

[{
"AddVideo": {
"_ref": 1,
"properties": {
"name": "my_video"
}
}
}, {
"AddFrame": {
"video_ref": 1,
"frame_number": 99,
"properties": {
"source": "main character image"
}
}
}]

Successful response:

[{
"AddVideo": {
"status": 0
}
}, {
"AddFrame": {
"status": 0
}
}]

in_frame_number_range

The in_frame_number_range parameter is the position range in a video defined by zero-based frame numbers "start" and "stop". The value of "stop" parameter is inclusive. Both values of "start" and "stop" are unsigned integers.

Example

This defines a frame range from frame 0 to frame 33, with total number of 34 frames.

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"year_captured": ["==", 1990]
}
}
}, {
"FindFrame": {
"in_frame_number_range": {
"start": 0,
"stop": 33
},
"is_connected_to": {
"ref": 1
},
"results": {
"list": ["source"]
},
"blobs": false
}
}]

Successful response:

[{
"FindVideo": {
"returned": 0,
"status": 0
}
}, {
"FindFrame": {
"returned": 1,
"status": 0,
"entities": [{
"source": "my_model"
}]
}
}]

frame_spec

The frame_spec parameter specifies a sequence of frame numbers in a video. The following two formats are recognized.

The first is an array of frame numbers. The type is number.

The second is an object with three unsigned integers

start,stop andstep. Thestep parameter is optional and defaults to 1. The value of stop parameter is inclusive.

Frame numbers are zero-based.

Example

This defines a frame sequence 0, 50, 100, and 150:

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"name": ["==", "my_video"]
},
"blobs": false
}
}, {
"ExtractFrames": {
"video_ref": 1,
"frame_spec": [0, 50, 100, 150],
"as_format": "jpg"
}
}]

Successful response:

[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"ExtractFrames": {
"status": 0,
"returned": 4,
"blobs_start": 0
}
}]

In this example we define a frame sequence from frame 0 to frame 33, with (default) step 1 and the total number of frames equal to 34:

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"name": ["==", "my_video"]
},
"blobs": false
}
}, {
"ExtractFrames": {
"video_ref": 1,
"frame_spec": {
"start": 0,
"stop": 33
},
"as_format": "jpg"
}
}]

Successful response:

[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"ExtractFrames": {
"status": 0,
"returned": 34,
"blobs_start": 0
}
}]

This defines a frame sequence from frame 0 to frame 33, with step 3 total number of frames equal to 12:

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"name": ["==", "my_video"]
},
"blobs": false
}
}, {
"ExtractFrames": {
"video_ref": 1,
"frame_spec": {
"start": 0,
"stop": 33,
"step": 3
},
"as_format": "jpg"
}
}]

Successful response:

[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"ExtractFrames": {
"status": 0,
"returned": 12,
"blobs_start": 0
}
}]

The following frame spec is equivalent to the one above:

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"name": ["==", "my_video"]
},
"blobs": false
}
}, {
"ExtractFrames": {
"video_ref": 1,
"frame_spec": [
0,
3,
6,
9,
12,
15,
18,
21,
24,
27,
30,
33
],
"as_format": "jpg"
}
}]

Successful response:

[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"ExtractFrames": {
"status": 0,
"returned": 12,
"blobs_start": 0
}
}]

time_fraction

The time_fraction is the position in a video defined by a fraction of video duration, with 0.0 being the beginning and 1.0 being the end of the video. Type is float.

Example

This defines a time frame at 0.375:

[{
"AddVideo": {
"_ref": 1,
"codec": "h264",
"container": "mp4",
"properties": {
"year_captured": 1991
}
}
}, {
"AddFrame": {
"video_ref": 1,
"time_fraction": 0.375,
"properties": {
"source": "my_model"
}
}
}]

Successful response:

[{
"AddVideo": {
"status": 0
}
}, {
"AddFrame": {
"status": 0
}
}]

in_time_fraction_range

The in_time_fraction_range is the position range in a video defined by two fractions of video duration, "start" and "stop". The value of "stop" parameter is inclusive. Types are

float.

Example

This defines a time frame range from 0.250 (end of 1st quarter of the video) to 0.500 (the middle of the video):

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"year_captured": ["==", 1992]
}
}
}, {
"FindFrame": {
"in_time_fraction_range": {
"start": 0.25,
"stop": 0.5
},
"is_connected_to": {
"ref": 1
},
"results": {
"list": ["source"]
},
"blobs": false
}
}]

Successful response:

[{
"FindVideo": {
"returned": 0,
"status": 0
}
}, {
"FindFrame": {
"returned": 1,
"status": 0,
"entities": [{
"source": "my_model"
}]
}
}]

time_offset

The time_offset parameter is the position in a video defined by the time since the beginning of the video. Type is string. Format is "[[HH:]MM:]SS[.n[n[...]]]", where square brackets indicate optional elements.

Example

This defines a time offset at "5 seconds and 125 milliseconds" after the beginning of the video:

[{
"AddVideo": {
"_ref": 1,
"codec": "h264",
"container": "mp4",
"properties": {
"year_captured": 1993
}
}
}, {
"AddFrame": {
"video_ref": 1,
"time_offset": "00:00:05.125",
"properties": {
"source": "my_model"
}
}
}]

Successful response:

[{
"AddVideo": {
"status": 0
}
}, {
"AddFrame": {
"status": 0
}
}]

in_time_offset_range

The in_time_offset_range parameter is the position range in a video defined by the times "start" and "stop" since the beginning of the video. The format for each is "[[HH:]MM:]SS[.n[n[...]]]", where square brackets indicate optional elements.

Example

This defines a time offset range from 5.1 sec to 5.2 sec:

[{
"FindVideo": {
"_ref": 1,
"constraints": {
"year_captured": ["==", 1994]
}
}
}, {
"FindFrame": {
"in_time_offset_range": {
"start": "00:00:05.1",
"stop": "00:00:05.2"
},
"is_connected_to": {
"ref": 1
},
"results": {
"list": ["source"]
},
"blobs": false
}
}]

Successful response:

[{
"FindVideo": {
"returned": 0,
"status": 0
}
}, {
"FindFrame": {
"returned": 1,
"status": 0,
"entities": [{
"source": "my_model"
}]
}
}]