Create video embeddings
The TasksClient
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 that uploads a video to the platform.
Video requirements
The videos you wish to upload must meet the following requirements:
- Video resolution: Must be at least 360x360 and must not exceed 3840x2160.
- Aspect ratio: Must be one of 1:1, 4:3, 4:5, 5:4, 16:9, 9:16, or 17:9.
- Video and audio formats: Your video files must be encoded in the video and audio formats listed on the FFmpeg Formats Documentation page. For videos in other formats, contact us at support@twelvelabs.io.
- Duration: Must be between 4 seconds and 2 hours (7,200s).
- File size: Must not exceed 2 GB. If you require different options, contact us at support@twelvelabs.io.
Video requirements
The videos you wish to upload must meet the following requirements:
- Video resolution: Must be at least 360x360 and must not exceed 3840x2160.
- Aspect ratio: Must be one of 1:1, 4:3, 4:5, 5:4, 16:9, 9:16, or 17:9.
- Video and audio formats: Your video files must be encoded in the video and audio formats listed on the FFmpeg Formats Documentation page. For videos in other formats, contact us at support@twelvelabs.io.
- Duration: Must be between 4 seconds and 2 hours (7,200s).
- File size: Must not exceed 2 GB. If you require different options, contact us at support@twelvelabs.io.
Video requirements
The videos you wish to upload must meet the following requirements:
- Video resolution: Must be at least 360x360 and must not exceed 3840x2160.
- Aspect ratio: Must be one of 1:1, 4:3, 4:5, 5:4, 16:9, 9:16, or 17:9.
- Video and audio formats: Your video files must be encoded in the video and audio formats listed on the FFmpeg Formats Documentation page. For videos in other formats, contact us at support@twelvelabs.io.
- Duration: Must be between 4 seconds and 2 hours (7,200s).
- File size: Must not exceed 2 GB. If you require different options, contact us at support@twelvelabs.io.
Video requirements
The videos you wish to upload must meet the following requirements:
- Video resolution: Must be at least 360x360 and must not exceed 3840x2160.
- Aspect ratio: Must be one of 1:1, 4:3, 4:5, 5:4, 16:9, 9:16, or 17:9.
- Video and audio formats: Your video files must be encoded in the video and audio formats listed on the FFmpeg Formats Documentation page. For videos in other formats, contact us at support@twelvelabs.io.
- Duration: Must be between 4 seconds and 2 hours (7,200s).
- File size: Must not exceed 2 GB. If you require different options, contact us at support@twelvelabs.io.
Function signature and example:
Parameters:
Return value: Return value: Returns a TasksCreateResponse
object representing the new video embedding task.
The TasksCreateResponse
class contains the following properties:
API Reference: Create a video embedding task.
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 TasksStatusResponse
object containing the current status of the embedding task.
The TasksStatusResponse
class contains the following properties:
The TasksStatusResponseVideoEmbedding
class contains the following properties:
The VideoEmbeddingMetadata
class extends BaseEmbeddingMetadata
and contains the following properties:
API Reference: Retrieve the status of a video embedding task.
Related guide: Create video embeddings.
Wait for a video embedding task to complete
Description: This method waits until a video embedding task is completed by periodically checking its status. If you provide a callback function, it calls the function after each status update with the current task object, allowing you to monitor progress.
Parameters
Return value: Returns a TasksStatusResponse
object containing the status of your completed task. See the Retrieve the status of a video embedding task section above for complete property details.
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:
Return value: Returns a TasksRetrieveResponse
object containing your embeddings.
The TasksRetrieveResponse
class contains the following properties:
The TasksRetrieveResponseVideoEmbedding
class contains the following properties:
The VideoEmbeddingMetadata
class extends BaseEmbeddingMetadata
and contains the following properties:
The VideoSegment
class extends AudioSegment
and contains the following properties:
API Reference: Retrieve video embeddings.
Related guide: Create video embeddings.
Error codes
This section lists the most common error messages you may encounter while creating video embeddings.
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