Set clipping intervals - doesn't work

I’m trying to run this example by loading the video first and using video split with intervals (Video understanding  |  Gemini API  |  Google AI for Developers). But it crashes with an error:
Error type: RetryError
Error message: RetryError[<Future at 0x7fe95ea43400 state=finished raised ClientError>]

If I remove the video split, everything is fine. Tested with all 2.5 models. Does it even work for anyone?

Hello,

Welcome to the Forum,

Could you please share your code so that I can try to reproduce your issue?

Sure!

client = genai.Client(api_key=API_TOKEN)

local_video_path = "vid1.mp4"  # 16sec video, 3.1Mb, 1280 × 720, h264
uploaded_file = client.files.upload(file=local_video_path)

while uploaded_file.state.name == "PROCESSING":
    print(f"File state: {uploaded_file.state.name}. Waiting...")
    time.sleep(2)
    uploaded_file = client.files.get(name=uploaded_file.name)

response = client.models.generate_content(
    model='models/gemini-2.5-pro',
    contents=types.Content(
        parts=[
            types.Part(
                file_data=types.FileData(file_uri=uploaded_file.uri),
                video_metadata=types.VideoMetadata(
                    start_offset='5s',
                    end_offset='15s'
                )
            ),
            types.Part(text='Please summarize the video in 3 sentences.')
        ]
    )
)

print(response.text)

it raised error:

File state: PROCESSING. Waiting...
...
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Unsupported MIME type: ', 'status': 'INVALID_ARGUMENT'}}

The above exception was the direct cause of the following exception:
...
tenacity.RetryError: RetryError[<Future at 0x7f17ed103fd0 state=finished raised ClientError>]

If I run this code without these lines of code:

start_offset='5s',
end_offset='15s'

It works well.

So, I read full logs and found this error: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Unsupported MIME type: ', 'status': 'INVALID_ARGUMENT'}}

And I fixed it with adding info mime_type="video/mp4" in types.FileData, so correct code is:

from google import genai
from google.genai import types
import time

API_TOKEN = "AIzaSyBT-Uxc_6pFccJXI1b0BkfyktWxMqcb7_E"

client = genai.Client(api_key=API_TOKEN)

local_video_path = "vid1.mp4"  # 16sec video, 3.1Mb, 1280 × 720, h264
uploaded_file = client.files.upload(file=local_video_path)

start_processing_time = time.time()
while uploaded_file.state.name == "PROCESSING":
    print(f"File state: {uploaded_file.state.name}. Waiting...")
    time.sleep(2)
    uploaded_file = client.files.get(name=uploaded_file.name)

response = client.models.generate_content(
    model='models/gemini-2.5-pro',
    contents=types.Content(
        parts=[
            types.Part(
                file_data=types.FileData(file_uri=uploaded_file.uri, mime_type="video/mp4"),
                video_metadata=types.VideoMetadata(
                    start_offset='5s',
                    end_offset='15s'
                )
            ),
            types.Part(text='Please summarize the video in 3 sentences.')
        ]
    )
)

print(response.text)

Pleas add this information to your documentation here Video understanding  |  Gemini API  |  Google AI for Developers
I also tested it with long 1 hour video, it works well.

P.S. your example with youtube link and offset - works well (without mime_type="video/mp4)