إنشاء الفيديوهات وتعديلها باستخدام Gemini Omni Flash

‫Gemini Omni Flash (gemini-omni-flash-preview) هو نموذج متعدد الوسائط عالي الأداء مصمّم لإنشاء الفيديوهات وتعديلها والتحكّم بها بشكل سينمائي وبسرعة عالية. يستند Gemini Omni إلى الإمكانات الأساسية التالية التي تميّزه عن نماذج الفيديو السابقة:

  • تعدُّد الوسائط: يعالج النصوص والصور والمقاطع الصوتية والفيديوهات في الوقت نفسه، ما يمنحك نتائج أكثر اتساقًا وتماسكًا وقابلية للتحكّم.
  • التعديل عبر سلسلة من الطلبات: تتيح لك هذه الميزة، التي يوفّرها واجهة برمجة التطبيقات Interactions، تحسين فيديوهاتك وتعديلها بشكل متكرّر من خلال محادثة باللغة الطبيعية. صِف التغييرات التي تريد إجراءها، وسيُطبّق النموذج التعديل مع الحفاظ على أجزاء الفيديو التي تريد الاحتفاظ بها.
  • المعرفة بالعالم: يجمع 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) فقط. احصل على ناتج الفيديو من مصفوفة steps عند استخدام REST API مباشرةً.

بنية JSON غير مُعالَجة لخدمة REST:

{
  "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 'fs';
const ai = new GoogleGenAI({});

const interaction = await ai.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'
  },
});

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-flash-preview",
 "input": "A futuristic city with neon lights and flying cars, cyberpunk style",
 "response_format": {
   "type": "video",
   "aspect_ratio": "9:16"
 }
}'

إنشاء فيديو من صورة

يمكنك تقديم صورة مرجعية مع طلبك النصي. استنادًا إلى طلبك، سيقرّر النموذج كيفية استخدام الصورة. وهي مفيدة لإضفاء الحيوية على لقطات المنتجات أو الرسوم التوضيحية أو الصور الفوتوغرافية.

يوضّح المثال التالي كيفية استخدام الصورة المرجعية لرسم سمكة تقفز من الماء:

رسم لسمكة تقفز خارج الماء

باستخدام الطلب التالي:

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-flash-preview",
    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-flash-preview',
  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-flash-preview",
 "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"}
 ]
}'

معرّف الموضوع

يمكنك إنشاء فيديو يتضمّن مواضيع محدّدة مقدَّمة كصور مرجعية. على سبيل المثال، يوضّح الرمز التالي كيفية تقديم صورتَين لقطة وخيط لإنشاء فيديو للقطة وهي تلعب بالخيط.

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-flash-preview",
    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-flash-preview',
  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-flash-preview",
 "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."}
 ]
}'

مَعلمة المهام

استخدِم المَعلمة task في video-config للإشارة بوضوح إلى السلوك المطلوب، مثلاً إذا كنت تريد أن ينشئ النموذج فيديو من صورة، يمكنك ضبط المَعلمة على image_to_video. إذا لم يتم ضبط هذه القيمة، سيستنتج النموذج ما تريده من الطلب.

في ما يلي القيم المسموح بها:

  • text_to_video
  • image_to_video
  • reference_to_video
  • edit

يوضّح المثال التالي كيفية ضبط ذلك على المثال السابق الذي يعرض صورة إلى فيديو.

Python

import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-flash-preview",
    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-flash-preview',
  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" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-flash-preview",
    "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"
      }
    }
  }'

تعديل الفيديوهات مع الحفاظ على السياق

إنشاء فيديو وتعديله بشكل متكرّر باستخدام طلبات متابعة تستند كل خطوة إلى النتيجة السابقة. يتذكّر النموذج سياق الفيديو، ويطبّق التغييرات التي أجريتها مع الحفاظ على العناصر التي لم تذكرها. استخدِموا الرمز 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-flash-preview", input="A woman playing violin outdoors.")

# Turn 2: Edit the previous video
res2 = client.interactions.create(
    model="gemini-omni-flash-preview",
    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-flash-preview',
  input: 'A woman playing violin outdoors.',
});

// Turn 2: Edit the previous video
const res2 = await ai.interactions.create({
  model: 'gemini-omni-flash-preview',
  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-flash-preview",
 "previous_interaction_id": "'"$PREVIOUS_ID"'",
 "input": "Make the violin invisible."
}'

مثال على فيديو أولي:

مثال على فيديو معدَّل:

يؤدي كل رد في المحادثة إلى إنشاء فيديو جديد. يفهم النموذج السياق من الجولات السابقة، ما يتيح لك إجراء تغييرات تدريجية، مثل تعديل الإضاءة وتبديل الخلفيات، بدون إعادة وصف المشهد بأكمله.

تعديل فيديوهاتك

حمِّل فيديوهاتك باستخدام Files API لتعديلها باستخدام Gemini Omni Flash.

يوضّح المثال التالي كيفية تعديل الفيديو الأصلي التالي:

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-flash-preview",
    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-flash-preview',
  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

#!/bin/bash
VIDEO_B64=$(encode_file "$VIDEO_FILE")

curl -sS -w "\n[HTTP %{http_code}]\n" "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d @- <<EOF > video_editing_response.json
{
  "model": "gemini-omni-flash-preview",
  "input": [
    {
      "type": "user_input",
      "content": [
        {
          "type": "video",
          "mime_type": "video/mp4",
          "data": "$VIDEO_B64"
        },
        {
          "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"
        }
      ]
    }
  ],
  "response_format": { "type": "video" }
}
EOF

مثال على فيديو معدَّل:

استرداد الفيديوهات باستخدام معرّف الموارد المنتظم (URI)

استخدِم المَعلمة delivery="uri" في response_format لاسترداد الفيديوهات التي تم إنشاؤها والتي يزيد حجمها عن 4 ميغابايت. تعرض هذه الطريقة معرّف موارد منتظم (URI) مستضافًا على Google يمكنك استخدامه إلى أن يصبح الفيديو ACTIVE قبل تنزيله.

Python

import time
from google import genai

client = genai.Client()

# 1. Request video via URI delivery
interaction = client.interactions.create(
    model="gemini-omni-flash-preview",
    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-flash-preview',
  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-flash-preview",
 "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"

بنية JSON غير مُعالَجة لخدمة REST (معرّف الموارد المنتظم):

{
  "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-flash-preview",
  "object": "interaction"
}


أفضل الممارسات

  • استخدام عرض المحتوى عبر معرّف الموارد الموحّد (URI) للفيديوهات الكبيرة: بالنسبة إلى الفيديوهات التي يزيد حجمها عن 4 ميغابايت (أكبر من 720 بكسل عند توفّرها)، استخدِم delivery="uri" في response_format لتجنُّب حدود حجم الحمولة.
  • الأداء المحسَّن: اضبط background=false وstore=false وstream=false لإنشاء أحادي أسرع ومتزامن. يُرجى العِلم أنّ ضبط store=false يعني أنّه لن يكون بإمكانك تعديل الفيديو الذي تم إنشاؤه في المحادثات اللاحقة باستخدام previous_interaction_id.
  • دقة الطلب: يُرجى الاطّلاع على قسم إرشادات الطلب لمعرفة التفاصيل.

القيود

  • لا تتوفّر إمكانية تحميل وتعديل الصور التي تتضمّن قاصرين في المنطقة الاقتصادية الأوروبية وسويسرا والمملكة المتحدة.
  • لا يمكن تحميل وتعديل الصور التي تحتوي على أشخاص معيّنين يمكن التعرّف عليهم.
  • لا تتوفّر حاليًا إمكانية تعديل الفيديوهات التي تم تحميلها للمستخدمين في المنطقة الاقتصادية الأوروبية وسويسرا والمملكة المتحدة (يمكن تعديل الفيديوهات التي أنشأها النموذج).
  • لا يمكن تحميل مراجع صوتية في الإصدار الحالي من واجهة برمجة التطبيقات.
  • يقبل مخطط واجهة برمجة التطبيقات مراجع الفيديو التي تصل مدتها إلى 3 ثوانٍ، ولكن لا يعالجها النموذج بشكل صحيح في الوقت الحالي.
  • لا يمكن الإشارة إلى فيديوهات متعددة أو تقديم أسباب استنادًا إليها. قد تؤدي محاولة استخدام طلبات متعددة للفيديو إلى تدهور أداء النموذج أو ظهور نتائج غير متوقعة.
  • لا تتوافق هذه الميزة مع امتداد الفيديو واستيفاء الفيديو (إنشاء فيديو بين إطار أول وإطار آخر).
  • لا يمكن إجراء التعديلات باستخدام الصوت.
  • لا تتوفّر ميزة "معدل النقل المتوفّر".
  • لا تتوفّر تعليمات النظام ودرجة الحرارة وtop_p وتسلسلات الإيقاف والطلبات السلبية (يمكنك وضع الطلبات السلبية في الطلب العادي، مثلاً "لا تفعل X").
  • لا يمكن استخدام فيديوهات YouTube كمصدر للوسائط.

التفاصيل الفنية

  • تتضمّن جميع الفيديوهات التي يتم إنشاؤها علامات مائية من SynthID غير مرئية للمشاهدين ولكن يمكن رصدها آليًا للتحقّق من مصدرها.
  • تختلف أوقات إنشاء الفيديوهات استنادًا إلى المدة ودرجة الدقة وحِمل واجهة برمجة التطبيقات الحالي. يستغرق إنشاء الفيديوهات الأطول والأعلى دقة وقتًا أطول.
  • يتم تطبيق فلاتر أمان المحتوى على طلبات الإدخال والفيديوهات التي يتم إنشاؤها (ويختلف ذلك حسب المنطقة). سيتم حظر الطلبات التي تنتهك سياسات الاستخدام.
  • اللغة الإنجليزية (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، تبدأ اللازمة الموسيقية في الصوت في الخلفية.
  • يتم الانتقال إلى إطار جديد كل ثانيتَين.
  • في تسلسل سريع، غيِّر المشهد إلى موقع جغرافي جديد كل نصف ثانية (12 لقطة في الثانية عند 24 لقطة في الثانية).

يمكنك أيضًا استخدام بنية رمز الوقت:

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

Meta prompting

يمكنك أن تطلب من Gemini Omni Flash الانتباه إلى الصفات العامة أو المبادئ العامة لإنشاء الفيديوهات:

  • يجب مراعاة التفاصيل الدقيقة والتعبيرات والتوقيت لإنشاء مشهد غني بالتفاصيل وطبيعي تمامًا.
  • يجب أن تكون تفاصيل الأوصاف الخاصة بالشخصيات والبيئات دقيقة للغاية. تطبيق مبادئ تصميم الأزياء على الشخصيات يجب أن تكون محدّدًا جدًا بشأن الأشخاص والأشياء والعناصر في المشهد.
  • أضِف الكثير من التفاصيل المناسبة في عناصر الخلفية لجعل المشهد يبدو واقعيًا وطبيعيًا.
  • أنشئ فيديو سريعًا يعرض [thing] مختلفًا كل ثانية واحدة، مع موسيقى حماسية، وأدرِج نصًا لتسمية الشيء.

النص في الفيديوهات

يمكنك تقديم طلب يتضمّن نصًا في الفيديو، وسيعرضه Gemini Omni بطريقة صحيحة وسهلة القراءة. إذا كان الفيديو سيتضمّن نصًا بشكل طبيعي، حتى في عناصر الخلفية، من المفيد تحديد ما يجب أن يقوله.

  • كلمة واحدة على الشاشة في كل مرة: "هل، تعلم، أنّ، Omni، يمكنه، إنشاء، نصوص، رائعة؟" تظهر كل كلمة لمدة ثانية واحدة بأسلوب متحرك مختلف. لا يوجد حوار.
  • هناك لافتة شارع مكتوب عليها: "هذا المحتوى من إنشاء الذكاء الاصطناعي باستخدام Omni"، وهناك واجهة متجر مكتوب عليها: "كل ما تحتاجه من الذكاء الاصطناعي"، وهناك سيارة تحمل لوحة أرقام مكتوب عليها: "OMN111"

استخدام العلامات في الطلبات لضبط أدوار الصور

يمكنك استخدام العلامات لربط الوسائط التي تم تحميلها بأدوار إنشاء محدّدة. يتيح لك ذلك تحديد ما إذا كانت كل صورة هي إطار أولي أو مرجع.

1. العلامات البسيطة (ننصح بها)

في الحالات البسيطة التي تكون فيها أدوار الصور واضحة من الطلب، يمكنك ربط الصور بالأدوار مباشرةً:

  • <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 (يجمع بين مرجع النمط من الصورة الأولى ومرجع العنصر من الصورة الثانية). تبدأ مراجع الصور من 0.

في ما يلي مثال يتضمّن 6 صور مرجعية:

[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.

2. الإفصاحات الواضحة

في الحالات الأكثر تعقيدًا التي تتضمّن صورًا وأدوارًا متعدّدة، يمكنك استخدام علامات بادئة صريحة مقترنة بلاحقات تعليمات باللغة الطبيعية.

  • الإفصاح عن المصادر والصور المرجعية:
    • سيتم استخدام الصورة الأولى كإطار البداية.[# Sources <FIRST_FRAME>@Image1]
    • سيتم استخدام الصورة الأولى كمرجع.[# References <IMAGE_REF_0>@Image1]
    • سيستخدم [# References <IMAGE_REF_1>@Image2] الصورة الثانية كمرجع.
    • سيستخدم [# References <IMAGE_REF_0>@Image1 <IMAGE_REF_1>@Image2] كلتا الصورتين كمرجع.
    • ستستخدم [# Sources <FIRST_FRAME>@Image1] [# References <IMAGE_REF_0>@Image2] الصورة الأولى كإطار البداية والصورة الثانية كمرجع.
  • تعليمات توجيهية: أضِف تعليمات توجيهية في نهاية الطلب:
    • بالنسبة إلى الإطار الأوّل: "Use this image as the starting frame."
    • بالنسبة إلى الصور المرجعية: "Use the given image(s) as references for video generation. The images should not be used as literal initial frames."

مثال على طلب موسَّع:

[# Sources <FIRST_FRAME>@Image1] [# References <IMAGE_REF_0>@Image2] a woman <IMAGE_REF_0> is walking. Use Image1 as the starting frame. Use Image2 as a reference for the video generation.

الخطوات التالية