Gemini Omni Flash(gemini-omni-flash-preview)は、高速な動画生成、編集、映画のようなコントロールを実現するために設計された高性能のマルチモーダル モデルです。Gemini Omni は、以前の動画モデルとは異なる次のコア機能を基盤として構築されています。
- ネイティブ マルチモーダル: テキスト、画像、音声、動画を同時に処理し、より一貫性があり、制御可能な出力を得ることができます。
- 会話型編集: Interactions API によって有効になり、自然言語の会話を通じて動画を繰り返し調整、編集できます。変更したい内容を説明すると、モデルが編集を適用し、残したい動画の部分はそのまま残ります。
- 世界に関する知識: Gemini Omni は、物理学の理解と Gemini の歴史、科学、文化的背景に関する知識を組み合わせ、フォトリアリズムから意味のあるストーリーテリングへのギャップを埋めます。
テキストから動画を生成する
テキスト プロンプトから動画を生成します。モデルは、テキストの説明に基づいて音声付きの動画を生成します。最適な結果を得るには、シーンの説明、カメラの動き、照明、ムードなどの詳細を含むプロンプトを作成します。
Python
import base64
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-omni-flash-preview",
input="A marble rolling fast on a chain reaction style track, continuous smooth shot."
)
with open("marble.mp4", "wb") as f:
f.write(base64.b64decode(interaction.output_video.data))
JavaScript
import { GoogleGenAI } from '@google/genai';
import * as fs from 'fs';
const ai = new GoogleGenAI({});
const interaction = await ai.interactions.create({
model: 'gemini-omni-flash-preview',
input: 'A marble rolling fast on a chain reaction style track, continuous smooth shot.',
});
if (interaction.output_video?.data) {
fs.writeFileSync('marble.mp4', Buffer.from(interaction.output_video.data, 'base64'));
}
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": "A marble rolling fast on a chain reaction style track, continuous smooth shot."
}'
REST レスポンス スキーマ
便宜上のフィールド interaction.output_video は SDK 専用です。REST API を直接使用する場合は、steps 配列から動画出力を取得します。
未加工の REST JSON 構造:
{
"steps": [
{ "type": "user_input", "content": [{"type": "text", "text": "..."}] },
{ "type": "thought", "content": [{"text": "...", "type": "thought"}] },
{
"type": "model_output",
"content": [
{
"type": "video",
"mime_type": "video/mp4",
"data": "AAAAIGZ0eXBpc29t..." // Base64 encoded video data
}
]
}
],
"id": "v1_...",
"status": "completed",
"model": "gemini-omni-flash-preview",
"object": "interaction"
}
アスペクト比を制御する
aspect_ratio を "9:16" に設定して、縦向きの動画を作成します。デフォルトは横向き(16:9)です。
Python
import base64
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-omni-flash-preview",
input="A futuristic city with neon lights and flying cars, cyberpunk style",
response_format={
"type": "video", # optional
"aspect_ratio": "9:16" # Supported values: "9:16", "16:9"
}
)
with open("example.mp4", "wb") as f:
f.write(base64.b64decode(interaction.output_video.data))
JavaScript
import { GoogleGenAI } from '@google/genai';
import * as fs from