-
Notifications
You must be signed in to change notification settings - Fork 91
Update Veo 3.1 features including interpolation #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrisraygill
wants to merge
1
commit into
main
Choose a base branch
from
Update-Veo-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -654,7 +654,7 @@ The Google AI plugin provides access to video generation capabilities through th | |
|
|
||
| ### Available Models | ||
|
|
||
| **Veo 3.1 Series** - Latest generation with native audio and high fidelity: | ||
| **Veo 3.1 Series** - Latest generation with native audio and high fidelity. Supports 4K resolution, landscape/portrait aspect ratios, video extension, and interpolation. | ||
| - `veo-3.1-generate-preview` - High-quality video and audio generation | ||
| - `veo-3.1-fast-generate-preview` - Fast generation with high quality | ||
|
|
||
|
|
@@ -724,9 +724,11 @@ async function downloadVideo(video: MediaPart, path: string) { | |
| } | ||
| ``` | ||
|
|
||
| #### Video Generation from Photo Reference | ||
| #### Image-to-Video and Interpolation | ||
|
|
||
| To use a photo as reference for the video using the Veo model (e.g. to make a static photo move), you can provide an image as part of the prompt. | ||
| Veo models can use a photo as a reference to generate video (image-to-video), or transition between two photos (interpolation). | ||
|
|
||
| **Image-to-Video:** | ||
|
|
||
| ```typescript | ||
| const startingImage = fs.readFileSync('photo.jpg', { encoding: 'base64' }); | ||
|
|
@@ -752,6 +754,84 @@ let { operation } = await ai.generate({ | |
| }); | ||
| ``` | ||
|
|
||
| **Interpolation:** | ||
|
|
||
| To generate a video that transitions between a starting image and an ending image, use the `image` parameter for the first frame and the `lastFrame` config for the final frame. | ||
|
|
||
| ```typescript | ||
| const firstImage = fs.readFileSync('first.jpg', { encoding: 'base64' }); | ||
| const lastImage = fs.readFileSync('last.jpg', { encoding: 'base64' }); | ||
|
|
||
| let { operation } = await ai.generate({ | ||
| model: googleAI.model('veo-3.1-generate-preview'), | ||
| prompt: [ | ||
| { text: 'A ghostly woman swinging gently on a rope swing beneath a massive tree fades away, vanishing completely.' }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good if this example fed into the extending one... |
||
| { | ||
| media: { | ||
| contentType: 'image/jpeg', | ||
| url: `data:image/jpeg;base64,${firstImage}`, | ||
| }, | ||
| }, | ||
| ], | ||
| config: { | ||
| lastFrame: { | ||
| contentType: 'image/jpeg', | ||
| url: `data:image/jpeg;base64,${lastImage}`, | ||
| }, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| #### Extending Veo Videos | ||
|
|
||
| Veo 3.1 can extend videos that were previously generated with Veo by 7 seconds. Provide the `video` object from a previous generation to the `video` configuration parameter. | ||
|
|
||
| ```typescript | ||
| // Assume 'previousOperation' is an operation from a previous Veo generation | ||
| const previousVideo = previousOperation.output?.message?.content.find((p) => !!p.media); | ||
|
|
||
| let { operation } = await ai.generate({ | ||
| model: googleAI.model('veo-3.1-generate-preview'), | ||
| prompt: 'Track the butterfly into the garden as it lands on an orange origami flower.', | ||
| config: { | ||
| video: previousVideo.media, | ||
| resolution: '720p', | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| #### Using Reference Images | ||
|
|
||
| Veo 3.1 can use up to 3 reference images to guide the appearance of a person, character, or product in the generated video. | ||
|
|
||
| ```typescript | ||
| const personImage = fs.readFileSync('person.jpg', { encoding: 'base64' }); | ||
| const dressImage = fs.readFileSync('dress.jpg', { encoding: 'base64' }); | ||
|
|
||
| let { operation } = await ai.generate({ | ||
| model: googleAI.model('veo-3.1-generate-preview'), | ||
| prompt: 'A woman in a magnificent flamingo dress walks through a sun-drenched lagoon.', | ||
| config: { | ||
| referenceImages: [ | ||
| { | ||
| media: { | ||
| contentType: 'image/jpeg', | ||
| url: `data:image/jpeg;base64,${personImage}`, | ||
| }, | ||
| referenceType: 'asset', | ||
| }, | ||
| { | ||
| media: { | ||
| contentType: 'image/jpeg', | ||
| url: `data:image/jpeg;base64,${dressImage}`, | ||
| }, | ||
| referenceType: 'asset', | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| The Veo models support various configuration options: | ||
|
|
||
| - **negativePrompt** _string_ | ||
|
|
@@ -782,14 +862,25 @@ The Veo models support various configuration options: | |
| - `2`: Supported in Veo 2 only. | ||
|
|
||
| - **durationSeconds** _number_ (Veo 2 only) | ||
|
|
||
| Length of each output video in seconds (5 to 8). Not configurable for Veo 3.1/3.0 (defaults to 8 seconds). | ||
| - **durationSeconds** _number_ | ||
|
Comment on lines
864
to
+865
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| Length of each output video in seconds. | ||
| - **Veo 3.1 / 3.0**: Defaults to `8` seconds. Must be `8` when using extension, reference images, 1080p, or 4k resolutions. | ||
| - **Veo 2.0**: `5` to `8` seconds. | ||
|
|
||
| - **resolution** _string_ (Veo 3.1 only) | ||
|
|
||
| Resolution of the generated video. | ||
| - `"720p"` (default) | ||
| - `"1080p"` (Available for 16:9 aspect ratio) | ||
| - `"1080p"` (Available for 8s duration) | ||
| - `"4k"` (Available for 8s duration) | ||
|
|
||
| - **video** _object_ (Veo 3.1 only) | ||
|
|
||
| A video object from a previous generation to be extended. | ||
|
|
||
| - **lastFrame** _object_ (Veo 3.1 only) | ||
|
|
||
| An image object to use as the final frame for interpolation. | ||
|
|
||
| - **seed** _number_ (Veo 3.1/3.0 only) | ||
|
|
||
|
|
@@ -798,6 +889,8 @@ The Veo models support various configuration options: | |
| - **referenceImages** _object[]_ (Veo 3.1 only) | ||
|
|
||
| Provides up to 3 reference images to guide the video's content or style. | ||
| - **media** _object_: The image to use as reference. | ||
| - **referenceType** _string_: The type of reference (e.g., `'asset'`). | ||
|
|
||
| - **enhancePrompt** _boolean_ (Veo 2 only) | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explanation for interpolation could be clearer. It mentions using an
imageparameter for the first frame, but the code example provides the starting image as amediapart within thepromptarray. To avoid confusion, I suggest rephrasing this to better match the code example.