I am unable to select a m3a or mp4 or any other media format file. It says file type not supported.
How do I try out MultiModal capability?
I am unable to select a m3a or mp4 or any other media format file. It says file type not supported.
How do I try out MultiModal capability?
Welcome to the forums!
I’ve given AI Studio an mp4 file several times without any problems. How long is the file, and are you sure it’s a real mp4 file?
A screen shot illustrating the problem may help us help you figure out what’s going on.
Here is the screenshot
This is simple 4 second audio file with. I have also tried with mp4 and other audio files.
Uploading it to drive and selecting files from the drive is also attempted.
Welcome to the Forum. I will hazard a guess that you made the recording using an iPhone or iPad. The google code doesn’t understand that the .m4a extension is a perfectly fine audio file. I had the same problem with my testing and wrote a helper utility that is used like this
part_util.makeBlobPart('REST/Econ_cycles.m4a', mimetype="audio/mp4")
In other words, by specifying the mime type the API will accept and process the file. The code for the utility looks like this
def makeBlobPart(filename:str, mimetype: str = None) -> Part:
# REST/image.jpg
return Part(inline_data=makeBlob(filename, mimetype))
def makeBlob(filename:str, mimetype: str = None) -> Blob:
blobby = make_blob(filename, mimetype)
return Blob(**blobby)
def make_blob(filename:str, mimetype: str = None) -> dict:
# Test image has "totalTokens": 262
blob_part = dict()
if mimetype == None:
guess = mimetypes.guess_type(filename)
if guess != None:
logger.info("make_blob: " + filename + " guessed mimetype "
+ guess[0])
blob_part.update({"mime_type": guess[0]})
else:
logger.warn("make_blob: " + filename + " cannot guess mimetype")
raise TypeError # can not reasonably proceed
else:
logger.info("make_blob: " + filename + " given mimetype " + mimetype)
blob_part.update({"mime_type": mimetype})
with open(filename, 'rb') as image_file:
base64data = base64.standard_b64encode(image_file.read())
blob_part.update({"data": base64data.decode('utf-8')})
return blob_part
Hope that helps.