Back to pipelines

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.

0.1

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.

4 inputs
4 required
0.1 credits
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}' \
  --wait

Get an API token →

Parameters

end_sec required

Window end (exclusive). Must be greater than start_sec.

number
start_sec required

Window start. Typically supplied by an upstream picker (e.g. highlights).

number
transcript_url required

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_url required

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" }
    }
  }
}

Full API reference MCP setup CLI reference

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

  1. Snap to sentences: your start and end move to the nearest transcript boundary, so cuts never land mid-sentence
  2. Trim the video: the source is cut to that window with clean, frame-accurate edges
  3. 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?
You supply it. The highlights pipeline (or any other picker) gives you a start and end time, and Video Trim cuts to exactly that window. It makes no editorial choice of its own, the decision of which moment to keep lives in the picker.
Why does it require a transcript?
The transcript is what lets the cut land on a full sentence instead of mid-word. Video Trim keeps every line of the transcript that overlaps your window, trims the video to match, and returns that same slice of the transcript lined up to the new clip, so the captions step can reuse it as-is.
Can it run without a transcript?
No. An earlier version guessed the cut from the video frames alone, but it kept drifting from the window you actually wanted, so it was removed. Transcribe the source first, the transcription pipeline reuses past results for the same file, so re-runs are free.
Does this cost credits?
0.1 credits per trim, flat.
What if the start or end time is outside the video?
The window is matched against your transcript, not the raw video. If it overshoots the end, the cut is snapped back to the last sentence in the transcript.

Explore more pipelines

See all →
Video Generator
from 9.5
Video Generator
Image Generator
0.2-6.4
Image Generator
Audio Generator
0.7-1.3
Audio Generator
Music Generator
2.5-45.1
Music Generator