Skip to content

Mr-funny/hbg-classical-poem-silk-video / skill/classical-poem-silk-video

classical-poem-silk-video

Verified

Turn 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.

FileKindSize
SKILL.mdskill md6.5 KB
agents/openai.yamlconfig275 B
assets/MaShanZheng-Regular.ttfbinary5.6 MB
assets/OFL.txtmarkdown4.2 KB
references/runtime-contract.mdmarkdown1.9 KB
references/style-and-scene-mapping.mdmarkdown6.2 KB
scripts/check_prerequisites.shexecutablescript1.5 KB
scripts/clean_star_watermark.shexecutablescript861 B
scripts/concat_poem.shexecutablescript1.3 KB
scripts/concat_poem_crossfade.shexecutablescript2.0 KB
scripts/docker_gemini_i2v.pyexecutablescript2.7 KB
scripts/docker_gemini_i2v.shexecutablescript970 B
scripts/final_media_qa.shexecutablescript3.6 KB
scripts/make_scene_ass.pyexecutablescript2.7 KB
scripts/render_scene.shexecutablescript1.8 KB

scripts/make_scene_ass.py

View on GitHub
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import re
from pathlib import Path


PUNCTUATION = re.compile(r"[,。!?、;:,.!?;:‘’“”\"'()()【】《》〈〉\s]")


def ass_time(seconds: float) -> str:
    centiseconds = max(0, round(seconds * 100))
    hours, remainder = divmod(centiseconds, 360000)
    minutes, remainder = divmod(remainder, 6000)
    secs, cs = divmod(remainder, 100)
    return f"{hours}:{minutes:02d}:{secs:02d}.{cs:02d}"


def clean_line(value: str) -> str:
    return PUNCTUATION.sub("", value)


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--line", action="append", required=True)
    parser.add_argument("--duration", type=float, default=9.0)
    parser.add_argument("--out", type=Path, required=True)
    parser.add_argument("--font", default="Ma Shan Zheng")
    parser.add_argument("--interval", type=float, default=0.42)
    args = parser.parse_args()

    lines = [clean_line(value) for value in args.line if clean_line(value)]
    if not 1 <= len(lines) <= 2:
        raise SystemExit("Provide one or two non-empty --line values")

    header = f"""[Script Info]
ScriptType: v4.00+
PlayResX: 1080
PlayResY: 1920
WrapStyle: 2
ScaledBorderAndShadow: yes
YCbCr Matrix: TV.709

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Poem,{args.font},112,&H00D8E3E8,&H00D8E3E8,&H683A3732,&H82171310,0,0,0,0,100,100,1,0,1,1.4,2.2,5,0,0,0,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
"""

    events: list[str] = []
    x_positions = [920] if len(lines) == 1 else [925, 785]
    reveal_start = 0.55
    end = max(reveal_start + 0.5, args.duration - 0.25)
    for line_index, line in enumerate(lines):
        count = len(line)
        step_y = min(138.0, 1120.0 / max(1, count - 1))
        start_y = 300.0
        for char_index, char in enumerate(line):
            start = reveal_start + char_index * args.interval
            y = start_y + char_index * step_y
            events.append(
                "Dialogue: 0,"
                f"{ass_time(start)},{ass_time(end)},Poem,,0,0,0,,"
                f"{{\\pos({x_positions[line_index]},{round(y)})\\fad(240,420)\\blur0.7}}{char}"
            )
        reveal_start += count * args.interval + 0.30

    args.out.parent.mkdir(parents=True, exist_ok=True)
    args.out.write_text(header + "\n".join(events) + "\n", encoding="utf-8")
    print(args.out)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall