Skip to content

Plumerai VLM Video API

This page documents the API for the VLM Video Collection and VLM Video Embedder components.

These components are used in Plumerai Video Search and Plumerai Custom AI Notifications. See those product pages for an overview of how these components are used in practice.

For context, the architecture diagram from the Video Search product page is included below:

overview

For the VLM Text Embedder and the Video and Text Matcher API documentation, visit this page.

See the minimal examples for example usage of the VLM Video Collection and VLM Video Embedder API.

VLMVideoCollection

start_clip

VLMVideoCollection.start_clip() -> ErrorCode

Start a new clip to collect data for the VLM Video Collection.

The user needs to decide when data collection should start, e.g. when someone walks into view. The VLMVideoCollection then will start collecting the necessary data for the VLM from this point onwards for every call to process_frame, until end_clip is called.

The results will be available when calling end_clip.

Arguments:

  • None.

Returns:

  • Returns SUCCESS on success, or CLIP_ALREADY_STARTED when a clip was already started.

end_clip

VLMVideoCollection.end_clip() -> tuple[ErrorCode, bytes]

Ends the data collection for the clip started with start_clip.

Arguments:

  • None.

Returns:

  • Returns a tuple with the results buffer and an error-code: SUCCESS on success or CLIP_NOT_YET_STARTED when a clip was not started previously or was already ended before.

VLMVideoEmbedder

compute_embeddings

VLMVideoEmbedder.compute_embeddings(
    clip_data: bytes, compute_single_unit_only: bool = False
) -> tuple[ErrorCode, bytes]

Compute video embeddings on data collected using `VLMVideoCollection.

Depending on the size of the collected data, this can be compute-heavy. The user can optionally set compute_single_unit_only to compute only a single part of the video embeddings. When compute_single_unit_only is set, this needs to be called in a loop with the same arguments. The error code return value will inform the user whether all units were computed, and whether the results are valid.

Arguments:

  • clip_data: The data collected using VLMVideoCollection::start_clip and VLMVideoCollection::end_clip.
  • compute_single_unit_only: Can be set to do a partial computation of the embeddings. If set, this needs to be called in a loop, see above.

Returns:

  • A tuple with the resulting embeddings and an error code. Returns SUCCESS when all embeddings have been computed, EMBEDDING_PART_COMPUTED when a single unit was successfully computed (but not everything), or INVALID_CLIP_DATA when the clip data is invalid. The resulting embeddings are only valid when the error code is SUCCESS.