Snapshot

Last update:2026-07-15 18:30:49

Snapshot functionality allows you to extract high-quality still images from videos for use as thumbnails, cover images, preview frames, and content moderation. The Atomile platform supports a wide range of input video formats and can generate images in multiple output formats with advanced formatting options.

Supported Formats

  • Input: MP4, FLV, M3U8, TS, MKV, MOV, WMV, AVI, VP8, VP9, RealVideo, Windows Media Video, and more
  • Codecs: H.265, H.264, H.263, MPEG, and more
  • Output: JPG, PNG, GIF (JPG and PNG also support CSS sprites)

How to Use

Structure your fops command in the request body as follows:

<op>/<Format>
    /offset/<value>
    /offsets/<value>
    /interval/<value>
    /vframeN/<value>
    /t/<value>
    /sprite/<value>
    /mode/<value>
    /w/<value>
    /h/<value>
    /autofill/<value>
    /rotate/<value>
    /isZip/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)>

Parameters

Parameter Required Description
op Yes Operation type. For snapshots, use vframe.
format Yes Target output format, such as jpg, png, or gif.
offset No Timestamp for a single snapshots, in seconds. Supports precision up to 3 decimal places.
offsets No Multiple snapshots timestamps, separated by colons and listed in ascending order.
Example: 0:30:60:120 captures frames at 0, 30, 60, and 120 seconds.
interval No Time interval between multiple snapshots, in seconds.
vframeN No Total number of snapshots to capture at regular intervals.
t No Duration of GIF output in seconds. Default: 5 seconds.
sprite No Generates a CSS sprite sheet using a specified row × column layout.
Example: 4x5 creates one image with 4 rows and 5 columns.
Note: Must be used together with interval.
mode No Scaling mode used to preserve aspect ratio. See Mode Parameters below.
w No Snapshot width in pixels. Range: 1 to 1920.
h No Snapshot height in pixels. Range: 1 to 1080.
autofill No Background fill method when w and h are used:
0 (default) - Force resize to the specified dimensions. This may cause distortion.
1 - Preserve aspect ratio and add black padding to fill the remaining area.
Note: Cannot be used together with mode.
rotate No Rotation angle. Supported values: 90, 180, 270, or auto.
isZip No Packages multiple snapshots into a ZIP file:
0 - Do not package
1 - Create a ZIP file with sequential file names such as a_00001.jpg, a_00002.jpg
Note: The output file name must end with .zip.
saveas Yes Output location as a URL-safe Base64-encoded string, in the format Urlsafe_Base64_Encode(bucket:savedfilename).

Mode Parameters

Parameter Description
/mode/1 Scales proportionally and center-crops the image to fit the exact dimensions. For example, if the original aspect ratio is 60:30 and the required output size is 30x10, the final snapshot will be 30x10, with part of the image center-cropped.
If only width or height is specified, the other dimension is scaled proportionally.
/mode/2 Scales proportionally without cropping, allowing width and height to be less than or equal to the specified values. For example, if the original aspect ratio is 60:30 and the required size is width ≤ 30 and height ≤ 10, the final snapshot will be 20x10.
If only one dimension is specified, the other is adjusted proportionally.
/mode/3 Scales proportionally without cropping, allowing width and height to be greater than or equal to the specified values. For example, if the original aspect ratio is 60:30 and the required size is width ≥ 30 and height ≥ 10, the final snapshot will be 30x15.
If only one dimension is specified, the other is adjusted proportionally.

Example

This example captures a frame at the 5-second mark of the video test.mp4 in the test-mp4-encrypt bucket and saves it as a JPG image named test.jpg.

Pseudocode:

curl -v -X POST \
  -d "bucket=Urlsafe_Base64_Encode(test-mp4-encrypt)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(vframe/jpg/offset/5|saveas/Urlsafe_Base64_Encode(test-mp4-encrypt:test.jpg))&force=1&separate=1" \
  -H "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"

Actual Request:

curl -v -X POST \
  -d "bucket=dGVzdC1tcDQtZW5jcnlwdA==&key=dGVzdC5tcDQ=&fops=dmZyYW1lL2pwZy9vZmZzZXQvNXxzYXZlYXMvZEdWemRDMXRjRFF0Wlc1amNubHdkRHAwWlhOMExtcHdadz09&force=1&separate=1" \
  -H "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"