File size: 2,463 Bytes
187e83b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
pretty_name: CopyrightGPT Video Fingerprint Dataset
tags:
  - video
  - copyright-detection
  - perceptual-hashing
  - fingerprinting
task_categories:
  - video-classification
---

# CopyrightGPT

A fast first-draft video dataset + fingerprint store, built to answer one question:
**has this video (or something very similar to it) been seen before?**

Each ingested video gets a YouTube-style random id and a folder ("bin") of binary
data files. A perceptual hash (pHash) is computed for sampled frames, so a new
video can be checked against everything already stored to flag likely duplicates /
re-uploads.

This is an early, intentionally simple draft — perceptual-hash frame matching only,
no audio fingerprinting yet, no ML model. It works, but it's not production-grade
copyright detection.

## Layout

```
copyrightgpt-v1/
  idgen.py        # generates YouTube-style 11-char ids
  fingerprint.py   # samples video frames + computes pHash fingerprints
  storage.py        # reads/writes the dataset/ bin+patch binary format
  ingest.py           # add a video to the dataset
  match.py              # compare a query video's fingerprint against the dataset
  cli.py                  # command-line interface (ingest / check / list)
  hf_sync.py                # push this project + dataset/ to this HF repo
  dataset/
    <id>/
      main.bin               # metadata: id, title, source path, duration, patch count
      patch-0.dat              # frame hashes from the first ingest of this id
      patch-1.dat, ...           # more patches appended on later re-ingests
```

`main.bin` and `patch-N.dat` are custom binary formats (via Python's `struct`) —
not pickle, not JSON — length-prefixed strings and packed `(timestamp, hash)`
records.

## Usage

```bash
pip install -r requirements.txt

python cli.py ingest path/to/video.mp4 --title "My Video"
python cli.py check path/to/new_video.mp4
python cli.py list
```

`check` reports a `match_ratio` (fraction of the query video's sampled frames
that have a close pHash match somewhere in a stored video) and flags
`is_likely_copyrighted: true` above a configurable threshold (default 0.5).

## Known limitations (first draft)

- Frame matching is unordered nearest-hash — won't reliably catch heavily
  cropped, rotated, or edited clips, or locate *where* a short clip appears
  inside a longer video.
- No audio fingerprinting.
- Single-process; no batching/indexing for large datasets yet.