[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/gemini-enterprise-agent-platform/models/tuning/video [Back]  [Original]

Video tuning  |  Gemini Enterprise Agent Platform  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Video tuning Stay organized with collections Save and categorize content based on your preferences.

This page provides prerequisites and detailed instructions for fine-tuning Gemini on video data using supervised learning.

Use cases

Fine-tuning lets you adapt base Gemini models for specialized tasks. Here are some video use cases:

Limitations

Dataset format

The fileUri field specifies the location of your dataset. It can be the URI for a file in a Cloud Storage bucket, or it can be a publicly available HTTP or HTTPS URL.

The mediaResolution field is used to specify the token count per frame for the input videos. The following describes token counts for supported models:

When a video segment is used for training and validation, the video segment is in the videoMetadata field. During tuning, this data point is decoded to contain information from the segment extracted from the specified video file, starting from timestamp startOffset (the start offset, in seconds) until endOffset.

To see the generic format example, see Dataset example for Gemini.

The following sections present video dataset format examples.

JSON schema example for cases where the full video is used for training and validation

This schema is added as a single line in the JSONL file.

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "fileData": {
            "fileUri": "gs://<path to the mp4 video file>",
            "mimeType": "video/mp4"
          },
        },
        {
          "text": "
          You are a video analysis expert. Detect which animal appears in the
          video.The video can only have one of the following animals: dog, cat,
          rabbit.\n Output Format:\n Generate output in the following JSON
          format:\n
          [{\n
            \"animal_name\": \"<CATEGORY>\",\n
          }]\n"
        }
      ]
    },
    {
      "role": "model",
      "parts": [
        {
          "text": "```json\n[{\"animal_name\": \"dog\"}]\n```"
        }
       ]
    },
  ],
  "generationConfig": {
    "mediaResolution": "MEDIA_RESOLUTION_LOW"
  }
}

(Gemini 3 and higher models only) Starting with the Gemini 3 models, you can also set the media resolution per individual media Part. This lets you mix resolutions in your dataset (for example, by setting MEDIA_RESOLUTION_HIGH for one item and MEDIA_RESOLUTION_LOW for another). For more information about part-level resolution and their corresponding token counts, see Media resolution.

Part-level media resolution settings take precedence over global settings.

The following is an example dataset that sets the media resolution at both the Part and global levels:

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "fileData": {
            "fileUri": "gs://<path to the mp4 video file>",
            "mimeType": "video/mp4"
          }
        },
        {
          "fileData": {
            "fileUri": "gs://<path to the mp4 video file>",
            "mimeType": "video/mp4"
          },
          "mediaResolution": {
            "level": "MEDIA_RESOLUTION_HIGH"
          }
        },
        {
          "text": "Describe these videos in detail."
        }
      ]
    },
    {
      "role": "model",
      "parts": [
        {
          "text": "Video 1 is low resolution while video 2 is sharp and clear"
        }
      ]
    }
  ],
  "generationConfig": {
    "mediaResolution": "MEDIA_RESOLUTION_LOW"
  }
}

JSON schema example for cases where a video segment is used for training and validation

This schema is added as a single line in the JSONL file.

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "fileData": {
            "fileUri": "gs://<path to the mp4 video file>",
            "mimeType": "video/mp4"
          },
         "videoMetadata": {
            "startOffset": "5s",
            "endOffset": "25s"
          }
        },
        {
          "text": "
          You are a video analysis expert. Detect which animal appears in the
          video.The video can only have one of the following animals: dog, cat,
          rabbit.\n Output Format:\n Generate output in the following JSON
          format:\n
          [{\n
            \"animal_name\": \"<CATEGORY>\",\n
          }]\n"
       }
      ]
   },
   {
      "role": "model",
      "parts": [
        {
          "text": "```json\n[{\"animal_name\": \"dog\"}]\n```"
        }
      ]
    },
  ],
"generationConfig": {
     "mediaResolution": "MEDIA_RESOLUTION_LOW"
  }
}

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-19 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-19 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page