Skip to main content

Trim

POST /v1/trim

Extract a segment from a video file by specifying start time and duration.

Request

FieldTypeRequiredDescription
srcstringYesURL of the source video
startnumberYesStart time in seconds
lengthnumberYesDuration to extract in seconds
outputobjectYesOutput format and resolution
callbackstringNoWebhook URL

Example

curl

curl -X POST https://api.vidiking.com/v1/trim \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"src": "https://example.com/long-video.mp4",
"start": 30,
"length": 15,
"output": {
"format": "mp4",
"resolution": "hd"
}
}'

Node.js

const { jobId } = await client.trim({
src: 'https://example.com/long-video.mp4',
start: 30,
length: 15,
output: { format: 'mp4', resolution: 'hd' },
});

Python

result = client.trim({
"src": "https://example.com/long-video.mp4",
"start": 30,
"length": 15,
"output": {"format": "mp4", "resolution": "hd"},
})

Response

{
"id": "job_trim_789",
"status": "QUEUED",
"created_at": "2025-01-15T10:30:00Z"
}

Cost

Trim operations cost $0.20 per job.

Notes

  • start and length are in seconds. Fractional values (e.g., 2.5) are supported.
  • If start + length exceeds the source video duration, the trim will stop at the end of the video.
  • The original video is not modified. A new file is created with the extracted segment.