0
votes

I've been having difficulty retrieving a thumbnail from a video hosted on Cloudinary. If I enter the video's url into my browser, the video is successfully retrieved and displayed on my screen. I would like to use this url to get a thumbnail from the video. I've tried using the Cloudinary api to accomplish this. According to the documentation, all you need to do is change the extension from .mp4 to .jpg:

https://cloudinary.com/documentation/video_manipulation_and_delivery#generating_video_thumbnails

However, when I do that, I get a 404 error with an x-cld-error header that says "Resource not found". This is unexpected because the video does indeed exist and Cloudinary's own website claims that changing the file extension converts the media to a thumbnail or the relevant media type.

I'm attempting to retrieve these thumbnails using Cloudinary's Java api as part of an Android app. The Java code I wrote to get the url of the thumbnail is as follows:

String videoPath = replaceExtension(strings[0], ".jpg");
Map<String, String> config = new HashMap<String, String>();
config.put("cloud_name", "<my_cloud_name>");
Cloudinary cloudinary = new Cloudinary(config);
cloudinary.url().resourceType("video").imageTag(videoPath);

Any help is greatly appreciated!

1

1 Answers

0
votes

The code you used to generate the video URL looks correct but it will not give the thumbnail.media_lib_thumb is the default thumbnail generated for every video/image uploaded.

String thumbnail=cloudinary.url().resourceType("video").transformation(new Transformation().named("media_lib_thumb")).imageTag("dog.jpg");

Maybe you can try printing the videopath and check the public_id actually exists in your account.