Convert mp3 to video with waveform overlay
I'm trying to take a picture, an mp3 file, and a number of other assets and turn that into a video export. One asset I'd like to add is a waveform. I have most of it working:h
http://res.cloudinary.com/pixstori/video/upload/w_640,h_480,c_fill,l_4e664f7f-ffc7-4f4b-b2bc-e7a89a199703/w_640,h_36,o_40,g_north,l_dot-black.png/l_text:arial_16:test%20%232,co_rgb:FFFFFF,g_north,y_10/w_100,h_30,g_north,y_42,l_WhiteLogo/dadzFjG6dMXDYbZBK.mp4
dadzFjG6dMXDYbZBK is the MP3 ID. I tried to add a waveform with this segment:
/l_dadzFjG6dMXDYbZBK.png,w_640,h_40,fl_waveform/
http://res.cloudinary.com/pixstori/video/upload/w_640,h_480,c_fill,l_4e664f7f-ffc7-4f4b-b2bc-e7a89a199703/w_640,h_36,o_40,g_north,l_dot-black.png/l_text:arial_16:test%20%232,co_rgb:FFFFFF,g_north,y_10/w_100,h_30,g_north,y_42,l_WhiteLogo/l_dadzFjG6dMXDYbZBK.png,w_640,h_480,fl_waveform/dadzFjG6dMXDYbZBK.mp4
It did not work. I suppose I can generate the image, then upload it as a library asset, but is there a way to get it to work this way? Any help is appreciated!
-
Hey Kevin,
Thank you for your patience,
When adding an image overlay, an already created image must be provided, and because no l_dadzFjG6dMXDYbZBK.png image asset exists, the request ends with a failure.
Fortunately, There's a workaround. You can use the fetch property of the overlay parameter (https://cloudinary.com/documentation/image_transformations#adding_image_overlays), with a base64 encoded URL of the video/audio transformed with a waveform transformation.
For example, the following URL is a waveform of a video asset (dog.mp4):
https://res.cloudinary.com/demo/video/upload/fl_waveform/dog.mp4
Here is the same URL encoded to Base 64:
aHR0cHM6Ly9yZXMuY2xvdWRpbmFyeS5jb20vZGVtby92aWRlby91cGxvYWQvZmxfd2F2ZWZvcm0vZG9nLm1wNA==
And, here is a video with the waveform as an overlay:
https://res.cloudinary.com/demo/video/upload/l_fetch:aHR0cHM6Ly9yZXMuY2xvdWRpbmFyeS5jb20vZGVtby92aWRlby91cGxvYWQvZmxfd2F2ZWZvcm0vZG9nLm1wNA==,w_200/dog.mp4Hope this helps, please let me know if you have any further questions.
Thanks,
Eyal0
Post is closed for comments.
Comments
1 comment