Skip to main content

Transformation Options

API reference for video transformation like crop, pad, and trim. Following transformations can be used with Create Asset request with specified parameters.

Crop#

This transformation can be used to crop the video by defining a rectangular area within the dimensions of the output video. Crop transformation takes the following parameters embedded within crop. Either width or height is required for this transformation.

ParameterDescription
horizontal_marginThis parameter defines the horizontal coordinate value of the upper-left corner of the cropping area. Values can be an absolute number of pixels or a percentage value relative to the video width. Default: 0
vertical_marginThis parameter defines the vertical coordinate value of the upper-left corner of the cropping area. Values can be an absolute number of pixels or a percentage value relative to the video height. Default: 0
widthWidth of the cropping area in pixels.
heightHeight of the cropping area in pixels.
curl -L -X POST 'https://api.gumlet.com/v1/video/assets' \-H 'Authorization: Bearer <YOUR API KEY>' \-H 'Content-Type: application/json' \-d '{    "input":"https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",    "source_id": "5f462c1561cf8a766464ffc4",    "format": "mp4",    "crop": {        "horizontal_margin": "10%",        "vertical_margin": "10%",        "width":"640",        "height": "360"    }}'

Pad#

This transformation can be used to add padding to the video. Pad transformation takes the following parameters embedded within pad parameter.

ParameterDescription
topWidth of padding on the top side. Values can be an absolute number of pixels or a percentage value relative to the video height. Default: 5%
leftWidth of padding on the left side. Values can be an absolute number of pixels or a percentage value relative to the video width. Default: 0
bottomWidth of padding on the bottom side. Values can be an absolute number of pixels or a percentage value relative to the video height. Default: 5%
rightWidth of padding on the right side. Values can be an absolute number of pixels or a percentage value relative to the video width. Default: 0
curl -L -X POST 'https://api.gumlet.com/v1/video/assets' \-H 'Authorization: Bearer <YOUR API KEY>' \-H 'Content-Type: application/json' \-d '{    "input":"https://gumlet.sgp1.digitaloceanspaces.com/video/sample_2.mp4",    "source_id": "5f462c1561cf8a766464ffc4",    "format": "mp4",    "pad": {        "top": "10%",        "bottom": "10%",        "left":"20%",        "right": "20%"    }}'

Trim#

Trim transformation can be used to trim videos with a combination of three parameters start_offset, end offsetand duration (optional) embedded in trim. These parameters can be specified in absolute value in seconds or inHH:MM:SSformat.

curl -L -X POST 'https://api.gumlet.com/v1/video/assets' \-H 'Authorization: Bearer <YOUR API KEY>' \-H 'Content-Type: application/json' \-d '{    "input":"https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",    "source_id": "5f462c1561cf8a766464ffc4",    "format": "mp4",    "trim": {        "start_offset": "00:00:00",        "end_offset": "00:00:10"    }}'