Last update:2026-07-15 18:48:36
Video cropping allows you to remove unwanted areas from a video frame and focus on a specific region of interest. This operation can also be combined with other media processing tasks in a single API call.
Structure your fops parameter in the request body as follows:
<op>/<format>
/gravity/<value>
/vcrop/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)>
| Parameter | Description |
|---|---|
op |
Operation type. Must be set to avthumb for video cropping. |
format |
Output format, such as flv, mp4, or m3u8. |
| Parameter | Description |
|---|---|
gravity |
Determines the starting position and direction for cropping. Default: TOP_LEFT. |
vcrop |
Defines the dimensions of the cropping area using width and height. |
saveas |
Specifies the output location and file name as a URL-safe Base64-encoded string in the format Urlsafe_Base64_Encode(bucket:savedfilename). |
The gravity parameter specifies where cropping begins.
| Value | Description |
|---|---|
TOP_LEFT |
Starts from the upper-left corner (default). |
TOP_CENTER |
Starts from the center of the top edge. |
TOP_RIGHT |
Starts from the upper-right corner. |
CENTER_LEFT |
Starts from the center of the left edge. |
CENTER |
Starts from the exact center of the frame. |
CENTER_RIGHT |
Starts from the center of the right edge. |
BOTTOM_LEFT |
Starts from the bottom-left corner. |
BOTTOM_CENTER |
Starts from the center of the bottom edge. |
BOTTOM_RIGHT |
Starts from the bottom-right corner. |
The vcrop parameter controls the cropping dimensions.
| Format | Description |
|---|---|
<Width>x |
Sets only the width while keeping the original height. Range: 0 to 10000. |
x<Height> |
Sets only the height while keeping the original width. Range: 0 to 10000. |
<Width>x<Height> |
Sets both width and height. Range: 0 to 10000 for each dimension. |
{vcropSize}a<dx>a<dy> |
Adjusts the crop position by moving dx pixels to the right and dy pixels downward from the starting point. |
This example crops a video in two different ways and creates two separate output files:
400x352 video in m4a format200x352 video in flv formatcurl -v -X POST \
-d "bucket=Urlsafe_Base64_Encode(vod-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/m4a/gravity/TOP_LEFT/vcrop/400x352|saveas/Urlsafe_Base64_Encode(vod-test001:test_file.m4a);avthumb/flv/gravity/CENTER/vcrop/200x352|saveas/Urlsafe_Base64_Encode(vod-test001:test_file.flv))&force=1&separate=1" \
-H "Authorization: AccessKey:EncodeSign" \
--url "http://mgrDomain/fops"
curl -v -X POST \
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tNGEvZ3Jhdml0eS9UT1BfTEVGVC92Y3JvcC80MDB4MzUyfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmWm1sc1pTNXROR0VLQ2c9PTthdnRodW1iL2Zsdi9ncmF2aXR5L0NFTlRFUi92Y3JvcC8yMDB4MzUyfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmWm1sc1pTNW1iSFlLQ2c9PQoK&force=1&separate=1" \
-H "Authorization: AccessKey:EncodeSign" \
--url "http://mgrDomain/fops"