Create embeddings
This quickstart guide provides a simplified introduction to generating text from video using the TwelveLabs Video Understanding Platform. It includes:
- A basic working example
- Minimal implementation details
- Core parameters for common use cases
For a comprehensive guide, see the Create embeddings section.
Prerequisites
-
To use the platform, you need an API key:
-
Ensure the TwelveLabs SDK is installed on your computer:
-
The videos you wish to use 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, or 9:16.
- 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.
-
The audio files you wish to use use must meet the following requirements:
- Format: WAV (uncompressed), MP3 (lossy), and FLAC (lossless)
- File size: Must not exceed 10MB.
-
The images you wish to use use must meet the following requirements:
- Format: JPEG and PNG.
- Dimension: Must be at least 128 x 128 pixels.
- Size: Must not exceed 5MB.
Starter code
You can copy and paste the code below to create embeddings. Replace the placeholders surrounded by <>
with your values.
Video embeddings
Text embeddigs
Image embeddings
Audio embeddings
Step-by-step guide
Video embeddings
Text embeddings
Image embeddings
Audio embeddings
Import the SDK and initialize the client
Create a client instance to interact with the TwelveLabs Video Understanding platform.
Upload videos
To perform any downstream tasks, you must first upload your videos, and the platform must finish processing them.
Monitor the status
The platform requires some time to process videos. Check the status of the video indexing task until it’s completed.