Skip to documentation
Deploy on AWS
Menu
Documentation · 18 of 19

Docs/Image outputs

Generate static thumbnails and animations

Every outputs must be set inside the outputs key with each value being a Hash describing the output format and settings.

The format specs are named following a very simple naming convention described in the Formats page.

Examples

Generating thumbnails in JPG formats and a very cool WebP animation with multiple scenes:

{
  "outputs": {
    "jpg:480x": {
      "key": "jpg:medium",
      "path": "/jpg/medium/thumbs_%05d.jpg",
      "number": 10
    },
    "jpg:120x": {
      "key": "jpg:tooltip",
      "path": "/jpg/tooltip/image.jpg",
      "interval": 10,
      "sprite": {
        "columns": 10,
        "limit": 100
      },
      "vtt": {
        "filename": "thumbs.vtt"
      }
    },
    "webp_anim:320x320": {
      "key": "webp:preview",
      "path": "/webp/preview.webp",
      "scene": {
        "number": 5,
        "duration": 1
      },
      "square": true
    }
  }
}

Parameters

NameTypeDefaultRequired
path<br>The path including the filename where the file will be uploaded. See Storage.<br>In case of multiple thumbnails, you must add a sequence number variable (printf style) to the filename like %05dstringYes
key<br>Will rename the output key which is sent in the notification payload. Very useful because you can change the output settings but the key name you get at the end will be unchanged. No code to update on your side.stringNo
format<br>Set the format specs. This is totally optional since you can set all the format specs inside the output key by following the syntax described here.hashNo
resolution<br>Set the resolution.<br>Example: 1280x720, 1280x or any resolutions 240p 360p 480p 540p 576p 720p 1080p 2140p.stringOriginalNo

Static thumbnails in JPG, PNG and WebP format

*Simple Format pattern: jpg|png|webp:$widthx$height*

Generate thumbnails in either jpg, png or webp format from the source video.

Example

{
  "outputs": {
    "jpg:240x": {
      "key": "jpg:small",
      "path": "/jpg/small/thumbs_%05d.jpg",
      "number": 10
    },
    "jpg:480x": {
      "key": "jpg:medium",
      "path": "/jpg/medium/thumbs_%05d.jpg",
      "number": 10
    },
    "webp:960x": {
      "key": "webp:large",
      "path": "/webp/large/thumbs_%05d.webp",
      "number": 10
    },
    "jpg:400x400": {
      "key": "jpg:square",
      "path": "/jpg/square/image.jpg",
      "square": true
    }
  }
}

3 ways to generate thumbnails

number

By using the number option which is the default, you choose to generate a given number of thumbnails. The images will be spaced equally.

Example:

{
  "outputs": {
    "jpg:240x": {
      "path": "/jpg/thumbs_%05d.jpg",
      "number": 20
    }
  }
}

offsets

By using offsets (Array), you specifically select 1 or many offsets in second where you want to take the thumbnail.

Example:

{
  "outputs": {
    "jpg:480x": {
      "path": "/jpg/thumbs_%05d.jpg",
      "offsets": [1, 10, 30, 50, 100]
    }
  }
}

interval

With interval, you specify an interval in seconds.

Example generating multiple sprite files and a VTT file:

{
  "outputs": {
    "webp:200x": {
      "path": "/webp/thumbs_%05d.webp",
      "interval": 10,
      "sprite": {
        "columns": 10,
        "limit": 100
      },
      "vtt": {
        "filename": "thumbs.vtt"
      }
    }
  }
}

Static Images Parameters

NameTypeDefaultRequired
number<br>Number of thumbnail you want to generate. Must be <= 100. Use either number or offsets, not both.int1No
offsets<br>Offset(s) in second where you want to extract the thumbnail(s).[int,]No
interval<br>Interval in seconds between each thumbnail.<br><br>If 0, will calculate the right gap in second according to the source video duration:<br>*interval 2 sec if duration <= 2 min*<br>*interval 5 sec if duration <= 10 min*<br>*interval 10 sec if duration <= 30 min*<br>*interval 20 sec if duration <= 60 min*<br>*interval 30 sec if duration > 60 min*intNo
square<br>The image will be cropped to a square. Use the width value to determine the size.<br>*width and height are required.*boolfalseNo
fit<br>Option to change the fit mode. To keep the original aspect ratio by cropping instead of padding (default behavior), set fit=crop.<br>*width and height are required.*stringpadNo
blur<br>Make a blurred image. Value goes from 1 to 5.intNo
sprite<br>We group interval thumbnails into a single image called sprite. The sprite is 4 columns wide. Best for network optimization if you have a lot of thumbnails and if you want to show tooltip like thumbnail within your player.hashNo
limit<br>The number of image per sprite.<br>Minimum is 10 and maximum is 1000.intYes
columns<br>The number of image per columns.int4No
vtt<br>Generate a WebVTT file that includes a list of cues with either individual thumbnail or sprite with the right coordinatesHashnoNo
filename<br>The VTT filename with .vtt extension.stringYes

Animation [ UNIMPLIMENTED ]

*Simple Format pattern: gif|webp_anim:$widthx$height*

Create an animation image from the source video. Width must be <= 600px.

Example

{
  "outputs": {
    "webp_anim:480x": {
      "key": "webp:animation",
      "path": "/webp/animation.webp",
      "scene": {
        "number:" 5,
        "duration": 1
      }
    }
  }
}

The height is automatically calculated according to the given width and the original aspect ratio.

Animation Parameters

NameTypeDefaultRequired
offset<br>Will start the animation from the given offset in secondintvideo_length / 3No
scene<br>Customize how many scenes you need and the scene duration in second.hashNo
number<br>The number of scenes.<br>Maximum is 10.int1No
duration<br>The Scene duration in second. For a more dynamic animation, we suggest to use very short scene duration like 1sec.<br>Maximum is 5.int5No
fit<br>Option to change the fit mode. To keep the original aspect ratio by cropping instead of padding (default behavior), set fit=crop.<br>*width and height are required.*stringpadNo
square<br>The animation image will be cropped to a square. Use the width value to determine the size.<br>*width and height are required.*boolfalseNo
blur<br>Make a blurred image. Value goes from 1 to 5.intNo
format<br>Set the format specs. This is totally optional since you can set all the format specs inside the output key by following the syntax described here.hashNo
resolution<br>Set the resolution.<br>Example: 500x, 300x160.<br>Maximum width is 600px.string200xNo