Update china-yt-longform skill for flat dumps, 3 cores, and A/B covers.
Require per-video folders without hard-padding duration, weave food/life/YT-money into SRT, enforce 3 AI thumbnail variants, and validate A/B/C covers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a39162ee83
commit
81acd53b1b
@ -1,11 +1,14 @@
|
|||||||
---
|
---
|
||||||
name: china-yt-longform
|
name: china-yt-longform
|
||||||
description: >-
|
description: >-
|
||||||
Batch-produce Alone-in-China / Chinese street-food YouTube long-form assets:
|
Batch-produce Alone-in-China YouTube long-form assets from raw mp4 dumps or
|
||||||
CapCut-safe English SRT, viral covers from real footage faces/bodies, English
|
themed folders: analyze footage, split into per-video folders (prefer 8–15 min
|
||||||
titles/descriptions. Use when the user mentions 剪辑, 长视频, 封面, 字幕, SRT,
|
when natural — never pad unrelated clips), CapCut-safe EN SRT woven to food /
|
||||||
CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, YT_COVER, YT_CAPTIONS,
|
life-in-China citywalk beauty / YouTube money, ≥3 A/B-test covers with
|
||||||
probe_durations, validate_deliverables, or folders of mp4s for YouTube upload.
|
photographic super-res HD, titles. Use when the user mentions 剪辑, 长视频,
|
||||||
|
封面, 字幕, SRT, CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, 素材,
|
||||||
|
分集, A/B, 超分, YT_COVER, YT_CAPTIONS, probe_durations, validate_deliverables,
|
||||||
|
or drops a folder of mp4s for YouTube upload.
|
||||||
---
|
---
|
||||||
|
|
||||||
# China YT Long-form Batch Ops
|
# China YT Long-form Batch Ops
|
||||||
@ -14,28 +17,70 @@ Pack root = parent of `.cursor/skills/china-yt-longform` (or ask user).
|
|||||||
Human SOP: `README.md` · Details: [reference.md](reference.md)
|
Human SOP: `README.md` · Details: [reference.md](reference.md)
|
||||||
Scripts: `scripts/probe_durations.py`, `validate_deliverables.py`, `new_batch.py`, `_gen_srt_copy.py`, `_make_covers_v4.py`
|
Scripts: `scripts/probe_durations.py`, `validate_deliverables.py`, `new_batch.py`, `_gen_srt_copy.py`, `_make_covers_v4.py`
|
||||||
|
|
||||||
## Deliverables (each media subfolder)
|
## Channel cores (hard — every SRT / title / description)
|
||||||
|
|
||||||
|
Weave **all three** into narration (match real footage first, then steer):
|
||||||
|
|
||||||
|
1. **Food** — street food, canteen, menus, prices, steam, orders
|
||||||
|
2. **Life in China** — citywalk POV, scooters, neon, **real street beauty/faces** (tasteful; no creepy framing)
|
||||||
|
3. **YouTube money** — channel ops, consistency, watch time, how the channel changed life / honest income talk (no fake flex)
|
||||||
|
|
||||||
|
Do **not** ignore the picture to force a pillar. Ground lines in what is on screen, then connect to the cores.
|
||||||
|
|
||||||
|
## Deliverables (each media subfolder = one upload)
|
||||||
|
|
||||||
| File | Role |
|
| File | Role |
|
||||||
|------|------|
|
|------|------|
|
||||||
|
| `*.mp4` (1+) | Source clips for this one video (CapCut timeline order ≈ name/time order) |
|
||||||
| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS |
|
| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS |
|
||||||
| `YT_COVER.jpg` | 1280×720 (`YT_COVER_ALT.jpg` optional) |
|
| `YT_COVER.jpg` | A — default thumbnail 1280×720 |
|
||||||
|
| `YT_COVER_B.jpg` | B — A/B test variant 1280×720 |
|
||||||
|
| `YT_COVER_C.jpg` | C — A/B test variant 1280×720 |
|
||||||
| `YT_TITLES.txt` | 5 EN titles + description + tags |
|
| `YT_TITLES.txt` | 5 EN titles + description + tags |
|
||||||
|
|
||||||
One subfolder = one YT video. Multiple mp4s = concat by summed duration.
|
**≥3 covers required** (A/B/C) for YouTube thumbnail experiments. Extra `YT_COVER_D.jpg`… OK.
|
||||||
|
`YT_COVER_ALT.jpg` is legacy alias for B — prefer `YT_COVER_B.jpg`.
|
||||||
|
|
||||||
|
**One subfolder = one YT video.** Multiple mp4s in a folder = concat by summed duration.
|
||||||
`_` / `.` prefixed dirs = tools/cache, not media.
|
`_` / `.` prefixed dirs = tools/cache, not media.
|
||||||
|
|
||||||
|
## Duration policy (prefer 8–15 min — never 硬凑)
|
||||||
|
|
||||||
|
- **Prefer** ~8–15 min per folder when clips **naturally** form a coherent scene/theme/time block.
|
||||||
|
- **Do not** glue unrelated scenes just to hit 8 min.
|
||||||
|
- **Do not** split a tight coherent story just to avoid going over 15 if a clean split would hurt (prefer a clean thematic cut; ~16–18 min OK if one continuous scene).
|
||||||
|
- **Short packs OK** (e.g. 5–7 min) when that is the real material — label honestly in titles; tell the user.
|
||||||
|
- **Long continuous clips** (>15–20 min): split on scene/location/time boundaries, not arbitrary clock cuts mid-action.
|
||||||
|
- Target band is a **guide for upload strategy**, not a padding rule.
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
|
### A) Flat mp4 dump (common: `V3YYYY-MM-DD…` with dozens of clips)
|
||||||
|
|
||||||
|
```
|
||||||
|
- [ ] 1. List / ffprobe all root *.mp4 (duration + time-of-day from filename)
|
||||||
|
- [ ] 2. Sample mid-frames (ffmpeg) → cluster by time + scene (ride / street / food / canteen / night…)
|
||||||
|
- [ ] 3. Create numbered theme folders; MOVE clips in (same-drive rename). Write _BATCH_PLAN.txt
|
||||||
|
- [ ] 4. python scripts/probe_durations.py <batch>
|
||||||
|
- [ ] 5. Copy/edit _gen_srt_copy.py + _make_covers_v4.py into batch root for THIS footage
|
||||||
|
- [ ] 6. CapCut-safe EN SRT (dense) + YT_TITLES — 3 cores + real content
|
||||||
|
- [ ] 7. ≥3 covers A/B/C from REAL frames + photographic super-res HD
|
||||||
|
- [ ] 8. python scripts/validate_deliverables.py <batch> → must pass
|
||||||
|
```
|
||||||
|
|
||||||
|
Folder naming example: `01_night_scooter_ride`, `05_food_street_walk` — sortable, theme-clear for CapCut.
|
||||||
|
|
||||||
|
### B) Already-foldered batch
|
||||||
|
|
||||||
```
|
```
|
||||||
- [ ] 1. python scripts/probe_durations.py <batch>
|
- [ ] 1. python scripts/probe_durations.py <batch>
|
||||||
- [ ] 2. CapCut-safe EN SRT (dense)
|
- [ ] 2. CapCut-safe EN SRT (dense)
|
||||||
- [ ] 3. YT_TITLES.txt
|
- [ ] 3. YT_TITLES.txt
|
||||||
- [ ] 4. Covers from REAL frames (no AI faces; no yellow boxes)
|
- [ ] 4. ≥3 covers A/B/C + super-res HD
|
||||||
- [ ] 5. python scripts/validate_deliverables.py <batch> → must pass
|
- [ ] 5. python scripts/validate_deliverables.py <batch> → must pass
|
||||||
```
|
```
|
||||||
|
|
||||||
Default order: **SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked.
|
Default order: **organize (if needed) → SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked.
|
||||||
|
|
||||||
### New empty batch
|
### New empty batch
|
||||||
|
|
||||||
@ -47,14 +92,24 @@ Then drop mp4s, probe, edit pack scripts, generate, validate.
|
|||||||
|
|
||||||
## CapCut SRT (hard)
|
## CapCut SRT (hard)
|
||||||
|
|
||||||
- English; match food / street / beauty / alone-in-China
|
- English; **picture-true** first, then food / life-in-China beauty / YT money
|
||||||
- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s
|
- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s
|
||||||
- Duration ≥ speech (~2.3–2.4 wps + buffer)
|
- Duration ≥ speech (~2.3–2.4 wps + buffer)
|
||||||
- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues**
|
- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues** (shorter videos: scale down, still dense)
|
||||||
- Pass validate: overlap=0, multiline=0, last end ≈ duration
|
- Pass validate: overlap=0, multiline=0, last end ≈ duration
|
||||||
|
|
||||||
## Cover (hard)
|
## Cover (hard)
|
||||||
|
|
||||||
|
**Count:** **minimum 3** distinct thumbnails per folder for YouTube A/B testing:
|
||||||
|
|
||||||
|
| File | Variant |
|
||||||
|
|------|---------|
|
||||||
|
| `YT_COVER.jpg` | A (default upload) |
|
||||||
|
| `YT_COVER_B.jpg` | B |
|
||||||
|
| `YT_COVER_C.jpg` | C |
|
||||||
|
|
||||||
|
Variants must **differ** in at least two of: source frame / crop focus / hook copy (same video, different CTR bets).
|
||||||
|
|
||||||
**Pixels (never print on image):** real faces/bodies (prefer women); face + readable figure.
|
**Pixels (never print on image):** real faces/bodies (prefer women); face + readable figure.
|
||||||
|
|
||||||
**On-image text only:** viewer hooks — `UNDER $3`, `SHE LOOKED AT MY CAMERA`, `MALATANG STEAM`…
|
**On-image text only:** viewer hooks — `UNDER $3`, `SHE LOOKED AT MY CAMERA`, `MALATANG STEAM`…
|
||||||
@ -63,9 +118,16 @@ Then drop mp4s, probe, edit pack scripts, generate, validate.
|
|||||||
|
|
||||||
Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets.
|
Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets.
|
||||||
|
|
||||||
|
**HD / super-res (hard) — AI only, no local compute:**
|
||||||
|
- **Forbidden:** running Real-ESRGAN / OpenCV EDSR-FSRCNN / heavy DNN upscale / GPU-Vulkan SR on the **user’s PC**. User has banned local SR compute.
|
||||||
|
- **Required:** agent **AI image generation** (GenerateImage / equivalent) for heavy photographic restore + cover compose — like old-photo HD restore, **not** oil-paint.
|
||||||
|
- Pipeline: extract 1–2 reference stills per variant (ffmpeg frame grab only — lightweight) → AI generate each cover from those refs → save `YT_COVER.jpg` / `_B` / `_C` at 1280×720 into the folder.
|
||||||
|
- Goal: **clear photo HD**; preserve real people/scene from refs; viewer hooks as text on image.
|
||||||
|
- Still: no meta cover text; no yellow boxes; ≥3 distinct A/B/C variants.
|
||||||
|
|
||||||
## Titles
|
## Titles
|
||||||
|
|
||||||
Viral, honest Alone-in-China / night-market / street POV.
|
Viral, honest — can lead with food, citywalk/life, or channel-money angle; stay true to the folder’s footage.
|
||||||
|
|
||||||
## Fix loop
|
## Fix loop
|
||||||
|
|
||||||
@ -73,11 +135,16 @@ Viral, honest Alone-in-China / night-market / street POV.
|
|||||||
|-----------|--------|
|
|-----------|--------|
|
||||||
| Meta cover text | Viewer hooks only |
|
| Meta cover text | Viewer hooks only |
|
||||||
| Yellow box | Remove frames/badges |
|
| Yellow box | Remove frames/badges |
|
||||||
|
| Oil-paint / mushy HD | Cut sharpen stack; re-run photographic super-res only |
|
||||||
|
| Only 1–2 covers | Generate B/C with different frame+hook |
|
||||||
| Sparse SRT | Add lines + regenerate |
|
| Sparse SRT | Add lines + regenerate |
|
||||||
|
| Pillars missing / off-topic | Rewrite lines: on-screen → pillar bridge |
|
||||||
|
| Hard-padded mashup | Re-split by theme; allow short/long folders |
|
||||||
| validate fails | Fix listed issues, re-run |
|
| validate fails | Fix listed issues, re-run |
|
||||||
|
|
||||||
## Script notes
|
## Script notes
|
||||||
|
|
||||||
- Prefer pack `scripts/` tools; copy into batch root when customizing
|
- Prefer pack `scripts/` tools; copy into batch root when customizing
|
||||||
|
- Super-res models: `tools/opencv_sr/EDSR_x2.pb` (and optional `tools/realesrgan/`)
|
||||||
- Unicode JPG: `cv2.imencode` + `Path.write_bytes`
|
- Unicode JPG: `cv2.imencode` + `Path.write_bytes`
|
||||||
- Deps: `pip install -r requirements.txt`
|
- Deps: `pip install -r requirements.txt`
|
||||||
|
|||||||
@ -18,17 +18,66 @@ python _gen_srt_copy.py
|
|||||||
python _make_covers_v4.py
|
python _make_covers_v4.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Flat dump → per-video folders
|
||||||
|
|
||||||
|
When the batch root is full of loose `VID_*.mp4` (no theme subfolders):
|
||||||
|
|
||||||
|
1. **Probe** each file duration (`ffprobe` / custom script).
|
||||||
|
2. **Preview** mid-frames for scene labels (night ride, food street, canteen…).
|
||||||
|
3. **Group by theme + contiguous time**, not by stopwatch alone.
|
||||||
|
4. **MOVE** into `01_theme_slug/`, `02_…/` — each folder = one CapCut project / one upload.
|
||||||
|
5. Write `_BATCH_PLAN.txt` listing clips + approx duration per folder.
|
||||||
|
6. Then normal probe → SRT → titles → covers → validate.
|
||||||
|
|
||||||
|
### Duration (no 硬凑)
|
||||||
|
|
||||||
|
| Situation | Action |
|
||||||
|
|-----------|--------|
|
||||||
|
| Coherent block ~8–15 min | One folder |
|
||||||
|
| Coherent but ~5–7 min | Keep short; don’t paste unrelated B-roll |
|
||||||
|
| Coherent but ~16–20 min | Prefer thematic mid-split; else one longer video OK |
|
||||||
|
| Random short leftovers | Own small folder or ask user; never frankenstein |
|
||||||
|
|
||||||
## Folder layout
|
## Folder layout
|
||||||
|
|
||||||
```
|
```
|
||||||
BatchRoot/
|
BatchRoot/
|
||||||
clip-a/ *.mp4 YT_CAPTIONS_EN.srt YT_COVER.jpg YT_TITLES.txt
|
01_night_scooter_ride/
|
||||||
|
*.mp4
|
||||||
|
YT_CAPTIONS_EN.srt
|
||||||
|
YT_COVER.jpg # A
|
||||||
|
YT_COVER_B.jpg # B — A/B test
|
||||||
|
YT_COVER_C.jpg # C — A/B test
|
||||||
|
YT_TITLES.txt
|
||||||
|
02_food_street_walk/
|
||||||
|
...
|
||||||
_meta_probe.json
|
_meta_probe.json
|
||||||
|
_BATCH_PLAN.txt
|
||||||
_gen_srt_copy.py
|
_gen_srt_copy.py
|
||||||
_make_covers_v4.py
|
_make_covers_v4.py
|
||||||
_cover_out/
|
_cover_out/
|
||||||
|
tools/opencv_sr/EDSR_x2.pb # photographic x2 super-res (pack root)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Three channel cores (SRT / titles)
|
||||||
|
|
||||||
|
Every pack’s `lines` + description should hit:
|
||||||
|
|
||||||
|
1. **Food** — what you see/smell/order/prices
|
||||||
|
2. **Life in China** — POV streets, scooters, tasteful beauty/citywalk faces
|
||||||
|
3. **YouTube money** — habits, watch time, life change, honest income (no fake flex)
|
||||||
|
|
||||||
|
Pattern per cue cluster: **on-screen detail → soft bridge to a core → CTA/habit**.
|
||||||
|
|
||||||
|
## Covers A/B/C + AI HD (no local SR)
|
||||||
|
|
||||||
|
- Always ship **≥3** files: `YT_COVER.jpg`, `YT_COVER_B.jpg`, `YT_COVER_C.jpg`
|
||||||
|
- Differ frame **and/or** crop **and/or** hook text so YouTube A/B has real CTR contrast
|
||||||
|
- **HD via agent AI image gen** from real footage reference stills (old-photo restore look)
|
||||||
|
- **Do not** run local Real-ESRGAN / OpenCV EDSR-FSRCNN / user-GPU upscale
|
||||||
|
- Lightweight ffmpeg frame extract for refs only is OK
|
||||||
|
- Final size **1280×720**; photographic, not oil-paint
|
||||||
|
|
||||||
## YT_TITLES.txt template
|
## YT_TITLES.txt template
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@ -41,9 +90,11 @@ BatchRoot/
|
|||||||
|
|
||||||
=== DESCRIPTION ===
|
=== DESCRIPTION ===
|
||||||
...
|
...
|
||||||
|
(mention food + life in China + channel growth as fits the footage)
|
||||||
|
|
||||||
=== TAGS ===
|
=== TAGS ===
|
||||||
alone in china, chinese street food, night market, china vlog, ...
|
alone in china, chinese street food, life in china, night market, china vlog,
|
||||||
|
youtube growth, city walk, ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## SRT packing
|
## SRT packing
|
||||||
@ -51,6 +102,7 @@ alone in china, chinese street food, night market, china vlog, ...
|
|||||||
- Spread across full runtime; add lines if gaps feel empty
|
- Spread across full runtime; add lines if gaps feel empty
|
||||||
- Keep hook opening + CTA close
|
- Keep hook opening + CTA close
|
||||||
- Trim middle lines first if over-length
|
- Trim middle lines first if over-length
|
||||||
|
- Shorter videos: fewer cues OK if still ~1 / 8–12s
|
||||||
|
|
||||||
## Cover composition
|
## Cover composition
|
||||||
|
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@ -7,3 +7,11 @@ venv/
|
|||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
# Local SR binaries (AI covers preferred; do not ship heavy models)
|
||||||
|
tools/realesrgan/
|
||||||
|
tools/opencv_sr/*.pb
|
||||||
|
tools/**/*.zip
|
||||||
|
tools/**/*.exe
|
||||||
|
tools/**/*.dll
|
||||||
|
tools/**/*.bin
|
||||||
|
|||||||
@ -1,19 +1,54 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Clean viral YT covers: real frames, big hooks, no boxes/badges/borders."""
|
"""≥3 A/B/C covers + OpenCV EDSR x2 photographic super-res (CPU)."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont
|
from PIL import Image, ImageDraw, ImageEnhance, ImageFont
|
||||||
|
|
||||||
|
try:
|
||||||
|
from cv2 import dnn_superres
|
||||||
|
except ImportError:
|
||||||
|
dnn_superres = None # type: ignore
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent
|
ROOT = Path(__file__).resolve().parent
|
||||||
W, H = 1280, 720
|
W, H = 1280, 720
|
||||||
|
EDSR = Path(r"c:\Users\Administrator\Desktop\youtube-skill\tools\opencv_sr\EDSR_x2.pb")
|
||||||
|
FSRCNN = Path(r"c:\Users\Administrator\Desktop\youtube-skill\tools\opencv_sr\FSRCNN_x2.pb")
|
||||||
|
|
||||||
|
_SR = None
|
||||||
|
|
||||||
|
|
||||||
def imwrite_u(path: Path, bgr: np.ndarray, q: int = 95) -> None:
|
def get_sr():
|
||||||
|
global _SR
|
||||||
|
if _SR is not None:
|
||||||
|
return _SR
|
||||||
|
if dnn_superres is None:
|
||||||
|
_SR = False
|
||||||
|
return _SR
|
||||||
|
sr = dnn_superres.DnnSuperResImpl_create()
|
||||||
|
if EDSR.exists():
|
||||||
|
sr.readModel(str(EDSR))
|
||||||
|
sr.setModel("edsr", 2)
|
||||||
|
print("SR model: EDSR_x2")
|
||||||
|
elif FSRCNN.exists():
|
||||||
|
sr.readModel(str(FSRCNN))
|
||||||
|
sr.setModel("fsrcnn", 2)
|
||||||
|
print("SR model: FSRCNN_x2")
|
||||||
|
else:
|
||||||
|
print("SR model missing — Lanczos only")
|
||||||
|
_SR = False
|
||||||
|
return _SR
|
||||||
|
_SR = sr
|
||||||
|
return _SR
|
||||||
|
|
||||||
|
|
||||||
|
def imwrite_u(path: Path, bgr: np.ndarray, q: int = 96) -> None:
|
||||||
ok, buf = cv2.imencode(".jpg", bgr, [int(cv2.IMWRITE_JPEG_QUALITY), q])
|
ok, buf = cv2.imencode(".jpg", bgr, [int(cv2.IMWRITE_JPEG_QUALITY), q])
|
||||||
path.write_bytes(buf.tobytes())
|
path.write_bytes(buf.tobytes())
|
||||||
|
|
||||||
@ -27,44 +62,139 @@ def find_folder(*tokens: str) -> Path | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def grab(folder: Path, clip: str, t: float) -> np.ndarray | None:
|
def sharpness(bgr: np.ndarray) -> float:
|
||||||
path = folder / clip
|
g = cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY)
|
||||||
if not path.exists():
|
h, w = g.shape
|
||||||
return None
|
roi = g[int(h * 0.12) : int(h * 0.88), int(w * 0.12) : int(w * 0.88)]
|
||||||
|
return float(cv2.Laplacian(roi, cv2.CV_64F).var())
|
||||||
|
|
||||||
|
|
||||||
|
def brightness(bgr: np.ndarray) -> float:
|
||||||
|
return float(cv2.cvtColor(bgr, cv2.COLOR_BGR2GRAY).mean())
|
||||||
|
|
||||||
|
|
||||||
|
def grab_at(path: Path, t: float) -> np.ndarray | None:
|
||||||
cap = cv2.VideoCapture(str(path))
|
cap = cv2.VideoCapture(str(path))
|
||||||
if not cap.isOpened():
|
if not cap.isOpened():
|
||||||
return None
|
return None
|
||||||
cap.set(cv2.CAP_PROP_POS_MSEC, t * 1000)
|
cap.set(cv2.CAP_PROP_POS_MSEC, max(0.0, t) * 1000)
|
||||||
ok, frame = cap.read()
|
ok, frame = cap.read()
|
||||||
cap.release()
|
cap.release()
|
||||||
return frame if ok else None
|
return frame if ok else None
|
||||||
|
|
||||||
|
|
||||||
def first(*items):
|
def resolve_clip(folder: Path, clip: str) -> Path | None:
|
||||||
for x in items:
|
path = folder / clip
|
||||||
if x is not None:
|
if path.exists():
|
||||||
return x
|
return path
|
||||||
return None
|
key = clip.replace(".mp4", "")
|
||||||
|
hits = [p for p in folder.glob("*.mp4") if key in p.name]
|
||||||
|
return hits[0] if hits else None
|
||||||
|
|
||||||
|
|
||||||
|
def best_frames(
|
||||||
|
folder: Path,
|
||||||
|
clip_hints: list[str],
|
||||||
|
times: list[float],
|
||||||
|
top_k: int = 3,
|
||||||
|
min_bright: float = 32.0,
|
||||||
|
min_sharp: float = 35.0,
|
||||||
|
) -> list[np.ndarray]:
|
||||||
|
clips: list[Path] = []
|
||||||
|
for h in clip_hints:
|
||||||
|
p = resolve_clip(folder, h)
|
||||||
|
if p and p not in clips:
|
||||||
|
clips.append(p)
|
||||||
|
if not clips:
|
||||||
|
clips = sorted(folder.glob("*.mp4"))
|
||||||
|
|
||||||
|
scored: list[tuple[float, np.ndarray]] = []
|
||||||
|
for path in clips:
|
||||||
|
cap = cv2.VideoCapture(str(path))
|
||||||
|
if not cap.isOpened():
|
||||||
|
continue
|
||||||
|
fps = cap.get(cv2.CAP_PROP_FPS) or 30.0
|
||||||
|
n = cap.get(cv2.CAP_PROP_FRAME_COUNT) or 0
|
||||||
|
dur = n / fps if fps > 0 else 0
|
||||||
|
for t in times:
|
||||||
|
if dur > 1 and t >= dur - 0.4:
|
||||||
|
continue
|
||||||
|
cap.set(cv2.CAP_PROP_POS_MSEC, t * 1000)
|
||||||
|
ok, frame = cap.read()
|
||||||
|
if not ok or frame is None:
|
||||||
|
continue
|
||||||
|
b = brightness(frame)
|
||||||
|
if b < min_bright:
|
||||||
|
continue
|
||||||
|
s = sharpness(frame)
|
||||||
|
if s < min_sharp:
|
||||||
|
continue
|
||||||
|
score = s * (0.85 + 0.15 * min(b, 140) / 140)
|
||||||
|
scored.append((score, frame))
|
||||||
|
cap.release()
|
||||||
|
|
||||||
|
if not scored:
|
||||||
|
for path in clips[:2]:
|
||||||
|
for t in [1.0, 3.0, 5.0, 8.0, 12.0]:
|
||||||
|
f = grab_at(path, t)
|
||||||
|
if f is not None:
|
||||||
|
scored.append((1.0, f))
|
||||||
|
if not scored:
|
||||||
|
return []
|
||||||
|
|
||||||
|
scored.sort(key=lambda x: x[0], reverse=True)
|
||||||
|
# diversify: skip near-duplicate sharpness neighbors by taking spaced picks
|
||||||
|
picks: list[np.ndarray] = []
|
||||||
|
for _, fr in scored:
|
||||||
|
picks.append(fr)
|
||||||
|
if len(picks) >= top_k:
|
||||||
|
break
|
||||||
|
while len(picks) < top_k:
|
||||||
|
picks.append(picks[-1])
|
||||||
|
return picks
|
||||||
|
|
||||||
|
|
||||||
|
def photo_grade(bgr: np.ndarray) -> np.ndarray:
|
||||||
|
out = bgr.astype(np.float32)
|
||||||
|
out = (out - 128.0) * 1.05 + 128.0 + 3.0
|
||||||
|
out = np.clip(out, 0, 255).astype(np.uint8)
|
||||||
|
hsv = cv2.cvtColor(out, cv2.COLOR_BGR2HSV).astype(np.float32)
|
||||||
|
hsv[:, :, 1] = np.clip(hsv[:, :, 1] * 1.05, 0, 255)
|
||||||
|
return cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR)
|
||||||
|
|
||||||
|
|
||||||
|
def super_res(bgr: np.ndarray, max_in: int = 960) -> np.ndarray:
|
||||||
|
"""Photographic x2 super-res (EDSR) then keep manageable size."""
|
||||||
|
src = photo_grade(bgr)
|
||||||
|
h, w = src.shape[:2]
|
||||||
|
if max(h, w) > max_in:
|
||||||
|
s = max_in / max(h, w)
|
||||||
|
src = cv2.resize(src, (int(w * s), int(h * s)), interpolation=cv2.INTER_AREA)
|
||||||
|
|
||||||
|
sr = get_sr()
|
||||||
|
if sr is False or sr is None:
|
||||||
|
return cv2.resize(src, (src.shape[1] * 2, src.shape[0] * 2), interpolation=cv2.INTER_LANCZOS4)
|
||||||
|
|
||||||
|
try:
|
||||||
|
up = sr.upsample(src)
|
||||||
|
except Exception as e:
|
||||||
|
print("SR upsample fail:", e)
|
||||||
|
return cv2.resize(src, (src.shape[1] * 2, src.shape[0] * 2), interpolation=cv2.INTER_LANCZOS4)
|
||||||
|
return up
|
||||||
|
|
||||||
|
|
||||||
def to_pil(bgr: np.ndarray) -> Image.Image:
|
def to_pil(bgr: np.ndarray) -> Image.Image:
|
||||||
return Image.fromarray(cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB))
|
return Image.fromarray(cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB))
|
||||||
|
|
||||||
|
|
||||||
def boost(img: Image.Image, c=1.28, k=1.18, s=1.35) -> Image.Image:
|
def crop_rel(bgr: np.ndarray, x0, y0, x1, y1) -> np.ndarray:
|
||||||
img = ImageEnhance.Color(img).enhance(c)
|
|
||||||
img = ImageEnhance.Contrast(img).enhance(k)
|
|
||||||
return ImageEnhance.Sharpness(img).enhance(s)
|
|
||||||
|
|
||||||
|
|
||||||
def crop_rel(bgr: np.ndarray, x0, y0, x1, y1) -> Image.Image:
|
|
||||||
h, w = bgr.shape[:2]
|
h, w = bgr.shape[:2]
|
||||||
a, b = int(x0 * w), int(y0 * h)
|
a, b0 = int(x0 * w), int(y0 * h)
|
||||||
c, d = int(x1 * w), int(y1 * h)
|
c, d = int(x1 * w), int(y1 * h)
|
||||||
return to_pil(bgr[max(0, b) : min(h, d), max(0, a) : min(w, c)])
|
return bgr[max(0, b0) : min(h, d), max(0, a) : min(w, c)].copy()
|
||||||
|
|
||||||
|
|
||||||
def fit(img: Image.Image, tw: int, th: int, focus=(0.5, 0.38)) -> Image.Image:
|
def fit_pil(img: Image.Image, tw: int, th: int, focus=(0.5, 0.38)) -> Image.Image:
|
||||||
iw, ih = img.size
|
iw, ih = img.size
|
||||||
scale = max(tw / iw, th / ih)
|
scale = max(tw / iw, th / ih)
|
||||||
nw, nh = int(iw * scale + 0.5), int(ih * scale + 0.5)
|
nw, nh = int(iw * scale + 0.5), int(ih * scale + 0.5)
|
||||||
@ -99,21 +229,20 @@ def stroke_text(draw, xy, text, font, fill, stroke=(0, 0, 0), sw=5):
|
|||||||
draw.text((x, y), text, font=font, fill=fill)
|
draw.text((x, y), text, font=font, fill=fill)
|
||||||
|
|
||||||
|
|
||||||
def left_shade(img: Image.Image, width=720, max_a=195) -> Image.Image:
|
def left_shade(img: Image.Image, width=620, max_a=155) -> Image.Image:
|
||||||
img = img.convert("RGBA")
|
img = img.convert("RGBA")
|
||||||
sh = Image.new("RGBA", img.size, (0, 0, 0, 0))
|
sh = Image.new("RGBA", img.size, (0, 0, 0, 0))
|
||||||
d = ImageDraw.Draw(sh)
|
d = ImageDraw.Draw(sh)
|
||||||
for i in range(width):
|
for i in range(width):
|
||||||
a = int(max_a * (1 - i / width) ** 1.05)
|
a = int(max_a * (1 - i / width) ** 1.2)
|
||||||
d.line([(i, 0), (i, H)], fill=(0, 0, 0, a))
|
d.line([(i, 0), (i, H)], fill=(0, 0, 0, a))
|
||||||
# soft bottom fade so text doesn't fight neon
|
for j in range(90):
|
||||||
for j in range(160):
|
a = int(50 * (1 - j / 90))
|
||||||
a = int(90 * (1 - j / 160))
|
|
||||||
d.line([(0, H - 1 - j), (W, H - 1 - j)], fill=(0, 0, 0, a))
|
d.line([(0, H - 1 - j), (W, H - 1 - j)], fill=(0, 0, 0, a))
|
||||||
return Image.alpha_composite(img, sh)
|
return Image.alpha_composite(img, sh)
|
||||||
|
|
||||||
|
|
||||||
def paste_soft(canvas: Image.Image, sub: Image.Image, x: int, y: int, fade=110) -> Image.Image:
|
def paste_soft(canvas: Image.Image, sub: Image.Image, x: int, y: int, fade=48) -> Image.Image:
|
||||||
canvas = canvas.convert("RGBA")
|
canvas = canvas.convert("RGBA")
|
||||||
sub = sub.convert("RGBA")
|
sub = sub.convert("RGBA")
|
||||||
mask = Image.new("L", sub.size, 255)
|
mask = Image.new("L", sub.size, 255)
|
||||||
@ -125,209 +254,339 @@ def paste_soft(canvas: Image.Image, sub: Image.Image, x: int, y: int, fade=110)
|
|||||||
return canvas
|
return canvas
|
||||||
|
|
||||||
|
|
||||||
def paint_hooks(img: Image.Image, lines: list, left=48, top=168) -> Image.Image:
|
def paint_hooks(img: Image.Image, lines: list, left=44, top=150) -> Image.Image:
|
||||||
img = left_shade(img)
|
img = left_shade(img)
|
||||||
d = ImageDraw.Draw(img)
|
d = ImageDraw.Draw(img)
|
||||||
y = top
|
y = top
|
||||||
for i, (text, size, color) in enumerate(lines):
|
for i, (text, size, color) in enumerate(lines):
|
||||||
font = find_font(size)
|
font = find_font(size)
|
||||||
stroke_text(d, (left, y), text, font, color, sw=max(4, size // 14))
|
stroke_text(d, (left, y), text, font, color, sw=max(5, size // 12))
|
||||||
bb = d.textbbox((0, 0), text, font=font)
|
bb = d.textbbox((0, 0), text, font=font)
|
||||||
y += (bb[3] - bb[1]) + (10 if i == 0 else 4)
|
y += (bb[3] - bb[1]) + (10 if i == 0 else 4)
|
||||||
# thin accent under hooks — not a box
|
|
||||||
d.rectangle([left, y + 10, left + 120, y + 16], fill=(255, 255, 255, 220))
|
d.rectangle([left, y + 10, left + 120, y + 16], fill=(255, 255, 255, 220))
|
||||||
return img.convert("RGB")
|
return img.convert("RGB")
|
||||||
|
|
||||||
|
|
||||||
def save(img: Image.Image, folder: Path, name="YT_COVER.jpg") -> None:
|
def save(img: Image.Image, folder: Path, name: str) -> None:
|
||||||
img = boost(img, 1.22, 1.14, 1.25)
|
img = ImageEnhance.Contrast(img).enhance(1.03)
|
||||||
|
img = ImageEnhance.Sharpness(img).enhance(1.06)
|
||||||
arr = cv2.cvtColor(np.asarray(img.convert("RGB")), cv2.COLOR_RGB2BGR)
|
arr = cv2.cvtColor(np.asarray(img.convert("RGB")), cv2.COLOR_RGB2BGR)
|
||||||
imwrite_u(folder / name, arr, 95)
|
imwrite_u(folder / name, arr, 96)
|
||||||
|
|
||||||
|
|
||||||
def build(
|
def build(
|
||||||
bg: Image.Image,
|
bg_bgr: np.ndarray,
|
||||||
person: Image.Image,
|
person_bgr: np.ndarray,
|
||||||
lines: list,
|
lines: list,
|
||||||
person_w=0.56,
|
person_w=0.56,
|
||||||
focus=(0.55, 0.30),
|
focus=(0.55, 0.30),
|
||||||
|
bg_focus=(0.42, 0.40),
|
||||||
|
crop_person=(0.30, 0.02, 0.98, 0.98),
|
||||||
) -> Image.Image:
|
) -> Image.Image:
|
||||||
# cinematic base + person blend, no inset frames
|
bg_up = super_res(bg_bgr, max_in=900)
|
||||||
canvas = fit(boost(bg, 1.35, 1.22), W, H, focus=(0.40, 0.42))
|
pers = crop_rel(person_bgr, *crop_person)
|
||||||
canvas = canvas.filter(ImageFilter.GaussianBlur(0.6))
|
if pers.size == 0:
|
||||||
panel = fit(boost(person, 1.22, 1.16, 1.45), int(W * person_w), H, focus=focus)
|
pers = person_bgr
|
||||||
canvas = paste_soft(canvas, panel, W - panel.size[0] + 8, 0, fade=100).convert("RGB")
|
person_up = super_res(pers, max_in=850)
|
||||||
|
|
||||||
|
bg = ImageEnhance.Color(to_pil(bg_up)).enhance(1.06)
|
||||||
|
person = ImageEnhance.Color(to_pil(person_up)).enhance(1.05)
|
||||||
|
canvas = fit_pil(bg, W, H, focus=bg_focus)
|
||||||
|
panel = fit_pil(person, int(W * person_w), H, focus=focus)
|
||||||
|
canvas = paste_soft(canvas, panel, W - panel.size[0] + 4, 0, fade=48).convert("RGB")
|
||||||
return paint_hooks(canvas, lines)
|
return paint_hooks(canvas, lines)
|
||||||
|
|
||||||
|
|
||||||
def do_street(folder: Path) -> None:
|
def save_abc(folder: Path, variants: list[tuple[str, Image.Image]]) -> None:
|
||||||
face_f = grab(folder, "VID_20261019_033518.mp4", 140.0)
|
"""variants: [(YT_COVER.jpg, img), (YT_COVER_B.jpg, img), (YT_COVER_C.jpg, img)]"""
|
||||||
walk = first(grab(folder, "VID_20261019_032711.mp4", 72.0), face_f)
|
for name, img in variants:
|
||||||
bg = first(grab(folder, "VID_20261019_032958.mp4", 55.0), face_f)
|
save(img, folder, name)
|
||||||
person = crop_rel(face_f, 0.40, 0.02, 0.98, 0.98)
|
# legacy alias
|
||||||
walker = crop_rel(walk, 0.55, 0.02, 0.98, 0.98)
|
b = folder / "YT_COVER_B.jpg"
|
||||||
img = build(
|
if b.exists():
|
||||||
to_pil(bg),
|
shutil.copy2(b, folder / "YT_COVER_ALT.jpg")
|
||||||
person,
|
|
||||||
|
|
||||||
|
T_NIGHT = [1.5, 3, 5, 7, 9, 12, 15, 18, 22, 28, 35, 42, 50, 60, 75, 90, 110]
|
||||||
|
T_DAY = [2, 4, 6, 8, 10, 14, 18, 24, 30, 40, 50, 65, 80, 100, 120]
|
||||||
|
|
||||||
|
|
||||||
|
def do_pack(
|
||||||
|
folder: Path,
|
||||||
|
clips: list[str],
|
||||||
|
times: list[float],
|
||||||
|
variants_spec: list[dict],
|
||||||
|
min_bright=32.0,
|
||||||
|
min_sharp=35.0,
|
||||||
|
) -> None:
|
||||||
|
frames = best_frames(folder, clips, times, top_k=max(3, len(variants_spec)), min_bright=min_bright, min_sharp=min_sharp)
|
||||||
|
outs = []
|
||||||
|
for i, spec in enumerate(variants_spec):
|
||||||
|
bg = frames[min(i, len(frames) - 1)]
|
||||||
|
person = frames[min(spec.get("person_idx", i), len(frames) - 1)]
|
||||||
|
img = build(
|
||||||
|
bg,
|
||||||
|
person,
|
||||||
|
spec["lines"],
|
||||||
|
person_w=spec.get("person_w", 0.56),
|
||||||
|
focus=spec.get("focus", (0.55, 0.30)),
|
||||||
|
bg_focus=spec.get("bg_focus", (0.42, 0.40)),
|
||||||
|
crop_person=spec.get("crop_person", (0.30, 0.02, 0.98, 0.98)),
|
||||||
|
)
|
||||||
|
outs.append((spec["name"], img))
|
||||||
|
save_abc(folder, outs)
|
||||||
|
|
||||||
|
|
||||||
|
def do_01(folder: Path) -> None:
|
||||||
|
do_pack(
|
||||||
|
folder,
|
||||||
|
["VID_20261019_092345.mp4", "VID_20261019_091912.mp4", "VID_20261019_091618.mp4"],
|
||||||
|
T_NIGHT,
|
||||||
[
|
[
|
||||||
("SHE LOOKED", 78, (255, 255, 255)),
|
{
|
||||||
("AT MY CAMERA", 72, (255, 230, 80)),
|
"name": "YT_COVER.jpg",
|
||||||
("Real China Walk", 36, (255, 170, 200)),
|
"lines": [("NIGHT", 82, (255, 255, 255)), ("SCOOTER POV", 68, (255, 230, 80)), ("China After Dark", 34, (120, 220, 255))],
|
||||||
|
"crop_person": (0.28, 0.05, 0.95, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("ALONE", 82, (255, 255, 255)), ("IN CHINA", 74, (255, 230, 80)), ("Ride = Content", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.15, 0.08, 0.80, 0.98),
|
||||||
|
"focus": (0.45, 0.40),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("THIS RIDE", 74, (255, 255, 255)), ("PAYS RENT", 74, (255, 90, 130)), ("YT Night Hustle", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.35, 0.10, 0.98, 0.98),
|
||||||
|
"focus": (0.60, 0.35),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
min_bright=22,
|
||||||
|
min_sharp=25,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
img2 = build(
|
|
||||||
to_pil(bg),
|
def do_02(folder: Path) -> None:
|
||||||
walker,
|
do_pack(
|
||||||
|
folder,
|
||||||
[
|
[
|
||||||
("10 MIN", 82, (255, 255, 255)),
|
"VID_20261019_092727_0_2400x1344_ISO4037.mp4",
|
||||||
("STREET POV", 76, (255, 230, 80)),
|
"VID_20261019_093126_0_2400x1344_ISO3720.mp4",
|
||||||
("No Tourist Edit", 34, (140, 255, 230)),
|
|
||||||
],
|
],
|
||||||
focus=(0.55, 0.4),
|
T_NIGHT,
|
||||||
)
|
|
||||||
save(img2, folder, "YT_COVER_ALT.jpg")
|
|
||||||
|
|
||||||
|
|
||||||
def do_citywalk(folder: Path) -> None:
|
|
||||||
market = first(
|
|
||||||
grab(folder, "VID_20261019_041246.mp4", 23.9),
|
|
||||||
grab(folder, "VID_20261019_041246.mp4", 77.7),
|
|
||||||
)
|
|
||||||
lantern = first(grab(folder, "VID_20261019_034248.mp4", 120.0), market)
|
|
||||||
person = crop_rel(market, 0.58, 0.08, 0.98, 0.98)
|
|
||||||
alt = grab(folder, "VID_20261019_041246.mp4", 77.7)
|
|
||||||
if alt is not None:
|
|
||||||
person = crop_rel(alt, 0.52, 0.05, 0.98, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(lantern),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("FOOD STREET", 74, (255, 255, 255)),
|
{
|
||||||
("AT DUSK", 74, (255, 230, 80)),
|
"name": "YT_COVER.jpg",
|
||||||
("$2 SNACKS", 70, (255, 90, 130)),
|
"lines": [("CROSSWALK", 74, (255, 255, 255)), ("AT NIGHT", 74, (255, 230, 80)), ("Real China Ride", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.22, 0.05, 0.88, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("GREEN LIGHT", 70, (120, 255, 160)), ("GO", 90, (255, 255, 255)), ("Scooter City", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.30, 0.08, 0.95, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("8 MIN", 86, (255, 255, 255)), ("NIGHT POV", 70, (255, 230, 80)), ("No Tourist Filter", 32, (255, 140, 180))],
|
||||||
|
"crop_person": (0.18, 0.10, 0.75, 0.98),
|
||||||
|
"focus": (0.40, 0.38),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
min_bright=25,
|
||||||
|
min_sharp=30,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def do_nm3(folder: Path) -> None:
|
def do_03(folder: Path) -> None:
|
||||||
steam = first(
|
do_pack(
|
||||||
grab(folder, "VID_20261019_045155.mp4", 2.0),
|
folder,
|
||||||
grab(folder, "VID_20261019_044816.mp4", 25.0),
|
["VID_20261020_034223.mp4", "VID_20261020_060822.mp4"],
|
||||||
)
|
T_DAY + T_NIGHT,
|
||||||
crowd = first(
|
|
||||||
grab(folder, "VID_20261019_045155.mp4", 0.0),
|
|
||||||
grab(folder, "VID_20261019_044816.mp4", 8.0),
|
|
||||||
steam,
|
|
||||||
)
|
|
||||||
neon = first(grab(folder, "VID_20261019_044816.mp4", 8.0), steam)
|
|
||||||
person = crop_rel(crowd, 0.30, 0.05, 0.88, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(neon),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("MALATANG", 82, (255, 55, 80)),
|
{
|
||||||
("STEAM", 82, (255, 255, 255)),
|
"name": "YT_COVER.jpg",
|
||||||
("NIGHT CHAOS", 68, (255, 230, 80)),
|
"lines": [("DAWN", 86, (255, 255, 255)), ("CITY RIDE", 72, (255, 230, 80)), ("Before the Rush", 34, (255, 170, 200))],
|
||||||
|
"crop_person": (0.35, 0.02, 0.98, 0.95),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("MORNING", 78, (255, 255, 255)), ("CHINA", 78, (255, 230, 80)), ("Shop Signs Glow", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.20, 0.05, 0.85, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("SCOUT", 82, (255, 255, 255)), ("FOOD STREETS", 64, (255, 90, 130)), ("Creator Habit", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.40, 0.08, 0.98, 0.98),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
focus=(0.5, 0.35),
|
min_bright=30,
|
||||||
|
min_sharp=45,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def do_nm1(folder: Path) -> None:
|
def do_04(folder: Path) -> None:
|
||||||
stalls = first(
|
do_pack(
|
||||||
grab(folder, "VID_20261019_041845.mp4", 8.0),
|
folder,
|
||||||
grab(folder, "VID_20261019_041738.mp4", 37.0),
|
|
||||||
)
|
|
||||||
crowd = first(grab(folder, "VID_20261019_041738.mp4", 36.0), stalls)
|
|
||||||
person = crop_rel(crowd, 0.30, 0.05, 0.78, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(stalls),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("UNDER $3", 86, (255, 230, 80)),
|
"VID_20261020_230243.mp4",
|
||||||
("NIGHT MARKET", 72, (255, 255, 255)),
|
"VID_20261020_201413.mp4",
|
||||||
("Eat Like a Local", 36, (160, 255, 240)),
|
"VID_20261020_214204_0_2400x1344_ISO100.mp4",
|
||||||
],
|
],
|
||||||
)
|
T_DAY,
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def do_nm2(folder: Path) -> None:
|
|
||||||
f = first(
|
|
||||||
grab(folder, "VID_20261019_042529.mp4", 54.0),
|
|
||||||
grab(folder, "VID_20261019_042529.mp4", 25.0),
|
|
||||||
)
|
|
||||||
glow = first(grab(folder, "VID_20261019_042529.mp4", 12.0), f)
|
|
||||||
person = crop_rel(f, 0.22, 0.12, 0.78, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(glow),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("SENSORY", 80, (255, 255, 255)),
|
{
|
||||||
("OVERLOAD", 80, (255, 230, 80)),
|
"name": "YT_COVER.jpg",
|
||||||
("2 MIN POV", 64, (255, 100, 150)),
|
"lines": [("REAL CHINA", 74, (255, 255, 255)), ("DAY WALK", 74, (255, 230, 80)), ("Scooters + Shops", 34, (140, 255, 230))],
|
||||||
|
"person_w": 0.52,
|
||||||
|
"crop_person": (0.02, 0.02, 0.55, 0.98),
|
||||||
|
"focus": (0.40, 0.30),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("11 MIN", 86, (255, 255, 255)), ("STREET POV", 70, (255, 230, 80)), ("No Tourist Edit", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.40, 0.05, 0.98, 0.98),
|
||||||
|
"focus": (0.55, 0.38),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("CITYWALK", 78, (255, 255, 255)), ("BEAUTY", 78, (255, 140, 180)), ("Life in China", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.10, 0.05, 0.70, 0.98),
|
||||||
|
"focus": (0.45, 0.32),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
min_bright=40,
|
||||||
|
min_sharp=55,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def do_canteen(folder: Path) -> None:
|
def do_05(folder: Path) -> None:
|
||||||
street = first(
|
do_pack(
|
||||||
grab(folder, "VID_20261019_042937.mp4", 12.0),
|
folder,
|
||||||
grab(folder, "VID_20261019_042937.mp4", 2.0),
|
["VID_20261021_044213.mp4", "VID_20261021_043500.mp4", "VID_20261021_044043.mp4"],
|
||||||
)
|
T_DAY,
|
||||||
alley = first(
|
|
||||||
grab(folder, "VID_20261019_044719.mp4", 15.0),
|
|
||||||
grab(folder, "VID_20261019_044719.mp4", 8.0),
|
|
||||||
street,
|
|
||||||
)
|
|
||||||
noodles = first(grab(folder, "VID_20261019_042937.mp4", 55.0), street)
|
|
||||||
person = crop_rel(alley, 0.20, 0.02, 0.78, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(noodles if noodles is not None else street),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("NOODLE", 84, (255, 255, 255)),
|
{
|
||||||
("RITUAL", 84, (255, 230, 80)),
|
"name": "YT_COVER.jpg",
|
||||||
("Alone in China", 36, (255, 140, 180)),
|
"lines": [("FOOD STREET", 72, (255, 255, 255)), ("NEON SNACKS", 68, (255, 90, 130)), ("Beef Noodles Ahead", 32, (255, 230, 80))],
|
||||||
|
"crop_person": (0.32, 0.02, 0.88, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("BEEF", 86, (255, 255, 255)), ("NOODLES", 78, (255, 230, 80)), ("Local Lunch Sign", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.40, 0.05, 0.95, 0.90),
|
||||||
|
"focus": (0.55, 0.25),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("SHE WALKED", 74, (255, 255, 255)), ("THE FOOD LANE", 64, (255, 140, 180)), ("Citywalk Hunger", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.28, 0.02, 0.80, 0.98),
|
||||||
|
"focus": (0.48, 0.28),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
focus=(0.48, 0.28),
|
min_bright=35,
|
||||||
|
min_sharp=45,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def do_bike(folder: Path) -> None:
|
def do_06(folder: Path) -> None:
|
||||||
walk = first(
|
do_pack(
|
||||||
grab(folder, "VID_20261019_042141.mp4", 72.0),
|
folder,
|
||||||
grab(folder, "VID_20261019_042141.mp4", 60.0),
|
["VID_20261021_051155.mp4", "VID_20261021_051605.mp4", "VID_20261021_050159.mp4"],
|
||||||
)
|
T_DAY,
|
||||||
start = first(grab(folder, "VID_20261019_042040.mp4", 8.0), walk)
|
|
||||||
person = crop_rel(walk, 0.28, 0.02, 0.80, 0.98)
|
|
||||||
img = build(
|
|
||||||
to_pil(start),
|
|
||||||
person,
|
|
||||||
[
|
[
|
||||||
("SCOOTER", 80, (255, 255, 255)),
|
{
|
||||||
("POV", 90, (255, 230, 80)),
|
"name": "YT_COVER.jpg",
|
||||||
("China Night Ride", 36, (120, 220, 255)),
|
"lines": [("CANTEEN", 82, (255, 255, 255)), ("LIFE", 86, (255, 230, 80)), ("Real China Lunch", 34, (160, 255, 240))],
|
||||||
|
"crop_person": (0.22, 0.02, 0.85, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("TRAY", 86, (255, 255, 255)), ("ECONOMY", 74, (255, 230, 80)), ("Creator Budget", 34, (255, 140, 180))],
|
||||||
|
"crop_person": (0.05, 0.10, 0.70, 0.95),
|
||||||
|
"focus": (0.40, 0.40),
|
||||||
|
"bg_focus": (0.35, 0.45),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("STAFF", 82, (255, 255, 255)), ("CANTEEN", 78, (255, 230, 80)), ("Alone Lunch POV", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.30, 0.02, 0.90, 0.98),
|
||||||
|
"focus": (0.50, 0.28),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
focus=(0.5, 0.35),
|
min_bright=45,
|
||||||
|
min_sharp=60,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def do_07(folder: Path) -> None:
|
||||||
|
do_pack(
|
||||||
|
folder,
|
||||||
|
["VID_20261021_230159.mp4", "VID_20261021_230951.mp4", "VID_20261021_054147.mp4"],
|
||||||
|
T_NIGHT + T_DAY,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "YT_COVER.jpg",
|
||||||
|
"lines": [("UNDER $2", 86, (255, 230, 80)), ("FRIED RICE", 72, (255, 255, 255)), ("Night Cheap Eats", 34, (255, 140, 180))],
|
||||||
|
"crop_person": (0.18, 0.02, 0.88, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("WOK", 90, (255, 255, 255)), ("MASTER", 78, (255, 230, 80)), ("Menu Under $3", 34, (140, 255, 230))],
|
||||||
|
"crop_person": (0.25, 0.05, 0.85, 0.95),
|
||||||
|
"focus": (0.48, 0.30),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("NIGHT", 82, (255, 255, 255)), ("SMILES", 82, (255, 140, 180)), ("Street + Bowl", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.20, 0.02, 0.90, 0.98),
|
||||||
|
"focus": (0.50, 0.28),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
min_bright=35,
|
||||||
|
min_sharp=45,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def do_08(folder: Path) -> None:
|
||||||
|
do_pack(
|
||||||
|
folder,
|
||||||
|
["VID_20261022_052232.mp4", "VID_20261022_045948.mp4", "VID_20261022_231736.mp4"],
|
||||||
|
T_NIGHT + T_DAY,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "YT_COVER.jpg",
|
||||||
|
"lines": [("MALATANG", 82, (255, 55, 80)), ("NIGHT", 82, (255, 255, 255)), ("Steam + Neon", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.30, 0.02, 0.98, 0.98),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_B.jpg",
|
||||||
|
"lines": [("DAY→NIGHT", 70, (255, 255, 255)), ("FOOD LOOP", 70, (255, 230, 80)), ("Canteen to Market", 32, (140, 255, 230))],
|
||||||
|
"crop_person": (0.15, 0.05, 0.80, 0.98),
|
||||||
|
"focus": (0.45, 0.35),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "YT_COVER_C.jpg",
|
||||||
|
"lines": [("SPICY", 86, (255, 55, 80)), ("STEAM", 86, (255, 255, 255)), ("Click for Chaos", 34, (255, 230, 80))],
|
||||||
|
"crop_person": (0.35, 0.05, 0.98, 0.95),
|
||||||
|
"focus": (0.58, 0.32),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
min_bright=30,
|
||||||
|
min_sharp=40,
|
||||||
)
|
)
|
||||||
save(img, folder)
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
get_sr()
|
||||||
jobs = [
|
jobs = [
|
||||||
(("032711", "033518"), do_street, "street"),
|
(("091618", "092345"), do_01, "01"),
|
||||||
(("034248", "041246"), do_citywalk, "citywalk"),
|
(("092727", "093126"), do_02, "02"),
|
||||||
(("044816", "045155"), do_nm3, "nm3"),
|
(("034223", "060822"), do_03, "03"),
|
||||||
(("041738", "041845"), do_nm1, "nm1"),
|
(("194952", "201413"), do_04, "04"),
|
||||||
(("042529",), do_nm2, "nm2"),
|
(("043500", "044213"), do_05, "05"),
|
||||||
(("042937", "044719"), do_canteen, "canteen"),
|
(("050159", "051605"), do_06, "06"),
|
||||||
(("042040", "042141"), do_bike, "bike"),
|
(("054147", "230159"), do_07, "07"),
|
||||||
|
(("045948", "052232"), do_08, "08"),
|
||||||
]
|
]
|
||||||
out = ROOT / "_cover_out"
|
out = ROOT / "_cover_out"
|
||||||
out.mkdir(exist_ok=True)
|
out.mkdir(exist_ok=True)
|
||||||
@ -337,15 +596,13 @@ def main() -> None:
|
|||||||
print("MISS", label)
|
print("MISS", label)
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
print(f"... {label} {folder.name}")
|
||||||
fn(folder)
|
fn(folder)
|
||||||
import shutil
|
for name in ("YT_COVER.jpg", "YT_COVER_B.jpg", "YT_COVER_C.jpg"):
|
||||||
|
src = folder / name
|
||||||
src = folder / "YT_COVER.jpg"
|
shutil.copy2(src, out / f"{label}_{name}")
|
||||||
shutil.copy2(src, out / f"{label}_YT_COVER.jpg")
|
print(f" {name} {src.stat().st_size}")
|
||||||
print(f"OK {label} -> {src.stat().st_size}")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
|
||||||
|
|
||||||
print("FAIL", label, e)
|
print("FAIL", label, e)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Validate YT deliverables in a batch root (SRT / cover / titles).
|
"""Validate YT deliverables in a batch root (SRT / covers A/B/C / titles).
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
python validate_deliverables.py
|
python validate_deliverables.py
|
||||||
@ -15,6 +15,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
COVER_NAMES = ("YT_COVER.jpg", "YT_COVER_B.jpg", "YT_COVER_C.jpg")
|
||||||
|
|
||||||
|
|
||||||
def to_sec(ts: str) -> float:
|
def to_sec(ts: str) -> float:
|
||||||
h, m, rest = ts.split(":")
|
h, m, rest = ts.split(":")
|
||||||
@ -61,10 +63,9 @@ def check_cover(path: Path) -> list[str]:
|
|||||||
im = Image.open(path)
|
im = Image.open(path)
|
||||||
w, h = im.size
|
w, h = im.size
|
||||||
if (w, h) != (1280, 720):
|
if (w, h) != (1280, 720):
|
||||||
errs.append(f"cover size {w}x{h} (want 1280x720)")
|
errs.append(f"{path.name} size {w}x{h} (want 1280x720)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errs.append(f"cover unreadable: {e}")
|
errs.append(f"{path.name} unreadable: {e}")
|
||||||
# filename-side heuristic only; OCR optional / skipped
|
|
||||||
return errs
|
return errs
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +76,6 @@ def check_titles(path: Path) -> list[str]:
|
|||||||
errs.append("titles missing TITLES section")
|
errs.append("titles missing TITLES section")
|
||||||
if t.count("\n") < 8:
|
if t.count("\n") < 8:
|
||||||
errs.append("titles file looks too short")
|
errs.append("titles file looks too short")
|
||||||
# meta words should not appear as title copy
|
|
||||||
up = t.upper()
|
up = t.upper()
|
||||||
for bad in ("FACE + FULL BODY", "CHINA GIRL"):
|
for bad in ("FACE + FULL BODY", "CHINA GIRL"):
|
||||||
if bad in up:
|
if bad in up:
|
||||||
@ -88,7 +88,9 @@ def main() -> None:
|
|||||||
folders = [
|
folders = [
|
||||||
d
|
d
|
||||||
for d in sorted(root.iterdir(), key=lambda p: p.name.lower())
|
for d in sorted(root.iterdir(), key=lambda p: p.name.lower())
|
||||||
if d.is_dir() and not d.name.startswith("_") and not d.name.startswith(".")
|
if d.is_dir()
|
||||||
|
and not d.name.startswith("_")
|
||||||
|
and not d.name.startswith(".")
|
||||||
and list(d.glob("*.mp4"))
|
and list(d.glob("*.mp4"))
|
||||||
]
|
]
|
||||||
if not folders:
|
if not folders:
|
||||||
@ -100,16 +102,26 @@ def main() -> None:
|
|||||||
for d in folders:
|
for d in folders:
|
||||||
issues = []
|
issues = []
|
||||||
srt = d / "YT_CAPTIONS_EN.srt"
|
srt = d / "YT_CAPTIONS_EN.srt"
|
||||||
cover = d / "YT_COVER.jpg"
|
|
||||||
titles = d / "YT_TITLES.txt"
|
titles = d / "YT_TITLES.txt"
|
||||||
if not srt.exists():
|
if not srt.exists():
|
||||||
issues.append("missing YT_CAPTIONS_EN.srt")
|
issues.append("missing YT_CAPTIONS_EN.srt")
|
||||||
else:
|
else:
|
||||||
issues += [f"SRT: {e}" for e in check_srt(srt)]
|
issues += [f"SRT: {e}" for e in check_srt(srt)]
|
||||||
if not cover.exists():
|
|
||||||
issues.append("missing YT_COVER.jpg")
|
# ≥3 A/B/C covers; accept legacy ALT as B if B missing
|
||||||
else:
|
cover_a = d / "YT_COVER.jpg"
|
||||||
issues += [f"COVER: {e}" for e in check_cover(cover)]
|
cover_b = d / "YT_COVER_B.jpg"
|
||||||
|
cover_c = d / "YT_COVER_C.jpg"
|
||||||
|
legacy_alt = d / "YT_COVER_ALT.jpg"
|
||||||
|
if not cover_b.exists() and legacy_alt.exists():
|
||||||
|
cover_b = legacy_alt
|
||||||
|
|
||||||
|
for label, path in (("A", cover_a), ("B", cover_b), ("C", cover_c)):
|
||||||
|
if not path.exists():
|
||||||
|
issues.append(f"missing cover {label} (need YT_COVER.jpg / _B / _C for A/B test)")
|
||||||
|
else:
|
||||||
|
issues += [f"COVER-{label}: {e}" for e in check_cover(path)]
|
||||||
|
|
||||||
if not titles.exists():
|
if not titles.exists():
|
||||||
issues.append("missing YT_TITLES.txt")
|
issues.append("missing YT_TITLES.txt")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
---
|
---
|
||||||
name: china-yt-longform
|
name: china-yt-longform
|
||||||
description: >-
|
description: >-
|
||||||
Batch-produce Alone-in-China / Chinese street-food YouTube long-form assets:
|
Batch-produce Alone-in-China YouTube long-form assets from raw mp4 dumps or
|
||||||
CapCut-safe English SRT, viral covers from real footage faces/bodies, English
|
themed folders: analyze footage, split into per-video folders (prefer 8–15 min
|
||||||
titles/descriptions. Use when the user mentions 剪辑, 长视频, 封面, 字幕, SRT,
|
when natural — never pad unrelated clips), CapCut-safe EN SRT woven to food /
|
||||||
CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, YT_COVER, YT_CAPTIONS,
|
life-in-China citywalk beauty / YouTube money, ≥3 A/B-test covers with
|
||||||
probe_durations, validate_deliverables, or folders of mp4s for YouTube upload.
|
photographic super-res HD, titles. Use when the user mentions 剪辑, 长视频,
|
||||||
|
封面, 字幕, SRT, CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, 素材,
|
||||||
|
分集, A/B, 超分, YT_COVER, YT_CAPTIONS, probe_durations, validate_deliverables,
|
||||||
|
or drops a folder of mp4s for YouTube upload.
|
||||||
---
|
---
|
||||||
|
|
||||||
# China YT Long-form Batch Ops
|
# China YT Long-form Batch Ops
|
||||||
@ -14,28 +17,70 @@ Pack root = parent of `.cursor/skills/china-yt-longform` (or ask user).
|
|||||||
Human SOP: `README.md` · Details: [reference.md](reference.md)
|
Human SOP: `README.md` · Details: [reference.md](reference.md)
|
||||||
Scripts: `scripts/probe_durations.py`, `validate_deliverables.py`, `new_batch.py`, `_gen_srt_copy.py`, `_make_covers_v4.py`
|
Scripts: `scripts/probe_durations.py`, `validate_deliverables.py`, `new_batch.py`, `_gen_srt_copy.py`, `_make_covers_v4.py`
|
||||||
|
|
||||||
## Deliverables (each media subfolder)
|
## Channel cores (hard — every SRT / title / description)
|
||||||
|
|
||||||
|
Weave **all three** into narration (match real footage first, then steer):
|
||||||
|
|
||||||
|
1. **Food** — street food, canteen, menus, prices, steam, orders
|
||||||
|
2. **Life in China** — citywalk POV, scooters, neon, **real street beauty/faces** (tasteful; no creepy framing)
|
||||||
|
3. **YouTube money** — channel ops, consistency, watch time, how the channel changed life / honest income talk (no fake flex)
|
||||||
|
|
||||||
|
Do **not** ignore the picture to force a pillar. Ground lines in what is on screen, then connect to the cores.
|
||||||
|
|
||||||
|
## Deliverables (each media subfolder = one upload)
|
||||||
|
|
||||||
| File | Role |
|
| File | Role |
|
||||||
|------|------|
|
|------|------|
|
||||||
|
| `*.mp4` (1+) | Source clips for this one video (CapCut timeline order ≈ name/time order) |
|
||||||
| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS |
|
| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS |
|
||||||
| `YT_COVER.jpg` | 1280×720 (`YT_COVER_ALT.jpg` optional) |
|
| `YT_COVER.jpg` | A — default thumbnail 1280×720 |
|
||||||
|
| `YT_COVER_B.jpg` | B — A/B test variant 1280×720 |
|
||||||
|
| `YT_COVER_C.jpg` | C — A/B test variant 1280×720 |
|
||||||
| `YT_TITLES.txt` | 5 EN titles + description + tags |
|
| `YT_TITLES.txt` | 5 EN titles + description + tags |
|
||||||
|
|
||||||
One subfolder = one YT video. Multiple mp4s = concat by summed duration.
|
**≥3 covers required** (A/B/C) for YouTube thumbnail experiments. Extra `YT_COVER_D.jpg`… OK.
|
||||||
|
`YT_COVER_ALT.jpg` is legacy alias for B — prefer `YT_COVER_B.jpg`.
|
||||||
|
|
||||||
|
**One subfolder = one YT video.** Multiple mp4s in a folder = concat by summed duration.
|
||||||
`_` / `.` prefixed dirs = tools/cache, not media.
|
`_` / `.` prefixed dirs = tools/cache, not media.
|
||||||
|
|
||||||
|
## Duration policy (prefer 8–15 min — never 硬凑)
|
||||||
|
|
||||||
|
- **Prefer** ~8–15 min per folder when clips **naturally** form a coherent scene/theme/time block.
|
||||||
|
- **Do not** glue unrelated scenes just to hit 8 min.
|
||||||
|
- **Do not** split a tight coherent story just to avoid going over 15 if a clean split would hurt (prefer a clean thematic cut; ~16–18 min OK if one continuous scene).
|
||||||
|
- **Short packs OK** (e.g. 5–7 min) when that is the real material — label honestly in titles; tell the user.
|
||||||
|
- **Long continuous clips** (>15–20 min): split on scene/location/time boundaries, not arbitrary clock cuts mid-action.
|
||||||
|
- Target band is a **guide for upload strategy**, not a padding rule.
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
|
### A) Flat mp4 dump (common: `V3YYYY-MM-DD…` with dozens of clips)
|
||||||
|
|
||||||
|
```
|
||||||
|
- [ ] 1. List / ffprobe all root *.mp4 (duration + time-of-day from filename)
|
||||||
|
- [ ] 2. Sample mid-frames (ffmpeg) → cluster by time + scene (ride / street / food / canteen / night…)
|
||||||
|
- [ ] 3. Create numbered theme folders; MOVE clips in (same-drive rename). Write _BATCH_PLAN.txt
|
||||||
|
- [ ] 4. python scripts/probe_durations.py <batch>
|
||||||
|
- [ ] 5. Copy/edit _gen_srt_copy.py + _make_covers_v4.py into batch root for THIS footage
|
||||||
|
- [ ] 6. CapCut-safe EN SRT (dense) + YT_TITLES — 3 cores + real content
|
||||||
|
- [ ] 7. ≥3 covers A/B/C from REAL frames + photographic super-res HD
|
||||||
|
- [ ] 8. python scripts/validate_deliverables.py <batch> → must pass
|
||||||
|
```
|
||||||
|
|
||||||
|
Folder naming example: `01_night_scooter_ride`, `05_food_street_walk` — sortable, theme-clear for CapCut.
|
||||||
|
|
||||||
|
### B) Already-foldered batch
|
||||||
|
|
||||||
```
|
```
|
||||||
- [ ] 1. python scripts/probe_durations.py <batch>
|
- [ ] 1. python scripts/probe_durations.py <batch>
|
||||||
- [ ] 2. CapCut-safe EN SRT (dense)
|
- [ ] 2. CapCut-safe EN SRT (dense)
|
||||||
- [ ] 3. YT_TITLES.txt
|
- [ ] 3. YT_TITLES.txt
|
||||||
- [ ] 4. Covers from REAL frames (no AI faces; no yellow boxes)
|
- [ ] 4. ≥3 covers A/B/C + super-res HD
|
||||||
- [ ] 5. python scripts/validate_deliverables.py <batch> → must pass
|
- [ ] 5. python scripts/validate_deliverables.py <batch> → must pass
|
||||||
```
|
```
|
||||||
|
|
||||||
Default order: **SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked.
|
Default order: **organize (if needed) → SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked.
|
||||||
|
|
||||||
### New empty batch
|
### New empty batch
|
||||||
|
|
||||||
@ -47,14 +92,24 @@ Then drop mp4s, probe, edit pack scripts, generate, validate.
|
|||||||
|
|
||||||
## CapCut SRT (hard)
|
## CapCut SRT (hard)
|
||||||
|
|
||||||
- English; match food / street / beauty / alone-in-China
|
- English; **picture-true** first, then food / life-in-China beauty / YT money
|
||||||
- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s
|
- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s
|
||||||
- Duration ≥ speech (~2.3–2.4 wps + buffer)
|
- Duration ≥ speech (~2.3–2.4 wps + buffer)
|
||||||
- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues**
|
- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues** (shorter videos: scale down, still dense)
|
||||||
- Pass validate: overlap=0, multiline=0, last end ≈ duration
|
- Pass validate: overlap=0, multiline=0, last end ≈ duration
|
||||||
|
|
||||||
## Cover (hard)
|
## Cover (hard)
|
||||||
|
|
||||||
|
**Count:** **minimum 3** distinct thumbnails per folder for YouTube A/B testing:
|
||||||
|
|
||||||
|
| File | Variant |
|
||||||
|
|------|---------|
|
||||||
|
| `YT_COVER.jpg` | A (default upload) |
|
||||||
|
| `YT_COVER_B.jpg` | B |
|
||||||
|
| `YT_COVER_C.jpg` | C |
|
||||||
|
|
||||||
|
Variants must **differ** in at least two of: source frame / crop focus / hook copy (same video, different CTR bets).
|
||||||
|
|
||||||
**Pixels (never print on image):** real faces/bodies (prefer women); face + readable figure.
|
**Pixels (never print on image):** real faces/bodies (prefer women); face + readable figure.
|
||||||
|
|
||||||
**On-image text only:** viewer hooks — `UNDER $3`, `SHE LOOKED AT MY CAMERA`, `MALATANG STEAM`…
|
**On-image text only:** viewer hooks — `UNDER $3`, `SHE LOOKED AT MY CAMERA`, `MALATANG STEAM`…
|
||||||
@ -63,9 +118,16 @@ Then drop mp4s, probe, edit pack scripts, generate, validate.
|
|||||||
|
|
||||||
Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets.
|
Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets.
|
||||||
|
|
||||||
|
**HD / super-res (hard) — AI only, no local compute:**
|
||||||
|
- **Forbidden:** running Real-ESRGAN / OpenCV EDSR-FSRCNN / heavy DNN upscale / GPU-Vulkan SR on the **user’s PC**. User has banned local SR compute.
|
||||||
|
- **Required:** agent **AI image generation** (GenerateImage / equivalent) for heavy photographic restore + cover compose — like old-photo HD restore, **not** oil-paint.
|
||||||
|
- Pipeline: extract 1–2 reference stills per variant (ffmpeg frame grab only — lightweight) → AI generate each cover from those refs → save `YT_COVER.jpg` / `_B` / `_C` at 1280×720 into the folder.
|
||||||
|
- Goal: **clear photo HD**; preserve real people/scene from refs; viewer hooks as text on image.
|
||||||
|
- Still: no meta cover text; no yellow boxes; ≥3 distinct A/B/C variants.
|
||||||
|
|
||||||
## Titles
|
## Titles
|
||||||
|
|
||||||
Viral, honest Alone-in-China / night-market / street POV.
|
Viral, honest — can lead with food, citywalk/life, or channel-money angle; stay true to the folder’s footage.
|
||||||
|
|
||||||
## Fix loop
|
## Fix loop
|
||||||
|
|
||||||
@ -73,11 +135,16 @@ Viral, honest Alone-in-China / night-market / street POV.
|
|||||||
|-----------|--------|
|
|-----------|--------|
|
||||||
| Meta cover text | Viewer hooks only |
|
| Meta cover text | Viewer hooks only |
|
||||||
| Yellow box | Remove frames/badges |
|
| Yellow box | Remove frames/badges |
|
||||||
|
| Oil-paint / mushy HD | Cut sharpen stack; re-run photographic super-res only |
|
||||||
|
| Only 1–2 covers | Generate B/C with different frame+hook |
|
||||||
| Sparse SRT | Add lines + regenerate |
|
| Sparse SRT | Add lines + regenerate |
|
||||||
|
| Pillars missing / off-topic | Rewrite lines: on-screen → pillar bridge |
|
||||||
|
| Hard-padded mashup | Re-split by theme; allow short/long folders |
|
||||||
| validate fails | Fix listed issues, re-run |
|
| validate fails | Fix listed issues, re-run |
|
||||||
|
|
||||||
## Script notes
|
## Script notes
|
||||||
|
|
||||||
- Prefer pack `scripts/` tools; copy into batch root when customizing
|
- Prefer pack `scripts/` tools; copy into batch root when customizing
|
||||||
|
- Super-res models: `tools/opencv_sr/EDSR_x2.pb` (and optional `tools/realesrgan/`)
|
||||||
- Unicode JPG: `cv2.imencode` + `Path.write_bytes`
|
- Unicode JPG: `cv2.imencode` + `Path.write_bytes`
|
||||||
- Deps: `pip install -r requirements.txt`
|
- Deps: `pip install -r requirements.txt`
|
||||||
|
|||||||
@ -18,17 +18,66 @@ python _gen_srt_copy.py
|
|||||||
python _make_covers_v4.py
|
python _make_covers_v4.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Flat dump → per-video folders
|
||||||
|
|
||||||
|
When the batch root is full of loose `VID_*.mp4` (no theme subfolders):
|
||||||
|
|
||||||
|
1. **Probe** each file duration (`ffprobe` / custom script).
|
||||||
|
2. **Preview** mid-frames for scene labels (night ride, food street, canteen…).
|
||||||
|
3. **Group by theme + contiguous time**, not by stopwatch alone.
|
||||||
|
4. **MOVE** into `01_theme_slug/`, `02_…/` — each folder = one CapCut project / one upload.
|
||||||
|
5. Write `_BATCH_PLAN.txt` listing clips + approx duration per folder.
|
||||||
|
6. Then normal probe → SRT → titles → covers → validate.
|
||||||
|
|
||||||
|
### Duration (no 硬凑)
|
||||||
|
|
||||||
|
| Situation | Action |
|
||||||
|
|-----------|--------|
|
||||||
|
| Coherent block ~8–15 min | One folder |
|
||||||
|
| Coherent but ~5–7 min | Keep short; don’t paste unrelated B-roll |
|
||||||
|
| Coherent but ~16–20 min | Prefer thematic mid-split; else one longer video OK |
|
||||||
|
| Random short leftovers | Own small folder or ask user; never frankenstein |
|
||||||
|
|
||||||
## Folder layout
|
## Folder layout
|
||||||
|
|
||||||
```
|
```
|
||||||
BatchRoot/
|
BatchRoot/
|
||||||
clip-a/ *.mp4 YT_CAPTIONS_EN.srt YT_COVER.jpg YT_TITLES.txt
|
01_night_scooter_ride/
|
||||||
|
*.mp4
|
||||||
|
YT_CAPTIONS_EN.srt
|
||||||
|
YT_COVER.jpg # A
|
||||||
|
YT_COVER_B.jpg # B — A/B test
|
||||||
|
YT_COVER_C.jpg # C — A/B test
|
||||||
|
YT_TITLES.txt
|
||||||
|
02_food_street_walk/
|
||||||
|
...
|
||||||
_meta_probe.json
|
_meta_probe.json
|
||||||
|
_BATCH_PLAN.txt
|
||||||
_gen_srt_copy.py
|
_gen_srt_copy.py
|
||||||
_make_covers_v4.py
|
_make_covers_v4.py
|
||||||
_cover_out/
|
_cover_out/
|
||||||
|
tools/opencv_sr/EDSR_x2.pb # photographic x2 super-res (pack root)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Three channel cores (SRT / titles)
|
||||||
|
|
||||||
|
Every pack’s `lines` + description should hit:
|
||||||
|
|
||||||
|
1. **Food** — what you see/smell/order/prices
|
||||||
|
2. **Life in China** — POV streets, scooters, tasteful beauty/citywalk faces
|
||||||
|
3. **YouTube money** — habits, watch time, life change, honest income (no fake flex)
|
||||||
|
|
||||||
|
Pattern per cue cluster: **on-screen detail → soft bridge to a core → CTA/habit**.
|
||||||
|
|
||||||
|
## Covers A/B/C + AI HD (no local SR)
|
||||||
|
|
||||||
|
- Always ship **≥3** files: `YT_COVER.jpg`, `YT_COVER_B.jpg`, `YT_COVER_C.jpg`
|
||||||
|
- Differ frame **and/or** crop **and/or** hook text so YouTube A/B has real CTR contrast
|
||||||
|
- **HD via agent AI image gen** from real footage reference stills (old-photo restore look)
|
||||||
|
- **Do not** run local Real-ESRGAN / OpenCV EDSR-FSRCNN / user-GPU upscale
|
||||||
|
- Lightweight ffmpeg frame extract for refs only is OK
|
||||||
|
- Final size **1280×720**; photographic, not oil-paint
|
||||||
|
|
||||||
## YT_TITLES.txt template
|
## YT_TITLES.txt template
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@ -41,9 +90,11 @@ BatchRoot/
|
|||||||
|
|
||||||
=== DESCRIPTION ===
|
=== DESCRIPTION ===
|
||||||
...
|
...
|
||||||
|
(mention food + life in China + channel growth as fits the footage)
|
||||||
|
|
||||||
=== TAGS ===
|
=== TAGS ===
|
||||||
alone in china, chinese street food, night market, china vlog, ...
|
alone in china, chinese street food, life in china, night market, china vlog,
|
||||||
|
youtube growth, city walk, ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## SRT packing
|
## SRT packing
|
||||||
@ -51,6 +102,7 @@ alone in china, chinese street food, night market, china vlog, ...
|
|||||||
- Spread across full runtime; add lines if gaps feel empty
|
- Spread across full runtime; add lines if gaps feel empty
|
||||||
- Keep hook opening + CTA close
|
- Keep hook opening + CTA close
|
||||||
- Trim middle lines first if over-length
|
- Trim middle lines first if over-length
|
||||||
|
- Shorter videos: fewer cues OK if still ~1 / 8–12s
|
||||||
|
|
||||||
## Cover composition
|
## Cover composition
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user