Skip to content

Any generation request with video_metadata results in a 500 error #854

Description

@kfajdsl

Environment details

  • Programming language: Python (also tested with REST API)
  • OS: macOS
  • Language runtime version: 3.12.9
  • Package version: 1.16.1

Steps to reproduce

  1. Run the following script:
from google import genai
from google.genai import types
from pathlib import Path
import os

client = genai.Client(api_key=os.environ['GEMINI_API_KEY'])

video_path = Path("vid.mp4")
video_bytes = video_path.read_bytes()

response = client.models.generate_content(
    model='models/gemini-2.5-flash-preview-05-20',
    contents=types.Content(
        parts=[
            types.Part(
                inline_data=types.Blob(
                    data=video_bytes,
                    mime_type='video/mp4',
                ),
                video_metadata=types.VideoMetadata(
                    fps=5
                )
            ),
            types.Part(text='Please summarize the video in 3 sentences.')
        ]
    )
)

This also happens with start_offset and end_offset.

Also, note, the docs page seems wrong. It has the following:

            types.Part(
                inline_data=types.Blob(
                    data=video_bytes,
                    mime_type='video/mp4',
                    video_metadata=types.VideoMetadata(fps=5)
            )),

This fails with a Pydantic error when run, and according to the API reference and other examples, video_metadata is a member of Part, not Blob.

Metadata

Metadata

Assignees

Labels

api: gemini-apipriority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsestatus:staletype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions