Skip to content

lispking/video-skills / manim-video-teacher

manim-video-teacher

Verified

专注于使用 Manim 生成动画教学视频的完整流程与专业建议。适用于用户用中文提示语让 Codex 生成脚本、分镜、Manim 代码、渲染命令或优化教学视频质量与节奏,并输出 MP4。

FileKindSize
SKILL.mdskill md5.1 KB
scripts/concat_audio.pyscript1.3 KB
scripts/make_cover.pyscript1.5 KB
scripts/mux_av.pyscript1019 B
scripts/pipeline.pyscript3.8 KB
scripts/tts_generate.pyscript2.4 KB

scripts/tts_generate.py

View on GitHub
#!/usr/bin/env python3
import argparse
import asyncio
import sys


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="Generate speech audio from text using edge-tts",
    )
    parser.add_argument("--text", help="Inline narration text")
    parser.add_argument("--text-file", help="Path to a UTF-8 text file")
    parser.add_argument("--voice", default="zh-CN-XiaoxiaoNeural")
    parser.add_argument("--rate", default="+0%")
    parser.add_argument("--volume", default="+0%")
    parser.add_argument("--output", default="voice.mp3")
    parser.add_argument("--subs-output", help="Write subtitles to an SRT file")
    return parser.parse_args()


async def run_tts(
    text: str,
    voice: str,
    rate: str,
    volume: str,
    output: str,
    subs_output: str | None,
) -> None:
    try:
        import edge_tts
    except ImportError:
        print("edge-tts not installed. Run: pip install edge-tts", file=sys.stderr)
        raise SystemExit(1)

    communicate = edge_tts.Communicate(
        text,
        voice=voice,
        rate=rate,
        volume=volume,
        boundary="SentenceBoundary",
    )
    if not subs_output:
        await communicate.save(output)
        return

    submaker = edge_tts.SubMaker()
    with open(output, "wb") as f:
        async for chunk in communicate.stream():
            if chunk["type"] == "audio":
                f.write(chunk["data"])
            elif chunk["type"] in ("WordBoundary", "SentenceBoundary"):
                submaker.feed(chunk)
    if hasattr(submaker, "generate_subs"):
        subs = submaker.generate_subs()
    elif hasattr(submaker, "get_srt"):
        subs = submaker.get_srt()
    else:
        raise RuntimeError("edge-tts SubMaker has no subtitle export method")
    with open(subs_output, "w", encoding="utf-8") as f:
        f.write(subs)


def load_text(args: argparse.Namespace) -> str:
    if args.text:
        return args.text
    if args.text_file:
        with open(args.text_file, "r", encoding="utf-8") as f:
            return f.read()
    print("Provide --text or --text-file", file=sys.stderr)
    raise SystemExit(2)


def main() -> None:
    args = parse_args()
    text = load_text(args)
    asyncio.run(
        run_tts(
            text,
            args.voice,
            args.rate,
            args.volume,
            args.output,
            args.subs_output,
        )
    )


if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall