Last update:2025-05-30 09:46:41
Screenshot functionality allows you to extract high-quality still images from your videos for use as thumbnails, cover images, preview frames, and content moderation. The CDNetworks platform supports a wide range of input video formats and can generate images in various output formats with advanced formatting options.
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)>
| Parameter | Required | Description |
|---|---|---|
op |
Yes | Operation type. For screenshots, use vframe. |
format |
Yes | Target output format (jpg, png, gif, etc.) |
offset |
No | Single screenshot timestamp in seconds (supports precision to 3 decimal places) |
offsets |
No | Multiple screenshot timestamps, separated by colons in ascending order Example: 0:30:60:120 captures frames at 0, 30, 60, and 120 seconds |
interval |
No | Time interval between multiple screenshots, in seconds |
vframeN |
No | Total number of screenshots to take at regular intervals |
t |
No | Duration of GIF output in seconds (default: 5 seconds) |
sprite |
No | Generate CSS sprite sheet with specified row×column pattern Example: 4x5 creates a single image with 4 rows and 5 columnsNote: Must be used with interval parameter |
mode |
No | Scaling mode to maintain aspect ratio (see Mode Parameters table) |
w |
No | Screenshot width in pixels (1-1920) |
h |
No | Screenshot height in pixels (1-1080) |
autofill |
No | Background filling method when using w and h:• 0 (default) - Force resize to dimensions (may distort)• 1 - Preserve aspect ratio with black background paddingNote: Cannot be used with mode parameter |
rotate |
No | Rotation angle: 90, 180, 270, or auto |
isZip |
No | Package multiple screenshots into ZIP file: • 0 - No packaging• 1 - Create ZIP with sequential filenames (e.g., a_00001.jpg, a_00002.jpg)Note: Output filename must end with .zip |
saveas |
No | Output location as URL-safe Base64-encoded string: Urlsafe_Base64_Encode(bucket:savedfilename) |
| Parameter | Description |
|---|---|
/mode/1 |
Proportionally scale and center-crop to fit exact dimensions, i.e, original width:height=60:30, required screenshot width=30, height=10, the final screenshot will be=30:10, with part of it being center-cropped. If only width or height is specified, scale proportionally. |
/mode/2 |
Proportionally scale without cropping, allow to set width/height ≤ a value. i.e, original width:height=60:30, required screenshot width≤30, height≤10, the final screenshot will be=20:10. If only one dimension specified, other adjusts proportionally. |
/mode/3 |
Proportionally scale without cropping, allow to set width/height ≥ a value. i.e, original width:height=60:30, required screenshot width≥30, height≥10, the final screenshot will be=30:15. If only one dimension specified, other adjusts proportionally |
This example captures a frame at the 5th second of the video test.mp4 in the test-mp4-encrypt bucket, saving 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"