Mr-funny/hbg-classical-poem-silk-video / skill/classical-poem-silk-video
classical-poem-silk-video
VerifiedTurn Chinese classical poems and ci into coherent vertical Chinese-art videos with poem-driven scene grouping, GPT ImageGen stills, Docker-only Gemini I2V, retained model-generated ambience, Gemini sparkle-watermark cleanup, brush-calligraphy captions revealed character by character, optional local BGM mixing, stitching, and final-frame QA. Supports verse-driven variation across ink landscape, gongbi bird-and-flower, colored figure-and-horse painting, blue-green landscape, xuan paper, silk, and related Chinese visual languages. Use when users ask for 古诗词动态视频、诗词逐句或两句一景、国风视频、毛笔字逐字出现、整首诗拼接成片,or want the established 月落乌啼霜满天 workflow applied to another poem.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.5 KB |
| agents/openai.yaml | config | 275 B |
| assets/MaShanZheng-Regular.ttf | binary | 5.6 MB |
| assets/OFL.txt | markdown | 4.2 KB |
| references/runtime-contract.md | markdown | 1.9 KB |
| references/style-and-scene-mapping.md | markdown | 6.2 KB |
| scripts/check_prerequisites.shexecutable | script | 1.5 KB |
| scripts/clean_star_watermark.shexecutable | script | 861 B |
| scripts/concat_poem.shexecutable | script | 1.3 KB |
| scripts/concat_poem_crossfade.shexecutable | script | 2.0 KB |
| scripts/docker_gemini_i2v.pyexecutable | script | 2.7 KB |
| scripts/docker_gemini_i2v.shexecutable | script | 970 B |
| scripts/final_media_qa.shexecutable | script | 3.6 KB |
| scripts/make_scene_ass.pyexecutable | script | 2.7 KB |
| scripts/render_scene.shexecutable | script | 1.8 KB |
scripts/docker_gemini_i2v.py
View on GitHub#!/usr/bin/env python3
from __future__ import annotations
import asyncio
import json
import os
from pathlib import Path
from gemini_webapi import GeminiClient
def load_cookie_map(path: Path) -> dict[str, str]:
data = json.loads(path.read_text(encoding="utf-8"))
if isinstance(data, dict) and isinstance(data.get("cookieMap"), dict):
data = data["cookieMap"]
elif isinstance(data, list):
data = {
item.get("name"): item.get("value")
for item in data
if isinstance(item, dict) and item.get("name") and item.get("value")
}
if not isinstance(data, dict) or not data.get("__Secure-1PSID"):
raise RuntimeError("Gemini cookie file is not authorized")
return {str(key): str(value) for key, value in data.items() if value is not None}
async def main() -> int:
image = Path(os.environ["POEM_I2V_IMAGE"])
output = Path(os.environ["POEM_I2V_OUTPUT"])
prompt = os.environ["POEM_I2V_PROMPT"]
cookie_file = Path(os.environ.get("GEMINI_COOKIE_FILE", "/data/auth/gemini/cookies.json"))
output.mkdir(parents=True, exist_ok=True)
cookies = load_cookie_map(cookie_file)
client = GeminiClient(
cookies["__Secure-1PSID"],
cookies.get("__Secure-1PSIDTS"),
proxy=os.environ.get("HTTPS_PROXY") or None,
)
await client.init(
timeout=900,
auto_close=False,
auto_refresh=True,
refresh_interval=600,
watchdog_timeout=180,
verbose=False,
)
saved: list[dict[str, str | None]] = []
try:
response = await asyncio.wait_for(
client.generate_content(prompt=prompt, files=[str(image)], temporary=False),
timeout=900,
)
for index, video in enumerate(response.videos, start=1):
item = await asyncio.wait_for(
video.save(
path=str(output),
filename=f"poem-scene-{index}",
verbose=True,
),
timeout=1200,
)
saved.append(item)
if not saved:
raise RuntimeError("Gemini returned no downloadable video")
(output / "result.json").write_text(
json.dumps(
{
"status": "complete",
"video_count": len(response.videos),
"saved": saved,
"response_text": response.text,
},
ensure_ascii=False,
indent=2,
),
encoding="utf-8",
)
print(json.dumps(saved, ensure_ascii=False))
return 0
finally:
await client.close()
if __name__ == "__main__":
raise SystemExit(asyncio.run(main()))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |