AddFrame
Adds a frame to a referenced video.
Frame is defined as a position in the video. The position can be specified in terms of terms of (i) frame number, (ii) time offset of the frame since the beginning of the video, or (iii) fractional offset of the frame in the video, with zero being the start and one being the end of the video.
Parameters
- video_ref: Reference to a single video within the transaction to which the corresponding frame will be added.
- [optional] label
- [optional] frame_number
- [optional] time_offset
- [optional] time_fraction
- [optional] properties
- [optional] if_not_found
- [optional] connect
Details
One of frame_number
, time_offset
or time_fraction
must be specified.
Parameters time_offset
or time_fraction
are stored
without conversion to frame number.
When a retrieval of an frame frame is requested, e.g. via
FindFrame command with "blob": true
,
the time parameter is converted to a frame number by finding
the latest frame that existed at the specified time.
Referenced video must be specified by the video_ref.
Example
Find the video with the "name" property equal to "my_video_1", add frame 99 (zero-based), and add a property to the frame with key "scene" and value "main character image":
[{
"FindVideo": {
"_ref": 1,
"unique": true,
"blobs": false,
"constraints": {
"name": ["==", "my_video_1"]
}
}
}, {
"AddFrame": {
"video_ref": 1,
"frame_number": 99,
"properties": {
"scene": "main character image"
}
}
}]
Successful response:
[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"AddFrame": {
"status": 0
}
}]
Find the video with the "name" property equal to "my_video_2", add frame at time 1h 22min 10.000sec since the start of the video, and add a property to the frame with key "scene" and value "main character image":
[{
"FindVideo": {
"_ref": 1,
"unique": true,
"blobs": false,
"constraints": {
"name": ["==", "my_video_2"]
}
}
}, {
"AddFrame": {
"video_ref": 1,
"time_offset": "01:22:10.000",
"properties": {
"scene": "main character image"
}
}
}]
Successful response:
[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"AddFrame": {
"status": 0
}
}]
Find the video with the "name" property equal to "my_video_3", add frame at the middle of the movie, and add a property to the frame with key "scene" and value "mid-movie frame":
[{
"FindVideo": {
"_ref": 1,
"unique": true,
"blobs": false,
"constraints": {
"name": ["==", "my_video_3"]
}
}
}, {
"AddFrame": {
"video_ref": 1,
"time_fraction": 0.5,
"properties": {
"scene": "main character image"
}
}
}]
[{
"FindVideo": {
"status": 0,
"returned": 0
}
}, {
"AddFrame": {
"status": 0
}
}]