gemini-omni-flash-api
Back to list

google-gemini/gemini-omni-flash-api

Gemini Omni Flash Api

GitHub

Generative video editing, text-to-video, image-referenced video, frame transitions, and extensions using Gemini Omni 1.1 Flash via the official google-genai SDK.

1.8K installsVideoTooling0 demos

Real-world examples not captured yet

This skill shows a gallery of live HTML demos (CDN libraries welcome — GSAP, Three.js, etc.) rendered inline via srcdoc.

Skill markdown
# Gemini Omni Flash Skill

This skill uses the Gemini Omni 1.2 Flash model (`gemini-omni-1.2-flash`) to perform text-to-video generation, image-to-video generation (first-frame and two-frame keyframe transitions), reference-to-video (R2V) generation, video extensions (3s–10s per turn, up to 30s total), and video editing.

> [!WARNING]
> **Important Regional Restrictions**: Uploading videos to use for video edits, extensions, or references is **NOT** available in the EEA, Switzerland, the United Kingdom, and some US states. If a video-to-video edit completes quickly with empty outputs (`total_output_tokens: 0` or no video content), it is likely due to this restriction.

## Core capabilities

1. **Text to video**: Generating videos (`3s`–`15s`, default `10s`) from a text prompt.
2. **First frame to video**: Generating videos (`3s`–`15s`, default `10s`) from a starting image (`--first-frame`).
3. **First and last frame transition**: Generating videos (`3s`–`10s`) interpolating between a starting image and a final image (`--first-frame` and `--last-frame`; note: `--last-frame` must be used with `--first-frame`).
4. **Video extensions**: Extending existing videos by `3` to `10` seconds per turn (`10s` default), up to a cumulative length of `30` seconds (`--extend` or `--previous-interaction-id`).
5. **Video editing and refinement**: Editing existing videos (uploaded source video up to `10` seconds), applying stylistic changes, or performing object addition/removal while keeping everything else consistent.
6. **Reference-to-video (R2V) & image-guided editing/extension**: Guiding new video generation (`3s`–`15s`) with reference images (`--image`, up to 6, including `15s` clips) or reference videos (`--video-reference`, up to 3 for `3s`–`10s` clips and max 1 for `11s`–`15s` clips). **Reference images** (`--image`) also work during **video editing** and **prompt-based video extension**, whereas **only reference videos** (`--video-reference`) are restricted to new video generation.

## Workflow

1. **Analyze request**: Determine the target workflow (text-to-video, first-frame-to-video, two-frame keyframe transition, video extension, video editing, or reference-to-video generation) and inspect any input media assets.
2. **Run SDK scripts**:

   * Directly run the appropriate utility (`scripts/video/generate_video.py` or `scripts/upload_file.py`).
   * Configure settings like `--aspect-ratio` (`16:9` default, `9:16`), `--resolution` (`360p`, `720p` default, `1080p`, `4k`), and `--duration` (integer from `3` to `15` seconds, default `10`; `3` to `10` seconds when combining `--first-frame` and `--last-frame` or extending). *Note: `4k` requests take longer to generate.*

3. **Retrieve and process output**: Outputs are saved to the local filesystem (e.g. `media/`). Report back the completed media path to the user.

## Reference Documentation

* **Video Generation & Editing (Omni Flash)**: Full parameter reference, duration limits, and prompting patterns at [aistudio.google.com/docs/omni.md](https://aistudio.google.com/docs/omni.md).
* **Interactions API**: All operations and state management for `gemini-omni-1.2-flash` use the [Interactions API](https://aistudio.google.com/docs/interactions-overview.md).
* **Files API**: Input media files (reference images and videos) are uploaded via the [Files API](https://aistudio.google.com/docs/files.md) and polled until `ACTIVE` before passing their URI and MIME type in `interactions.create`.
* **[Gemini API Skill Reference](https://github.com/google-gemini/gemini-skills/blob/main/skills/gemini-api-dev/SKILL.md)**: Platform-wide guidelines, current model specifications, and SDK usage rules for the Gemini API.

## Dependencies and Prerequisites

* **Python SDK (`google-genai`)**: Requires `google-genai >= 2.30.1` (Python) to support the current `interactions` steps schema, output helpers (`interaction.output_video`), and full video output resolution configuration (`360p`, `720p`, `1080p`, `4k`). Install or upgrade using:
  ```bash
  pip install -U google-genai
  ```
* **Python Runtime**: Requires **Python >= 3.10** (for compatibility with modern `google-genai` SDK types and methods).
* **ffmpeg & ffprobe**: `prep_video.py`, `inspect_video.py`, and `generate_video.py` (when stripping audio via `--strip-audio`) require `ffmpeg` and `ffprobe` binaries installed and available in your system `PATH`.
* **API Key**: Set the `GEMINI_API_KEY` environment variable:
  ```bash
  export GEMINI_API_KEY="your-api-key"
  ```

## Available scripts

Use the following Python scripts to upload media with the Files API, prepare input videos with ffmpeg, and generate video outputs using the Interactions API.

1. **[upload_file.py](scripts/upload_file.py)**: Uploads local media (images and videos) to the Files API and polls until `ACTIVE`. If uploading a video larger than 25MB, it prints an informative warning/tip highlighting that Gemini Omni Flash is optimized for editing 10s source videos at 720p/24fps, 

…

More from google-gemini