AddVideo

Add a new video and properties associated with it.

An encoded video must be provided in the array of blobs.

Parameters

  • [optional] _ref: Reference to be used within the transaction.
  • [optional] codec: Specifies the codec in which the video will be stored.
  • [optional] container: Specified the container in which the video will be stored.
  • [optional] index_frames: Specifies that an index will be created for key-frames of the video.
  • [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.

The index_frame parameter, when “true”, will trigger the creation of a key-frame index for the video. The index is used to perform partial decoding rather than full decoding, which results in reduced memory consumption and faster frame retrieval. Creating the key-frame index for a video will make the command take longer to process. Key-frame indexes are only supported for H.264 encoded videos.

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",
                "w": 1920,
                "h": 1080,
            }
        ]
    }
} ]

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

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",
                "w": 1920,
                "h": 1080,
            }
        ],
        "connect": {
            "ref": 1,
            "class": "IsOfCategory"
        }
    }
} ]

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