Create video embeddings
The Resources.EmbedTask
class provides methods to create embeddings for your videos.
To create video embeddings:
- Create a video embedding task that uploads and processes a video.
- Monitor the status of your task.
- Retrieve the embeddings once the task is completed.
Methods
Create a video embedding task
Description: This method creates a new video embedding task.
Function signature and example:
Parameters:
The CreateEmbeddingsTaskVideoParams
interface defines the parameters for creating a video embedding task:
Return value: Returns a Promise
that resolves to a Models.EmbeddingsTask
instance.
API Reference: For a description of each field in the request and response, see the Create a video embedding task page.
Related guide: Create video embeddings.
Retrieve the status of a video embedding task
Description: This method retrieves the status of a video embedding task.
Function signature and example:
Parameters:
Return value: Returns a Promise
that resolves to a Models.EmbeddingsTaskStatus
instance.
You can also use the [waitForDone
] method of the Models.EmbeddingTask
class to monitor the status of a video indexing task until it completes.
API Reference: For a description of each field in the response, see the Retrieve the status of a video embedding task page.
Related guide: Create video embeddings.
Retrieve video embeddings
Description: This method retrieves embeddings for a specific video embedding task. Ensure the task status is ready
before retrieving your embeddings.
Function signature and example:
Parameters:
The Resources.RetrieveEmbeddingsTaskParams
interface contains the following fields:
Return value: Returns a Promise
that resolves to a EmbeddingsTask
instance.
API Reference: For a description of each field in the response, see the Retrieve video embeddings page.
Related guide: Create video embeddings.
Error codes
This section lists the most common error messages you may encounter while using the Resources.EmbedTask
class.
parameter_invalid
- The
video_clip_length
parameter is invalid.video_clip_length
should be within 2-10 seconds long - The
video_end_offset_sec
parameter is invalid.video_end_offset_sec
should be greater thanvideo_start_offset_sec
- The