Skip to main content

Managing multimedia content

One of the typical use cases of Vertx technology is copyright protection, when a multimedia asset is searched in large collections containing copyrighted songs and movies. Music and movies assets are managed by Vertx organization. There are pipelines that periodically fetch new releases and add signatures to search indices along with the metadata.

However, there might be use cases that require adding custom content to search indices. An example of such a use case might be content deduplication in a large multimedia collection. Another example could be indexing custom content type, e.g. a collection of objectionable content (terrorism, nudity and porn) and scanning user-generated content against it.

At Vertx, we introduced content buckets to provide isolation in a multi-tenant environment. Content buckets create boundaries between resources to limit any exposure to cross-tenant access. By default, all content buckets are private and can be accessed only by users belonging to an organization that is explicitly granted access. Each organization can manage a number of content buckets that are created on demand to accommodate different use cases.

There is a number of ways one can register multimedia content: calling REST API or invoking Vertx CLI. In both cases, one can specify metadata for multimedia asset that will be attached to search results.

# CURL example to register content
curl -X POST 'https://api.vertx.ai/v1/media/${BUCKET}' \
-H "Accept: application/json" \
-H "X-Session-Token: ${VERTX_API_KEY}" \
-H "Content-Type: multipart/form-data" \
-F "media_file=@/path/to/media/file.mp4" \
-F "metadata=@/path/to/metadata.json"
# Vertx CLI example to register content in bucket ${BUCKET}
vertx register \
--bucket=${BUCKET} \
${MEDIA_FILE_PATH}

After successful registration, signatures for the media asset are added to the private bucket search index. Each media asset is assigned a unique identifier (uid) being a 64-bit unsigned integer represented as string. The uid can be parsed from the JSON response. One can delete of update registered asset providing the uid. There is REST API to update metadata for a media asset:

# CURL example to update metadata for multimedia asset with unique identifier UID
curl -X POST "https://api.vertx.ai/v1/media/${BUCKET}/${UID}" \
-H "Accept: application/json" \
-H "X-Session-Token: ${VERTX_API_KEY}" \
-F 'metadata="{\"title\"=\"new_title\"}"'

In order to delete media asset from the private bucket, one has to call DELETE method:

# CURL example to delete multimedia asset with unique identifier `UID`
curl -X DELETE "https://api.vertx.ai/v1/media/${BUCKET}/${UID}" \
-H "X-Session-Token: ${VERTX_API_KEY}"

There is a GET endpoint to list all the assets registered in the bucket. The endpoint supports cursor based pagination with pagination information inside a pagination object. This means that to get all objects, you need to paginate through the results by always using the id of the last resource in the list as a GET parameter for the next call. To make it easier, the API will construct the next call into next uri together with all the currently used pagination parameters. You know that you have paginated all the results when the response’s next uri is empty.

# CURL example to list multimedia assets registered in bucket ${BUCKET} 
curl -X GET "https://api.vertx.ai/v1/media/${BUCKET}?page[size]=50&page[after]=" \
--header "X-Session-Token: ${VERTX_API_KEY}"