Skip to main content

AddVideo

Add a new video and properties associated with it.

An encoded video must be provided in the array of blobs or you can provide a url where the video is.

Parameters

  • [optional] _ref: Reference to be used within the transaction.
  • [optional] codec: Specifies the codec in which the video will be stored.
  • [optional] container: Specifies the container in which the video will be stored. Specifies that an index will be created for key-frames of the video.
  • [optional] url: Provide a valid URL instead of passing a blob.
  • [optional] properties
  • [optional] if_not_found
  • [optional] connect
  • [optional] operations

Details

properties are key-value pairs associated with the entity. Check properties for more details.

if_not_found can be used to turn this command into "conditional add". Check if_not_found for more details.

connect can be used to create a connection between the added object and other object(s). Check connect for more details.

Instead of passing a video blob to this command, if you would like to add a video without moving it away from a remote storage location such as a cloud bucket that it currently is present in, you can specify a valid URL to that video.

An object pointed to by the url can be modified outside of the scope of the server. It might also be subject to a retention policy as determined by the storage target policies. When accessing this object through a Find* command, appropriate error will be returned if the object is no longer accessible.

Operations can be specified through the operations parameter, all of which will be performed before persisting the video in ApertureDB.

The idea behind using url is typically to avoid moving data from its storage. Therefore, format or operations are not permitted since it would mean downloading the object locally or assuming write permissions at the remote location of the original data.

Examples

Insert a video with properties, resize to 1080p resolution, and transcode to H.264 before persisting it:


[{
"AddVideo": {
"codec": "h264",
"container": "mp4",
"properties": {
"name": "The Shinning",
"length": 186
},
"operations": [{
"type": "resize",
"width": 1920,
"height": 1080
}]
}
}]

// A blob must be passed together with the JSON Query.

Successful response:


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

Insert a new video with properties, resize to 1080p resolution, and create a connection between the new video and an Entity of the class "Category" where the "name" property is "Comedy":


[{
"FindEntity": {
"with_class": "Category",
"_ref": 1,
"unique": true,
"constraints": {
"name": ["==", "Comedy"]
}
}
}, {
"AddVideo": {
"properties": {
"name": "Mean Girls",
"length": 97
},
"operations": [{
"type": "resize",
"width": 1920,
"height": 1080
}],
"connect": {
"ref": 1,
"class": "IsOfCategory"
}
}
}]

// A blob must be passed together with the JSON Query.

Successful response:


[{
"FindEntity": {
"returned": 0,
"status": 0
}
}, {
"AddVideo": {
"status": 0
}
}]