Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error "Failed to initialize the ffmpeg demuxer" when send video as Part.from_uri

Code

 

model = GenerativeModel("gemini-1.5-flash-002")
video_part = Part.from_uri(
"url-to-mp4-file.mp4",
mime_type="video/mp4",
)
result = model.generate_content(["What is shown in this video?", video_part])

ERROR

{
	"name": "InvalidArgument",
	"message": "400 Failed to initialize the ffmpeg demuxer, please make sure 1. Vertex's P4SA has permission to access input data; 2. video URL is valid; 3. video data is valid.",
	"stack": "---------------------------------------------------------------------------
}

 


It seems it only appear on some mp4 file. any idea how to resolve this? 

1 2 347
2 REPLIES 2

i've dot the same problem on certain videos, while the same videos work ok in aistudio.

Did you figure out solution or workaround?

the solution was to upload the file to gcp first. wait until it finished PROCESSING . then use the file as input to model.generate_content([myfile, prompt])