Create thumbnails from your source videos
When creating thumbnails there are two different approaches to set images based on whether you want a single thumbnail to be created at a specific point of the video (Single frame thumbnails) or thumbnails created at an interval of seconds (interval-based thumbnails). Here is a quick overview of how these different types of thumbnails are created through the API:
-
Single frame thumbnails: Thumbnails created from a single frame defined in percentage of duration. Set output to thumbnail and set time to the percentage of video duration you want to pull the thumbnail from.
-
Interval-based thumbnails: Thumbnails created by intervals defined in seconds. Set output to thumbnail and set interval to a value in seconds for the interval in which thumbnails should be created.
Single frame thumbnails
Creating a single frame thumbnail allows you to select specific parts of the video for images to be created. Single frame thumbnails are created using the following parameters.
The time is the integer value for percentage of total video length from which to select the frame the single frame thumbnail. The time can be set to any value between and including 0 and 1.
Example: time = 0 (beginning of the video, at 0% of duration) time = 0.5 (middle of the video, at 50% of duration) time = 1 (end of the video, at 100% of duration)
The size allows you to set the height and width (WxH) in pixels of your output thumbnail images.
If you set multiple time and size parameters, a thumbnail image will be created for each time and size combination.
The image_format is the output format of the image file generated for your thumbnails. The main values to choose from currently are jpg and png, with the default being png. You can also use the quality parameter to to specify the image quality of your thumbnails.
To create single frame thumbnails, create a format and set the output attribute to “thumbnail”. Enter the time, width, height, destination and user tag. Make sure to specify the full url in the destination.url field (ie: s3://s3.nyc3.qencode.com/bucket/thumb/50_320x240.png)
Example of Single frame thumbnail
{
"output": "thumbnail",
"time": 0.5,
"width": "320",
"height": "240",
"destination": {
"url":"s3://s3.nyc3.qencode.com/bucket/thumb/50_320x240.png",
"key":"your_access_key",
"secret":"your_secret_key",
"permissions": "public-read"
},
"user_tag": "50_320x240"
}
Interval-based thumbnails
Creating an interval-based thumbnail allows you to create images at many points of the video based on an interval of time that you define.
The interval is the number of seconds between each thumbnail image being created.
Example: interval = 20 (an image will be created every 20 seconds)
Just like with single frame thumbnails and videos, the size allows you to set the height and width (WxH) in pixels of your thumbnails. You can set different resolutions and renditions with multiple image sizes and an image will be created for each time and size combination.
To create single frame thumbnails, create a format and set the output attribute to “thumbnails”. Enter the destination, time, width, and height. Make sure to specify the full path to where you want the images and .vtt file to be saved in the destination.url field (ie: s3://s3.nyc.qencode.com/bucket/thumb/)
Example of Interval-based thumbnail
{
"output" : "thumbnails",
"destination": {
"url":"s3://s3.nyc.qencode.com/bucket/thumb/",
"key":"your_access_key",
"secret":"your_secret_key",
"permissions": "public-read"
},
"interval": 30,
"width" : 320,
"height" : 240
}