Generating Videos Render API - Thumbnails API for creating thumbnail images using video templates
In addition to generating videos, the Capsule Render API can be used to generate thumbnail images. The process is almost identical to generating videos , you just need to add the following parameters to the job request:
Copy {
"thumbnail" : true ,
"thumbnailFrame" : <integer_frame_number>
}
When the job is complete, the url
parameter in the job status response points to a png image of the requested frame.
Example
Here’s an example JSON object for the POST request:
Copy {
"template" : "game-announcement" ,
"thumbnail" : true ,
"thumbnailFrame" : 116 ,
"payload" : {
"canvasWidth" : 1080 ,
"canvasHeight" : 1080 ,
"assets" : [
{
"name" : "broadcastLogo" ,
"url" : "https://static.capsule.video/demo/nba.png" ,
"cache" : true
} ,
{
"name" : "sponsorLogo" ,
"url" : "https://static.capsule.video/demo/axp.png" ,
"cache" : true
} ,
{
"name" : "camera" ,
"url" : "https://static.capsule.video/demo/suns_jazz_6s.mp4" ,
"cache" : true
}
] ,
"cameraScale" : "fill" ,
"accentColor" : "#E03A3E" ,
"team1" : "Utah Jazz" ,
"team2" : "Phoenix Suns" ,
"gameDate" : "April 21" ,
"gameTime" : "8:00" ,
"gameTimeInfo" : "PM ET"
}
}
Here’s an example API call to create a thumbnail job using the payload above:
Copy curl -X POST "https://api.capsule.video/job" \
-H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>" \
-H "content-type: application/json" \
--data-raw '{"script":"game-announcement","thumbnail":true,"thumbnailFrame":116,"payload":{"canvasWidth":1080,"canvasHeight":1080,"assets":[{"name":"broadcastLogo","url":"https://static.capsule.video/demo/nba.png","cache":true},{"name":"sponsorLogo","url":"https://static.capsule.video/demo/axp.png","cache":true},{"name":"camera","url":"https://static.capsule.video/demo/suns_jazz_6s.mp4","cache":true}],"cameraScale":"fill","accentColor":"#E03A3E","team1":"Utah Jazz","team2":"Phoenix Suns","gameDate":"April 21","gameTime":"8:00","gameTimeInfo":"PM ET"}}'
Response:
Copy {
"jobId" : "65053295e53f397b2c00ea92" ,
"message" : "ok" ,
"success" : true
}
Next check the status of that job with a GET using the job ID returned above, a few moments later once job is completed:
Copy curl -X GET "https://api.capsule.video/job/65053295e53f397b2c00ea92" \
-H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>"
Response:
Copy {
"jobId" : "65053295e53f397b2c00ea92" ,
"status" : "completed" ,
"compDuration" : 7.5 ,
"endtime" : 1694839448179 ,
"progress" : 1 ,
"runtime" : 0 ,
"streaming" : false ,
"url" : "https://render.capsule.video/media/65053295e53f397b2c00ea92/thumbnail"
}
Now, download the png image via the url
param above, and you'll get this: