Skip to content
Agentmart
Submit a tool

cut-segment

Extract one or more time-range segments from a video.

Skill by danielrosehill

IndexedMIT★ 6
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/danielrosehill-cut-segment

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Extract one or more time-range segments from a video. Use when the user says "cut from 1:30 to 3:45", "trim the first 30 seconds", "extract these segments", "split this clip at 5:00". Stream-copies losslessly by default; offers a frame-accurate re-encode mode when the cut must be exact. Multiple segments are written as separate files (or optionally stitched in one pass).

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/cut-segment

Tools it pre-approves 14

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(test
  • *),
  • Bash(ls
  • Bash(mkdir
  • Bash(jq
  • Bash(basename
  • Bash(dirname
  • Bash(realpath
  • Bash(printf
  • Bash(awk
  • Bash(ffmpeg
  • Bash(ffprobe
Show 2 more
  • Read,
  • Write

What's inside

Skill name
cut-segment
Description
Extract one or more time-range segments from a video. Use when the user says "cut from 1:30 to 3:45", "trim the first 30 seconds", "extract these segments", "split this clip at 5:00". Stream-copies losslessly by default; offers a frame-accurate re-encode mode when the cut must be exact. Multiple segments are written as separate files (or optionally stitched in one pass).
License
MIT
Allowed tools
Bash(test, *),, Bash(ls, *),, Bash(mkdir, *),, Bash(jq, *),, Bash(basename, *),, Bash(dirname, *),, Bash(realpath, *),, Bash(printf, *),, Bash(awk, *),, Bash(ffmpeg, *),, Bash(ffprobe, *),, Read,, Write
Instructions
98 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Cut Segment

Extract precise time ranges from a video. Replaces the legacy `cut-video-segment` command.

## Procedure

### 1. Inputs

| Field | Default |
|-------|---------|
| Source | required |
| Segments | required: one or more `start..end` ranges (e.g. `00:01:30..00:03:45`) or a JSON array `[{start, end, label?}, ...]` |
| Output dir | default: same dir as source (or `<project>/exports/` when run inside a project) |
| Mode | `copy` (lossless, stream-copy) — `precise` (re-encode for frame-accurate cuts) |
| Stitch | `no` (one file per segment) — `yes` (concatenate all segments into a single output) |

### 2. Validate ranges

```bash
SRC="$(realpath "$INPUT")"
DUR=$(ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$SRC")

to_seconds() {
  awk -F: '{
    n = NF
    if (n == 3)      print $1*3600 + $2*60 + $3
    else if (n == 2) print $1*60 + $2
    else             print $1
  }' <<<"$1"
}
```

For each segment: convert start/end to seconds; reject if `start >= end`, if `start < 0`, or if `end > DUR`. Report which segments were rejected and abort.

### 3. Mode: `copy` (default)

Stream-copy each segment. Fast, lossless, but cuts land on the nearest keyframe (typically within 1–2s of the requested mark).

```bash
i=0
for seg in "${SEGMENTS[@]}"; do
  read s e <<<"$seg"
  OUT="$OUTDIR/$(basename "${SRC%.*}")_seg_$(printf '%02d' $i)${EXT}"
  ffmpeg -y -ss "$s" -to "$e" -i "$SRC" -c copy -avoid_negative_ts make_zero "$OUT"
  i=$((i+1))
done
```

`-ss` *before* `-i` enables fast seek; combined with `-c copy` this is the lossless path.

### 4. Mode: `precise`

Frame-accurate cuts via re-encode. `-ss` goes *after* `-i` to force decode-side seek.

```bash
ffmpeg -y -i "$SRC" -ss "$s" -to "$e" \
  -c:v libx264 -crf 18 -preset medium \
  -c:a aac -b:a 192k \
  "$OUT"
```

If a render profile name was supplied (from `render-profiles.json`), build the encoder args from that profile instead.

### 5. Stitch (optional)

If `STITCH=yes`:

```bash
LIST=$(mktemp)
for f in "${SEGMENT_OUTPUTS[@]}"; do printf "file '%s'\n" "$f" >> "$LIST"; done
ffmpeg -y -f concat -safe 0 -i "$LIST" -c copy "$OUTDIR/$(basename "${SRC%.*}")_stitched${EXT}"
```

If the segments were produced via `precise` mode they share encoder params and concat-copy works. For `copy` mode + stitch, fall back to a re-encode through `render-from-library` if stream-copy concat fails.

### 6. Verify

For each output:

```bash
ffprobe -v error -show_entries format=duration,size -of default=nw=1 "$OUT"
```

Compare actual duration to requested `(end - start)`. In `copy` mode, mention the keyframe-snap drift if it's >0.5s.

### 7. Confirm

Print a table of segment outputs with their durations and sizes. Offer follow-ups (`burn-graphics` to overlay a label on each, `render-from-library` to stitch in a richer way, `audio-analysis` per segment).

## Notes

- Default output extension preserves the source's container.
- Multiple segments with the same numeric index won't clobber each other (they get `_seg_00`, `_seg_01`, …); supply a `label` per segment in the JSON form to get human-readable names instead.
- For "trim the first/last N seconds" shorthands, translate to a single segment: `00:00:00..-00:00:N` (use ffprobe duration) before validation.
- For multi-file concatenation (the legacy `merge-videos` command's job), use `render-from-library` instead.
- For watermarks and overlays (the legacy `add-watermark` command's job), use `burn-graphics` instead.

From danielrosehill/Claude-Video-Editor-Plugin, MIT.

More from danielrosehill/Claude-Video-Editor-Plugin

Signals

Stars
6
Forks
0
Open issues
0
Last commit (this folder)
Apr 30, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from danielrosehill

Cite this page

cut-segment skill. Agent Mart. https://agentmart.dev/skills/danielrosehill-cut-segment (last updated 2026-10-24)