You can upload any file type to your Cloudinary account, including audio files.
By default, Cloudinary expects uploaded assets to be images. If you want to upload an asset that is not in an image format, you will need to include the resource_type
parameter. All video and audio files need to be specified as resource_type:'video'
or resource_type: 'auto'
. Sending 'auto' as the value for the resource_type
allows Cloudinary to automatically detect the asset type of the file and set the corresponding resource_type
You can find additional information on asset types in our guide to uploading assets.
If you find that your upload returns an 'Invalid image file' error message, this may be because the resource_type
was set to 'image' on the upload, instead of "auto" or "raw"
Please reference the documentation for further information on audio transformations:
https://cloudinary.com/documentation/audio_transformations#audio_transformation_and_streaming
Comments
11 comments
I tried uploading but seems it doesnt accept audio files in the free tier
When resource_type is set to 'video' for uploaded audio file (mp3) the duration returned is wrong (in my case 22:50 returned insted of 05:42), also audio is transcoded to wav format.
I am trying to work in React and running into issues. I just want to upload audio files via the video resource type from a React front end / node back end and then add the meta data to the database????
So far all documentation has been limited. Any help?
@lori bannon
Exact implementation varies depending on what you're trying to accomplish but in general, you'd want to use some kind of upload on the React end (probably a form?) which sends the file to the node server. The server then sends the file to cloudinary. You can use the cloudinary node module for that part. You'll have to read up on how file processing works when using forms. You'll most likely need the multer module in node as well.
Thanks Adam,
But I am way past that already. I was able to figure out how to upload the audio files and take the response url that is sent from Cloudinary and put it in my users collection in mongo. From there I just grab that url to play.
Where I am at now is I am trying to stream a video playlist. The demo works on my site, I can bring down one url by using the transformations and overlays but it stops after the first video is done and can't find the next. Arggg. So, troubleshooting that currently.
Would you be able to point me in the direction of anymore information as to where they are at with the Live features?
@Lori
Glad to hear it :) I figured that you were probably past it given the date on your comment but that someone might need that info in the future. It sounds like your solution (storing the remote id or url in mongo) is almost identical to my own solution.
I'm not using video streaming, only images (with transforms) and audio, so I can't help you with that.
Hello! I hope you are well. Where do I set the resource_type when using Rails active storage to upload directly to Cloudinary? I am receiving the Invalid image file error when trying to upload audio, however I do not get this error when I upload video or gltf zip files.
I am uploading media to cloudinary using simple_form. I am not using the Cloudinary Uploader (unless it is secretly being configured and used in the background without me knowing)
This is how I retrieve audio files for my rails app. I am using the free tier.
THis seems to have changed with the new UI. Really frustrating that i can't find this simple setting
Hi Zachary,
I would love to help. Can you let me know which setting you are unable to find?
Kind regards,
Tia
Please sign in to leave a comment.