cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

set custom fps not working?

Open gobigandwin opened this issue 6 months ago • 6 comments

Description of the bug:

I got extra_forbidden error when trying to set custom fps for video processing using client.models.generate_content. (code reference: https://ai.google.dev/gemini-api/docs/video-understanding). Please share if you have ran into the same issue and look forward to hearing how you solved it!

My code:

with open(video_local.name, 'rb') as f:
                    video_bytes = f.read()
                
                # Create content using inline data
                response = await self.gemini_client.aio.models.generate_content(
                    model=model,
                    contents=types.Content(
                        parts=[
                            types.Part(
                                inline_data=types.Blob(
                                    data=video_bytes,
                                    mime_type=mime_type,
                                    video_metadata=types.VideoMetadata(fps=5)
                                )
                            ),
                            types.Part(text=prompt)
                        ]
                    )
                )

Actual vs expected behavior:

Error Message: Failed to process video [https://....mp4] for Gemini: 1 validation error for Blob video_metadata Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata] For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden ERROR:app.routes.ads:Failed to analyze xxxxx: 1 validation error for Blob video_metadata Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata] For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden

Any other information you'd like to share?

No response

gobigandwin avatar May 28 '25 18:05 gobigandwin

Hi @gobigandwin, May I know the model you are using for video understanding with custom FPS. Thank You.

kiransair avatar May 29 '25 06:05 kiransair

Hi @kiransair, I'm using "gemini-2.5-pro-preview-05-06", the latest model.

Hi @gobigandwin, May I know the model you are using for video understanding with custom FPS. Thank You.

gobigandwin avatar May 29 '25 06:05 gobigandwin

Hi @gobigandwin, while reproducing we have encountered the same error. will check with the engineering team. Thank You.

kiransair avatar May 29 '25 12:05 kiransair

Hi @gobigandwin, while reproducing we have encountered the same error. will check with the engineering team. Thank You.

Hi, same question also occurred in gemini-2.5-flash-05-20

syx1031 avatar May 30 '25 17:05 syx1031

I'm also getting this issue. It works when switching back to gemini-2.0-flash. I would prefer to use the File API, but that does not currently support specifying a custom FPS.

joshdixon avatar May 30 '25 23:05 joshdixon

Description of the bug:

I got extra_forbidden error when trying to set custom fps for video processing using client.models.generate_content. (code reference: https://ai.google.dev/gemini-api/docs/video-understanding). Please share if you have ran into the same issue and look forward to hearing how you solved it!

My code:

with open(video_local.name, 'rb') as f:
                    video_bytes = f.read()
                
                # Create content using inline data
                response = await self.gemini_client.aio.models.generate_content(
                    model=model,
                    contents=types.Content(
                        parts=[
                            types.Part(
                                inline_data=types.Blob(
                                    data=video_bytes,
                                    mime_type=mime_type,
                                    video_metadata=types.VideoMetadata(fps=5)
                                )
                            ),
                            types.Part(text=prompt)
                        ]
                    )
                )

Actual vs expected behavior:

Error Message: Failed to process video [https://....mp4] for Gemini: 1 validation error for Blob video_metadata Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata] For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden ERROR:app.routes.ads:Failed to analyze xxxxx: 1 validation error for Blob video_metadata Extra inputs are not permitted [type=extra_forbidden, input_value=VideoMetadata(fps=5.0, en...None, start_offset=None), input_type=VideoMetadata] For further information visit https://errors.pydantic.dev/2.10/v/extra_forbidden

Any other information you'd like to share?

No response

Hi friend, what's your google-genai module's version? When I upgrade my 1.15.0 to 1.17.0, it works~

syx1031 avatar May 31 '25 06:05 syx1031

It didn't work for me. Then I upgraded google-genai to 1.17.0. Works now, but only for Gemini 2.0 Flash. Still not working for 2.5 series

priyanshuchandra avatar Jun 30 '25 06:06 priyanshuchandra

I confirm that it works perfectly in Gemini 2.0 Flash. It failed In every 2.5 series at the current date (July 23rd)

VGonPa avatar Jul 23 '25 08:07 VGonPa

Hi, I just tested it using the 2.5 model, and it seems to be working fine. For your reference, I am attaching a Colab Gist file. Let me know if you are still facing the same issues.

Thanks!

Gunand3043 avatar Aug 14 '25 09:08 Gunand3043

Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.

github-actions[bot] avatar Aug 28 '25 22:08 github-actions[bot]

This issue was closed because it has been inactive for 27 days. Please post a new issue if you need further assistance. Thanks!

github-actions[bot] avatar Sep 11 '25 22:09 github-actions[bot]