Video Trim

From 0.1 credits

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)

How to use Video Trim

A compact decision guide for placing this pipeline in a workflow.

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

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.

Get an API token
inputs
4
required
4
Pricing
0.1 credits
Language
Language
bun add @pipe2-ai/sdk
Run a pipeline
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
Run a pipeline
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
Run a pipeline
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
Run a pipeline
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

Full API reference CLI reference

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.

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.

Explore more pipelines

Video Generator
from 9.5
Video Generator
Image Generator
0.2-6.4
Image Generator
Audio Generator
0.002-40.0
Audio Generator
Music Generator
2.5-22.6
Music Generator