anbeime/skill / skills/srt-whiteboard-animation
srt-whiteboard-animation
Verified将 SRT 字幕做成暖米黄纸张底的白板手绘动画:读字幕→输出配图策略→确认后生成统一风格线稿→按叙事语义标注分区→预览台调整→渲染 MP4。编排沿用分区遮罩揭示(annotation.json / sequence / startMs / protectedRegions),但每个区域内的落墨换成 stream 的连续笔迹(骨架/网格 ink→color)。当用户提供 SRT 字幕并要求"字幕做成白板手绘/流式笔迹视频""SRT 生成白板动画""按字幕分镜画手绘"时触发。
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 211 B |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 6.2 KB |
| SKILL.md | skill md | 13.8 KB |
| agents/openai.yaml | config | 245 B |
| assets/drawing-hand.png | binary | 784.0 KB |
| assets/preview.html | other | 27.7 KB |
| examples/scene-01-monkey-mountain-banana-whiteboard.gif | binary | 1.7 MB |
| examples/scene-01-monkey-mountain-banana-whiteboard.mp4 | binary | 1.1 MB |
| examples/scene-01-monkey-mountain-banana.annotation.json | config | 1.8 KB |
| examples/scene-01-monkey-mountain-banana.png | binary | 2.3 MB |
| examples/scene-01-monkey-mountain-stream.gif | binary | 5.1 MB |
| examples/scene-01-monkey-mountain.png | binary | 1.2 MB |
| scripts/merge_scenes.py | script | 3.8 KB |
| scripts/parse_srt.py | script | 4.9 KB |
| scripts/prepare_env.py | script | 2.9 KB |
| scripts/render_annotation_preview.py | script | 1.9 KB |
| scripts/render_stream_whiteboard.py | script | 24.8 KB |
| scripts/stream_render.py | script | 75.4 KB |
scripts/prepare_env.py
View on GitHub#!/usr/bin/env python3
"""
流式笔迹动画 - 环境引导脚本
职责:
1. 在 skill 目录下建立隔离的 Python 虚拟环境(已存在则复用)
2. 核对运行所需的第三方库是否可导入
3. 自动补齐缺失的库
4. 末行打印 ENV_PY=<解释器路径>,供上层调用方捕获
用法:
python prepare_env.py # 建环境 + 补依赖,输出 ENV_PY
python prepare_env.py --check # 仅探测,缺东西就以非零码退出
"""
from __future__ import annotations
import os
import subprocess
import sys
import venv
from pathlib import Path
# skill 根目录 = 本脚本向上两级
SKILL_ROOT = Path(__file__).resolve().parent.parent
VENV_ROOT = SKILL_ROOT / ".venv"
# 解释器导入名 -> pip 安装名
DEPS: dict[str, str] = {
"cv2": "opencv-python",
"numpy": "numpy",
"av": "av", # PyAV:纯 pip 安装的 H.264 编码,无需系统 ffmpeg
"PIL": "Pillow", # render_annotation_preview.py 画区域编号预览图(含中文标签)
}
def interpreter_path() -> Path:
"""虚拟环境里的 python 可执行文件位置(跨平台)。"""
if sys.platform.startswith("win"):
return VENV_ROOT / "Scripts" / "python.exe"
return VENV_ROOT / "bin" / "python"
def ensure_venv(check_only: bool) -> Path:
py = interpreter_path()
if VENV_ROOT.exists() and py.exists():
print(f"[ok] 复用现有虚拟环境: {VENV_ROOT}")
return py
if check_only:
print(f"[err] 虚拟环境尚未建立: {VENV_ROOT}")
sys.exit(1)
print(f"[..] 建立虚拟环境: {VENV_ROOT}")
venv.create(str(VENV_ROOT), with_pip=True)
print("[ok] 虚拟环境就绪")
return py
def can_import(py: Path, import_name: str) -> bool:
probe = subprocess.run(
[str(py), "-c", f"import {import_name}"],
capture_output=True,
)
return probe.returncode == 0
def install(py: Path, packages: list[str]) -> bool:
if not packages:
return True
print(f"[..] 安装依赖: {', '.join(packages)}")
res = subprocess.run(
[str(py), "-m", "pip", "install", "--quiet", *packages],
capture_output=True,
text=True,
)
if res.returncode != 0:
print(f"[err] 安装失败:\n{res.stderr}")
return False
print("[ok] 依赖安装完成")
return True
def main() -> None:
check_only = "--check" in sys.argv
py = ensure_venv(check_only)
missing: list[str] = []
for import_name, pip_name in DEPS.items():
if can_import(py, import_name):
print(f"[ok] {pip_name}")
else:
print(f"[miss] {pip_name}")
missing.append(pip_name)
if missing:
if check_only:
print(f"\n缺 {len(missing)} 个依赖: {', '.join(missing)}")
sys.exit(1)
if not install(py, missing):
sys.exit(1)
# 末行:供调用方捕获的约定输出
print(f"\nENV_PY={py}")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |