From a39162ee8394ac5f116a50f8f67b612ef5e1cd10 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Mon, 19 Oct 2026 21:42:37 +0800 Subject: [PATCH] Initial commit: China YT long-form skill pack. EOF --- .cursor/skills/china-yt-longform/SKILL.md | 83 +++ .cursor/skills/china-yt-longform/reference.md | 67 +++ .gitignore | 9 + README.md | 127 ++++ install_skill.ps1 | 25 + requirements.txt | 3 + scripts/_gen_srt_copy.py | 551 ++++++++++++++++++ scripts/_make_covers_v4.py | 354 +++++++++++ scripts/new_batch.py | 62 ++ scripts/probe_durations.py | 77 +++ scripts/validate_deliverables.py | 131 +++++ skills/china-yt-longform/SKILL.md | 83 +++ skills/china-yt-longform/reference.md | 67 +++ 交付检查清单.md | 29 + 如何安装Skill.md | 34 ++ 15 files changed, 1702 insertions(+) create mode 100644 .cursor/skills/china-yt-longform/SKILL.md create mode 100644 .cursor/skills/china-yt-longform/reference.md create mode 100644 .gitignore create mode 100644 README.md create mode 100644 install_skill.ps1 create mode 100644 requirements.txt create mode 100644 scripts/_gen_srt_copy.py create mode 100644 scripts/_make_covers_v4.py create mode 100644 scripts/new_batch.py create mode 100644 scripts/probe_durations.py create mode 100644 scripts/validate_deliverables.py create mode 100644 skills/china-yt-longform/SKILL.md create mode 100644 skills/china-yt-longform/reference.md create mode 100644 交付检查清单.md create mode 100644 如何安装Skill.md diff --git a/.cursor/skills/china-yt-longform/SKILL.md b/.cursor/skills/china-yt-longform/SKILL.md new file mode 100644 index 0000000..1ca9f20 --- /dev/null +++ b/.cursor/skills/china-yt-longform/SKILL.md @@ -0,0 +1,83 @@ +--- +name: china-yt-longform +description: >- + Batch-produce Alone-in-China / Chinese street-food YouTube long-form assets: + CapCut-safe English SRT, viral covers from real footage faces/bodies, English + titles/descriptions. Use when the user mentions 剪辑, 长视频, 封面, 字幕, SRT, + CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, YT_COVER, YT_CAPTIONS, + probe_durations, validate_deliverables, or folders of mp4s for YouTube upload. +--- + +# China YT Long-form Batch Ops + +Pack root = parent of `.cursor/skills/china-yt-longform` (or ask user). +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` + +## Deliverables (each media subfolder) + +| File | Role | +|------|------| +| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS | +| `YT_COVER.jpg` | 1280×720 (`YT_COVER_ALT.jpg` optional) | +| `YT_TITLES.txt` | 5 EN titles + description + tags | + +One subfolder = one YT video. Multiple mp4s = concat by summed duration. +`_` / `.` prefixed dirs = tools/cache, not media. + +## Workflow + +``` +- [ ] 1. python scripts/probe_durations.py +- [ ] 2. CapCut-safe EN SRT (dense) +- [ ] 3. YT_TITLES.txt +- [ ] 4. Covers from REAL frames (no AI faces; no yellow boxes) +- [ ] 5. python scripts/validate_deliverables.py → must pass +``` + +Default order: **SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked. + +### New empty batch + +```bash +python scripts/new_batch.py "D:/Desktop/V3-YYYY-MM-DD主题" street nightmarket +``` + +Then drop mp4s, probe, edit pack scripts, generate, validate. + +## CapCut SRT (hard) + +- English; match food / street / beauty / alone-in-China +- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s +- Duration ≥ speech (~2.3–2.4 wps + buffer) +- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues** +- Pass validate: overlap=0, multiline=0, last end ≈ duration + +## Cover (hard) + +**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`… + +**Forbidden on cover:** 人脸 / 全身 / 中国女人 / FACE+FULL BODY / CHINA GIRL; yellow frames; sticker badges. + +Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets. + +## Titles + +Viral, honest Alone-in-China / night-market / street POV. + +## Fix loop + +| Complaint | Action | +|-----------|--------| +| Meta cover text | Viewer hooks only | +| Yellow box | Remove frames/badges | +| Sparse SRT | Add lines + regenerate | +| validate fails | Fix listed issues, re-run | + +## Script notes + +- Prefer pack `scripts/` tools; copy into batch root when customizing +- Unicode JPG: `cv2.imencode` + `Path.write_bytes` +- Deps: `pip install -r requirements.txt` diff --git a/.cursor/skills/china-yt-longform/reference.md b/.cursor/skills/china-yt-longform/reference.md new file mode 100644 index 0000000..38a5a6c --- /dev/null +++ b/.cursor/skills/china-yt-longform/reference.md @@ -0,0 +1,67 @@ +# Reference — China YT Long-form + +## Commands + +Run from pack, pointing at a batch root: + +```bash +pip install -r requirements.txt +python scripts/probe_durations.py "D:/Desktop/MyBatch" +python scripts/validate_deliverables.py "D:/Desktop/MyBatch" +python scripts/new_batch.py "D:/Desktop/V3-2026-10-20夜市" street nightmarket bike +``` + +After copying generators into the batch root: + +```bash +python _gen_srt_copy.py +python _make_covers_v4.py +``` + +## Folder layout + +``` +BatchRoot/ + clip-a/ *.mp4 YT_CAPTIONS_EN.srt YT_COVER.jpg YT_TITLES.txt + _meta_probe.json + _gen_srt_copy.py + _make_covers_v4.py + _cover_out/ +``` + +## YT_TITLES.txt template + +```text +=== YOUTUBE TITLES (pick 1) === +1. ... +2. ... +3. ... +4. ... +5. ... + +=== DESCRIPTION === +... + +=== TAGS === +alone in china, chinese street food, night market, china vlog, ... +``` + +## SRT packing + +- Spread across full runtime; add lines if gaps feel empty +- Keep hook opening + CTA close +- Trim middle lines first if over-length + +## Cover composition + +- Right person panel (soft fade) + left environment +- Thin accent line OK; boxes/badges not OK +- Hand-pick timestamps; Haar on signs is often a false positive + +## Install for friends + +- One-click: `install_skill.ps1` +- Or copy `skills/china-yt-longform/` → `%USERPROFILE%/.cursor/skills/china-yt-longform/` +- Or open this pack folder in Cursor (uses `.cursor/skills/`) + +See `如何安装Skill.md`. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06d0310 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +__pycache__/ +*.py[cod] +.Python +.env +.venv/ +venv/ +*.log +.DS_Store +Thumbs.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..37afaa9 --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +# 中国生活 YouTube 长视频 · 剪辑交付 SOP + +Alone in China / 美食 / 夜市 / 街拍 / 骑行 POV 长视频。 +**整夹打包发给朋友即可**;对方看 `如何安装Skill.md` 或双击 `install_skill.ps1`。 + +--- + +## 0. 本包里有什么 + +``` +中国生活YT长视频SOP/ + README.md ← 本文 + 交付检查清单.md + 如何安装Skill.md + install_skill.ps1 ← 一键装到 Cursor 个人 Skills + requirements.txt + .cursor/skills/china-yt-longform/ ← 打开本夹即用 + skills/china-yt-longform/ ← 可复制到 ~/.cursor/skills/ + scripts/ + probe_durations.py + validate_deliverables.py + new_batch.py + _gen_srt_copy.py ← 样例(需按新批次改 PACKS) + _make_covers_v4.py ← 样例(需按新批次改时间戳) +``` + +依赖:`pip install -r requirements.txt`(opencv-python / numpy / Pillow) + +--- + +## 1. 每条视频交付 3 样 + +| 文件 | 用途 | +|------|------| +| `YT_CAPTIONS_EN.srt` | 英文旁白 → CapCut「朗读」 | +| `YT_COVER.jpg` | 1280×720 封面 | +| `YT_TITLES.txt` | 5 英文标题 + Description + Tags | + +--- + +## 2. 素材怎么摆 + +``` +批次根目录/ + city walk/ *.mp4 + 三个交付文件 + 夜市/ + _meta_probe.json + _gen_srt_copy.py + _make_covers_v4.py +``` + +- 一子文件夹 = 一条 YT 长视频 +- 多段 mp4 = 时长相加 +- `_` / `.` 开头 = 工具/缓存,不当素材 + +快速建批次: + +```powershell +python scripts\new_batch.py "D:\Desktop\V3-2026-10-20夜市" street nightmarket bike +``` + +--- + +## 3. 标准流程 + +```powershell +cd 你的批次根目录 +python 路径\scripts\probe_durations.py . +# 编辑并运行字幕/封面脚本(可从 scripts\ 拷来) +python _gen_srt_copy.py +python _make_covers_v4.py +python 路径\scripts\validate_deliverables.py . +``` + +对 Cursor:`按 china-yt-longform 处理桌面某某批次` + +默认顺序:**字幕+标题 → 封面**。 + +--- + +## 4. 字幕硬规则(CapCut) + +1. 英文,贴画面 +2. **每条 cue 仅 1 行** +3. **零重叠**,间隙约 0.28~0.35s +4. 时长 ≥ 朗读时间(约 2.3~2.4 词/秒) +5. 约每 8~12 秒一条;≥8 分钟要 40~60+ 条,别太稀 + +自检:`overlap=0` / `multiline=0` / 末尾贴近片尾。 + +--- + +## 5. 封面硬规则 + +**画面(制作目标,别印在图上):** 真人人脸/身材(优先女性),脸清 + 能看出人。 + +**图上的字(给观众):** `UNDER $3` / `SHE LOOKED AT MY CAMERA` / `MALATANG STEAM` 等钩子。 + +**禁止:** +`人脸` `全身` `中国女人` `FACE+FULL BODY` `CHINA GIRL`;黄框;大红角标贴纸。 + +用干净大图拼人 + 左侧大字(v4 风格)。 + +--- + +## 6. 标题调性 + +真实 Alone in China / 夜市 / 街拍;少假大空旅游腔。 + +--- + +## 7. 踩坑 + +| 问题 | 做法 | +|------|------| +| 封面写制作要求 | 只写观众钩子 | +| 黄框小头像 | 删掉框 | +| 字幕太稀 | 加旁白条数 | +| CapCut 叠音 | 查重叠 + 加大间隙 | +| 中文路径 JPG 失败 | `imencode` + `write_bytes` | + +--- + +## 8. 分享前 + +把整个 `中国生活YT长视频SOP` 文件夹压缩发送。 +朋友:运行 `install_skill.ps1`,或用 Cursor 打开本夹。 diff --git a/install_skill.ps1 b/install_skill.ps1 new file mode 100644 index 0000000..b60b7a1 --- /dev/null +++ b/install_skill.ps1 @@ -0,0 +1,25 @@ +# Install china-yt-longform into the current user's Cursor personal skills. +# Run: 右键 → 使用 PowerShell 运行,或在本目录执行: +# powershell -ExecutionPolicy Bypass -File .\install_skill.ps1 + +$ErrorActionPreference = "Stop" +$src = Join-Path $PSScriptRoot "skills\china-yt-longform" +if (-not (Test-Path -LiteralPath $src)) { + $src = Join-Path $PSScriptRoot ".cursor\skills\china-yt-longform" +} +if (-not (Test-Path -LiteralPath $src)) { + Write-Host "ERROR: skill folder not found next to this script." -ForegroundColor Red + exit 1 +} + +$dstRoot = Join-Path $env:USERPROFILE ".cursor\skills" +$dst = Join-Path $dstRoot "china-yt-longform" +New-Item -ItemType Directory -Force -Path $dstRoot | Out-Null +if (Test-Path -LiteralPath $dst) { + Remove-Item -LiteralPath $dst -Recurse -Force +} +Copy-Item -LiteralPath $src -Destination $dst -Recurse -Force + +Write-Host "Installed -> $dst" -ForegroundColor Green +Write-Host "Open a NEW Cursor chat, then say: 按 china-yt-longform 处理我的视频批次" +Write-Host "Optional deps: pip install -r requirements.txt" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d17d95a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +opencv-python>=4.8 +numpy>=1.24 +Pillow>=10.0 diff --git a/scripts/_gen_srt_copy.py b/scripts/_gen_srt_copy.py new file mode 100644 index 0000000..1c5f69f --- /dev/null +++ b/scripts/_gen_srt_copy.py @@ -0,0 +1,551 @@ +# -*- coding: utf-8 -*- +"""Generate CapCut-safe English SRT + YouTube titles/descriptions per folder. +CapCut 朗读 rules: 1 line/cue, cue duration >= speech time, no overlapping cues. +""" +from __future__ import annotations + +import json +import re +from pathlib import Path + +ROOT = Path(__file__).resolve().parent + +# ~2.4 words/sec for clear US male TTS + buffers +WPS = 2.4 +MIN_CUE = 1.5 +GAP = 0.28 # silence between cues — prevents double-voice +LEAD = 0.6 # start after video begins + + +def ts(sec: float) -> str: + if sec < 0: + sec = 0 + h = int(sec // 3600) + m = int((sec % 3600) // 60) + s = int(sec % 60) + ms = int(round((sec - int(sec)) * 1000)) + if ms >= 1000: + ms = 0 + s += 1 + return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}" + + +def speech_dur(text: str) -> float: + words = len(re.findall(r"[A-Za-z0-9']+", text)) + return max(MIN_CUE, words / WPS + 0.45) + + +def build_srt(lines: list[str], total: float) -> str: + """Pack lines across [LEAD, total-0.5] with no overlap.""" + end_limit = max(LEAD + 5, total - 0.4) + usable = end_limit - LEAD + # estimate total speech need + need = sum(speech_dur(x) + GAP for x in lines) - GAP + # if too long, trim lines from middle-ish (keep hook + close) + while need > usable * 0.98 and len(lines) > 8: + # drop every other mid line + mid = lines[2:-2] + if not mid: + break + drop = mid[len(mid) // 2] + lines = lines[:2] + [x for x in mid if x is not drop] + lines[-2:] + need = sum(speech_dur(x) + GAP for x in lines) - GAP + + # stretch gaps across the full runtime (more lines => denser talk) + base = sum(speech_dur(x) for x in lines) + gaps_n = max(1, len(lines) - 1) + spare = usable - base + gap = max(GAP, spare / gaps_n) if spare > 0 else GAP * 0.5 + + cues = [] + t = LEAD + for i, text in enumerate(lines, 1): + d = speech_dur(text) + if t + d > end_limit: + # compress remaining into leftover + left = end_limit - t + if left < 1.2: + break + d = left + start, end = t, t + d + cues.append((i, start, end, text.strip())) + t = end + gap + if t >= end_limit: + break + + # if we finished early with leftover lines, force-fit last closing line near end + if lines and cues and cues[-1][3] != lines[-1]: + close = lines[-1] + d = min(speech_dur(close), 4.0) + start = max(cues[-1][2] + 0.2, end_limit - d - 0.1) + if start + 1.0 < end_limit and start >= cues[-1][2]: + cues.append((len(cues) + 1, start, min(start + d, end_limit), close)) + + out = [] + for i, start, end, text in cues: + # hard guarantee no overlap / single line + text = text.replace("\n", " ").strip() + out.append(f"{i}\n{ts(start)} --> {ts(end)}\n{text}\n") + return "\n".join(out).rstrip() + "\n" + + +# Content packs keyed by identifying video stem present in folder +PACKS = { + "citywalk": { + "match": ("034248", "041246", "041500"), + "slug": "citywalk", + "title_file": "YT_TITLES.txt", + "srt_file": "YT_CAPTIONS_EN.srt", + "titles": [ + "I Walked Alone Through China's Busiest Food Street (Everything Smelled Amazing)", + "POV: Night Market City Walk in China — Real Street Food, Real Life", + "Alone in China: Following Neon Lights to $2 Street Food", + "This Chinese Food Street Hit Different at Golden Hour", + "Living Alone in China — City Walk Where Locals Actually Eat", + ], + "description": """Walking alone through a real Chinese food street — lanterns, scooters, Guangdong rice rolls, and the kind of neon that makes you forget your phone battery. + +No tourist map. Just POV city walking, street food signs glowing, and everyday people living their night. + +If you're building a YouTube life around China: film what you smell first. The algorithm loves honest hunger. + +📍 Real local food street | scooters | night snacks | alone in China lifestyle + +#AloneInChina #ChineseStreetFood #NightMarket #ChinaVlog #CityWalk #FoodTour #RealLifeInChina #StreetFood #POV""", + "lines": [ + "Tonight I'm walking alone through a Chinese food street.", + "No guide. No plan. Just neon and hunger.", + "The sky is soft grey, but the stalls already glow.", + "Those red lanterns mean one thing — snacks everywhere.", + "Scooters slide past like this is normal Tuesday traffic.", + "Listen to that hum — engines, oil, people talking fast.", + "Look at that sign — Guangdong steamed rice rolls.", + "Fresh cut. Hot steam. Instant appetite.", + "This is where locals eat after work, not tourists.", + "I'm filming everything because this is my YouTube life in China.", + "One person. One camera. Real streets.", + "Every stall smells different — sweet, spicy, greasy, perfect.", + "A girl checks her phone while the food window glows behind her.", + "That backpack rig? Someone else is also recording their night.", + "In China, street food is not a show. It's dinner.", + "I keep walking because every corner looks like a thumbnail.", + "Skewers on the left. Cold drinks on the right.", + "Luckin Coffee on one side. Smoke and skewers on the other.", + "This contrast is modern China in one block.", + "A vendor flips something in the pan and the whole alley smells richer.", + "If you want views, film what Americans can't smell through a screen.", + "Cheap bites. Loud signs. Soft evening light.", + "I'm alone here, but the street never feels empty.", + "Someone laughs behind me. Someone orders without looking up.", + "That's the secret of living in China for YouTube.", + "Walk slow. Taste later. Let the city talk first.", + "Neon characters blink like they're begging for a close-up.", + "I pass a snack photo board and almost break character.", + "Don't sprint the street — linger on the details.", + "Plastic stools. Tiny tables. Big flavor.", + "This is daily life dressed up as content.", + "My battery is dropping, but my curiosity is not.", + "Subscribe if you want more real nights like this.", + "Save this walk for when you miss China energy.", + "Comment what you'd order first from these stalls.", + "Next stop — whatever smells strongest.", + "I'll keep filming until the lanterns own the whole block.", + "A couple shares one skewer like it's a tiny date.", + "Oil pops in a wok and everyone turns for half a second.", + "I catch a neon reflection in a puddle — free cinematography.", + "Don't blink past the side stalls. That's where the gems hide.", + "Cold drink in one hand. Hot snack in the other. Balance.", + "This street teaches you more than any China guidebook.", + "I adjust the framing and keep drifting forward.", + "If the algorithm asks what this video is — it's hunger with legs.", + "Alone in China, one food street at a time.", + "Thanks for walking with me tonight.", + "One last pan of skewers before I cut.", + "If you're still here, hit subscribe for the next night walk.", + "China after dark never really ends — we just stop filming.", + ], + }, + "nm1": { + "match": ("041738", "041845"), + "slug": "nightmarket", + "titles": [ + "Chinese Night Market Under $3 — Potstickers, Stinky Tofu, Lemon Tea", + "I Tried the Loudest Street Food Block in My Chinese City", + "Alone in China: Night Market Foods Locals Queue For", + "Stinky Tofu vs Potstickers — Which Would You Pick?", + "Real China Night Market POV (No Tourist Filter)", + ], + "description": """Night market run in a real Chinese city — fresh meat potstickers, stinky tofu smoke, grilled squid, hand-shaken lemon tea, and Wuhan-style doupi glowing on the menu board. + +Filmed alone, walking stall to stall. This is how I document daily life for YouTube while living in China. + +Prices start around pocket change. Flavor does not. + +#NightMarket #ChineseStreetFood #StinkyTofu #AloneInChina #ChinaFood #StreetFoodTour #RealLifeChina""", + "lines": [ + "Night market mode — let's go.", + "The lights are already warmer than the sky.", + "First stall hits me with fresh meat potstickers.", + "Eight for pocket money. Twelve if you're starving.", + "That pan sound alone could sell the video.", + "Across the street — stinky tofu smoke in the air.", + "Yeah, it smells wild. Yeah, people still line up.", + "In China, bold smell usually means bold flavor.", + "Grilled squid signs are calling my name.", + "Char marks. Chili dust. Instant hunger.", + "This is not fancy dining. This is China after dark.", + "I'm alone, but every stall feels like a conversation.", + "Vendors shout. Customers point. Money moves fast.", + "Hand-shaken lemon tea with a cartoon bear logo.", + "Sweet cold drink versus hot fried snacks — dangerous combo.", + "Sanxian doupi — crispy outside, soft inside, very Wuhan energy.", + "I film the glow because neon sells the feeling.", + "Look at the menu boards — photos do half the selling.", + "If you run a China YouTube channel, night markets are free cinema.", + "Real faces. Real steam. Real prices.", + "A kid walks past with a skewer bigger than his patience.", + "I keep moving before I order everything.", + "This whole block is a content goldmine.", + "Stay for the smoke trails — they look unreal on camera.", + "Tonight's mission: eat local, film honest, stay curious.", + "Tell me in the comments — potstickers or stinky tofu first?", + ], + }, + "nm2": { + "match": ("042529",), + "slug": "nightmarket2", + "titles": [ + "2 Minutes Inside a Chinese Night Market (Sensory Overload)", + "Follow Me Through Neon Street Food Stalls in China", + "Alone in China — Short Night Market Walk, Big Appetite", + "What a Real Chinese Snack Street Sounds Like at Night", + "POV: You're Hungry in China and Every Sign Looks Good", + ], + "description": """A tight night-market walk — glowing carts, snack photos on every panel, vendors moving fast, and me filming alone through the noise. + +Short clip. Full atmosphere. Built for people who love China street food and honest POV life content. + +#ChineseNightMarket #StreetFood #AloneInChina #ChinaVlog #FoodPOV""", + "lines": [ + "Short walk. Maximum snack energy.", + "The stalls light up like a video game map.", + "Warm bulbs. Cold air. Instant appetite.", + "Every photo on these boards looks illegal levels of good.", + "Fried, grilled, steamed — all in one glance.", + "Vendors move fast — China night service speed.", + "I'm filming alone so you can walk with me.", + "No talking head. Just POV through the neon.", + "Listen — scooters, oil, chatter, sizzling pans.", + "This is the sound of a real Chinese evening.", + "Someone orders three things without slowing down.", + "I don't need a script when the street writes one.", + "Find the brightest sign. That's usually the move.", + "Steam hits the lens and makes everything cinematic.", + "Living in China means dinner can start on the sidewalk.", + "Plastic bags swing. Chopsticks click. Night begins.", + "For YouTube, moments like this beat studio talking heads.", + "Watch the colors — red signs, gold light, dark street.", + "Stay to the end — the glow only gets better.", + "If you're hungry, you're already late.", + "Save this for late-night cravings.", + "Next clip, I might actually stop and eat.", + ], + }, + "nm3": { + "match": ("044816", "045155", "045353"), + "slug": "nightmarket3", + "titles": [ + "Xinfeng Food Street at Night — Malatang Steam and Neon Chaos", + "I Got Lost in China's Snack Street (In the Best Way)", + "Alone in China: BBQ, Grilled Fish, and Girls Ordering Malatang", + "This Chinese Food Street Looks Like a Movie at Dusk", + "8 Minutes of Pure China Night Market Energy", + ], + "description": """Long walk through Xinfeng Road Food Street — malatang steam clouds, red lantern arches, Wanzhou grilled fish specials, BBQ smoke, squid-and-chips stalls, and locals crowding the counters. + +I'm alone with a camera, building a YouTube life out of real Chinese nights like this. + +Watch for the faces, the steam, and the signs — that's the story. + +#FoodStreet #Malatang #ChineseBBQ #NightMarketChina #AloneInChina #StreetFood #ChinaVlog""", + "lines": [ + "This food street hits different when the sky turns blue-grey.", + "Red lanterns. Metal arches. Steam like a special effect.", + "That cloud is malatang — spicy, numbing, dangerous.", + "Broth bubbling. Chili oil shining. Instant ASMR.", + "Girls gather at the counter like it's a weekend ritual.", + "I'm not staging this. China's just cinematic.", + "Xinfeng Food Street — written right on the stall signs.", + "I read the menu boards the way some people read maps.", + "Squid, potato chips, chicken strips — sweet sour spicy.", + "One stall. Three flavor moods. Zero hesitation.", + "Wanzhou grilled fish on special for pocket-friendly money.", + "BBQ neon in the back. Smoke in the front.", + "The air tastes like peppercorn before I even order.", + "Every few steps, another reason to stop filming and eat.", + "I keep recording because this is my job and my life here.", + "Alone in China doesn't mean lonely — it means free.", + "Watch how locals order without overthinking.", + "Point. Pay. Wait for steam. Live.", + "A vendor lifts the lid and the whole lane gets warmer.", + "If your YouTube niche is real China, film nights like this.", + "Faces in the crowd tell better stories than stock B-roll.", + "The street gets tighter. The lights get louder.", + "I follow the brightest red tent like a moth.", + "Lanterns overhead make every walk feel like a trailer.", + "Someone laughs. Someone films. Someone eats with chopsticks mid-walk.", + "This is the China Americans ask me about in comments.", + "Not skyscraper flex. Sidewalk flavor.", + "Scooters squeeze through like they own the snack lane.", + "I slow down at the malatang counter just to watch the steam.", + "Grilled fish. Skewers. Cold drinks. Full sensory stack.", + "My camera loves the red light more than I planned.", + "I stay until my battery and my willpower both drop.", + "If you're building a China channel, nights like this are inventory.", + "Save this walk for when you need China energy.", + "Like if the steam got you hungry through the screen.", + "Comment your spice level — mild, brave, or malatang chaos.", + "Next time — I actually sit down and finish a full bowl.", + "Until then, I'll keep walking the brightest street I find.", + "A steam cloud drifts across a red lantern and looks unreal.", + "I pass the same BBQ light twice and still want it.", + "Crowds thicken near the best smelling corner. Always.", + "This is research, dinner, and content in one walk.", + "Keep watching — the street still has more glow left.", + "Thanks for staying through the chaos with me.", + ], + }, + "street": { + "match": ("032711", "032958", "033518"), + "slug": "street", + "titles": [ + "10 Minutes Walking China's Real Streets (No Tourist Edit)", + "Alone in China POV — Cake Shops, Sidewalk Snacks, City Girls", + "What Daily Life Looks Like on a Normal Chinese Street", + "I Filmed My Neighborhood Walk for YouTube — This Is China", + "Street Level China: Power Banks, Scooters, and Snack Carts", + ], + "description": """A long street-level walk through everyday China — shop windows, sidewalk snack carts, shared power-bank stations, cake signs, scooters, and real people living their afternoon. + +This is the kind of footage I use to grow a YouTube channel about life alone in China: less flex, more truth. + +#AloneInChina #ChinaStreet #RealLifeChina #CityWalk #ChinaVlog #DailyLife""", + "lines": [ + "Starting a long street walk through my Chinese city.", + "No landmark checklist. Just life at eye level.", + "Cloudy sky, busy sidewalk, perfect for POV.", + "Yellow power-bank stations — peak modern China detail.", + "Even the street furniture looks like modern life.", + "Two girls pause by a cake shop window.", + "Glasses, backpacks, casual fit — real, not styled for TV.", + "She glances past the lens like the camera isn't special.", + "Behind them, a snack cart is already working.", + "This is the China that never trends until you film it right.", + "I walk slower so the microphone catches the city.", + "Scooters, plastic bags, soft conversations.", + "A delivery rider cuts through like it's choreography.", + "Living alone here taught me to notice small scenes.", + "A pink hoodie cuts through the grey weather.", + "Shop glass reflects faces, bikes, and afternoon light.", + "Twenty-four hour supermarket glow on the right.", + "When it's cloudy, neon does the storytelling.", + "Cake signs. Snack smoke. Phone chargers. Whole ecosystem.", + "I'm building YouTube videos from walks like this.", + "Americans love beauty and food — China has both on every block.", + "But the real hook is honesty.", + "Don't fake a travel show. Show your Tuesday.", + "Street food smoke mixes with traffic air.", + "Someone buys a snack without slowing their conversation.", + "I keep the camera steady and my curiosity louder.", + "Every shop sign is a potential title.", + "Every face is a reminder this place is alive.", + "Watch the crosswalk — people move with quiet purpose.", + "No tourist map. No forced smile. Just neighborhood pace.", + "If you want to grow a China channel, walk more than you talk.", + "Ten minutes on the street beats ten tips on a desk.", + "I pass another cake window and almost stop for sugar.", + "These ordinary blocks are my content library.", + "Stay with me — there's more city ahead.", + "The longer you walk, the more China opens up.", + "Like if this felt more real than a travel brochure.", + "Comment where you want me to walk next.", + "This is alone in China, one sidewalk at a time.", + "I'll keep filming until the street runs out of stories.", + "A scooter beeps once and vanishes into the block.", + "Sidewalk chalk, shop stickers, random flyers — texture everywhere.", + "I film a snack cart long enough to smell it through memory.", + "Grey weather makes the warm signs hit harder.", + "Two friends argue about which cake to buy. Peak content.", + "I don't need landmarks when the neighborhood is the story.", + "Power lines, shop awnings, soft chatter — city ASMR.", + "Another girl walks past with earbuds and zero rush.", + "This pace is why I film China from the ground.", + "If you made it this far, you're built for long POV walks.", + "One more block. One more detail. Then we wrap.", + "Thanks for walking the ordinary streets with me.", + "I catch one more cake-shop window before the light fades.", + "A snack cart lid opens and the block smells sweeter.", + "People wait at a light like it's just another Tuesday.", + "That is the vibe — calm city, quiet stories.", + "My footsteps stay soft so the street can talk louder.", + "Shop shutters, open doors, half-finished conversations.", + "I pan past a phone charger stand again on purpose.", + "Tiny details stack into a real China portrait.", + "If this helped you feel the sidewalk, mission complete.", + "Subscribe for more unfiltered neighborhood walks.", + "See you on the next block.", + ], + }, + "canteen": { + "match": ("042937", "044719"), + "slug": "canteen", + "titles": [ + "Chinese Noodle Counter POV — Green Onion, Chili, Pure Comfort", + "I Ate Noodles Like a Local (Alone in China Food Ritual)", + "Lanzhou Beef Noodles Energy — Simple Bowl, Serious Flavor", + "Food Street + Noodle Shop: My Favorite Alone Dinner in China", + "Watch Me Build a Bowl in a Real Chinese Eatery", + ], + "description": """Noodle-shop POV in China — chopped green onion, cilantro, pickled beans, fried soy crunch, chopsticks ready, then back out toward the food-street arch and milk-tea lights. + +A quiet alone-in-China dinner ritual. Soft, real, and very rewatchable. + +#ChineseNoodles #AloneInChina #FoodPOV #BeefNoodles #RealLifeChina #ChinaFood""", + "lines": [ + "Noodle time. This is my comfort ritual in China.", + "Walk in. Sit down. Build the bowl.", + "Green onion first — always.", + "Bright, fresh, and already making me hungry.", + "Cilantro if you can handle it. I can.", + "Pickled beans with chili for that sour kick.", + "Crunchy fried soy on top — texture matters.", + "Layer by layer, the bowl gets louder.", + "Chopsticks wrapped and ready. No ceremony needed.", + "This counter looks simple. The bowl will not be.", + "Hot broth hits and the whole table softens.", + "Outside, Xinjiu Road Food Street lights are waking up.", + "Milk tea glow. Phone repair LED. Beef noodle sign.", + "China stacks daily life and dinner on the same sidewalk.", + "I film the toppings because close-ups convert viewers.", + "But I stay for the steam and the quiet focus.", + "Slurp once and the day resets a little.", + "Eating alone here feels normal, not sad.", + "That's a cultural flex people underestimate.", + "Locals finish fast. Flavor doesn't need a speech.", + "For YouTube, food ASMR plus real streets is a lethal combo.", + "Listen to the kitchen — chop, pour, clink, done.", + "I finish the bowl like a local — fast, grateful, gone.", + "Back outside, the alley already smells like round two.", + "If you cook at home tonight, still watch this. Flavor is contagious.", + "Comment your noodle order — mild, spicy, or no cilantro.", + "Save this for the next lonely dinner craving.", + "Alone in China never tasted this comforting.", + ], + }, + "bike": { + "match": ("042040", "042141"), + "slug": "bike", + "titles": [ + "E-Bike POV Through a Chinese Neighborhood (Qujiang Road)", + "Riding Alone in China — Balloons, Fruit Trucks, Noodle Signs", + "3 Minutes of Real China Street Traffic From the Seat", + "Alone in China: Scooter Life Is the Real Public Transit", + "Follow My Ride Past Local Shops and Snack Streets", + ], + "description": """E-bike / scooter POV along Qujiang Road — balloon sellers, fresh-fruit trucks, specialty noodle signs, scooters with winter wind shields, and the soft chaos of a Chinese neighborhood. + +Short ride. High authenticity. Perfect B-roll energy for an alone-in-China channel. + +#ChinaScooter #EbikePOV #AloneInChina #RealLifeChina #ChinaVlog #Qujiang""", + "lines": [ + "Engine soft. City loud. Let's ride.", + "Qujiang Road — local speed, local rules.", + "Handlebars steady. Neighborhood rolling past.", + "Balloon cluster on the left like a moving cartoon.", + "Fresh fruit truck parked like a sidewalk grocery.", + "Oranges, apples, instant snack temptation.", + "Specialty noodle signs keep tempting me to stop.", + "In China, scooters are not hobbies. They're arteries.", + "Wind shield blankets. Delivery bags. Everyday armor.", + "Someone overtakes me like this road is a highway.", + "I'm filming from the ride because motion sells reality.", + "Alone doesn't mean isolated — the street shares the frame.", + "Watch the crosswalk stripes pull us forward.", + "Shop lights smear into soft streaks as we pass.", + "This is how I scout content between bigger shoots.", + "If it looks ordinary, zoom with your attention.", + "A fruit seller waves people over without raising his voice.", + "Ordinary China is the niche.", + "Balloons bounce. Scooters weave. Life keeps moving.", + "I almost stop for noodles twice in one block.", + "Stay on the ride — the details keep stacking.", + "Ride ending soon — appetite starting now.", + "Like if scooter POV feels more real than car tours.", + "Next time maybe I hop off for that fruit truck.", + "Alone in China, even the commute is content.", + ], + }, +} + + +def resolve_folder(match_tokens: tuple[str, ...]) -> Path | None: + for d in ROOT.iterdir(): + if not d.is_dir() or d.name.startswith("_"): + continue + names = " ".join(p.name for p in d.glob("*.mp4")) + if any(tok in names for tok in match_tokens): + return d + return None + + +def write_titles(folder: Path, pack: dict) -> None: + lines = [] + lines.append("=== YOUTUBE TITLES (pick 1) ===") + for i, t in enumerate(pack["titles"], 1): + lines.append(f"{i}. {t}") + lines.append("") + lines.append("=== DESCRIPTION ===") + lines.append(pack["description"].strip()) + lines.append("") + lines.append("=== TAGS ===") + lines.append( + "alone in china, chinese street food, night market, china vlog, real life china, " + "city walk, food tour, pov china, street food china, living in china, youtube growth" + ) + (folder / "YT_TITLES.txt").write_text("\n".join(lines) + "\n", encoding="utf-8") + + +def main() -> None: + probe = json.loads((ROOT / "_meta_probe.json").read_text(encoding="utf-8")) + # map folder path -> duration via video match + summary = [] + for key, pack in PACKS.items(): + folder = resolve_folder(pack["match"]) + if not folder: + print("MISSING folder for", key) + continue + # duration from probe by matching any video file + dur = None + for pname, info in probe.items(): + vids = " ".join(v["file"] for v in info["videos"]) + if any(tok in vids for tok in pack["match"]): + dur = float(info["total_duration"]) + break + if dur is None: + print("NO DUR", key) + continue + srt = build_srt(list(pack["lines"]), dur) + srt_path = folder / "YT_CAPTIONS_EN.srt" + srt_path.write_text(srt, encoding="utf-8") + write_titles(folder, pack) + # cue count + cues = srt.count(" --> ") + last_end = re.findall(r"--> (\d{2}:\d{2}:\d{2},\d{3})", srt)[-1] + summary.append(f"{folder.name}: {dur:.1f}s | cues={cues} | last={last_end} | SRT+TITLES OK") + print(summary[-1]) + (ROOT / "_gen_summary.txt").write_text("\n".join(summary) + "\n", encoding="utf-8") + print("ALL DONE") + + +if __name__ == "__main__": + main() diff --git a/scripts/_make_covers_v4.py b/scripts/_make_covers_v4.py new file mode 100644 index 0000000..3981708 --- /dev/null +++ b/scripts/_make_covers_v4.py @@ -0,0 +1,354 @@ +# -*- coding: utf-8 -*- +"""Clean viral YT covers: real frames, big hooks, no boxes/badges/borders.""" +from __future__ import annotations + +import os +from pathlib import Path + +import cv2 +import numpy as np +from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont + +ROOT = Path(__file__).resolve().parent +W, H = 1280, 720 + + +def imwrite_u(path: Path, bgr: np.ndarray, q: int = 95) -> None: + ok, buf = cv2.imencode(".jpg", bgr, [int(cv2.IMWRITE_JPEG_QUALITY), q]) + path.write_bytes(buf.tobytes()) + + +def find_folder(*tokens: str) -> Path | None: + for d in ROOT.iterdir(): + if d.is_dir() and not d.name.startswith("_"): + names = " ".join(p.name for p in d.glob("*.mp4")) + if any(t in names for t in tokens): + return d + return None + + +def grab(folder: Path, clip: str, t: float) -> np.ndarray | None: + path = folder / clip + if not path.exists(): + return None + cap = cv2.VideoCapture(str(path)) + if not cap.isOpened(): + return None + cap.set(cv2.CAP_PROP_POS_MSEC, t * 1000) + ok, frame = cap.read() + cap.release() + return frame if ok else None + + +def first(*items): + for x in items: + if x is not None: + return x + return None + + +def to_pil(bgr: np.ndarray) -> Image.Image: + 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: + 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] + a, b = int(x0 * w), int(y0 * 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)]) + + +def fit(img: Image.Image, tw: int, th: int, focus=(0.5, 0.38)) -> Image.Image: + iw, ih = img.size + scale = max(tw / iw, th / ih) + nw, nh = int(iw * scale + 0.5), int(ih * scale + 0.5) + img = img.resize((nw, nh), Image.Resampling.LANCZOS) + cx, cy = int(nw * focus[0]), int(nh * focus[1]) + left = max(0, min(cx - tw // 2, nw - tw)) + top = max(0, min(cy - th // 2, nh - th)) + return img.crop((left, top, left + tw, top + th)) + + +def find_font(size: int): + for p in [ + r"C:\Windows\Fonts\impact.ttf", + r"C:\Windows\Fonts\arialbd.ttf", + r"C:\Windows\Fonts\seguibl.ttf", + r"C:\Windows\Fonts\arial.ttf", + ]: + if os.path.exists(p): + try: + return ImageFont.truetype(p, size) + except OSError: + pass + return ImageFont.load_default() + + +def stroke_text(draw, xy, text, font, fill, stroke=(0, 0, 0), sw=5): + x, y = xy + for dx in range(-sw, sw + 1): + for dy in range(-sw, sw + 1): + if (dx or dy) and dx * dx + dy * dy <= sw * sw: + draw.text((x + dx, y + dy), text, font=font, fill=stroke) + draw.text((x, y), text, font=font, fill=fill) + + +def left_shade(img: Image.Image, width=720, max_a=195) -> Image.Image: + img = img.convert("RGBA") + sh = Image.new("RGBA", img.size, (0, 0, 0, 0)) + d = ImageDraw.Draw(sh) + for i in range(width): + a = int(max_a * (1 - i / width) ** 1.05) + d.line([(i, 0), (i, H)], fill=(0, 0, 0, a)) + # soft bottom fade so text doesn't fight neon + for j in range(160): + a = int(90 * (1 - j / 160)) + d.line([(0, H - 1 - j), (W, H - 1 - j)], fill=(0, 0, 0, a)) + return Image.alpha_composite(img, sh) + + +def paste_soft(canvas: Image.Image, sub: Image.Image, x: int, y: int, fade=110) -> Image.Image: + canvas = canvas.convert("RGBA") + sub = sub.convert("RGBA") + mask = Image.new("L", sub.size, 255) + md = ImageDraw.Draw(mask) + for i in range(fade): + md.line([(i, 0), (i, sub.size[1])], fill=int(255 * (i / max(fade, 1)))) + sub.putalpha(mask) + canvas.alpha_composite(sub, (x, y)) + return canvas + + +def paint_hooks(img: Image.Image, lines: list, left=48, top=168) -> Image.Image: + img = left_shade(img) + d = ImageDraw.Draw(img) + y = top + for i, (text, size, color) in enumerate(lines): + font = find_font(size) + stroke_text(d, (left, y), text, font, color, sw=max(4, size // 14)) + bb = d.textbbox((0, 0), text, font=font) + 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)) + return img.convert("RGB") + + +def save(img: Image.Image, folder: Path, name="YT_COVER.jpg") -> None: + img = boost(img, 1.22, 1.14, 1.25) + arr = cv2.cvtColor(np.asarray(img.convert("RGB")), cv2.COLOR_RGB2BGR) + imwrite_u(folder / name, arr, 95) + + +def build( + bg: Image.Image, + person: Image.Image, + lines: list, + person_w=0.56, + focus=(0.55, 0.30), +) -> Image.Image: + # cinematic base + person blend, no inset frames + canvas = fit(boost(bg, 1.35, 1.22), W, H, focus=(0.40, 0.42)) + canvas = canvas.filter(ImageFilter.GaussianBlur(0.6)) + panel = fit(boost(person, 1.22, 1.16, 1.45), int(W * person_w), H, focus=focus) + canvas = paste_soft(canvas, panel, W - panel.size[0] + 8, 0, fade=100).convert("RGB") + return paint_hooks(canvas, lines) + + +def do_street(folder: Path) -> None: + face_f = grab(folder, "VID_20261019_033518.mp4", 140.0) + walk = first(grab(folder, "VID_20261019_032711.mp4", 72.0), face_f) + bg = first(grab(folder, "VID_20261019_032958.mp4", 55.0), face_f) + person = crop_rel(face_f, 0.40, 0.02, 0.98, 0.98) + walker = crop_rel(walk, 0.55, 0.02, 0.98, 0.98) + img = build( + to_pil(bg), + person, + [ + ("SHE LOOKED", 78, (255, 255, 255)), + ("AT MY CAMERA", 72, (255, 230, 80)), + ("Real China Walk", 36, (255, 170, 200)), + ], + ) + save(img, folder) + img2 = build( + to_pil(bg), + walker, + [ + ("10 MIN", 82, (255, 255, 255)), + ("STREET POV", 76, (255, 230, 80)), + ("No Tourist Edit", 34, (140, 255, 230)), + ], + focus=(0.55, 0.4), + ) + 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)), + ("$2 SNACKS", 70, (255, 90, 130)), + ], + ) + save(img, folder) + + +def do_nm3(folder: Path) -> None: + steam = first( + grab(folder, "VID_20261019_045155.mp4", 2.0), + grab(folder, "VID_20261019_044816.mp4", 25.0), + ) + 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)), + ("NIGHT CHAOS", 68, (255, 230, 80)), + ], + focus=(0.5, 0.35), + ) + save(img, folder) + + +def do_nm1(folder: Path) -> None: + stalls = first( + grab(folder, "VID_20261019_041845.mp4", 8.0), + 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)), + ("NIGHT MARKET", 72, (255, 255, 255)), + ("Eat Like a Local", 36, (160, 255, 240)), + ], + ) + 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)), + ("2 MIN POV", 64, (255, 100, 150)), + ], + ) + save(img, folder) + + +def do_canteen(folder: Path) -> None: + street = first( + grab(folder, "VID_20261019_042937.mp4", 12.0), + grab(folder, "VID_20261019_042937.mp4", 2.0), + ) + 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)), + ("Alone in China", 36, (255, 140, 180)), + ], + focus=(0.48, 0.28), + ) + save(img, folder) + + +def do_bike(folder: Path) -> None: + walk = first( + grab(folder, "VID_20261019_042141.mp4", 72.0), + grab(folder, "VID_20261019_042141.mp4", 60.0), + ) + 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)), + ("China Night Ride", 36, (120, 220, 255)), + ], + focus=(0.5, 0.35), + ) + save(img, folder) + + +def main() -> None: + jobs = [ + (("032711", "033518"), do_street, "street"), + (("034248", "041246"), do_citywalk, "citywalk"), + (("044816", "045155"), do_nm3, "nm3"), + (("041738", "041845"), do_nm1, "nm1"), + (("042529",), do_nm2, "nm2"), + (("042937", "044719"), do_canteen, "canteen"), + (("042040", "042141"), do_bike, "bike"), + ] + out = ROOT / "_cover_out" + out.mkdir(exist_ok=True) + for tokens, fn, label in jobs: + folder = find_folder(*tokens) + if not folder: + print("MISS", label) + continue + try: + fn(folder) + import shutil + + src = folder / "YT_COVER.jpg" + shutil.copy2(src, out / f"{label}_YT_COVER.jpg") + print(f"OK {label} -> {src.stat().st_size}") + except Exception as e: + import traceback + + print("FAIL", label, e) + traceback.print_exc() + + +if __name__ == "__main__": + main() diff --git a/scripts/new_batch.py b/scripts/new_batch.py new file mode 100644 index 0000000..bc53880 --- /dev/null +++ b/scripts/new_batch.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +"""Scaffold a new YouTube long-form batch folder. + +Usage: + python new_batch.py "D:\\Desktop\\V3-2026-10-20夜市" + python new_batch.py "D:\\Desktop\\V3-2026-10-20夜市" street nightmarket bike +Creates batch root + subfolders + copies template scripts. +""" +from __future__ import annotations + +import shutil +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +PACK = HERE.parent + + +def main() -> None: + if len(sys.argv) < 2: + print('Usage: python new_batch.py "D:\\path\\BatchName" [folder1 folder2 ...]') + sys.exit(2) + root = Path(sys.argv[1]).expanduser().resolve() + names = sys.argv[2:] or ["clip_01", "clip_02"] + root.mkdir(parents=True, exist_ok=True) + for name in names: + (root / name).mkdir(parents=True, exist_ok=True) + readme = root / name / "PUT_MP4_HERE.txt" + if not readme.exists(): + readme.write_text("Put one or more .mp4 files in this folder.\n", encoding="utf-8") + + for fname in ("_gen_srt_copy.py", "_make_covers_v4.py", "probe_durations.py", "validate_deliverables.py"): + src = HERE / fname + if src.exists(): + shutil.copy2(src, root / fname) + + tip = root / "README_BATCH.txt" + tip.write_text( + "\n".join( + [ + "Batch scaffolded by 中国生活YT长视频SOP", + "", + "1. Drop mp4s into each subfolder", + "2. python probe_durations.py", + "3. Edit _gen_srt_copy.py PACKS for this batch, then run it", + "4. Edit _make_covers_v4.py timestamps/crops, then run it", + "5. python validate_deliverables.py", + "", + f"SOP pack: {PACK}", + "", + ] + ), + encoding="utf-8", + ) + print(f"Created {root}") + for name in names: + print(" ", name) + print("Scripts copied. Next: put mp4s, then probe_durations.py") + + +if __name__ == "__main__": + main() diff --git a/scripts/probe_durations.py b/scripts/probe_durations.py new file mode 100644 index 0000000..9b8e581 --- /dev/null +++ b/scripts/probe_durations.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +"""Probe total duration of every media subfolder under a batch root. + +Usage: + python probe_durations.py + python probe_durations.py "D:\\MyBatch" +Writes: _meta_probe.json +""" +from __future__ import annotations + +import json +import sys +from pathlib import Path + +import cv2 + + +def probe_video(path: Path) -> dict: + cap = cv2.VideoCapture(str(path)) + if not cap.isOpened(): + return {"file": path.name, "path": str(path), "duration": 0.0, "size_mb": 0, "w": 0, "h": 0, "fps": "0"} + fps = float(cap.get(cv2.CAP_PROP_FPS) or 0) + n = float(cap.get(cv2.CAP_PROP_FRAME_COUNT) or 0) + if n > 0 and fps > 0: + dur = n / fps + else: + cap.set(cv2.CAP_PROP_POS_AVI_RATIO, 1.0) + dur = float(cap.get(cv2.CAP_PROP_POS_MSEC) or 0) / 1000.0 + w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH) or 0) + h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT) or 0) + cap.release() + return { + "file": path.name, + "path": str(path), + "duration": round(float(dur), 3), + "size_mb": round(path.stat().st_size / 1024 / 1024, 1), + "w": w, + "h": h, + "fps": str(fps), + } + + +def hms(sec: float) -> str: + sec = max(0, int(sec)) + return f"{sec // 3600:02d}:{(sec % 3600) // 60:02d}:{sec % 60:02d}" + + +def main() -> None: + root = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else Path.cwd().resolve() + out: dict = {} + rows = [] + for d in sorted(root.iterdir(), key=lambda p: p.name.lower()): + if not d.is_dir() or d.name.startswith("_") or d.name.startswith("."): + continue + mp4s = sorted(d.glob("*.mp4")) + if not mp4s: + continue + vids = [probe_video(p) for p in mp4s] + total = sum(v["duration"] for v in vids) + out[d.name] = { + "videos": vids, + "total_duration": round(total, 3), + "total_hms": hms(total), + } + rows.append((d.name, total, len(vids), hms(total))) + + path = root / "_meta_probe.json" + path.write_text(json.dumps(out, ensure_ascii=False, indent=2), encoding="utf-8") + print(f"ROOT {root}") + print(f"{'folder':40} {'clips':>5} {'duration':>10} {'hms':>10}") + for name, total, n, hm in rows: + print(f"{name[:40]:40} {n:5d} {total:10.1f} {hm:>10}") + print(f"Wrote {path} folders={len(rows)}") + + +if __name__ == "__main__": + main() diff --git a/scripts/validate_deliverables.py b/scripts/validate_deliverables.py new file mode 100644 index 0000000..172dceb --- /dev/null +++ b/scripts/validate_deliverables.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +"""Validate YT deliverables in a batch root (SRT / cover / titles). + +Usage: + python validate_deliverables.py + python validate_deliverables.py "D:\\MyBatch" + +Exit code 0 = all OK; 1 = problems found. +""" +from __future__ import annotations + +import re +import sys +from pathlib import Path + +from PIL import Image + + +def to_sec(ts: str) -> float: + h, m, rest = ts.split(":") + s, ms = rest.split(",") + return int(h) * 3600 + int(m) * 60 + int(s) + int(ms) / 1000 + + +def check_srt(path: Path) -> list[str]: + errs = [] + text = path.read_text(encoding="utf-8", errors="replace") + if not text.strip(): + return ["SRT empty"] + blocks = re.split(r"\n\s*\n", text.strip()) + prev_end = None + cues = 0 + for b in blocks: + lines = [ln for ln in b.splitlines() if ln.strip() != ""] + if len(lines) < 3: + continue + cues += 1 + m = re.match(r"(\d{2}:\d{2}:\d{2},\d{3})\s*-->\s*(\d{2}:\d{2}:\d{2},\d{3})", lines[1]) + if not m: + errs.append(f"bad timing line: {lines[1][:40]}") + continue + start, end = to_sec(m.group(1)), to_sec(m.group(2)) + if end <= start: + errs.append(f"end<=start cue#{cues}") + if prev_end is not None and start + 1e-6 < prev_end: + errs.append(f"overlap before cue#{cues}") + prev_end = end + body = lines[2:] + if len(body) != 1: + errs.append(f"multiline cue#{cues} lines={len(body)}") + elif "\n" in body[0]: + errs.append(f"newline in cue#{cues}") + if cues < 8: + errs.append(f"too few cues ({cues}) — consider denser narration") + return errs + + +def check_cover(path: Path) -> list[str]: + errs = [] + try: + im = Image.open(path) + w, h = im.size + if (w, h) != (1280, 720): + errs.append(f"cover size {w}x{h} (want 1280x720)") + except Exception as e: + errs.append(f"cover unreadable: {e}") + # filename-side heuristic only; OCR optional / skipped + return errs + + +def check_titles(path: Path) -> list[str]: + errs = [] + t = path.read_text(encoding="utf-8", errors="replace") + if "YOUTUBE TITLES" not in t.upper() and "=== YOUTUBE TITLES" not in t: + errs.append("titles missing TITLES section") + if t.count("\n") < 8: + errs.append("titles file looks too short") + # meta words should not appear as title copy + up = t.upper() + for bad in ("FACE + FULL BODY", "CHINA GIRL"): + if bad in up: + errs.append(f"titles contain forbidden meta: {bad}") + return errs + + +def main() -> None: + root = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else Path.cwd().resolve() + folders = [ + d + 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(".") + and list(d.glob("*.mp4")) + ] + if not folders: + print("No media folders found under", root) + sys.exit(1) + + bad = 0 + print(f"ROOT {root}") + for d in folders: + issues = [] + srt = d / "YT_CAPTIONS_EN.srt" + cover = d / "YT_COVER.jpg" + titles = d / "YT_TITLES.txt" + if not srt.exists(): + issues.append("missing YT_CAPTIONS_EN.srt") + else: + issues += [f"SRT: {e}" for e in check_srt(srt)] + if not cover.exists(): + issues.append("missing YT_COVER.jpg") + else: + issues += [f"COVER: {e}" for e in check_cover(cover)] + if not titles.exists(): + issues.append("missing YT_TITLES.txt") + else: + issues += [f"TITLES: {e}" for e in check_titles(titles)] + + if issues: + bad += 1 + print(f"FAIL {d.name}") + for e in issues: + print(f" - {e}") + else: + print(f"OK {d.name}") + + print(f"\n{len(folders) - bad}/{len(folders)} folders OK") + sys.exit(1 if bad else 0) + + +if __name__ == "__main__": + main() diff --git a/skills/china-yt-longform/SKILL.md b/skills/china-yt-longform/SKILL.md new file mode 100644 index 0000000..1ca9f20 --- /dev/null +++ b/skills/china-yt-longform/SKILL.md @@ -0,0 +1,83 @@ +--- +name: china-yt-longform +description: >- + Batch-produce Alone-in-China / Chinese street-food YouTube long-form assets: + CapCut-safe English SRT, viral covers from real footage faces/bodies, English + titles/descriptions. Use when the user mentions 剪辑, 长视频, 封面, 字幕, SRT, + CapCut 朗读, Alone in China, 夜市, 街拍, 骑行, V3批次, YT_COVER, YT_CAPTIONS, + probe_durations, validate_deliverables, or folders of mp4s for YouTube upload. +--- + +# China YT Long-form Batch Ops + +Pack root = parent of `.cursor/skills/china-yt-longform` (or ask user). +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` + +## Deliverables (each media subfolder) + +| File | Role | +|------|------| +| `YT_CAPTIONS_EN.srt` | EN CapCut 朗读 TTS | +| `YT_COVER.jpg` | 1280×720 (`YT_COVER_ALT.jpg` optional) | +| `YT_TITLES.txt` | 5 EN titles + description + tags | + +One subfolder = one YT video. Multiple mp4s = concat by summed duration. +`_` / `.` prefixed dirs = tools/cache, not media. + +## Workflow + +``` +- [ ] 1. python scripts/probe_durations.py +- [ ] 2. CapCut-safe EN SRT (dense) +- [ ] 3. YT_TITLES.txt +- [ ] 4. Covers from REAL frames (no AI faces; no yellow boxes) +- [ ] 5. python scripts/validate_deliverables.py → must pass +``` + +Default order: **SRT + titles → covers**. Pure AI; no unrelated Boom kits unless asked. + +### New empty batch + +```bash +python scripts/new_batch.py "D:/Desktop/V3-YYYY-MM-DD主题" street nightmarket +``` + +Then drop mp4s, probe, edit pack scripts, generate, validate. + +## CapCut SRT (hard) + +- English; match food / street / beauty / alone-in-China +- **1 line/cue**; **no overlap**; gap ≈ 0.28–0.35s +- Duration ≥ speech (~2.3–2.4 wps + buffer) +- ≈ 1 cue / 8–12s; ≥8 min → **40–60+ cues** +- Pass validate: overlap=0, multiline=0, last end ≈ duration + +## Cover (hard) + +**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`… + +**Forbidden on cover:** 人脸 / 全身 / 中国女人 / FACE+FULL BODY / CHINA GIRL; yellow frames; sticker badges. + +Design: real-frame composite + left hooks + soft shade. Use v4-style; no yellow insets. + +## Titles + +Viral, honest Alone-in-China / night-market / street POV. + +## Fix loop + +| Complaint | Action | +|-----------|--------| +| Meta cover text | Viewer hooks only | +| Yellow box | Remove frames/badges | +| Sparse SRT | Add lines + regenerate | +| validate fails | Fix listed issues, re-run | + +## Script notes + +- Prefer pack `scripts/` tools; copy into batch root when customizing +- Unicode JPG: `cv2.imencode` + `Path.write_bytes` +- Deps: `pip install -r requirements.txt` diff --git a/skills/china-yt-longform/reference.md b/skills/china-yt-longform/reference.md new file mode 100644 index 0000000..38a5a6c --- /dev/null +++ b/skills/china-yt-longform/reference.md @@ -0,0 +1,67 @@ +# Reference — China YT Long-form + +## Commands + +Run from pack, pointing at a batch root: + +```bash +pip install -r requirements.txt +python scripts/probe_durations.py "D:/Desktop/MyBatch" +python scripts/validate_deliverables.py "D:/Desktop/MyBatch" +python scripts/new_batch.py "D:/Desktop/V3-2026-10-20夜市" street nightmarket bike +``` + +After copying generators into the batch root: + +```bash +python _gen_srt_copy.py +python _make_covers_v4.py +``` + +## Folder layout + +``` +BatchRoot/ + clip-a/ *.mp4 YT_CAPTIONS_EN.srt YT_COVER.jpg YT_TITLES.txt + _meta_probe.json + _gen_srt_copy.py + _make_covers_v4.py + _cover_out/ +``` + +## YT_TITLES.txt template + +```text +=== YOUTUBE TITLES (pick 1) === +1. ... +2. ... +3. ... +4. ... +5. ... + +=== DESCRIPTION === +... + +=== TAGS === +alone in china, chinese street food, night market, china vlog, ... +``` + +## SRT packing + +- Spread across full runtime; add lines if gaps feel empty +- Keep hook opening + CTA close +- Trim middle lines first if over-length + +## Cover composition + +- Right person panel (soft fade) + left environment +- Thin accent line OK; boxes/badges not OK +- Hand-pick timestamps; Haar on signs is often a false positive + +## Install for friends + +- One-click: `install_skill.ps1` +- Or copy `skills/china-yt-longform/` → `%USERPROFILE%/.cursor/skills/china-yt-longform/` +- Or open this pack folder in Cursor (uses `.cursor/skills/`) + +See `如何安装Skill.md`. diff --git a/交付检查清单.md b/交付检查清单.md new file mode 100644 index 0000000..6c1243a --- /dev/null +++ b/交付检查清单.md @@ -0,0 +1,29 @@ +# 交付前快检 + +每个有 mp4 的子文件夹: + +## 文件 +- [ ] `YT_CAPTIONS_EN.srt` +- [ ] `YT_COVER.jpg`(1280×720) +- [ ] `YT_TITLES.txt`(5 标题 + 描述 + tags) + +## 字幕 +- [ ] 英文、贴画面 +- [ ] 每条只有 1 行 +- [ ] 无时间轴重叠 +- [ ] 长片(≥8 分钟)够密(约 8~12 秒一条) +- [ ] 最后一条接近片尾 + +## 封面 +- [ ] 真人实拍(非 AI 假脸) +- [ ] 字是观众钩子 +- [ ] 无「人脸/全身/中国女人/FACE+BODY」制作字 +- [ ] 无黄色方框 / 贴纸角标 + +## 自动验收 + +```powershell +python scripts\validate_deliverables.py "你的批次路径" +``` + +应全部 `OK`。 diff --git a/如何安装Skill.md b/如何安装Skill.md new file mode 100644 index 0000000..3ce12d5 --- /dev/null +++ b/如何安装Skill.md @@ -0,0 +1,34 @@ +# 给朋友:安装 Skill(2 分钟) + +把整个文件夹 `中国生活YT长视频SOP` 收下后: + +## 最快:一键安装 + +1. 双击或在本目录 PowerShell 运行: + +```powershell +powershell -ExecutionPolicy Bypass -File .\install_skill.ps1 +``` + +2. **新开**一个 Cursor 对话 +3. 说:`按 china-yt-longform 处理我的视频批次` + +## 或者:用 Cursor 打开本文件夹 + +打开 `中国生活YT长视频SOP` 作为工作区 → 已自带 `.cursor/skills/china-yt-longform/`。 + +## 或者:手动复制 + +把 `skills\china-yt-longform\` **整个文件夹**复制到: + +``` +%USERPROFILE%\.cursor\skills\china-yt-longform\ +``` + +## 依赖(做字幕/封面脚本时) + +```powershell +pip install -r requirements.txt +``` + +更多流程见 `README.md`。