You can use Veo on Gemini Enterprise Agent Platform to remove objects from videos that you generate. You provide a mask and a video object, and then use a text prompt to describe the output that you want. The Agent Platform API is supported during Preview. Supported interfaces include the Google Cloud console and the Gemini Enterprise Agent Platform API.
The following models support removing objects from videos:
For more information about writing effective text prompts for video generation, see the Veo prompt guide.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
Enable the Agent Platform API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
Enable the Agent Platform API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
Set up authentication for your environment.
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
Python
To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up ADC for a local development environment in the Google Cloud authentication documentation.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Remove an object from a video
In the Google Cloud console, go to the Agent Platform > Media Studio
page. Click Video. In the Task menu, select Video inpaint (insert). From the Model menu, select a model from the displayed options. In the Input video section, click Add. In the Prompt box, enter a text prompt that describes the videos to
generate. Optional: Adjust the following Parameters: Number of results: adjust the slider or enter a value between 1
and 4. Mask behavior: Select an option from the displayed options. Output directory: click Browse to create or select a
Cloud Storage bucket to store the generated
files. Click Run.
To learn more, see the
SDK reference documentation.
Set environment variables to use the Google Gen AI SDK with Vertex AI:
For more information about the Veo API, see the following:
Before using any of the request data,
make the following replacements:
Additional optional parameters Use the following optional variables depending on your use
case. Add some or all of the following parameters in the The default value is The default value is The default value is
HTTP method and URL:
Request JSON body:
To send your request, choose one of these options:
Save the request body in a file named
Save the request body in a file named Optional: Check the status of the video generation long-running operation.
Before using any of the request data,
make the following replacements:
HTTP method and URL:
Request JSON body:
To send your request, choose one of these options:
Save the request body in a file named
Save the request body in a file named Console
Python
Install
pip install --upgrade google-genai
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_ENTERPRISE=True
REST
endpoints.predictVideoGenerationModelInstanceVideoGenerationModelParamsVideoGenerationModelResult
PROJECT_ID: Your
Google Cloud project ID.
TEXT_PROMPT: The text prompt
used to guide video generation.
MASK_STORAGE_URI
The Cloud Storage bucket URI path to the mask object.
MASK_MIME_TYPE The MIME type
of the image mask. Only one of the following:
image/pngimage/jpegimage/webpVIDEO_INPUT_STORAGE_URI
The Cloud Storage bucket URI path video input object.
VIDEO_MIME_TYPE The MIME
type of the video object. Only one of the following:
video/movvideo/mpegvideo/mp4video/mpgvideo/avivideo/wmvvideo/mpegpsvideo/flvOUTPUT_STORAGE_URI:
Optional: The Cloud Storage bucket to store the output videos. If not
provided, a Base64-bytes encoded video is returned in the response. For
example: gs://video-bucket/output/.
RESPONSE_COUNT: The number of
video files you want to generate. Accepted integer values: 1-4.
"parameters": {} object.
"parameters": {
"aspectRatio": "ASPECT_RATIO",
"negativePrompt": "NEGATIVE_PROMPT",
"personGeneration": "PERSON_SAFETY_SETTING",
// "resolution": RESOLUTION, // Veo 3 models only
"sampleCount": RESPONSE_COUNT,
"seed": SEED_NUMBER
}
ASPECT_RATIO:
Optional: A string value that describes the aspect ratio of the generated
videos. You can use the following values:
"16:9" for landscape"9:16" for portrait"16:9"NEGATIVE_PROMPT: Optional: A string
value that describes content that you want to prevent the model from
generating.
PERSON_SAFETY_SETTING:
Optional: A string value that controls the safety setting for generating
people or face generation. You can use the following values:
"allow_adult": Only allow generation of adult people and
faces.
"disallow": Doesn't generate people or faces.
"allow_adult".RESOLUTION:
Optional: A string value that controls the resolution of the generated
video. Supported by Veo 3 models only. You can use the following
values:
"720p""1080p""4k" (Veo 3.1 Preview models only)"720p".RESPONSE_COUNT:
Optional. An integer value that describes the number of videos to generate.
The accepted range of values is 1-4.
SEED_NUMBER:
Optional. An uint32 value that the model uses to generate deterministic
videos. Specifying a seed number with your request without changing other
parameters guides the model to produce the same videos. The accepted range
of values is 0-4294967295.
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-preview:predictLongRunning
{
"instances": [
{
"prompt": "TEXT_PROMPT",
// The following fields can be repeated for up to three total
// images.
"mask": {
"gcsUri": "MASK_STORAGE_URI",
"mimeType": "MASK_MIME_TYPE",
"maskMode": "remove"
},
"video": {
"gcsUri": "VIDEO_INPUT_STORAGE_URI",
"mimeType": "VIDEO_MIME_TYPE"
}
}
],
"parameters": {
"storageUri": "OUTPUT_STORAGE_URI",
"sampleCount": RESPONSE_COUNT,
}
}
curl
request.json,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-preview:predictLongRunning"PowerShell
request.json,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-preview:predictLongRunning" | Select-Object -Expand Content
{
"name": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-001/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8"
}
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation
{
"operationName": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID"
}
curl
request.json,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation"PowerShell
request.json,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation" | Select-Object -Expand Content
What's next
- Generate videos from text
- Learn more about prompts
- Understand responsible AI and usage guidelines for Veo on Gemini Enterprise Agent Platform