0. Quy trình 5 bước bắt buộc (không bỏ bước)
- Lập Kịch bản Nhịp (Beat Sheet JSON): Chia video 60–95s (hoặc 25–45s nếu là bài test ngắn) thành các nhịp 2–4 giây/nhịp. MỌI nhịp phải có ít nhất 1 chiêu thị giác từ Từ điển 12 Chiêu (Mục 2). CẤM để bản đồ trống đứng im quá 3,5 giây; CẤM làm slideshow ảnh tĩnh.
- Dùng GPT Image tạo bộ PNG tách nền (phát huy điểm mạnh nhất của ChatGPT):
- Tạo 2–4 nhân vật chibi chính (thân tròn ngắn, nét viền đen sạch, mặt biểu cảm rõ, nền trong suốt PNG — tuyệt đối KHÔNG vẽ chữ, KHÔNG vẽ bản đồ vào ảnh).
- Tạo 1–2 ảnh hậu cảnh thực địa 2.5D cho cảnh lặn
diorama25d(ví dụ: cảng tuyết Alaska, đồn điền mía, chiến trường…) và 1–2 đạo cụ ẩn dụ đặc thù của câu chuyện (ví dụ: tờ ngân phiếu \$7.2M, tảng vàng, tàu hơi nước…). - Truyền ảnh PNG vào Engine qua
GeoStory.registerAssets({ key: dataUrl_hoặc_driveId })lúc chạy Playwright — TUYỆT ĐỐI KHÔNG nhúng base64 vào file HTML Studio trên Drive!
- Tạo Giọng đọc nén đều + Khớp thời lượng từng nhịp: Giọng đọc rõ, nhịp nhanh dứt khoát (không khoảng lặng > 0,5s), nén chuẩn
-14.5 LUFS,LRA ≤ 4.5 LU. Gắn giọng vào Studio quaawait GeoStory.loadVoice(dataUrl)và khớpdurationcủa từng câusay+waitđúng bằng độ dài lời đọc thật. - Chạy tự kiểm tra JSON + Render MP4 30fps bằng GeoStory Studio 7.0: Gọi
GeoStory.audit(steps)đạt 12/12 ĐẠT, sau đó gọiawait GeoStory.render(steps, { fps: 30, resolution: 1920, filename: 'Ten_Video.mp4' })(hoặc1280khi test nhanh). - Hậu kiểm bằng
kiem_tra_geostory.py& lưu Drive: Chạypython kiem_tra_geostory.py Ten_Video.mp4 --script kich_ban.json(thêm--shortnếu clip test 20–50s). Chỉ bàn giao khi đạt 100% ĐẠT toàn bộ bảng!
1. Tư duy Edit Video Chuẩn Mẫu Louisiana (6 Quy luật vàng)
Nguyên tắc số 1 — "Bản đồ là xương sống liên tục": Không cắt giật đen giữa các cảnh bản đồ! Dùng
flyTo bay mượt từ quốc gia này sang quốc gia khác, dùng basemap chuyển mượt giữa bản đồ cổ (parchment) và vệ tinh biển (satellite).
- Nguyên tắc số 2 — "Nói gì hiện nấy mỗi 2–4 giây": Câu nói nhắc đến tiền → rơi chồng tiền / thẻ giá đỏ; nhắc đến mộng đế chế → bong bóng suy nghĩ; nhắc đến sông / tuyến biển → vẽ sông phát sáng neon; nhắc đến xung đột → 2 cánh tay que găng trắng mọc từ 2 nước vung gậy; nhắc đến hồi tưởng quá khứ → hiệu ứng tua băng
<<<. - Nguyên tắc số 3 — "Nhân vật Chibi diễn ngay trên bản đồ": Đặt nhân vật đứng trực tiếp trên đất nước của họ (
mapActor), dựng thêm bàn đàm phán (negotiation_board) ngay trên nền bản đồ, đổi biểu cảm mặt (neutral → smug → angry → shocked → happy) theo diễn biến câu chuyện. - Nguyên tắc số 4 — "Lặn xuống thực địa 2.5D ở cao trào": Mỗi video PHẢI có 1–2 cảnh
diorama25d(lặn từ bản đồ xuống góc ngang mặt đất: trời mây + hậu cảnh mờ DOF + mặt đất + nhân vật chibi đứng/hành quân) để phá nhịp, tạo cảm xúc mạnh rồi mới quay lên bản đồ. - Nguyên tắc số 5 — "Phụ đề 2–4 từ sạch gọn": Luôn bật
setup.subStyle = "louisiana"và dùng lệnhsay. Studio tự chia câu thành cụm 2–4 từ ở vùng dưới an toàn (y = 84%), tuyệt đối không để khối chữ to che nhân vật. - Nguyên tắc số 6 — "Âm thanh -14.5 LUFS, 0 khoảng chết": Nhạc nền tiết tấu đều (
upbeat/mystery), SFX khớp đúng khoảnh khắc bật hình (pop, tiền, tua băng, bước chân), âm lượng trộn chuẩn-14.5 LUFS, không im lặng quá0,7s.
2. Từ điển 12 Chiêu Dựng Hình (Shot Grammar) của GeoStory Studio 7.0
Khi viết kich_ban.json, Dot chọn đúng lệnh tương ứng với ý nghĩa câu thoại:
| # | Chiêu Edit | Khi nào dùng? | Lệnh JSON chuẩn (GeoStory 7.0) |
|---|---|---|---|
| 1 | Chuyển nền mượt | Đổi giữa bản đồ lịch sử cổ & vệ tinh đại dương không cắt giật | {"do":"basemap","map":"satellite","duration":0.8} (parchment | satellite | physical) |
| 2 | Tô lãnh thổ lịch sử | Hiển thị đế quốc / vùng đất tranh chấp (có viền mực đen + tên serif) | {"do":"territory","id":"alaska","countries":["United States"],"polygon":[[lon,lat],...],"color":"#2753c4","stroke":"#142454","label":"Russian\nAlaska","labelAt":[-152,64]} |
| 3 | Biến hình sáp nhập | Chốt thương vụ / đổi chủ lãnh thổ (flash sáng + đổi màu hòa nhập) | {"do":"territoryMorph","id":"alaska","toColor":"#cbe6e1","toStroke":"#2b9e96","flash":true,"duration":1.5} |
| 4 | Sông / Tuyến phát sáng | Nhấn mạnh sông huyết mạch, eo biển, đường hàng hải + mũi tên trắng | {"do":"glowRiver","id":"bering","points":[[-170,66],[-168,64],[-162,58]],"color":"#38bdf8","label":"Bering Strait","arrowAt":[-168,65],"duration":1.4} |
| 5 | Nhân vật Chibi trên Map | Lãnh đạo/nhà ngoại giao nói chuyện, chỉ trỏ, trao vật ngay trên bản đồ | {"do":"mapActor","id":"tsar","preset":"tsar","asset":"optional_gpt_png","expr":"smug","screenPos":[0.74,0.64],"dir":-1,"action":"give","held":"map_piece","speaking":true} |
| 6 | Đạo cụ sân khấu trên Map | Bàn đàm phán, tàu buồm chạy qua biển, cảng mini, va-li tiền, chồng USD, đám đông + hàng hóa | {"do":"mapProp","id":"p1","kind":"negotiation_board|ship|port_city|briefcase|cash_pile|island_crowd","asset":"optional_png","ll":[lon,lat],"toLL":[lon,lat],"moveDur":3.2,"layer":"back|front"} |
| 7 | Tua ngược quá khứ | Chuyển từ mở bài (hook) quay ngược về bối cảnh lịch sử | {"do":"rewind","duration":1.1} |
| 8 | Bong bóng suy nghĩ | Minh họa tham vọng, giấc mơ đế chế hoặc kế hoạch bí mật | {"do":"thoughtBubble","x":0.5,"y":0.46,"anchor":[0.38,0.9],"asset":"optional_gpt_png","duration":3.0} |
| 9 | Thẻ giá đỏ đung đưa | Nhấn mạnh giá mua bán lịch sử (\$15M, \$7.2M, 2¢/acre) | {"do":"priceTag","text":"$7.2M","x":0.52,"y":0.44,"tilt":-14,"duration":3.0} |
| 10 | Tay que tranh chấp | 2 nước đối đầu, đe dọa tấn công, không thể phòng thủ | {"do":"stickConflict","fromA":[-102,54],"fromB":[37,55],"meetAt":[-150,63],"weapon":"bat","duration":2.5} |
| 11 | Chân dung lịch sử nghiêng vào | Chèn tranh sơn dầu/ảnh thật nhân vật lịch sử nhìn vào bản đồ | {"do":"portraitCameo","side":"left","asset":"optional_gpt_png","preset":"napoleon","expr":"smug","duration":2.5} |
| 12 | Lặn xuống thực địa 2.5D | Cao trào cảm xúc: đồn điền, quân lính hành quân, bãi vàng, cảng tuyết | {"do":"diorama25d","sky":"arctic","bgPreset":"arctic","bgAsset":"optional_gpt_bg","blurBg":3,"ground":"snow","actors":[...],"say":"Câu ngắn 6-10 từ","duration":3.2} |
Lệnh phụ trợ: setup (map:"parchment"|"satellite", frame:"9:16", subStyle:"louisiana"), audio (bgm:"upbeat"|"mystery"|"epic"|"calm", sfx:true, targetLufs:-14.5), camera, flyTo (lon,lat,zoom,duration hoặc country), say (text,duration), wait (seconds ≤ 3.5), clearMapStory (keepTerritories:true|false), assets (map:{key:url}).
3. Cách Bot DOT dùng GPT Image + Playwright để Render Tự Động
Luật vẽ ảnh cho GPT Image: Chỉ vẽ nhân vật chibi nền trong suốt (tỷ lệ đầu to tròn ~42% chiều cao, viền mực đen đậm gọn, không đổ bóng sàn), đạo cụ ẩn dụ, hoặc nền thực địa 2.5D (để dùng trong
diorama25d.bgAsset). CẤM để GPT Image vẽ bản đồ hay viết chữ nhỏ lên ảnh!
# Mẫu chạy GeoStory Studio 7.0 bằng Playwright trong sandbox của Bot DOT
import base64, json, pathlib
from playwright.sync_api import sync_playwright
def to_data_url(path, mime="image/png"):
return f"data:{mime};base64," + base64.b64encode(pathlib.Path(path).read_bytes()).decode()
steps = json.loads(pathlib.Path("kich_ban.json").read_text(encoding="utf-8"))
custom_pngs = {
# "tsar_png": to_data_url("assets/tsar_chibi.png"),
# "alaska_bg": to_data_url("assets/alaska_tundra_bg.png"),
}
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
ctx = browser.new_context(viewport={"width": 1280, "height": 900}, accept_downloads=True)
page = ctx.new_page()
page.goto("http://127.0.0.1:8765/GeoStory_Studio_7.0_LiveDrive_AI.html", wait_until="domcontentloaded")
page.evaluate("() => GeoStory.whenReady()")
page.evaluate("(m) => GeoStory.registerAssets(m)", custom_pngs)
# Nạp giọng đọc WAV/MP3 đã tạo (nếu có):
# page.evaluate("(u) => GeoStory.loadVoice(u)", to_data_url("giong.mp3", "audio/mpeg"))
audit = page.evaluate("(s) => GeoStory.audit(s)", steps)
print("AUDIT:", audit["passed"], "/", audit["total"])
assert audit["ok"], json.dumps(audit, ensure_ascii=False, indent=2)
with page.expect_download(timeout=300000) as dl_info:
page.evaluate("(s) => GeoStory.render(s, { fps: 30, resolution: 1920, filename: 'output.mp4' })", steps)
dl_info.value.save_as("output.mp4")
browser.close()
4. Phụ lục — Mã nguồn đầy đủ kiem_tra_geostory.py
Bot DOT có thể tải trực tiếp từ Google Drive (ID 1opH9k0IvFBooph0qllR-NuFrEQ-chdlU) hoặc lưu đoạn mã nguyên văn dưới đây thành kiem_tra_geostory.py:
#!/usr/bin/env python3
"""
kiem_tra_geostory.py — Bộ kiểm tra tự động chuẩn Video Bản Đồ + Chibi (Mẫu Louisiana)
Dùng cho Bot DOT (ChatGPT) kiểm tra TRƯỚC & SAU khi render bằng GeoStory_Studio_7.0_LiveDrive_AI.html.
Cách chạy:
python kiem_tra_geostory.py video.mp4 --script kich_ban.json
python kiem_tra_geostory.py video.mp4 --script kich_ban.json --short # cho clip test 20-55s
"""
import argparse, json, os, re, subprocess, sys
META_OPS = {
"glowRiver", "thoughtBubble", "priceTag", "stickConflict", "rewind",
"mapProp", "portraitCameo", "territoryMorph", "iconBurst", "counter",
"stamp", "multiArc", "splitCompare"
}
def run_cmd(cmd):
return subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace")
def check_script(script_path, short_mode=False):
rows = []
def add(name, val, need, ok):
rows.append((ok, "Kịch bản", name, str(val), need))
with open(script_path, "r", encoding="utf-8") as f:
steps = json.load(f)
if not isinstance(steps, list) or not steps:
add("Cấu trúc JSON mảng bước", "không hợp lệ", "mảng JSON >= 10 lệnh", False)
return rows
types = {s.get("do") for s in steps if isinstance(s, dict) and s.get("do")}
setup = next((s for s in steps if isinstance(s, dict) and s.get("do") == "setup"), {})
frame = setup.get("frame", "9:16")
sub_style = setup.get("subStyle", "louisiana")
fly_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in ("flyTo", "camera"))
terr_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in ("territory", "select", "territoryMorph"))
actor_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in ("mapActor", "updateActor"))
diorama_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in ("diorama25d", "skit", "puppet"))
meta_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in META_OPS)
say_cnt = sum(1 for s in steps if isinstance(s, dict) and s.get("do") in ("say", "subtitle"))
max_wait = max([float(s.get("seconds", 0)) for s in steps if isinstance(s, dict) and s.get("do") == "wait"] or [0.0])
has_morph_or_river = ("territoryMorph" in types) or ("glowRiver" in types)
has_audio = "audio" in types
min_fly = 2 if short_mode else 4
min_meta = 3 if short_mode else 5
min_say = 3 if short_mode else 6
min_types = 6 if short_mode else 8
add("Khung hình dọc 9:16", frame, "9:16", frame == "9:16")
add("Kiểu phụ đề 2-4 từ Louisiana", sub_style, "louisiana", sub_style == "louisiana")
add("Bản đồ bay liên tục (flyTo/camera)", f"{fly_cnt} cú bay", f">= {min_fly} cú bay mượt", fly_cnt >= min_fly)
add("Tô lãnh thổ / biên giới vector", f"{terr_cnt} lệnh", ">= 2 vùng", terr_cnt >= 2)
add("Nhân vật Chibi/Cutout trên bản đồ", f"{actor_cnt} lệnh", ">= 2 nhân vật/lượt diễn", actor_cnt >= 2)
add("Ẩn dụ thị giác (Visual Metaphor)", f"{meta_cnt} chiêu", f">= {min_meta} chiêu", meta_cnt >= min_meta)
add("Morph lãnh thổ hoặc Sông phát sáng", "có" if has_morph_or_river else "thiếu", "territoryMorph hoặc glowRiver", has_morph_or_river)
add("Cảnh lặn xuống thực địa 2.5D", f"{diorama_cnt} cảnh", ">= 1 cảnh diorama25d", diorama_cnt >= 1)
add("Độ đa dạng chiêu dựng", f"{len(types)} loại lệnh", f">= {min_types} loại", len(types) >= min_types)
add("Không đứng im lâu (max wait)", f"{max_wait:.1f}s", "<= 3.5s", max_wait <= 3.5)
add("Nhịp phụ đề đồng bộ", f"{say_cnt} câu", f">= {min_say} câu", say_cnt >= min_say)
add("Cấu hình âm thanh -14.5 LUFS", "bật" if has_audio else "thiếu", "có lệnh audio", has_audio)
return rows
def check_video(video_path, short_mode=False):
rows = []
def add(name, val, need, ok):
rows.append((ok, "Video/Audio", name, str(val), need))
if not os.path.exists(video_path):
add("Tệp MP4 tồn tại", "không thấy", video_path, False)
return rows
p = run_cmd(["ffprobe", "-v", "error", "-show_format", "-show_streams", "-of", "json", video_path])
if p.returncode != 0:
add("Đọc thông tin ffprobe", "lỗi", "MP4 hợp lệ", False)
return rows
info = json.loads(p.stdout)
dur = float(info.get("format", {}).get("duration", 0))
vs = next((s for s in info.get("streams", []) if s.get("codec_type") == "video"), None)
as_ = next((s for s in info.get("streams", []) if s.get("codec_type") == "audio"), None)
w = int(vs.get("width", 0)) if vs else 0
h = int(vs.get("height", 0)) if vs else 0
fps_s = vs.get("r_frame_rate", "0/1") if vs else "0/1"
num, den = (fps_s.split("/") + ["1"])[:2]
fps = float(num) / max(1.0, float(den))
add("Độ phân giải 9:16 chuẩn", f"{w}x{h}", "1080x1920 hoặc 720x1280", (w, h) in ((1080, 1920), (720, 1280)))
add("Tốc độ khung hình", f"{fps:.1f} fps", "30 fps", 29.0 <= fps <= 31.0)
min_d, max_d = (18.0, 115.0) if short_mode else (50.0, 115.0)
add("Thời lượng video", f"{dur:.1f}s", f"{min_d:.0f}-{max_d:.0f}s", min_d <= dur <= max_d)
add("Có kênh âm thanh AAC/Stereo", as_.get("codec_name") if as_ else "không có", "aac", bool(as_))
# Scene cut flicker check (< 0.6s between hard cuts)
sc = run_cmd(["ffmpeg", "-i", video_path, "-vf", "select=gt(scene\\,0.35),showinfo", "-f", "null", "-"])
cuts = [float(m) for m in re.findall(r"pts_time:([0-9.]+)", sc.stderr)]
flicker = sum(1 for i in range(1, len(cuts)) if cuts[i] - cuts[i - 1] < 0.6)
add("Cắt giật (< 0.6s)", flicker, "0", flicker == 0)
# Audio loudness (EBU R128) & longest silence
if as_:
au = run_cmd(["ffmpeg", "-i", video_path, "-af", "ebur128=framelog=quiet,silencedetect=n=-38dB:d=0.35", "-f", "null", "-"])
lufs_m = re.search(r"I:\s*(-?[0-9.]+)\s*LUFS", au.stderr)
lra_m = re.search(r"LRA:\s*([0-9.]+)\s*LU", au.stderr)
sil_durs = [float(x) for x in re.findall(r"silence_duration:\s*([0-9.]+)", au.stderr)]
max_sil = max(sil_durs) if sil_durs else 0.0
lufs = float(lufs_m.group(1)) if lufs_m else -99.0
lra = float(lra_m.group(1)) if lra_m else 99.0
add("Độ to âm thanh (LUFS)", f"{lufs:.1f} LUFS", "-16.5 đến -12.5 LUFS (mục tiêu -14.5)", -16.5 <= lufs <= -12.5)
add("Độ nén âm thanh đều (LRA)", f"{lra:.1f} LU", "<= 6.0 LU", lra <= 6.0)
add("Khoảng im lặng dài nhất", f"{max_sil:.2f}s", "<= 0.70s", max_sil <= 0.70)
return rows
def main():
ap = argparse.ArgumentParser(description="Kiểm tra video GeoStory 7.0 chuẩn mẫu Louisiana")
ap.add_argument("video", nargs="?", help="Đường dẫn file .mp4")
ap.add_argument("--script", "-s", help="Đường dẫn file kịch bản JSON GeoStory 7.0")
ap.add_argument("--short", action="store_true", help="Chế độ kiểm tra clip ngắn (18-55s)")
args = ap.parse_args()
if not args.video and not args.script:
ap.print_help()
sys.exit(2)
all_rows = []
if args.script:
all_rows.extend(check_script(args.script, args.short))
if args.video:
all_rows.extend(check_video(args.video, args.short))
passed = sum(1 for r in all_rows if r[0])
total = len(all_rows)
print(f"=== KẾT QUẢ KIỂM TRA GEOSTORY 7.0: {passed}/{total} ĐẠT ===")
for ok, grp, name, val, need in all_rows:
st = "ĐẠT " if ok else "KHÔNG ĐẠT"
print(f"{st} | {grp:<11} | {name:<36} | {val:<18} | cần: {need}")
sys.exit(0 if passed == total else 1)
if __name__ == "__main__":
main()