3. Transfer and index videos
This section shows how to transfer the files from your AWS S3 bucket to Twelve Labs and index them.
Note
The platform checks for duplicate files using hashes and will not upload the same video to the same index twice.
Prerequisites
- Before you can download the list of files in your AWS S3 bucket, you must set up an integration.
Procedure
- Import the required packages into your application:
from twelvelabs import TwelveLabs from twelvelabs.models.task import Task
import { TwelveLabs, Task } from 'twelvelabs-js'; import * as fs from 'fs';
- Instantiate the SDK client with your API key:
client = TwelveLabs(api_key="<YOUR_API_KEY>")
const client = new TwelveLabs({ apiKey: '<YOUR_API_KEY>' });
- To perform a cloud-to-cloud transfer, invoke the
transfer
method of thetask
object, passing it a string representing the path to your JSON file as a parameter:client.task.transfer(file="<YOUR_JSON_FILE>")
client.task.transfer(fs.createReadStream('<YOUR_JSON_FILE>'));
Note that, once you've uploaded a video and the platform has finished indexing it, you can provide custom metadata. You can use custom metadata to filter search results or videos.
Updated 15 days ago