Capsule Developer Tools
  • Generating Videos
    • Render API
    • Render API - Thumbnails
    • Supported features
  • Capturing Videos
    • Embed a video recorder
  • Accessing Videos
    • Webhooks
    • Fetch API
  • Displaying Videos
    • Embed a video collection
    • Embed a single video
Powered by GitBook
On this page

Was this helpful?

  1. Generating Videos

Render API - Thumbnails

API for creating thumbnail images using video templates

PreviousRender APINextSupported features

Last updated 1 year ago

Was this helpful?

In addition to generating videos, the Capsule Render API can be used to generate thumbnail images. The process is almost identical to , you just need to add the following parameters to the job request:

{
    "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:

{
    "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:

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:

{
    "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:

curl -X GET "https://api.capsule.video/job/65053295e53f397b2c00ea92" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>"

Response:

{
   "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:

generating videos