Video/Audio Trimming

Last update:2026-07-15 18:34:40

The trimming operation allows you to specify a start point and duration to extract only the relevant portion of a media file.

Parameters

Parameter Required Description
op Yes Operation type. Use avthumb for trimming operations.
format Yes Target output format, such as mp3, mp4, m3u8, or mov.
ss No Start point for trimming, in seconds. For example, 120 starts trimming at the 120-second mark.
t No Duration of the trimmed output, in seconds. When used with ss, this defines the segment to extract. For example, ss=120 and t=180 extract a 180-second clip starting at the 120-second mark.
saveas Yes Specifies the output location and file name as a URL-safe Base64-encoded string in the format Urlsafe_Base64_Encode(bucket:savedfilename).

How to Use

Structure your fops parameter in the request body as follows:

<op>/<format>
    /ss/<value>
    /t/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)>

Example

This example demonstrates trimming a 100-second segment from a video, starting at the 125-second mark.

Source details:

  • Source bucket: vod-test001
  • Source file: test.mp4
  • Start point: 125 seconds
  • Duration: 100 seconds
  • Output format: MOV
  • Output file name: output.mov

Pseudocode

curl -v -X POST \
  -d "bucket=Urlsafe_Base64_Encode(vod-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mov/ss/125/t/100|saveas/Urlsafe_Base64_Encode(vod-test001:output.mov))&force=1&separate=1" \
  -H "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"

Actual Request

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