2026年10月9日、私たちは Amazon BedrockでTwelveLabsのPegasus 1.5が利用可能になったことを発表しました。Pegasus 1.5は、長尺動画を構造化されたタイムスタンプ付きのメタデータに変換する動画言語モデルです。ワークフローにとって重要な瞬間を記述すると、モデルは一致するすべてのセグメントをJSONとして返します。
動画は、重要かつ複雑な非構造化データのカテゴリですが、その大部分は検索不能で十分に活用されていません。こうしたコンテンツから構造化された実用的なインサイトを抽出するには、従来、手間のかかる手動レビューまたは断片化されたツールチェーンが必要でした。
以前のバージョンのPegasusでは、モデルにクリップを指定して質問を投げ、回答を得ることができました。 now、Pegasus 1.5は動画全体を分析し、ユーザー定義の基準に一致するすべてのセグメントを検出して、構造化されたタイムスタンプ付きのメタデータを返します。さらに、動画セグメンテーション、参照画像を用いたマルチモーダルプロンプティング、オンザフライ処理も新たに導入されました。
Amazon Bedrock上のPegasus 1.5を使用すると、前処理によるインデックス作成を必要とせずに、Amazon Simple Storage Service (Amazon S3) のURIまたはbase64文字列から直接動画を分析でき、データはAWSのデータ境界内に保持されます。
この記事では、Pegasus 1.5の新機能、Amazon Bedrockでのモデルのパッケージ方法、最初のリクエストの送信方法について説明します。その後、動画セグメンテーション、構造化JSON出力、マルチモーダルプロンプティングを順に見ていきます。
Pegasus 1.5の新機能
Pegasus 1.5には、以前のバージョンと比較して以下の変更点があります:
- 時間ベースのメタデータ生成。 編集セグメント、スポーツのプレー、話者の交代、ブランドの登場など、ワークフローにとって重要なセグメント、イベント、またはドメイン固有の手がかりを定義します。Pegasus 1.5は、開始時刻と終了時刻、および要求されたフィールドが設定された、一致するすべてのセグメントをJSONとして返します。
- マルチモーダルプロンプティング。 セグメント定義には、テキストの説明と視覚的な参照を組み合わせることができます。これにより、特定の製品、ロゴ、または人物を、画面上で何をしているかと合わせて特定することが可能になります。
- オンザフライ処理。 取り込みパイプラインや事前インデックス作成の手順は必要ありません。動画はAmazon S3から直接送信され、結果はレスポンスで返されます。
- 拡張された処理能力。 Pegasus 1.5は、1回のリクエストで最大2時間の動画を分析できます。Pegasus 1.2では最大1時間でした。
Pegasus 1.5は、Pegasus 1.2を動画理解のための強力なツールたらしめた以下の中核機能を保持し、強化しています:
- 動画からテキストの生成: 動画コンテンツに基づいて詳細なテキスト記述を作成します。
- きめ細かな視覚理解: 動画フレーム内のオブジェクト、画面上のテキスト、数値コンテンツを分析します。
- 時間的グラウンディング: 動画内の特定のイベントのタイムスタンプを正確に特定します。
- マルチモーダル理解: 視覚、音声、テキストの情報を組み合わせて包括的な分析を行います。
- 多言語対応: 英語を完全にサポートし、アラビア語、中国語、フランス語、ドイツ語、イタリア語、日本語、韓国語、ポルトガル語、ロシア語、スペイン語、タイ語、ベトナム語を部分的にサポートします。
Amazon BedrockにおけるPegasus 1.5の仕組み
Pegasus 1.5 は動画と、テキストプロンプトまたは一連のセグメント定義を入力として受け取り、テキストまたは JSON を返します。次の bedrock-runtime エンドポイントを InvokeModel API で呼び出すか、レスポンスを生成されながらストリーミングで受け取りたい場合は InvokeModelWithResponseStream を使用します。
| 設定 | 値 |
| モデル ID | twelvelabs.pegasus-1-5-v1:0 |
| AWS リージョン | 米国西部 (オレゴン)、 us-west-2 |
| 推論 | オンデマンド |
| API | InvokeModel, InvokeModelWithResponseStream |
各リクエストは、次のいずれかで選択された2つの分析モードのうち1つで実行されます。 analysisMode 分野:
| 分析モード | analysisMode | あなたが送る | あなたは戻ってくる |
| 一般 | general (デフォルト) |
におけるテキストプロンプト inputPrompt |
以下の言語でのテキスト回答: message、スキーマを指定する場合は JSON など |
| 時間ベースのメタデータ | time_based_metadata |
におけるセグメント定義 responseFormat |
A segments 開始時刻と終了時刻、およびご希望の項目を含むリスト |
モデルに動画を指定する方法は2つあります。1つはS3ロケーション(s3Location)はオブジェクトの uri そしてその bucketOwner アカウント ID に対応し、長尺動画に適しています。base64 文字列(base64String)はリクエストボディに動画を埋め込み、最大 25 MB までで、短いクリップに適しています。
アプリケーションごとにコストを追跡するには、Pegasus 1.5 モデルからアプリケーション推論プロファイルを作成し、タグを付け、モデル ID の代わりにその Amazon Resource Name (ARN) を指定して呼び出します。
Pegasus 1.5 を使い始める
以下のセクションでは、Pegasus 1.5 を使い始める方法を概説します。
前提条件
始める前に、以下を持っていることを確認してください:
- Amazon Bedrock へのアクセス権を持つ有効な AWS アカウント。
- AWS SDK for Python (Boto3) がインストールされた、Python 3.10 以降。
- AWS Identity and Access Management (IAM) の以下に対する権限:
bedrock:InvokeModelおよびbedrock:InvokeModelWithResponseStream. - で、TwelveLabs Pegasus 1.5 のモデルアクセスが有効化されていること Amazon Bedrock コンソール.
- Amazon S3 バケットに保存された動画、またはインラインで送信できる短いクリップ。
次のポリシーは、Pegasus 1.5 に対する invoke アクションの両方を付与します。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:us-west-2::foundation-model/twelvelabs.pegasus-1-5-v1:0"
]
}
]
}
Boto3 は通常の AWS 認証情報でリクエストに署名します。Amazon Bedrock API キーを次の AWS_BEARER_TOKEN_BEDROCK 環境変数に設定して認証することもできます。本番環境では、IAM 認証情報から生成される短期キーを aws-bedrock-token-generator パッケージで利用することを推奨します。有効期限が自動的に切れるためです。Bearer トークン認証には、さらに bedrock:CallWithBearerToken 権限が必要です。
最初のリクエストを送信する
Boto3 をインストールします:
pip install boto3
次の例では、Amazon S3 に保存された動画を general モードで解析します。この例ではグローバルの Cross Region Inference (CRIS) エンドポイントを使用します。代わりに米国の地理的エンドポイントを対象にするには、エンドポイント URL の「global.」を「us.」に置き換えてください。
import boto3
import json
from botocore.config import Config
AWS_REGION = "us-west-2"
MODEL_ID = "global.twelvelabs.pegasus-1-5-v1:0"
bedrock_runtime = boto3.client(
service_name="bedrock-runtime",
region_name=AWS_REGION,
config=Config(
# keep a longer read_timeout for lengthier invocations such as video segmentation
read_timeout=900,
retries={"max_attempts": 0},
connect_timeout=10,
),
)
# Analyze a video stored in Amazon S3
payload = {
"inputPrompt": "Summarize this video and identify the key topics discussed.",
"mediaSource": {
"s3Location": {
"uri": "s3://amzn-s3-demo-pegasus-15/your-video.mp4",
"bucketOwner": "your-account-id"
}
},
"temperature": 0.2,
"maxOutputTokens": 4096,
"includeMetering": True
}
response = bedrock_runtime.invoke_model(
modelId=MODEL_ID,
body=json.dumps(payload)
)
result = json.loads(response["body"].read())
print(result["message"])
レスポンスには、回答が messageに、トークン数が input_tokens と output_tokensに含まれており、生成が終了した理由が stopReasonに示されます。 stopReason が length の場合は、回答が終了前に maxOutputTokens に達したことを意味するため、出力に依存する前に確認してください:
if result["stopReason"] == "length":
print("The answer was cut off. Raise maxOutputTokens and try again.")
print("Tokens in:", result["input_tokens"], "out:", result["output_tokens"])
general モードのリクエストフィールド:
| フィールド | 必須 | 説明 |
inputPrompt |
はい | 動画に関する質問または指示 |
mediaSource.s3Location.uri |
1つの動画ソースが必要です | 動画のS3 URI |
mediaSource.s3Location.bucketOwner |
とともに uri |
バケットを所有するAWSアカウントID |
mediaSource.base64String |
1つの映像ソースが必要です | Base64エンコードされた動画、最大25 MBまで |
temperature |
いいえ | 出力のランダム性、0から1の範囲で指定します。デフォルトは0.2です。 |
maxOutputTokens |
いいえ | 生成する最大トークン数。512から98,304まで。 |
responseFormat |
いいえ | 回答が従うべきJSONスキーマ |
analysisMode |
いいえ | general (デフォルト)または time_based_metadata |
短いクリップの場合は、S3からではなく、動画をインラインで送信できます:
import base64
with open("your-video.mp4", "rb") as f:
video_b64 = base64.b64encode(f.read()).decode("utf-8")
payload["mediaSource"] = {"base64String": video_b64}
response = bedrock_runtime.invoke_model(modelId=MODEL_ID, body=json.dumps(payload))
print(json.loads(response["body"].read())["message"])
前の例ではオプションの includeMetering 属性。 includeMetering: True Pegasus 1.5 では、非ストリーミング応答に2つの課金利用フィールドが追加されます: outputTokenCount and inputVideoSecond (解析対象動画の長さ、秒単位)。
レスポンスをストリーミングする
インタラクティブなアプリケーションの場合、 InvokeModelWithResponseStream 生成された回答をチャンク(塊)単位で返します。各チャンクには、続くテキストの次の断片が含まれており、 message:
response = bedrock_runtime.invoke_model_with_response_stream(
modelId=MODEL_ID,
body=json.dumps(payload)
)
for event in response["body"]:
chunk = json.loads(event["chunk"]["bytes"])
print(chunk.get("message", ""), end="", flush=True)
print()
構造化されたJSONを返す
一般モードでは、回答をJSON Schemaに制約でき、下流のコードが直接パースできるようになります。設定するには responseFormat.type から json_schema そして、スキーマを下に置きます jsonSchema。その答えが次の message JSON文字列として:
payload = {
"inputPrompt": "Analyze this video and return a structured summary.",
"mediaSource": {
"s3Location": {
"uri": "s3://amzn-s3-demo-pegasus-15/your-video.mp4",
"bucketOwner": "your-account-id"
}
},
"temperature": 0,
"maxOutputTokens": 2048,
"includeMetering": True,
"responseFormat": {
"type": "json_schema",
"jsonSchema": {
"type": "object",
"properties": {
"summary": {"type": "string"},
"key_scenes": {"type": "array", "items": {"type": "string"}},
"setting": {"type": "string"}
},
"required": ["summary", "key_scenes", "setting"]
}
}
}
response = bedrock_runtime.invoke_model(modelId=MODEL_ID, body=json.dumps(payload))
summary = json.loads(json.loads(response["body"].read())["message"])
print(summary["summary"])
for scene in summary["key_scenes"]:
print(" -", scene)
映像セグメンテーション:動画を構造化データに変換する
時間ベースのメタデータ生成は、Pegasus 1.5が以前のバージョンと最も異なる点です。プロンプトを送る代わりに、1つ以上のセグメント定義を送信すると、モデルはそれぞれの定義に一致する動画の全セグメントを返します。
セット analysisMode へ time_based_metadata および responseFormat.type 〜 segment_definitions。これらの定義は、~の代わりを務める inputPrompt,因此そのフィールドは省略してください。各定義には以下が含まれます:
id定義の名前で、マッチするすべてのセグメントに対して返されます。description: 一致するセグメントがどのようなものかの例。fields: 各セグメントについて抽出する値、それぞれにname、type(string,boolean,number,integer,array、またはtimestamp、およびdescription.
次の例では、ニュース放送内の各編集セクションを識別し、それぞれについてタイトル、要約、主要トピックを返します。
payload = {
"analysisMode": "time_based_metadata",
"mediaSource": {
"s3Location": {
"uri": "s3://amzn-s3-demo-pegasus-15/news-broadcast.mp4",
"bucketOwner": "your-account-id"
}
},
"responseFormat": {
"type": "segment_definitions",
"segmentTimeFormat": "hh:mm:ss",
"segmentDefinitions": [
{
"id": "editorial_section",
"description": "A distinct editorial section of the broadcast, "
"such as a new story, topic, or segment of the program.",
"fields": [
{"name": "segment_title", "type": "string",
"description": "A descriptive title"},
{"name": "summary", "type": "string",
"description": "A brief summary of the segment content"},
{"name": "key_topics", "type": "array", "items": {"type": "string"},
"description": "Main topics discussed"}
]
}
]
},
"temperature": 0,
"maxOutputTokens": 32768,
"includeMetering": True
}
response = bedrock_runtime.invoke_model(
modelId=MODEL_ID,
contentType="application/json",
accept="application/json",
body=json.dumps(payload)
)
result = json.loads(response["body"].read())
for segment in result["segments"]:
print(segment["start_sec"], "-", segment["end_sec"], segment["segment_title"])
print(" ", segment["summary"])
print(" topics:", ", ".join(segment["key_topics"]))
上記のサンプルコードをスポーツクリップに対してテストすると、次のようなサンプル出力が生成される場合があります。
{
"segments": [
{
"start_sec": "00:04:24",
"end_sec": "00:05:22",
"segment_title": "Substitutions and Added Time",
"summary": "The referee announces three minutes of added time, and both teams make substitutions in preparation for a potential penalty shootout.",
"key_topics": ["Substitutions", "Added time", "Penalty shootout preparation", "Tactical changes"]
},
{
"start_sec": "00:05:22",
"end_sec": "00:08:57",
"segment_title": "Last Gasp Attempts and Final Whistle",
"summary": "The final minutes of the match see intense action from both sides, with several close calls before the referee blows the final whistle, ending the game in a 3-3 draw.",
"key_topics": ["Final whistle", "Draw"]
},
{
"start_sec": "00:08:57",
"end_sec": "00:09:29",
"segment_title": "Match Conclusion and Penalty Shootout Setup",
"summary": "The match concludes with a 3-3 draw, leading to a penalty shootout. Players from both teams shake hands and prepare for the decisive moments.",
"key_topics": ["Match conclusion", "Penalty shootout", "Player handshakes", "Final"]
}
],
"definition_errors": [],
"input_tokens": 249408,
"output_tokens": 802,
"stopReason": "stop",
"finish_reason": "stop"
}
各セグメントには start_sec, end_secが含まれ、 fields で定義した内容が反映されます。 segmentTimeFormat は時刻の書き方を制御します。 seconds は算術演算が可能な数値を返します。一方、 hh:mm:ss と hh:mm:ss.fff は読みやすいタイムスタンプを文字列として返します。レスポンスには definition_errors リストも含まれており、すべての定義が処理された場合は空になります。
1つのリクエストには複数のセグメント定義を含めることができます。たとえば、編集セクション用と画面上のブランド登場用の定義を同時に指定できます。Pegasus 1.5 はすべてのマッチを1つの segments リストで返し、各セグメントに _definition_id をタグ付けするため、区別がつきます。次の例では、前のリクエストに2つ目の定義を追加し、結果をグループ化します。
from collections import defaultdict
payload["responseFormat"]["segmentDefinitions"].append({
"id": "brand_appearance",
"description": "A shot where a company logo or branded product "
"is clearly visible on screen.",
"fields": [
{"name": "brand", "type": "string", "description": "The brand shown"},
{"name": "is_prominent", "type": "boolean",
"description": "Whether the brand is the main focus of the shot"}
]
})
response = bedrock_runtime.invoke_model(modelId=MODEL_ID, body=json.dumps(payload))
result = json.loads(response["body"].read())
by_definition = defaultdict(list)
for segment in result["segments"]:
by_definition[segment["_definition_id"]].append(segment)
for definition_id, segments in by_definition.items():
print(definition_id, len(segments), "segments")
スキーマは一度定義するだけでよいため、同じ定義を動画ライブラリ全体に適用でき、すべてのアセットに対して一貫したメタデータを生成できます。
マルチモーダルプロンプト: クエリへの視覚的コンテキストの追加
Pegasus 1.5 ではマルチモーダルプロンプトが導入され、テキストプロンプトに加えて参照画像を含めることができるようになりました。これは、説明するよりも見せた方が伝わりやすい特定のオブジェクト、人物、シーンについてモデルに質問したい場合に役立ちます。
たとえば、製品画像を提供して、その製品が動画内に登場するすべての瞬間をモデルに識別させることができます。あるいは、特定のロゴの参照画像を提供して、ブランドの登場とそのタイムスタンプをモデルに検出させることができます。この機能により動画分析の精度が向上し、ビジュアルブランドモニタリング、商品配置分析、画像ガイドによるコンテンツ検索などのユースケースが開かれます。
参照画像の添付方法はモードによって異なります。一般モードでは、次の場所に配置します promptV2.mediaSources、ならびにその中の質問とともに promptV2.inputText。セグメンテーションモード(analysisMode: time_based_metadata)では、それらを mediaSources 内の各セグメント定義の responseFormat.segmentDefinitionsに紐付けます。定義は、テキストによる記述に加えて視覚的な参照にも一致させることができます。各画像には、 nameと、 media_type の image、そして正確に1つのソース、すなわちインラインの base64String 、または s3Location と uri を伴う bucketOwnerのいずれかが必要です。1つのリクエストで最大30枚の参照画像を送信できます。
汎用モードのリクエストでは、参照画像に示されたオブジェクトについてモデルに質問します。以下のサンプルペイロードとレスポンスは、汎用モードの例を示しています。
payload = {
"analysisMode": "general",
"mediaSource": {"s3Location": {"uri": "s3://...", "bucketOwner": "..."}},
"promptV2": {
"inputText": "Does the object in the reference image appear in this video?",
"mediaSources": [
{"name": "ref1", "media_type": "image", "base64String": "..."}
]
}
…
}
{
"input_tokens": 144,
"output_tokens": 11,
"message": "Yes, the green canoe appears in the video.",
"stopReason": "stop"
}
セグメンテーションモードでは、参照画像が定義の内部にあるため、Pegasusはその製品が登場するセグメントのみを返します。以下のサンプルペイロードとレスポンスは、セグメンテーションモードの例を示しています。
payload = {
"analysisMode": "time_based_metadata",
"mediaSource": {"s3Location": {"uri": "s3://...", "bucketOwner": "..."}},
"responseFormat": {
"type": "segment_definitions",
"segmentTimeFormat": "hh:mm:ss",
"segmentDefinitions": [
{
"id": "product_appearance",
"description": "A shot showing the product in the reference image",
"fields": [
{"name": "what", "type": "string", "description": "what is on screen"}
],
"mediaSources": [
{"name": "ref1", "media_type": "image",
"s3Location": {"uri": "s3://...", "bucketOwner": "..."}}
]
}
]
}
}
{
"segments": [
{"start_sec": "00:00:00", "end_sec": "00:00:02",
"what": "A family of four in a green canoe, paddling on a calm river surrounded by towering red rock formations."},
{"start_sec": "00:00:09", "end_sec": "00:00:10",
"what": "The family back in the canoe, paddling away from the shore, with the children smiling and enjoying the serene surroundings."}
],
"definition_errors": [],
"input_tokens": 4498,
"output_tokens": 292,
"stopReason": "stop",
"finish_reason": "stop"
}
使用状況のモニタリング
Pegasus 1.5は、モデルIDごとに AWS/Bedrock 名前空間でAmazon CloudWatchメトリクスを公開します。これには Invocations, OutputTokenCount, InvocationLatency、 InvocationClientErrorsなどが含まれます。これらを使用してボリュームとレイテンシーを追跡できます。アプリケーションごとに使用状況を細分化する必要がある場合は、アプリケーション推論プロファイルと組み合わせてください。
ユースケース
Pegasus 1.5は、大量の長尺動画を管理する組織向けに設計されています:
- ニュースおよび放送アーカイブ: チームは編集セグメント、トピック、話者の変化を一度定義すれば、以前は文字起こしのキーワードでしか検索できなかった何年分もの映像をカタログ化できます。
- スポーツ放送局およびリーグ: 全編の試合映像からプレー、得点イベント、その他の重要な瞬間を検出し、ハイライト制作を迅速化します。
- ストリーミングアプリケーション: シーンレベルのメタデータにより、瞬間に基づくレコメンデーション、状況に応じた広告配信、セグメントレベルのブランド安全性レビューが可能になります。
いずれの場合も、人間はワークフローの一部であり続けます。彼らの作業は、すべての瞬間を手作業で見つけてタグ付けすることから、モデルが生成したメタデータの確認と精査へと移行します。
入力要件
Pegasus 1.5は以下の動画仕様に対応しています:
- 長さ: 最大2時間。
- ファイルサイズ: Amazon S3からは最大2 GB、base64文字列としては最大25 MB。
- 解像度: 360×360から5184×2160。
- アスペクト比: 1:1から2.4:1の間、またはその逆数。
- フォーマット: FFmpegがサポートしているフォーマット。
利用可能になりました
TwelveLabs Pegasus 1.5 は本日から、米国西 (オレゴン) AWS リージョンの Amazon Bedrock で利用可能になりました。今後の更新については リージョンの全リスト を確認し、料金情報については Amazon Bedrock の料金ページ をご覧ください。Pegasus 1.5 は AWS Marketplace を通じて課金されるため、その料金は Amazon Bedrock ではなく TwelveLabs として、AWS の請求書および AWS Cost Explorer に表示されます。
はじめに:
- モデルファミリーの詳細については、 Amazon Bedrock の TwelveLabs モデルページ をご覧ください。
- 機能サポート、リージョン別の利用可否、サンプルコードについては、 Pegasus 1.5 モデルカード をご確認ください。
- フィードバックは Amazon Bedrock の AWS re:Post または通常のご利用の AWS Support の連絡先からお寄せください。
Amazon Bedrock で TwelveLabs Pegasus 1.5 を使って皆さまが何を構築されるか、楽しみにしています。
