The /video/thumbs Robot

Transloadit offers a variety of features to reduce video size while maintaining quality, as well as add effects like watermarks.

The /video/thumbs Robot extracts any number of images from videos for use as previews.

Parameters

Name Type Default Description
ffmpeg_stack String "v1.0.0" Selects the FFmpeg stack for the encoding. Valid values are "v1.0.0" , "v2.0.0", "v2.1.0" and "v2.2.3". These versions do not reflect any real FFmpeg versions, they reflect our own internal (non-semantic) versioning for our custom FFmpeg builds. The recommended value here is "v2.2.3".
count Integer(1-999) 8 The number of thumbnails to be extracted. As some videos have incorrect durations, the actual number of thumbnails generated may be less in rare cases. The maximum number of thumbails we currently allow is 999.
offsets Array of Integers / Array of Strings [] An array of offsets representing seconds of the file duration, such as [ 2, 45, 120 ]. Offsets can also be percentage values such as [ "2%", "50%", "75%" ]. This option cannot be used with the count parameter, and takes precedence if both are specified. Out-of-range offsets are silently ignored.
format String "jpeg" The format of the extracted thumbnail. Supported values are "jpg", "jpeg" and "png". Even if you specify the format to be "jpeg" the resulting thumbnails will have a "jpg" file extension.
width Integer(1-1920) Width of the video The width of the thumbnail, in pixels.
height Integer(1-1080) Height of the video The height of the thumbnail, in pixels.
resize_strategy String "pad" One of the available resize strategies.
rotate Integer Auto Forces the video to be rotated by the specified degree integer. Currently, only multiples of 90 are supported. We automatically correct the orientation of many videos when the orientation is provided by the camera. This option is only useful for videos requiring rotation because it was not detected by the camera.

Example use cases

Our /video/thumbs Robot can be used in combination with other Robots, to create powerful workflows unique to your use case.
Here are a few example scenarios, and the required the Assembly Instructions to implement them.
You can also try demos of these examples right here, live on our website.

Encode a video, extract 8 thumbnails and store everything in your S3 bucket

{
  "steps": {
    "ipad_encoding": {
      "use": ":original",
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "width": 640,
      "height": 480
    },
    "extracted_thumbs": {
      "use": "ipad_encoding",
      "robot": "/video/thumbs",
      "result": true
    },
    "store": {
      "robot": "/s3/store",
      "use": [
        "ipad_encoding",
        "extracted_thumbs"
      ],
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET",
      "bucket": "YOUR_S3_BUCKET"
    }
  }
}

Specify multiple encoding Steps for a single file

{
  "steps": {
    "ipad_video": {
      "use": ":original",
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "width": 854,
      "height": 480
    },
    "iphone_video": {
      "use": ":original",
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "result": true,
      "preset": "iphone"
    },
    "thumbnails": {
      "use": ":original",
      "robot": "/video/thumbs"
    },
    "resized_thumbs": {
      "robot": "/image/resize",
      "use": "thumbnails",
      "result": true,
      "width": 130,
      "height": 130
    },
    "exported": {
      "robot": "/s3/store",
      "use": [
        ":original",
        "ipad_video",
        "iphone_video",
        "resized_thumbs"
      ],
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET",
      "bucket": "YOUR_S3_BUCKET"
    }
  }
}

Automatically process multiple file types

{
  "steps": {
    "image_thumbs": {
      "use": ":original",
      "robot": "/image/resize",
      "result": true,
      "format": "png",
      "width": 320,
      "height": 240
    },
    "video_thumbs": {
      "use": ":original",
      "robot": "/video/thumbs",
      "result": true,
      "width": 320,
      "height": 240,
      "resize_strategy": "pad",
      "background": "#000000",
      "count": 4
    },
    "encode_video": {
      "use": ":original",
      "robot": "/video/encode",
      "result": true,
      "preset": "ipad-high",
      "ffmpeg_stack": "v2.2.3",
      "width": 640,
      "height": 480
    },
    "exported": {
      "use": [
        "image_thumbs",
        "video_thumbs",
        "encode_video",
        ":original"
      ],
      "robot": "/s3/store",
      "bucket": "YOUR_S3_BUCKET",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Convert any video to animated GIF

{
  "steps": {
    "extracted_thumbs": {
      "use": ":original",
      "robot": "/video/thumbs",
      "result": false,
      "count": 50
    },
    "anigif": {
      "robot": "/video/merge",
      "use": {
        "steps": [
          {
            "name": "extracted_thumbs",
            "as": "image"
          }
        ]
      },
      "result": true,
      "duration": 7.8,
      "framerate": "10",
      "ffmpeg_stack": "v2.2.3",
      "ffmpeg": {
        "f": "gif",
        "pix_fmt": "rgb24"
      },
      "resize_strategy": "pad"
    },
    "exported": {
      "use": [
        ":original",
        "anigif"
      ],
      "robot": "/s3/store",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET",
      "bucket": "YOUR_S3_BUCKET"
    }
  }
}

Extract 10 thumbnails and modify their size

{
  "steps": {
    "ipad_encoding": {
      "use": ":original",
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "width": 640,
      "height": 480
    },
    "extracted_thumbs": {
      "use": "ipad_encoding",
      "robot": "/video/thumbs",
      "count": 10
    },
    "small": {
      "use": "extracted_thumbs",
      "robot": "/image/resize",
      "result": true,
      "width": "30",
      "height": "30"
    },
    "thumb": {
      "use": "extracted_thumbs",
      "robot": "/image/resize",
      "result": true,
      "width": "75",
      "height": "75"
    },
    "big": {
      "use": "extracted_thumbs",
      "robot": "/image/resize",
      "result": true,
      "width": "120",
      "height": "120"
    }
  }
}

Related blog posts

Over the years we wrote the following posts about Our /video/thumbs robot on our blog:

Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.
This is the power of Transloadit.