Skip to content
Agentmart
Submit a tool

dedupe-clips

Find duplicate or near-duplicate clips in a folder.

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-dedupe-clips

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

Find duplicate or near-duplicate clips in a folder. Two modes — `exact` (sha256 of file bytes, fastest, catches true duplicates) and `perceptual` (sample frames + dHash, catches re-encodes / format converts of the same source). Use when the user says "find duplicate clips", "dedupe this folder", "remove duplicate videos", "flatten and dedupe". Quarantines duplicates to `_duplicates/` by default; never deletes without explicit confirmation.

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/dedupe-clips

Tools it pre-approves 22

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

  • Bash(test
  • *),
  • Bash(ls
  • Bash(mkdir
  • Bash(mv
  • Bash(rm
  • Bash(find
  • Bash(stat
  • Bash(sha256sum
  • Bash(sort
  • Bash(uniq
  • Bash(awk
Show 10 more
  • Bash(ffmpeg
  • Bash(ffprobe
  • Bash(jq
  • Bash(basename
  • Bash(dirname
  • Bash(realpath
  • Bash(printf
  • Bash(python3
  • Read,
  • Write

What's inside

Skill name
dedupe-clips
Description
Find duplicate or near-duplicate clips in a folder. Two modes — `exact` (sha256 of file bytes, fastest, catches true duplicates) and `perceptual` (sample frames + dHash, catches re-encodes / format converts of the same source). Use when the user says "find duplicate clips", "dedupe this folder", "remove duplicate videos", "flatten and dedupe". Quarantines duplicates to `_duplicates/` by default; never deletes without explicit confirmation.
License
MIT
Allowed tools
Bash(test, *),, Bash(ls, *),, Bash(mkdir, *),, Bash(mv, *),, Bash(rm, *),, Bash(find, *),, Bash(stat, *),, Bash(sha256sum, *),, Bash(sort, *),, Bash(uniq, *),, Bash(awk, *),, Bash(ffmpeg, *),, Bash(ffprobe, *),, Bash(jq, *),, Bash(basename, *),, Bash(dirname, *),, Bash(realpath, *),, Bash(printf, *),, Bash(python3, *),, Read,, Write
Instructions
137 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Dedupe Clips

Identify duplicate or near-duplicate video clips in a folder. Always quarantine, never auto-delete.

## Procedure

### 1. Inputs

| Field | Default |
|-------|---------|
| Source folder | required |
| Mode | `exact` (sha256) — `perceptual` (frame-hash) for finding re-encodes |
| Recursive | `no` |
| Hamming threshold (perceptual) | `8` (out of 64 bits) |
| Frames to sample (perceptual) | `5` |
| Action | `quarantine` (move dups to `_duplicates/`) — `delete` requires explicit confirmation |
| Keeper | `largest` (keep biggest file) — alternatives: `oldest`, `newest`, `first` (alpha) |

### 2. Enumerate

```bash
SRC="$(realpath "$INPUT")"
test -d "$SRC" || { echo "Not a folder: $SRC"; exit 1; }
if [ "$RECURSIVE" = "yes" ]; then
  mapfile -t FILES < <(find "$SRC" -type f \( -iname '*.mp4' -o -iname '*.mov' -o -iname '*.mkv' -o -iname '*.avi' -o -iname '*.m4v' -o -iname '*.webm' \) -not -path '*/_duplicates/*')
else
  mapfile -t FILES < <(find "$SRC" -maxdepth 1 -type f \( -iname '*.mp4' -o -iname '*.mov' -o -iname '*.mkv' -o -iname '*.avi' -o -iname '*.m4v' -o -iname '*.webm' \))
fi
```

### 3a. Mode: exact

```bash
sha256sum "${FILES[@]}" | sort > /tmp/hashes.txt
awk '{print $1}' /tmp/hashes.txt | sort | uniq -d > /tmp/dup_hashes.txt
```

For each duplicate hash, group the files. Apply the keeper rule and mark the rest for quarantine.

### 3b. Mode: perceptual

For each file, sample `N` frames at evenly-spaced timestamps and compute a dHash per frame. Concatenate the per-frame dHashes; two clips are near-duplicates if **all** frame-pair Hamming distances are `≤ THRESHOLD`.

Use a Python helper (one-shot, inline) — only needs `Pillow` (already in many envs; if missing, instruct to `uv pip install Pillow` into the plugin venv).

```python
# /tmp/dhash_clip.py
import sys, subprocess, json, tempfile, os
from PIL import Image

def dhash(img, hash_size=8):
    img = img.convert("L").resize((hash_size+1, hash_size))
    bits = 0
    for y in range(hash_size):
        for x in range(hash_size):
            left = img.getpixel((x, y))
            right = img.getpixel((x+1, y))
            bits = (bits << 1) | (1 if left > right else 0)
    return bits

def hashes_for(path, n=5):
    dur = float(subprocess.check_output(
        ["ffprobe","-v","error","-show_entries","format=duration","-of","default=nw=1:nk=1",path]
    ).strip() or 0)
    if dur <= 0: return []
    out = []
    with tempfile.TemporaryDirectory() as td:
        for i in range(n):
            t = dur * (i+1) / (n+1)
            jpg = os.path.join(td, f"{i}.jpg")
            subprocess.run(["ffmpeg","-v","error","-ss",str(t),"-i",path,
                            "-frames:v","1","-vf","scale=64:64","-y",jpg], check=False)
            if os.path.exists(jpg):
                out.append(dhash(Image.open(jpg)))
    return out

if __name__ == "__main__":
    print(json.dumps({p: hashes_for(p) for p in sys.argv[1:]}))
```

Hamming compare:

```python
def hamming(a, b): return bin(a ^ b).count("1")
def near(hs1, hs2, thr):
    if len(hs1) != len(hs2) or not hs1: return False
    return all(hamming(a,b) <= thr for a,b in zip(hs1,hs2))
```

Run pairwise comparison; group transitively (union-find) so chains of near-dups become one cluster.

### 4. Preview

Print clusters:

```
Cluster 1 — keeping: holiday_v2.mp4 (412 MB, h264 1080p)
  duplicate: holiday_v2_copy.mp4   (412 MB)        [exact match]
  duplicate: holiday_export.mp4    (138 MB, hevc)  [perceptual, hamming=2]

Cluster 2 — keeping: GX010044.MP4 (3.2 GB)
  duplicate: GX010044 (1).MP4      (3.2 GB)        [exact match]
```

Show total clusters, total dup files, total reclaimable bytes. Ask the user to **confirm**. For `delete` mode, require an extra confirmation.

### 5. Apply

For `quarantine`:

```bash
mkdir -p "$SRC/_duplicates"
for f in "${DUPS[@]}"; do
  mv -n "$f" "$SRC/_duplicates/"
done
```

For `delete` (only after explicit second confirmation): `rm -f --` each file.

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

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