DEV Community

Cover image for How to extend a video to 40 seconds with Gemini Omni 1.1 Flash
Hassann
Hassann

Posted on Originally published at apidog.com

How to extend a video to 40 seconds with Gemini Omni 1.1 Flash

Extending Gemini Omni 1.1 Flash Videos Beyond 10 Seconds

Gemini Omni 1.1 Flash generates 10-second clips. Scene extension lets you go further: each extension appends another 10 seconds, up to 40 seconds total.

Try Apidog today

The feature existed in the preview model, but it only used the final second of footage as context. That preserved rough colors, but characters could change clothes and camera movements could reset. The GA release on August 27, 2026 expanded the context window to 10 seconds. Google says this provides “improved visual consistency and narrative adherence”.

This guide shows how to call scene extension, plan within its limits, and keep a 40-second sequence coherent.

Make a basic extension call

Extensions use the Files API. Upload the existing clip, then pass its URI with a prompt describing the next action:

import base64
from google import genai

client = genai.Client()

video_file = client.files.upload(file="my_video.mp4")

interaction = client.interactions.create(
    model="gemini-omni-1.1-flash",
    input=[
        {"type": "document", "uri": video_file.uri},
        {"type": "text", "text": "Continue the scene."},
    ],
)

with open("extended.mp4", "wb") as f:
    f.write(base64.b64decode(interaction.output_video.data))

Enter fullscreen mode Exit fullscreen mode

File uploads are asynchronous. Poll the file state before creating the interaction:

import time

while video_file.state == "PROCESSING":
    time.sleep(10)
    video_file = client.files.get(name=video_file.name)

if video_file.state == "FAILED":
    raise ValueError(video_file.state)

Enter fullscreen mode Exit fullscreen mode

If the source video was generated by Omni in the same session, chain the next call with the interaction ID instead of uploading the video again. This uses fewer tokens and preserves more state:

res2 = client.interactions.create(
    model="gemini-omni-1.1-flash",
    previous_interaction_id=res1.id,
    input="The camera pulls back to reveal the whole street.",
)

Enter fullscreen mode Exit fullscreen mode

The API walkthrough covers additional options, including resolution and delivery formats.

Add a character reference

You can attach reference media and identify it in the prompt. Uploaded references are addressed as <IMAGE_REF_0>, <IMAGE_REF_1>, and so on:

video_file = client.files.upload(file="my_video.mp4")
character_img = client.files.upload(file="character.png")

interaction = client.interactions.create(
    model="gemini-omni-1.1-flash",
    input=[
        {"type": "document", "uri": video_file.uri},
        {"type": "document", "uri": character_img.uri},
        {"type": "text", "text": "Extend this video: have the character shown in <IMAGE_REF_0> enter the scene and wave."},
    ],
)

Enter fullscreen mode Exit fullscreen mode

Video references are also supported, with a limit of three clips at three seconds each. Omni uses them for movement and appearance; audio from reference clips is ignored.

Know the limits

  • 40 seconds is the maximum. A sequence contains one 10-second generation and up to three 10-second extensions.
  • Extensions append only. You cannot prepend footage or insert content in the middle. If segment two fails, regenerate from segment two onward.
  • Uploaded videos are limited to 10 seconds. Multi-turn chains using previous_interaction_id are not subject to this upload limit because Omni retains the earlier state.
  • Uploaded extensions cannot add dialogue. You can extend someone else’s uploaded clip silently, or use a multi-turn interaction, but dialogue cannot be added when extending an upload.
  • Regional restrictions apply. Video upload and editing are unavailable in the European Economic Area, Switzerland, and the UK. Model-generated videos remain editable there, so previous_interaction_id works even though the upload path does not.
  • Only one video can be provided at a time. Omni does not reason across multiple input videos.

Draft the complete arc before rendering at full resolution

The most reliable workflow is to validate the entire sequence cheaply first.

A 40-second sequence at 720p costs roughly $4.06 in video output. If the story drifts in segment three, you must regenerate segments three and four—and may lose a detail you liked at the start of segment three.

Draft all four segments at 360p. It renders up to 60% faster and costs about one-third as much, bringing the same sequence to roughly $1.35. Once the arc works, re-render at 720p or higher using the validated prompts. See the pricing breakdown.

Set the resolution in response_format:

interaction = client.interactions.create(
    model="gemini-omni-1.1-flash",
    input=[
        {"type": "document", "uri": video_file.uri},
        {"type": "text", "text": "Continue the scene."},
    ],
    response_format={"type": "video", "resolution": "360p"},
)

Enter fullscreen mode Exit fullscreen mode

Write prompts that survive four segments

Use prompts that describe the next beat without asking the model to reinterpret the previous one.

Describe the change, not the entire scene. Omni already sees the preceding 10 seconds. “The camera pushes in on the door” is better than re-describing the room.

Give each segment one movement. Ten seconds is usually enough for one action. Prompts with two beats often produce rushed versions of both.

Name continuity anchors. Explicitly preserve details such as “the same red jacket” or “the same low angle.”

Plan around append-only editing. Sequence the beats in playback order. You cannot repair the beginning without regenerating everything after it.

The Veo prompt guide covers prompting principles that also apply to Omni.

Test every extension consistently

Four chained calls create four opportunities for model behavior to change. Comparing only the final render makes regressions difficult to isolate.

Save each stage as a separate request in Apidog. Store the file URI and interaction ID in environment variables so you can rerun one segment without rebuilding the chain.

Assert the response shape as well as the status. Higher-resolution output can exceed 4 MB and switch from inline base64 data to a URI. Also set a timeout well above the default: an extension takes longer than an initial generation because Omni must first process the preceding 10 seconds.

This small harness makes it easier to determine whether a seam problem comes from the prompt or a model update. Download Apidog to set it up.

FAQ

How long can a Gemini Omni video be?

40 seconds total: one 10-second generation plus three 10-second extensions.

Can I extend a video I filmed myself?

Yes, for input videos up to 10 seconds, except in the EEA, Switzerland, and the UK. Upload it through the Files API and pass its URI.

Can I add footage to the beginning?

No. Extension only appends to the end.

Why does my character change between segments?

The prompt may be re-describing the scene instead of describing the next change, or it may not specify a continuity anchor. Name the details that must remain unchanged, and consider attaching a character image reference.

Does each extension cost extra?

Yes. Each extension bills for its own 10 seconds of video output, plus the input tokens used to process the context.

What if I need more than 40 seconds?

Veo 3.1 extends clips by seven seconds at a time, up to 148 seconds, at 720p only. The model comparison explains the tradeoffs, while Veo’s API guide covers integration.

Scene extension makes Omni useful for deliverable video, but planning matters. Storyboard four beats, validate the full arc at 360p, give each prompt one movement, and spend on 720p only after the sequence works.

Top comments (0)