Gemini Omni Flash 1.1(早期アクセス プログラム)で動画を生成、編集する

Gemini Omni Flash 1.1(gemini-omni-1.1-eap)は、高速な動画生成、編集、シネマティック コントロール向けに設計された高性能なマルチモーダル モデルです。 Gemini Omni Flash 1.1 は、以前のバージョンの Gemini Omni Flash を完全に置き換えるもので、生成品質の向上、ネイティブ マルチモーダル、ステートフルな動画編集機能を提供します。

  • ネイティブ マルチモーダル: テキスト、画像、音声、動画を同時に処理し、よりまとまりのある、一貫性のある、制御可能な出力を提供します。
  • 話して編集: Interactions API により、自然言語での会話を通じて動画を反復的に調整、編集できます。変更したい内容を説明すると、保持したい動画の部分を保持しながら、モデルが編集を適用します。
  • 実世界の知識: Gemini Omni は、物理法則の理解と、歴史、科学、文化的背景に関する Gemini の知識を組み合わせることで、写実的な表現と意味のあるストーリーテリングとの間のギャップを埋めます。

テキストからの動画生成

テキスト プロンプトから動画を生成します。モデルは、テキストの説明に基づいて音声付きの動画を生成します。シーンの説明、カメラの動き、照明、ムードなどの詳細をプロンプトに記述すると、最適な結果が得られます。

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    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-1.1-eap',  
  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-1.1-eap",
 "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-1.1-eap",
  "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-1.1-eap",
    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 'fs';
const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  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'
  },
});

if (interaction.output_video?.data) {
  fs.writeFileSync('example.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-1.1-eap",
 "input": "A futuristic city with neon lights and flying cars, cyberpunk style",
 "response_format": {
   "type": "video",
   "aspect_ratio": "9:16"
 }
}'

解像度コントロール

360p 下書きモード

response_format で resolution: "360p" を使用すると、トークン消費量を抑えながら、軽量のプレビュー クリップを約 2 倍の速度で生成できます。

Python

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input="A robotic dog exploring a lush enchanted forest.",
    response_format={
        "type": "video",
        "resolution": "360p",
        "aspect_ratio": "16:9"
    }
)

JavaScript

import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: 'A robotic dog exploring a lush enchanted forest.',
  response_format: {
    type: 'video',
    resolution: '360p',
    aspect_ratio: '16:9',
  },
});

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.1-eap",
    "input": "A robotic dog exploring a lush enchanted forest.",
    "response_format": {
      "type": "video",
      "resolution": "360p",  # Supported values: "360p", "720p", "1080p", "4k"
      "aspect_ratio": "16:9"
    }
  }'

高解像度(1080p と 4K)

response_format で resolution を "1080p" または "4k" に設定すると、鮮明な高解像度動画を生成できます。

Python

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input="A cinematic drone shot through misty pine mountains at sunrise.",
    response_format={
        "type": "video",
        "resolution": "1080p",  # Supported values: "360p", "720p", "1080p", "4k"
        "delivery": "uri"
    }
)

JavaScript

import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: 'A cinematic drone shot through misty pine mountains at sunrise.',
  response_format: {
    type: 'video',
    resolution: '1080p', // Supported values: '360p', '720p', '1080p', '4k'
    delivery: 'uri',
  },
});

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.1-eap",
    "input": "A cinematic drone shot through misty pine mountains at sunrise.",
    "response_format": {
      "type": "video",
      "resolution": "1080p",
      "delivery": "uri"
    }
  }'

画像からの動画生成

テキスト プロンプトで参照画像を指定できます。プロンプトに応じて、モデルは画像の用途を決定します。商品写真、イラスト、写真を鮮やかに表現します。

次の例は、水から飛び出す魚の絵の参照画像を使用する方法を示しています。

水面から飛び上がる魚の絵

次のプロンプトを使用します。

turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input=[
        {"type": "image", "data": base64_image, "mime_type": "image/jpeg"},
        {"type": "text", "text": "turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video"}
    ],
)
with open("clownfish.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-1.1-eap',
  input: [
    { type: 'image', data: base64Image, mime_type: 'image/jpeg' },
    { type: 'text', text: 'turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video' }
  ]
});

if (interaction.output_video?.data) {
  fs.writeFileSync('clownfish.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-1.1-eap",
 "input": [
   {"type": "image", "data": "'"$BASE64_IMAGE"'", "mime_type": "image/jpeg"},
   {"type": "text", "text": "turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video"}
 ]
}'

被写体参照

参照画像として指定された特定の被写体を組み込んだ動画を生成できます。 たとえば、次のコードは、猫と毛糸の 2 枚の画像を指定して、猫が毛糸で遊ぶ動画を生成する方法を示しています。

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input=[
        {"type": "image", "data": cat_b64, "mime_type": "image/png"},
        {"type": "image", "data": yarn_b64, "mime_type": "image/png"},
        {"type": "text", "text": "A cat playfully batting at a ball of yarn."}
    ],
)
with open("cat.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-1.1-eap',
  input: [
    { type: 'image', data: catData, mime_type: 'image/png' },
    { type: 'image', data: yarnData, mime_type: 'image/png' },
    { type: 'text', text: 'A cat playfully batting at a ball of yarn.' }
  ]
});

if (interaction.output_video?.data) {
  fs.writeFileSync('cat.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-1.1-eap",
 "input": [
   {"type": "image", "data": "'"$CAT_B64"'", "mime_type": "image/png"},
   {"type": "image", "data": "'"$YARN_B64"'", "mime_type": "image/png"},
   {"type": "text", "text": "A cat playfully batting at a ball of yarn."}
 ]
}'

タスク パラメータ

必要に応じて、generation_config の video_config で task パラメータを設定して、生成タスクを明示的に定義できます。設定しない場合、モデルはプロンプトと入力メディアに基づいて適切なモードを自動的に決定します。

サポートされている task 値は次のとおりです。

  • text_to_video: テキスト プロンプトのみから動画を生成します。
  • image_to_video: 1 つまたは 2 つのソース画像(開始フレームとオプションの終了フレーム)から動画を生成します。
  • reference_to_video: 指定されたメディアを参照として使用して動画を生成します。
  • edit: 既存の動画を変更します。
  • extend: 既存の動画クリップを延長します。

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input=[
        {"type": "image", "data": base64_image, "mime_type": "image/jpeg"},
        {"type": "text", "text": "turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video"}
    ],
    generation_config={
        "video_config": {
            "task": "image_to_video"
        }
    },
)
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 'fs';
const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: [
    { type: 'image', data: base64Image, mime_type: 'image/jpeg' },
    { type: 'text', text: 'turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video' }
  ],
  generationConfig: {
    videoConfig: {
      task: 'image_to_video',
    }
  }
});

if (interaction.output_video?.data) {
  fs.writeFileSync('example.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-1.1-eap",
    "input": [
      {
        "type": "image",
        "data": "'"$BASE64_IMAGE"'",
        "mime_type": "image/jpeg"
      },
      {
        "type": "text",
        "text": "turn this into realistic footage, using the drawing only as a guide for movement, do not show the drawing in the final video"
      }
    ],
    "generation_config": {
      "video_config": {
        "task": "image_to_video"
      }
    }
  }'

キーフレームの補間

開始フレームと終了フレームの間をスムーズに移行する連続動画を生成します。これは、カメラの軌道、ズーム効果、タイムラプス進行、シームレスなループ クリップに最適です。

入力配列に両方の画像と、目的の動きの説明を指定します。

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input=[
        {"type": "image", "data": start_frame_b64, "mime_type": "image/png"},
        {"type": "image", "data": end_frame_b64, "mime_type": "image/png"},
        {
            "type": "text",
            "text": "Smooth continuous timelapse from sunrise to sunset over a mountain lake."
        }
    ],
    # The task parameter is optional. If omitted, the model automatically infers the mode.
    generation_config={
        "video_config": {
            "task": "image_to_video"
        }
    },
    response_format={"type": "video"}
)
with open("interpolated.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-1.1-eap',
  input: [
    { type: 'image', data: startFrameB64, mime_type: 'image/png' },
    { type: 'image', data: endFrameB64, mime_type: 'image/png' },
    {
      type: 'text',
      text: 'Smooth continuous timelapse from sunrise to sunset over a mountain lake.'
    }
  ],
  // The task parameter is optional. If omitted, the model automatically infers the mode.
  generationConfig: {
    videoConfig: {
      task: 'image_to_video',
    },
  },
  response_format: { type: 'video' }
});

if (interaction.output_video?.data) {
  fs.writeFileSync('interpolated.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-1.1-eap",
    "input": [
      {"type": "image", "data": "'"$START_FRAME_B64"'", "mime_type": "image/png"},
      {"type": "image", "data": "'"$END_FRAME_B64"'", "mime_type": "image/png"},
      {
        "type": "text",
        "text": "Smooth continuous timelapse from sunrise to sunset over a mountain lake."
      }
    ],
    "generation_config": {
      "video_config": {
        "task": "image_to_video"
      }
    },
    "response_format": {"type": "video"}
  }'

ステートフルな動画編集

動画を生成し、フォローアップ プロンプトを使用して反復的に編集します。各ターンは前の結果に基づいて構築されます。モデルは動画のコンテキストを記憶し、言及しなかった要素を保持しながら変更を適用します。previous_interaction_id を使用すると、前の動画を再アップロードせずに、会話履歴と生成された動画の状態を追跡できます。

次の例は、最初の動画を生成してから編集する方法を示しています。

Python

import base64
from google import genai

client = genai.Client()

# Turn 1: Generate initial video
res1 = client.interactions.create(model="gemini-omni-1.1-eap", input="A woman playing violin outdoors.")

# Turn 2: Edit the previous video
res2 = client.interactions.create(
    model="gemini-omni-1.1-eap",
    previous_interaction_id=res1.id,
    input="Make the violin invisible."
)
with open("example.mp4", "wb") as f:
    f.write(base64.b64decode(res2.output_video.data))

JavaScript

import { GoogleGenAI } from '@google/genai';
import * as fs from 'fs';
const ai = new GoogleGenAI({});

// Turn 1: Generate initial video
const res1 = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: 'A woman playing violin outdoors.',
});

// Turn 2: Edit the previous video
const res2 = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  previous_interaction_id: res1.id,
  input: 'Make the violin invisible.',
});

if (res2.output_video?.data) {
  fs.writeFileSync('example.mp4', Buffer.from(res2.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-1.1-eap",
 "previous_interaction_id": "'"$PREVIOUS_ID"'",
 "input": "Make the violin invisible."
}'

最初の動画の例:

編集した動画の例:

会話の各ターンで新しい動画が生成されます。モデルは前のターンのコンテキストを理解しているため、シーン全体を再記述することなく、照明の調整や背景の入れ替えなどの増分変更を行うことができます。

自分の動画を編集する

Files API を使用して動画をアップロードし、 Gemini Omni Flash 1.1 で編集します。

次の例は、次の元の動画を編集する方法を示しています。

Python

import time
import base64
from google import genai

client = genai.Client()

# Upload video using the file API
video_file = client.files.upload(file="Video.mp4")

while video_file.state == "PROCESSING":
    print('Waiting for video to be processed.')
    time.sleep(10)
    video_file = client.files.get(name=video_file.name)

if video_file.state == "FAILED":
  raise ValueError(video_file.state)
print(f'Video processing complete: ' + video_file.uri)

# Edit your video
interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input=[
        {"type": "document", "uri": video_file.uri},
        {"type": "text", "text": "When the person touches the mirror, make the mirror ripple beautifully like liquid, and the person's arm turns into reflective mirror material"}
    ],
)
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 'fs';
const ai = new GoogleGenAI({});

// Upload video using the file API
let videoFile = await ai.files.upload({
  file: 'Video.mp4',
});

while (videoFile.state === 'PROCESSING') {
  console.log('Waiting for video to be processed.');
  await new Promise(r => setTimeout(r, 10000));
  videoFile = await ai.files.get({ name: videoFile.name });
}

if (videoFile.state === 'FAILED') {
  throw new Error(videoFile.state);
}
console.log('Video processing complete: ' + videoFile.uri);

# Edit your video
const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: [
    { type: 'document', uri: videoFile.uri },
    { type: 'text', text: "When the person touches the mirror, make the mirror ripple beautifully like liquid, and the person's arm turns into reflective mirror material" }
  ],
});

if (interaction.output_video?.data) {
  fs.writeFileSync('example.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-1.1-eap",
    "input": [
      {
        "type": "video",
        "data": "'"$VIDEO_B64"'",
        "mime_type": "video/mp4"
      },
      {
        "type": "text",
        "text": "When the person touches the mirror, make the mirror ripple beautifully like liquid, and the person arm turns into reflective mirror material"
      }
    ]
  }'

編集した動画の例:

シーンの延長

以前のコンテキストを使用して、既存の動画クリップを延長します。Gemini Omni Flash 1.1 は、以前の動きとシーン構成を分析して、延長されたショット全体で連続性、キャラクターの同一性、環境照明を維持します。

Python

import base64
from google import genai

client = genai.Client()

# Extend from a previous interaction ID
# The task parameter is optional. If omitted, the model automatically infers the mode.
extended = client.interactions.create(
    model="gemini-omni-1.1-eap",
    previous_interaction_id=res1.id,
    input="Continue the shot: the woman finishes the violin solo and takes a bow.",
    generation_config={
        "video_config": {
            "task": "extend"
        }
    },
    response_format={"type": "video"}
)
with open("extended.mp4", "wb") as f:
    f.write(base64.b64decode(extended.output_video.data))

JavaScript

import { GoogleGenAI } from '@google/genai';
import * as fs from 'fs';
const ai = new GoogleGenAI({});

// The task parameter is optional. If omitted, the model automatically infers the mode.
const extended = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  previous_interaction_id: res1.id,
  input: 'Continue the shot: the woman finishes the violin solo and takes a bow.',
  generationConfig: {
    videoConfig: {
      task: 'extend',
    },
  },
  response_format: { type: 'video' },
});

if (extended.output_video?.data) {
  fs.writeFileSync('extended.mp4', Buffer.from(extended.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-1.1-eap",
    "previous_interaction_id": "'"$PREVIOUS_ID"'",
    "input": "Continue the shot: the woman finishes the violin solo and takes a bow.",
    "generation_config": {
      "video_config": {
        "task": "extend"
      }
    },
    "response_format": {
      "type": "video"
    }
  }'

URI を使用して動画を取得する

response_format で delivery="uri" パラメータを使用して、4 MB を超える生成された動画を取得します。 これにより、動画が ACTIVE になるまでポーリングしてダウンロードできる、Google がホストする URI が返されます。

Python

import time
from google import genai

client = genai.Client()

# 1. Request video via URI delivery
interaction = client.interactions.create(
    model="gemini-omni-1.1-eap",
    input="A beautiful sunset.",
    response_format={"type": "video", "delivery": "uri"}
)

# 2. Extract file name and poll for ACTIVE state
video_output = interaction.output_video
file_name = video_output.uri.split("/")[-1] # Extract ID

print("Waiting for video processing...")
while True:
    f_info = client.files.get(name=f"files/{file_name}")
    if f_info.state.name == "ACTIVE":
        break
    elif f_info.state.name == "FAILED":
        raise RuntimeError("Generation failed.")
    time.sleep(5)

# 3. Download the final video
video_bytes = client.files.download(file=video_output.uri)
with open("output.mp4", "wb") as f:
    f.write(video_bytes)

JavaScript

import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({});

// 1. Request video via URI delivery
const interaction = await ai.interactions.create({
  model: 'gemini-omni-1.1-eap',
  input: 'A beautiful sunset.',
  response_format: { type: 'video', delivery: 'uri' },
});

// 2. Extract file name and poll for ACTIVE state
const videoOutput = interaction.output_video;
const fileId = videoOutput.uri.match(/files\/([a-zA-Z0-9]+)/)[1];
const name = `files/${fileId}`;

console.log("Waiting for video processing...");
while (true) {
  const fInfo = await ai.files.get({ name });
  if (fInfo.state.name === 'ACTIVE') break;
  if (fInfo.state.name === 'FAILED') throw new Error("Generation failed.");
  await new Promise(r => setTimeout(r, 5000));
}

// 3. Download the final video
await ai.files.download({
  file: videoOutput,
  downloadPath: 'output.mp4',
});
console.log("Saved video to output.mp4");

REST

#!/bin/bash

# 1. Initial request to generate the video
RESPONSE=$(curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$API_KEY" \
-H "Content-Type: application/json" \
-d '{
 "model": "gemini-omni-1.1-eap",
 "input": "A beautiful sunset over a calm ocean.",
 "response_format": {"type": "video", "delivery": "uri"}
}')

# Extract FILE_ID from the URI (e.g., "files/abc-123" -> "abc-123")
FILE_URI=$(echo $RESPONSE | jq -r '.output_video.uri')
FILE_ID=$(echo $FILE_URI | cut -d'/' -f2)

echo "Video requested (ID: $FILE_ID). Waiting for processing..."

# 2. Polling loop
while true; do
 # Get current file status
 STATUS_JSON=$(curl -s -X GET "https://generativelanguage.googleapis.com/v1beta/files/$FILE_ID?key=$API_KEY")
 STATE=$(echo $STATUS_JSON | jq -r '.state')

 if [ "$STATE" == "ACTIVE" ]; then
   echo "Processing complete! Downloading..."
   break
 elif [ "$STATE" == "FAILED" ]; then
   echo "Error: Generation failed."
   exit 1
 else
   echo "Current state: $STATE... (waiting 5s)"
   sleep 5
 fi
done

# 3. Final download
curl -L -X GET "https://generativelanguage.googleapis.com/v1beta/files/$FILE_ID:download?alt=media&key=$API_KEY" \
--output "output.mp4"

echo "Done! Video saved to output.mp4"

未加工の REST JSON 構造(URI):

{
  "steps": [
    { "type": "user_input", "content": [{"type": "text", "text": "..."}] },
    { "type": "thought", "content": [{"text": "...", "type": "thought"}] },
    {
      "type": "model_output",
      "content": [
        {
          "type": "video",
          "mime_type": "video/mp4",
          "uri": "https://generativelanguage.googleapis.com/v1beta/files/...:download?alt=media"
        }
      ]
    }
  ],
  "id": "v1_...",
  "status": "completed",
  "model": "gemini-omni-1.1-eap",
  "object": "interaction"
}

ベスト プラクティス

  • 大きな動画には URI 配信を使用する: 4 MB を超える動画(720p 超)の場合は、delivery="uri" で response_format を使用して、ペイロード サイズの制限を回避します。
  • パフォーマンスの最適化: より高速な同期ユニタリ生成を行うには、background=false、store=false、stream=false を設定します。store=false を設定すると、生成された動画は previous_interaction_id を使用して後続のターンで編集できなくなります。
  • プロンプトの精度: 詳細については、プロンプト ガイドをご覧ください。

制限事項

  • 欧州経済領域、スイス、英国では、未成年者の画像を含む画像のアップロードと編集は対象外です。
  • 特定の認識可能な人物を含む画像のアップロードと編集は対象外です。
  • 現在、欧州経済領域(EEA)、スイス、英国のユーザーは、アップロードした動画を編集できません(モデルで生成された動画の編集はサポートされています)。
  • 現在のバージョンの API では、音声参照のアップロードはサポートされていません。
  • 最長 3 秒の動画参照は API スキーマで受け付けられますが、現時点ではモデルで正しく処理されません。
  • 複数の動画にまたがる参照や推論はサポートされていません。複数の動画のプロンプトを試すと、モデルのパフォーマンスが低下したり、予期しない出力が発生したりする可能性があります。
  • 動画の拡張と動画の補間(最初と最後のフレームの間に動画を生成する)は対象外です。
  • 音声編集はサポートされていません。
  • プロビジョニングされたスループットはサポートされていません。
  • システム指示、温度、top_p、停止シーケンス、ネガティブ プロンプトはサポートされていません(ネガティブは通常のプロンプトに含めることができます。例: 「X を行わないでください」)。
  • YouTube 動画をメディアソースとして使用することは対象外です。

詳細な技術情報

  • 生成されたすべての動画には SynthID の透かしが含まれています。これは視聴者には見えませんが、来歴確認のためにプログラムで検出できます。
  • 動画の生成時間は、再生時間、解像度、現在の API 負荷によって異なります。動画の再生時間が長く、解像度が高いほど、生成に時間がかかります。
  • コンテンツ セーフティ フィルタは、入力プロンプトと生成された動画の両方に適用されます(地域によって異なります)。利用規約に違反するプロンプトはブロックされます。
  • 英語(EN)は完全にサポートされていますが、他の言語は評価されていないため、機能する可能性がありますが、結果は異なる場合があります。

Gemini Omni Flash プロンプト ガイド

このセクションでは、Gemini Omni Flash を効果的にプロンプトする方法に関するヒントと例を紹介します。

単一シーン

デフォルトでは、Omni Flash はいくつかの異なるショットを含む動画を作成しようとします。 プロンプトに基づいて、興味深いナレーションを作成しようとします。

出力動画に単一のシーンを含める必要がある場合は、次のようにプロンプトを指定する必要があります。

  • 途切れない単一のシーンで
  • 連続した一発ショットで
  • シーンカットなし

次に例を示します。

Continuous, unbroken handheld shot of a fluffy tabby cat sitting on a sunny windowsill, looking out into a leafy garden. The cat's tail twitches slowly, and its ears rotate slightly toward ambient noises. Sunbeams illuminate dust motes in the air. Sound design: Gentle breeze, distant bird chirps. No dialogue.

不要な要素を削除する

生成された動画に不要なものが含まれている場合は、簡単なネガティブ プロンプトを含めて回避します。

  • 会話なし
  • 装飾なし
  • 追加の効果音なし

編集用のプロンプト

動画編集にはシンプルなプロンプトが最適です。説明が多すぎるプロンプトは、意図しない変更につながる可能性があります。

シンプルな編集プロンプトの例を次に示します。

  • この動画をアニメにする
  • この人にファッショナブルな帽子をかぶせる
  • 照明をよりドラマチックにする
  • 看板のテキストを「Omni Flash」に変更する

動画の特定の側面を編集する場合は、"Keep everything else the same" を含めて視覚的な一貫性を維持します。

この手法の適用方法の例を次に示します。

  • 避けるべきこと: In the video of the man sitting on the sofa, please add a small black cat that runs from the right side of the screen, jumps onto his lap, and then he starts to stroke its head while looking down.
    • シンプルにする: Add a cat that jumps onto his lap, he begins to pet it. Keep everything else the same.
  • 避けるべきこと: Please remove the cell phone that the person is holding in their hand and fill in the background so it looks like they are just holding their hand empty.
    • シンプルにする: Make the phone invisible. Keep everything else the same.

音声のプロンプト

デフォルトでは、モデルは動画に適した音声トラックを生成しようとします。これが常に望ましいとは限りません。プロンプトを使用して、必要な音声の種類を記述できます。これは、動画に音楽を入れたい場合に特に重要です。

  • 穏やかなバックグラウンド ミュージックを含める
  • 動画にはハイエナジー テクノ ビートがある
  • 音声は、バックグラウンドで曲を再生する低音のラジオ放送です

イベントのタイミング

動画の特定の時間に発生する事柄をプロンプトで指定できます。正確な構文は必要なく、自然言語を使用できます。これは、独自のシーンカット、リズム、連射シーケンスを作成する場合に特に便利です。 例については、以下をご覧ください。

  • 3 秒後に女性がシーンに入る。
  • 5 秒でバックグラウンド音声でサビが始まる。
  • 2 秒ごとに新しいフレームに切り替える。
  • 連射シーケンスでは、0.5 秒ごと(24 fps で 12 フレーム)にシーンを新しい場所に切り替えます。

タイムコード構文を使用することもできます。

[0-3s] A person is walking
[3-6s] They stop and turn around
[6-10s] They start running

メタプロンプト

Gemini Omni Flash に、動画生成の一般的な品質や原則に注意するよう指示できます。

  • マイクロディテール、表現、タイミングを考慮して、非常にリッチで詳細でありながら完全に自然なシーンを作成します。
  • キャラクターと環境の説明は非常に詳細に記述してください。 キャラクターに衣装デザインの原則を適用します。シーン内の人物、アイテム、オブジェクトを具体的に指定します。
  • 背景要素に適切な詳細を多く含めて、シーンをリアルで自然なものにします。
  • 1 秒ごとに異なる珍しい [thing] を表示する連射動画を作成し、アップビートな音楽を流し、テキストを含めてそのものをラベル付けします。

動画内のテキスト

動画にテキストを含めるようにプロンプトを指定すると、Gemini Omni が正しく読みやすいようにレンダリングします。動画に自然に発生するテキストがある場合は、背景要素であっても、その内容を定義すると便利です。

  • 画面に一度に 1 つの単語を表示する: 「did, you, know, that, Omni, can, do, awesome, text?」 各単語は 1 秒間表示され、アニメーション スタイルが異なります。会話なし。
  • 「This is an AI generation by Omni」と書かれた道路標識がある。「All you need AI」と書かれた店舗がある。ナンバープレートに「OMN111」と書かれた車がある。

プロンプトでタグを使用して画像ロールを設定する

タグを使用して、アップロードしたメディアを特定の生成ロールにバインドできます。これにより、各画像が最初のフレームか参照かを指定できます。

  • <FIRST_FRAME>: 画像を動画の開始フレームとして使用します。 例: <FIRST_FRAME> a woman is walking
  • <IMAGE_REF_N>: 画像を参照として使用します。例: in the style of <IMAGE_REF_0> a woman <IMAGE_REF_1> is walking(最初の画像からスタイルの 参照を、2 番目の画像から被写体の参照を組み合わせます)。 画像参照は 0 から始まります。

参照画像を使用した例を次に示します。

[0-3s] A studio fashion sequence. Starting with woman <IMAGE_REF_0>, she is holding <IMAGE_REF_1>
[3-6s] Then we see the man <IMAGE_REF_2> holding <IMAGE_REF_3>
[6-10s] And finally another woman <IMAGE_REF_4> who is holding <IMAGE_REF_5> while walking.

次のステップ