Gemini Omni Flash 1.1 (Early Access Program) की मदद से वीडियो जनरेट और एडिट करना

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, एसडीके टूल के लिए ही उपलब्ध है. 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"
 }
}'

समस्या हल करने से जुड़े कंट्रोल

360 पिक्सल ड्राफ़्ट मोड

response_format में resolution: "360p" का इस्तेमाल करके, कम टोकन इस्तेमाल करके, करीब दो गुना तेज़ी से हल्की झलक वाली क्लिप जनरेट करें.

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"
    }
  }'

हाई रिज़ॉल्यूशन (1080 पिक्सल और 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"}
 ]
}'

विषय का रेफ़रंस

रेफ़रंस इमेज के तौर पर दिए गए विषयों को शामिल करके, वीडियो जनरेट किया जा सकता है. उदाहरण के लिए, यहाँ दिए गए कोड में बिल्ली और ऊन की दो इमेज दी गई हैं. इससे बिल्ली के ऊन से खेलने का वीडियो जनरेट किया जा सकता है.

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: यह सुविधा, एक या दो सोर्स इमेज (शुरुआती फ़्रेम और वैकल्पिक तौर पर आखिरी फ़्रेम) से वीडियो जनरेट करती है.
  • 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"
    }
  }'

यूआरआई की मदद से वीडियो वापस पाना

4 एमबी से ज़्यादा साइज़ वाले जनरेट किए गए वीडियो वापस पाने के लिए, delivery="uri" पैरामीटर response_format का इस्तेमाल करें. इससे 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-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 का रॉ स्ट्रक्चर (यूआरआई):

{
  "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"
}

सबसे सही तरीके

  • बड़े वीडियो के लिए यूआरआई डिलीवरी का इस्तेमाल करें: अगर वीडियो का साइज़ 4 एमबी से ज़्यादा है (उपलब्ध होने पर >720p), तो पेलोड के साइज़ की सीमा से बचने के लिए, response_format में delivery="uri" का इस्तेमाल करें.
  • ऑप्टिमाइज़ की गई परफ़ॉर्मेंस: तेज़ी से और सिंक्रोनस तरीके से यूनेरी जनरेट करने के लिए, background=false, store=false, और stream=false सेट करें. ध्यान दें कि store=false सेटिंग का मतलब है कि जनरेट किए गए वीडियो में, previous_interaction_id का इस्तेमाल करके बाद के चरणों में बदलाव नहीं किया जा सकेगा.
  • प्रॉम्प्ट की सटीक जानकारी: ज़्यादा जानकारी के लिए, प्रॉम्प्ट के लिए दिशा-निर्देश सेक्शन देखें.

सीमाएं

  • यूरोपियन इकनॉमिक एरिया, स्विट्ज़रलैंड, और यूनाइटेड किंगडम में, नाबालिगों की इमेज अपलोड करने और उनमें बदलाव करने की सुविधा उपलब्ध नहीं है.
  • पहचाने जा सकने वाले कुछ लोगों की इमेज अपलोड करने और उनमें बदलाव करने की सुविधा उपलब्ध नहीं है.
  • फ़िलहाल, अपलोड किए गए वीडियो में बदलाव करने की सुविधा, यूरोपियन इकनॉमिक एरिया (ईईए), स्विट्ज़रलैंड, और यूनाइटेड किंगडम में रहने वाले लोगों के लिए उपलब्ध नहीं है. हालांकि, मॉडल से जनरेट किए गए वीडियो में बदलाव किया जा सकता है.
  • एपीआई के मौजूदा वर्शन में, ऑडियो रेफ़रंस अपलोड करने की सुविधा उपलब्ध नहीं है.
  • एपीआई स्कीमा में, तीन सेकंड तक की अवधि वाले वीडियो के रेफ़रंस स्वीकार किए जाते हैं. हालांकि, फ़िलहाल मॉडल इन्हें सही तरीके से प्रोसेस नहीं करता है.
  • एक से ज़्यादा वीडियो के कॉन्टेंट का हवाला देने या उनके बारे में तर्क देने की सुविधा उपलब्ध नहीं है. एक साथ कई वीडियो का इस्तेमाल करने पर, मॉडल की परफ़ॉर्मेंस खराब हो सकती है या अनचाहे नतीजे मिल सकते हैं.
  • वीडियो एक्सटेंशन और वीडियो इंटरपोलेशन (पहले और आखिरी फ़्रेम के बीच वीडियो जनरेट करना) मौजूद नहीं है.
  • आवाज़ में बदलाव करने की सुविधा मौजूद नहीं है.
  • प्रोविज़न किए गए थ्रूपुट की सुविधा काम नहीं करती.
  • सिस्टम के निर्देशों, टेंपरेचर, 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.

ऑडियो के लिए प्रॉम्प्ट देना

डिफ़ॉल्ट रूप से, मॉडल किसी वीडियो के लिए सही ऑडियो ट्रैक जनरेट करने की कोशिश करेगा. ऐसा हो सकता है कि आपको हमेशा इस तरह के सुझाव न चाहिए हों. अपने प्रॉम्प्ट का इस्तेमाल करके, आपको जिस तरह का ऑडियो चाहिए उसके बारे में बताया जा सकता है. अगर आपको अपने वीडियो में संगीत जोड़ना है, तो ऐसा करना खास तौर पर ज़रूरी है:

  • बैकग्राउंड में शांत संगीत शामिल करें
  • वीडियो में हाई एनर्जी टेक्नो बीट है
  • बैकग्राउंड में रेडियो ब्रॉडकास्ट का ऑडियो चल रहा है. इसमें एक गाना बज रहा है. ऑडियो की क्वालिटी बहुत खराब है

समय इवेंट

वीडियो में किसी खास समय पर होने वाली चीज़ों के लिए प्रॉम्प्ट दिया जा सकता है. इसके लिए, सटीक सिंटैक्स की ज़रूरत नहीं होती. साथ ही, नैचुरल लैंग्वेज का इस्तेमाल किया जा सकता है. यह सुविधा, सीन कट, रिदम या रैपिड फ़ायर सीक्वेंस बनाने में खास तौर पर मददगार होती है. उदाहरणों के लिए, यहां दिया गया लेख पढ़ें:

  • तीन सेकंड बाद, एक महिला सीन में दिखती है.
  • पांच सेकंड पर, बैकग्राउंड ऑडियो में कोरस शुरू होता है.
  • हर दो सेकंड में एक नया फ़्रेम दिखता है.
  • तेज़ी से सीन बदलने वाले सीक्वेंस में, हर आधे सेकंड (24fps पर 12 फ़्रेम) में सीन को नई जगह पर बदलें.

टाइमकोड सिंटैक्स का भी इस्तेमाल किया जा सकता है:

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

मेटा प्रॉम्प्टिंग

Gemini Omni Flash को वीडियो जनरेट करने के सामान्य सिद्धांतों या क्वालिटी पर ध्यान देने के लिए कहा जा सकता है:

  • बारीकियों से लैस और पूरी तरह से असली दिखने वाला सीन बनाने के लिए, माइक्रो-डिटेल, एक्सप्रेशन, और टाइमिंग का ध्यान रखें.
  • किरदारों और माहौल के बारे में ज़्यादा से ज़्यादा जानकारी दें. किरदारों के लिए, कॉस्ट्यूम डिज़ाइन के सिद्धांतों को लागू करना. सीन में मौजूद लोगों, चीज़ों, और ऑब्जेक्ट के बारे में सटीक जानकारी दें.
  • बैकग्राउंड के एलिमेंट में ज़्यादा से ज़्यादा जानकारी शामिल करें, ताकि सीन असली और नैचुरल लगे.
  • एक ऐसा वीडियो बनाओ जिसमें हर सेकंड में अलग-अलग रेयर [thing] दिखें. वीडियो में तेज़ संगीत हो और टेक्स्ट शामिल करके, हर चीज़ को लेबल किया गया हो.

वीडियो में मौजूद टेक्स्ट

वीडियो में टेक्स्ट शामिल करने के लिए प्रॉम्प्ट दिया जा सकता है. Gemini Omni, टेक्स्ट को इस तरह से रेंडर करेगा कि वह सही और पढ़ने लायक हो. अगर आपके वीडियो में टेक्स्ट अपने-आप जनरेट होता है, तो आपको यह तय करने में मदद मिल सकती है कि टेक्स्ट में क्या लिखा होना चाहिए. भले ही, यह टेक्स्ट बैकग्राउंड में मौजूद एलिमेंट में हो.

  • स्क्रीन पर एक बार में एक शब्द: "क्या, आपको, पता, है, कि, Omni, कमाल, का, टेक्स्ट, लिख, सकता, है?" हर शब्द, ऐनिमेशन की अलग-अलग स्टाइल में एक सेकंड के लिए दिखता है. कोई जवाब नहीं दिया गया.
  • सड़क पर एक साइन बोर्ड है, जिस पर लिखा है: "यह इमेज, 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 (पहली इमेज से स्टाइल का रेफ़रंस और दूसरी इमेज से सब्जेक्ट का रेफ़रंस मिलाता है). इमेज रेफ़रंस की शुरुआत 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.

आगे क्या करना है