Trim
POST /v1/trim
Extract a segment from a video file by specifying start time and duration.
Request
| Field | Type | Required | Description |
|---|---|---|---|
src | string | Yes | URL of the source video |
start | number | Yes | Start time in seconds |
length | number | Yes | Duration to extract in seconds |
output | object | Yes | Output format and resolution |
callback | string | No | Webhook 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
startandlengthare in seconds. Fractional values (e.g.,2.5) are supported.- If
start + lengthexceeds 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.