Provide transcriptions for cloud-to-cloud transfers
Cloud-to-cloud transfers allow you to group multiple video indexing operations in a single API request. For a description of each field in the request and response, see the API Reference > Make a cloud-to-cloud transfer page.
Prerequisites
- You’re familiar with the concepts that are described on the Platform overview page.
- You've already created an index. For details, see the Create indexes page.
- You already downloaded the list of videos in your AWS S3 bucket.
- Your transcription files reside on an AWS S3 bucket, and they're publicly accessible.
- Your transcription must be in the SRT or VTT format.
- Your video must meet the following requirements:
- Video resolution: must be greater or equal than 360p and less or equal than 4K.
- Duration: must be between 4 seconds and 2 hours (7,200s).
- File size: must not exceed 2 GB.
If you require different options, send us an email at [email protected]. - Audio track: If the
conversation
indexing option is selected, the video you're uploading must contain an audio track.
Note
For consistent search results, Twelve Labs recommends you upload 360p videos.
Procedure
- The Dashboard page allows you to download the list of videos in your AWS S3 bucket as a JSON file, and you can provide transcriptions by editing this file in a plain-text editor. Open the JSON file containing the videos you want to upload and update the
transcription
fields by adding the S3 URLs of your transcription files. The following example adds two transcription files:01.srt
and02.srt
:
[
{
"index_id": "629d807aa9e2a3a33a92c00b1",
"language": "en",
"object": "s3://twelve-labs-docs/01.mp4",
"transcription": "s3://twelve-labs-docs/01.srt"
},
{
"index_id": "629d807aa9e2a3a33a92c00b",
"language": "en",
"object": "s3://twelve-labs-docs/02.mp4",
"transcription": "s3://twelve-labs-docs/02.srt"
}
]
-
Declare the
/tasks/transfers
endpoint:TASKS_TRANSFERS_URL = f"{API_URL}/tasks/transfers"
const TASKS_TRANSFERS_URL = `${API_URL}/tasks/transfers`
-
Read your JSON file. Open a stream making sure to replace the placeholders surrounded by
<>
with your values:file_path = "<YOUR_FILE_PATH>" file_name = "<YOUR_FILE_NAME>" file_stream = open(file_path, "rb")
const file_path = '<YOUR_FILE_PATH>' const file_stream = fs.createReadStream(file_path)
-
If you're using Python, store the file to upload in an array named
file_param
and specify that you want to make amultipart/form-data
request. If you're using Node.js, store the file to upload in a variable namedformData
of typeFormData
:file_param = [ ("file", (file_name, file_stream, "multipart/form-data")), ]
let formData = new FormData() formData.append('file', file_stream)
-
Upload the JSON file. Call the
POST
method of the/tasks/transfers
endpoint, store the result in a variable namedresponse
, and print the status code and the response:requests.post(TASKS_TRANSFERS_URL, headers=headers, files=file_param) print (f"Status code: {response.status_code}") pprint (response.json())
let config = { method: 'post', url: TASKS_TRANSFERS_URL, headers: headers, data : formData, }; resp = await axios(config) response = await resp.data console.log(`Status code: ${resp.status}`) console.log(response)
Updated about 1 year ago