Video Trim
Trim a video to an exact start and end, snapping each cut to a sentence boundary from your SRT so clips never break mid-word. Returns the clip plus a matching transcript, ready to caption.
Still needed: Video, Transcript (SRT), Start (seconds), End (seconds)
Best for
- •Cutting long videos to an explicit window already chosen upstream
- •Chaining after highlights: highlights picks the moment, video-trim slices it
- •Producing a clean, sentence-aligned clip plus its matching transcript in one call
When to use
- •Always after transcription + highlights (or any caller that already knows the window)
- •Before captions, the returned transcript already lines up with the trimmed clip and feeds the captions step directly
Tips
- ✓Pair with highlights (count=N, style=...) to get authoritative editorial picks
- ✓Cuts are snapped to SRT segment boundaries, pass a slightly tight window and let snapping widen it to a full sentence
- ✓The returned transcript already lines up with the trimmed clip, feed it straight into captions
Recipes using this pipeline
Articles about this pipeline
Video Trim API
Call this pipeline from your own code. One request dispatches a run; the model is an input field, not a separate endpoint.
bun add @pipe2-ai/sdk import { createClient } from "@pipe2-ai/sdk";
const client = createClient(process.env.PIPE2_TOKEN!);
const { run_pipeline } = await client.RunPipeline({
pipeline_slug: "video-trim",
input: {
video_url: "https://example.com/interview.mp4",
transcript_url: "https://example.com/interview.vtt",
start_sec: 12,
end_sec: 48,
},
});pip install pipe2 import asyncio
import os
from pipe2 import Pipe2Client
client = Pipe2Client(token=os.environ["PIPE2_TOKEN"])
run = asyncio.run(client.run_pipeline(
pipeline_slug="video-trim",
input={
"video_url": "https://example.com/interview.mp4",
"transcript_url": "https://example.com/interview.vtt",
"start_sec": 12,
"end_sec": 48,
},
))go get github.com/pipe2-ai/sdk-go client := pipe2.NewClient(os.Getenv("PIPE2_TOKEN"))
input := json.RawMessage(`{
"video_url": "https://example.com/interview.mp4",
"transcript_url": "https://example.com/interview.vtt",
"start_sec": 12,
"end_sec": 48
}`)
run, err := pipe2.RunPipeline(context.Background(), client, "video-trim", input)
if err != nil {
log.Fatal(err)
}brew install pipe2-ai/tap/pipe2 pipe2 pipelines run \
--pipeline video-trim \
--input-json '{"video_url": "https://example.com/interview.mp4", "transcript_url": "https://example.com/interview.vtt", "start_sec": 12, "end_sec": 48}' \
--waitParameters
-
end_secrequired -
Window end (exclusive). Must be greater than start_sec.
number -
start_secrequired -
Window start. Typically supplied by an upstream picker (e.g. highlights).
number -
transcript_urlrequired -
SRT transcript of the source, required. The window is snapped to its segment boundaries and the sliced SRT is returned for downstream captioning.
string -
video_urlrequired -
Source video to trim.
string
Use it from an AI agent
Point any MCP client at pipe2 and your agent gets these tools. It finds this pipeline, reads the same schema above, then runs it.
- list_pipelines
- get_pipeline_schema
- run_pipeline
- get_pipeline_run_status
- request_upload
https://mcp.pipe2.ai/mcp {
"mcpServers": {
"pipe2ai": {
"url": "https://mcp.pipe2.ai/mcp",
"headers": { "Authorization": "Bearer YOUR_TOKEN" }
}
}
}Video Trim: Clean, Transcript-Aligned Cuts
Give Video Trim a video, its SRT transcript, and a start and end time. It cuts the clip to that window and nudges each edge to the nearest sentence boundary, so your clip never starts or ends mid-word, then hands back a matching transcript so the captions step needs no re-transcribing.
How It Works
- Snap to sentences: your start and end move to the nearest transcript boundary, so cuts never land mid-sentence
- Trim the video: the source is cut to that window with clean, frame-accurate edges
- Return the transcript: the matching slice of the SRT comes back aligned to the new clip, ready for captions
Pair It With Highlights
Video Trim doesn't choose which moment to keep, you give it the window. The highlights pipeline is built to pick those moments and hand the window straight to Video Trim for a clean cut.
Frequently Asked Questions
How is the window chosen?
Why does it require a transcript?
Can it run without a transcript?
Does this cost credits?
What if the start or end time is outside the video?
Explore more pipelines
See all →Generate AI videos from a text prompt, image, or reference clip. Cinematic shots, product reveals, lifestyle ads, with synchronized audio and natural motion.
Generate AI images from text or reference photos. Product shots, character art, posters with readable text, photoreal portraits, high resolution in seconds.
Turn text into natural speech with dozens of voices, 70+ languages, and custom style directions for tone, accent, and pacing.
Generate original background music that matches any mood, genre, and length you describe. Royalty-free, ready in seconds.