For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sample appsIntegrationsDiscordPlaygroundDevEx repo
GuidesSDK ReferenceAPI Reference
GuidesSDK ReferenceAPI Reference
  • Get Started
    • Introduction
    • Quickstart
    • Manage your plan
    • Rate limits
    • Release notes
    • Migration guide
  • Guides
    • Search
    • Analyze videos
    • Segment videos
    • Create embeddings
  • Concepts
    • Models
    • Upload and processing methods
    • Indexes
    • Modalities
    • Multimodal large language models
  • Cloud partner integrations
    • Amazon Bedrock
      • Create embeddings
      • Analyze videos
      • Troubleshooting
      • Migration guide
  • Advanced
    • Organizations
    • Fine-tuning
    • Webhooks
    • Metadata
    • Model context protocol
    • Claude Code Plugin
  • Resources
    • Platform overview
    • Playground
    • TwelveLabs SDKs
    • Frequently asked questions
    • Use cases
    • Sample applications
    • Partner integrations
    • From the community
LogoLogo
Sample appsIntegrationsDiscordPlaygroundDevEx repo
On this page
  • Regional availability
  • Model specifications
  • Input requirements
  • Pricing
  • Prerequisites
  • Analyze videos
  • Example
  • Use the generated text
  • Request parameters and response fields
Cloud partner integrationsAmazon Bedrock

Analyze videos

Was this page helpful?
Previous

Troubleshooting

Next
Built with

Use the TwelveLabs Pegasus 1.2 model to analyze videos and generate text based on their content.

Regional availability

Pegasus 1.2 is available in the following regions:

Americas
  • US East (N. Virginia)
  • US East (Ohio)
  • US West (N. California)
  • US West (Oregon)
  • Canada (Central)
  • Canada West (Calgary)
  • Mexico (Central)
  • South America (São Paulo)
Europe
  • Europe (Frankfurt)
  • Europe (Zurich)
  • Europe (Stockholm)
  • Europe (Milan)
  • Europe (Spain)
  • Europe (Ireland)
  • Europe (London)
  • Europe (Paris)
Asia Pacific
  • Asia Pacific (Tokyo)
  • Asia Pacific (Seoul)
  • Asia Pacific (Osaka)
  • Asia Pacific (Taipei)
  • Asia Pacific (Mumbai)
  • Asia Pacific (Hyderabad)
  • Asia Pacific (Jakarta)
  • Asia Pacific (Melbourne)
  • Asia Pacific (Sydney)
  • Asia Pacific (Malaysia)
  • Asia Pacific (Thailand)
  • Asia Pacific (Singapore)
Middle East & Africa
  • Africa (Cape Town)
  • Israel (Tel Aviv)
  • Middle East (Bahrain)
  • Middle East (UAE)

Amazon Bedrock offers the following cross-region inference options:

  • Global cross-region inference: Routes requests to AWS Regions with available capacity worldwide for high availability, performance, and cost efficiency
  • Geographic cross-region inference: Routes requests within specific regions (US, EU, or APAC) for data residency or compliance requirements

For details, see the Global cross-Region inference and Geographic cross-Region inference pages in the Amazon Bedrock documentation.

Model specifications

SpecificationsDetails
Model IDtwelvelabs.pegasus-1-2-v1:0
Inference profile IDs- Global: global.twelvelabs.pegasus-1-2-v1:0
- Geographic: us.twelvelabs.pegasus-1-2-v1:0, eu.twelvelabs.pegasus-1-2-v1:0, apac.twelvelabs.pegasus-1-2-v1:0
InputVideo
Input methodsS3 URI or base64 encoded string
OutputText

Input requirements

  • Format: Video files
  • Maximum duration: 1 hour
  • Maximum file size: 2 GB (S3) or 36 MB (base64)

Pricing

For details on pricing, see the Amazon Bedrock pricing page.

Prerequisites

Before you start, ensure you have the following:

  • An AWS account with access to a region where the TwelveLabs models are supported.
  • An AWS IAM principal with sufficient Amazon Bedrock permissions. For details on setting permissions, see the Identity and access management for Amazon Bedrock page.
  • S3 permissions to read input files.
  • The AWS CLI and configured with your credentials.
  • Python 3.7 or later with the boto3 library.
  • Access to the model you want to use. Navigate to the AWS Console > Bedrock > Model Access page and request access. Note that the availability of the models varies by region.

Analyze videos

Pegasus supports base64 encoded strings and S3 URIs for video input. The base64 method has a 36MB file size limit. This guide uses S3 URIs.

Note

Your S3 bucket and the model must be in the same region. If regions don’t match, the API returns a ValidationException error.

You use the InvokeModel API to analyze videos and generate text. This API processes your request synchronously and returns the generated text directly in the response.

The InvokeModel API requires two parameters:

  • modelId: The inference profile ID for the model.
  • body: A JSON-encoded string containing your input parameters.

The body contains:

  • inputPrompt: A string that guides the model on the desired format or content
  • mediaSource: The video source, which contains either:
    • base64String: Your base64-encoded video for inline processing
    • s3Location: The S3 location for videos stored in S3

Example

The example code below demonstrates how to use Pegasus to analyze videos and generate text based on their content.

Ensure you replace the following placeholders with your values:

  • <YOUR_REGION>: with your region (example: “eu-west-1”).
  • <INFERENCE_PROFILE_ID>: with the inference profile ID. See the Model specifications section for available inference profile IDs.
  • <YOUR_ACCOUNT_ID>: with your AWS account ID (example: “123456789012”).
  • <YOUR_BUCKET_NAME>: with the name of your S3 bucket (example: “my-video-bucket”).
  • <YOUR_VIDEO_FILE>: with the name of your video file (example: “my_video.mp4”).
  • <YOUR_PROMPT>: with a string that guides the model on the desired format or content (example: “Summarize this video”).
Python
1import boto3
2import json
3import base64
4
5REGION = "<YOUR_REGION>"
6INFERENCE_PROFILE_ID = "<INFERENCE_PROFILE_ID>" # Example: "eu.twelvelabs.pegasus-1-2-v1:0" or "global.twelvelabs.pegasus-1-2-v1:0"
7INPUT_PROMPT = "<YOUR_PROMPT>"
8ACCOUNT_ID = "<YOUR_ACCOUNT_ID>"
9BUCKET = "<YOUR_BUCKET_NAME>"
10FILE_NAME = "<YOUR_VIDEO_FILE>"
11
12bedrock = boto3.client(service_name="bedrock-runtime", region_name=REGION)
13body = json.dumps({
14 "inputPrompt": INPUT_PROMPT,
15 "mediaSource": {
16 "s3Location": {
17 "uri": f"s3://{BUCKET}/{FILE_NAME}",
18 "bucketOwner": ACCOUNT_ID
19 }
20 }
21})
22
23response = bedrock.invoke_model(
24 body=body,
25 modelId=INFERENCE_PROFILE_ID,
26 contentType="application/json",
27 accept="application/json"
28)
29
30response_body = json.loads(response.get("body").read())
31print(response_body)

Use the generated text

After generating text from your videos, you can integrate the output into various applications and workflows.

The typical workflow is as follows:

1

Generate text from your video.

2

Parse and format the generated text based on your needs.

3

Store the text with video metadata in your database.

4

Index the text for search capabilities.

5

Display or process the text in your application.

You can use Pegasus-generated text to:

  • Populate content management systems with video descriptions and metadata.
  • Enable text-based search across your video library.
  • Generate automated reports for compliance or documentation.
  • Create accessible content with transcriptions and descriptions.
  • Feed downstream AI workflows such as translation or sentiment analysis.
  • Trigger automated actions based on video content analysis.

Request parameters and response fields

For a complete list of request parameters and response fields, see the TwelveLabs Pegasus 1.2 page in the Amazon Bedrock documentation.