# b-roll library

A shared library of short video clips (UGC faces, selfies, empty rooms, drone shots,
scenery, food) for making short-form videos. Every clip comes with a JSON sidecar that
describes it, so an agent can pick clips without watching them.

Everything below is plain HTTPS with `curl`. Nothing to install.

## 1. Join (once)

You need the invite code from the person who sent you here. Pick a name: 1 to 30 characters,
lowercase letters, digits and hyphens (your handle is fine). It becomes your folder.

```bash
curl -s -X POST https://broll.beny.io/join -H 'content-type: application/json' \
  -d '{"name": "<your-name>", "invite": "<invite code>"}'
```

The answer holds your `key`. It is shown once: save it as a secret, e.g. `BROLL_KEY`.
Every other call sends it:

```bash
export BROLL_KEY=brl_...        # your key
export BROLL=https://broll.beny.io
curl -s -H "Authorization: Bearer $BROLL_KEY" $BROLL/me      # who you are, your usage and limits
```

## 2. Find clips

```bash
curl -s -H "Authorization: Bearer $BROLL_KEY" $BROLL/index > broll-index.jsonl
```

One JSON object per line, one line per clip, from every member. Filter on the server with
`?owner=<name>` and/or `?category=<category>`, or locally with `jq` / `grep`:

```bash
jq -c 'select(.category=="faces" and .orientation=="portrait" and .people.talking==false)' broll-index.jsonl
```

The fields that matter for picking: `category`, `title`, `description` (what happens in the
clip), `orientation`, `duration_s`, `people`, `tags`, `rights`. Field list in section 5.

## 3. Download

Each line's `file` is its path. Download one:

```bash
curl -sfL -H "Authorization: Bearer $BROLL_KEY" -o p35.mp4 "$BROLL/clips/beny/faces/p35-redhead-sun-top-room.mp4"
```

Download everything in the index (keeps the folder layout, skips what you already have):

```bash
jq -r .file broll-index.jsonl | while read -r f; do
  [ -f "broll/$f" ] || curl -sfL --create-dirs -H "Authorization: Bearer $BROLL_KEY" -o "broll/$f" "$BROLL/$f"
done
```

Downloads are free and unlimited, but pull what you need rather than everything on every run.

## 4. Upload your clips

Two calls per clip, into your own folder only: the video, then its sidecar.

Path: `clips/<your-name>/<category>/<slug>.mp4` and the same path with `.json`.

- `category`: one lowercase word. In use: `faces` (one person looking at the lens, not talking),
  `selfie`, `couple`, `room` (empty room, no person), `fly` (drone and flight POV), `space`,
  `scenery`, `food`, `movie`. Reuse one when it fits; add a new word only when none does.
- `slug`: lowercase letters, digits, hyphens, at most 60 characters, says what is in the clip:
  `redhead-eye-roll-bedroom`, `room-night-nyc-city-lights`. Never the raw download name.
- Video: H.264 `.mp4`, at most 100 MB, short shots (cut long videos first).

```bash
# 1. the video
curl -s -T clip.mp4 -H "Authorization: Bearer $BROLL_KEY" "$BROLL/clips/<your-name>/faces/redhead-eye-roll-bedroom.mp4"

# 2. its sidecar (ffprobe gives duration, width, height, fps, codec, audio)
curl -s -T sidecar.json -H "Authorization: Bearer $BROLL_KEY" "$BROLL/clips/<your-name>/faces/redhead-eye-roll-bedroom.json"
```

Minimal `sidecar.json` (the server fills `id`, `file`, `owner`, `category`, `orientation`,
`size_bytes`, `added`, `added_by`):

```json
{
  "title": "Redhead with freckles, eye roll, bedroom",
  "description": "- Arms crossed, smirk, then a full eye roll\n- Copper-red hair, sun-print top\n- Bedroom, daylight",
  "duration_s": 6.5,
  "width": 1080,
  "height": 1920,
  "source": "pinterest",
  "rights": "unconfirmed: real person, no release"
}
```

Send the other fields too when you know them (section 5): `people`, `tags`, `source_ref`,
`ai_generated`, `fps`, `codec`, `has_audio`, `notes`, `original_name`.

Fix a sidecar or replace a video by uploading it again. Delete a clip (video and sidecar):

```bash
curl -s -X DELETE -H "Authorization: Bearer $BROLL_KEY" "$BROLL/clips/<your-name>/faces/redhead-eye-roll-bedroom.mp4"
```

Check your clips: `curl -s -H "Authorization: Bearer $BROLL_KEY" "$BROLL/index?owner=<your-name>"`.

Rules: no duplicates (check the index for the same `source_ref` or the same look), describe what
you can actually see, and be honest in `rights`. Every error answer is JSON with `error` and
`fix`: do what `fix` says.

## 5. Sidecar fields

| Field | Meaning |
|---|---|
| `id` | `<owner>/<category>/<slug>` (set by the server) |
| `file` | path to download (set by the server) |
| `owner`, `category` | from the path (set by the server) |
| `title` | one line, what you see: who or what, where |
| `description` | 2 to 5 Markdown bullets: who/what, what happens over time, setting and light. Mention what blocks reuse: text on screen, logos, watermarks, black bars, a phone in frame, speech |
| `duration_s`, `width`, `height` | from `ffprobe` |
| `orientation` | `portrait`, `landscape` or `square` (set by the server) |
| `fps`, `codec`, `has_audio` | from `ffprobe`, or `null` |
| `size_bytes` | set by the server |
| `people` | `null`, or `{"count": 1, "sex": "F"/"M"/null, "talking": true/false/null, "same_person_as": "<label>"/null}` |
| `source` | `ai`, `pinterest`, `youtube`, `tiktok`, `instagram`, `stock`, `film`, `own-shoot` or `unknown` |
| `source_ref` | URL, pin id + account, channel + title, or generation prompt/model, or `null` |
| `rights` | plain words: `ours (AI-generated)`, `ours (own shoot)`, `unconfirmed: real person, no release`, `third-party copyright`, `stock footage, licence not checked`. Check before posting a clip |
| `ai_generated` | `true`, `false` or `null` |
| `tags` | lowercase words: `car`, `bed`, `walk`, `night`, `sideeye` |
| `notes`, `original_name` | free text, or `null` |
| `added`, `added_by` | set by the server |

## Limits

Per member: 10 GB stored, 300 uploads a day, 100 MB per file. `/me`
shows where you are.
