Video Editing
Compose multi-track video with /v2/timeline, split a video into clips with /v2/video-split, and run thumbnail, GIF and format-conversion jobs — all on the same async contract as the models.
Alongside the AI models, Segmind serves a set of media editing endpoints —
deterministic operations like compositing a timeline, cutting a video into
clips, or pulling a still frame. There is no model involved, so they are cheap
and fast, and they speak exactly the
async contract you already use:
POST /v2/{slug}, poll the status URL, read the result.
That means an edit is just another step in the same pipeline as the generation that produced the footage — no separate tool, no downloading and re-uploading between stages.
The endpoints
| Endpoint | Required input | What it does |
|---|---|---|
/v2/timeline | tracks | Composes a multi-track edit — video, overlays, text, captions and audio — into one render |
/v2/video-split | video, mode | Cuts one video into several clips |
/v2/video-thumbnail | video | Extracts a still frame, returned in images[] |
/v2/video-gif-extract | video, end_time | Makes a GIF from a segment |
/v2/video-format-convert | video | Re-encodes between container formats |
/v2/image-compress | image | Re-encodes an image at a lower size |
Each one bills like any other request — the jobs on this page each cost
$0.0002 — and the result carries the usual metrics block with cost,
remaining_credits, queue_time and total_time.
Submitting always returns 200 with a request_id, even if the body is
invalid. Input is validated when the job runs, so a malformed request surfaces
as status: FAILED on the status endpoint with a message naming the field at
fault — not as an error on the POST. Failed jobs are not charged.
/v2/timeline — multi-track composition
One request describes a whole edit. A composition block sets the output
frame, tracks holds the layers, and master controls the final encode.
{
"composition": { "width": 1280, "height": 720, "fps": 30, "duration": "auto", "format": "mp4" },
"tracks": [
{
"type": "video",
"id": "V1",
"clips": [
{ "source": "https://example.com/shot-a.mp4", "start": 0, "in": 0, "out": 4,
"transition_out": { "type": "dissolve", "duration": 0.75 } },
{ "source": "https://example.com/shot-b.mp4", "start": 3.25, "in": 0, "out": 4 }
]
},
{
"type": "text",
"id": "T1",
"clips": [
{ "start": 0.5, "duration": 3, "text": "Multi-track composition",
"style": { "size": 64, "color": "#FFFFFF", "bg": "#000000AA",
"position": "lower-third", "animation": "fade" } }
]
}
],
"master": { "video": { "crf": 20 }, "audio": { "normalize": true, "target_lufs": -14 } }
}That request renders a 1280×720, 30 fps H.264 file: two clips joined by a three-quarter-second dissolve, with a lower-third title fading in over the opening.
Video coming soon
The output of the request above — two clips, one dissolve, one text overlay, rendered in a single call
https://segmind-resources.s3.amazonaws.com/docs/serverless-api/video-editing/timeline-composition.mp4
Track types
tracks is an ordered list. Visual tracks stack bottom to top, and every audio
track sums into one mix.
type | Holds | Notable per-clip controls |
|---|---|---|
video | Video clips | speed, crop, color, transform, transition_out, gain, and audio to drop the clip's own sound |
overlay | Images or video composited on top | transform — position, scale, rotate, opacity, fit |
text | Rendered titles and captions you supply inline | style — font, size, color, background pill, stroke, shadow, position, animation |
caption | Subtitles from an SRT or VTT source | the same style block |
audio | Music and voice tracks | gain, loop, and duck |
Every clip shares the same timing fields: start places it on the timeline,
in and out trim the source, and fade_in / fade_out ramp its edges.
Composition and master
composition takes width, height, fps, format (mp4 or webm) and
background. duration defaults to "auto", which resolves to the extent of
the timeline. Width and height must both be even numbers. A transparent
background requires format: "webm", since MP4 cannot carry an alpha channel.
master handles the finish: video.crf for encode quality, and
audio.normalize with audio.target_lufs — on by default at −14 LUFS, so a
mix of loud and quiet sources comes out at a consistent level without you
measuring anything.
Ducking
An audio clip can duck against another track, which is the usual way to put music under a voiceover:
{ "type": "audio", "id": "A1", "clips": [
{ "source": "https://example.com/music.mp3", "start": 0, "loop": true,
"duck": { "key_track": "A2", "amount": -12, "attack": 0.2, "release": 0.4 } }
]}Whenever a clip on A2 is playing, this one drops by 12 dB and comes back
after it.
A transition needs the two clips to overlap. transition_out consumes time
from both sides, so the next clip must start exactly one transition-duration
before the previous one ends. A clip ending at 4 with a 0.75 second
transition requires the next to start at 3.25. Get it wrong and the job
fails with a message giving you the number it expected.
/v2/video-split — one video into many
{ "video": "https://example.com/long.mp4", "mode": "count", "count": 3 }mode picks how the cuts are chosen:
mode | Also send | Result |
|---|---|---|
count | count | That many equal parts |
duration | segment_duration | A part every N seconds, keeping the remainder |
segments | segments | An explicit [{ "start": 4.0, "end": 6.5 }] cut list |
reencode defaults to true for frame-accurate cuts; set it to false for a
faster stream copy that snaps to keyframes. output_format accepts mp4 or
webm.
The result returns the first segment only. A split job renders every part,
but the v2 result carries a single video. To retrieve a specific range, send
one request per range with mode: "segments" — a call with
segments: [{ "start": 4.0, "end": 6.5 }] returns exactly that 2.5 seconds.
response_format: "json" is accepted and validated, but on this endpoint it
returns the same single file as the default.
Reading the result
Which field holds the output follows the kind of file produced, matching the rest of the API:
{
"status": "COMPLETED",
"output": "https://images.segmind.com/generations/.../result.mp4",
"video": { "url": "...", "content_type": "video/mp4", "file_size": "2488382" },
"metrics": { "cost": 0.0002, "remaining_credits": 45.68,
"queue_time": 0.03, "total_time": 14.8 }
}Video jobs fill video; jobs that produce a still — video-thumbnail,
video-gif-extract, image-compress — fill images[] instead. output always
points at the primary file either way.
Next steps
Web Search Grounding
Ground Gemini text and image generations in live Google Search results with web_search: true, and read back the queries and sources behind the answer.
Monitoring
Track Segmind API usage from the console: Generations for individual requests, Cost Analytics for spend, and API Health for latency percentiles, success rate and error breakdown.