Cloudinary supports the upload of any file type, including audio files.
When uploading an asset to Cloudinary, by default, the file type will be set to image
hence If you want to upload an asset that is not in an image, you will need to include the resource_type
parameter.
For video and audio files, this parameter needs to be set to video
or auto
. When setting the resource_type
to auto
, Cloudinary will automatically detect the file type and set the corresponding resource_type
. You can find additional information on asset types in our guide to uploading assets.
If you get the Invalid Image file
error message when uploading assets, this is certainly because the resource_type
was set to image
on the upload, instead of video
, auto
or raw
(in case you are uploading non-media assets)
For further information on audio transformations, please refer to this documentation:
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.