Skip to content

anbeime/skill / skills/native-subtitle-quote-image/native-subtitle-quote-image

native-subtitle-quote-image

Verified

将本地视频或用户有权处理的在线视频,经过来源获取、文字稿定位、选题选句、精确取帧、紧凑裁切、拼图和逐张质检,制作成 3:4 或保留画面原比例的视频字幕长图。支持两种明确分开的输出:保留画面内已烧录字幕的原生字幕模式,以及把已审核的时间点与台词绘制到真实视频帧上的脚本字幕模式。用户要求原生字幕截图、字幕帧拼图、YouTube 金句长图、台词截图、不重绘字幕、自定义中文台词,或调整主图比例、字幕区域、台词间隔和美感时使用。

FileKindSize
.codex-plugin/plugin.jsonconfig1.5 KB
.github/ISSUE_TEMPLATE/bug_report.ymlconfig1.2 KB
.github/ISSUE_TEMPLATE/config.ymlconfig275 B
.github/ISSUE_TEMPLATE/feature_request.ymlconfig827 B
.github/agent/implement.mdmarkdown1.7 KB
.github/agent/review.mdmarkdown1.1 KB
.github/agent/triage.mdmarkdown2.7 KB
.github/labels.jsonconfig2.5 KB
.github/pull_request_template.mdmarkdown432 B
.github/release.ymlconfig345 B
.github/scripts/apply_triage.pyscript6.6 KB
.github/scripts/dump_issue.shscript509 B
.github/scripts/intake_feedback.pyscript4.0 KB
.github/scripts/open_agent_pr.shscript3.7 KB
.github/workflows/agent-implement.ymlconfig4.4 KB
.github/workflows/agent-review.ymlconfig2.8 KB
.github/workflows/agent-triage.ymlconfig4.6 KB
.github/workflows/claude.ymlconfig2.9 KB
.github/workflows/feedback-intake.ymlconfig2.0 KB
.github/workflows/release-label.ymlconfig1.2 KB
.github/workflows/release.ymlconfig3.5 KB
.github/workflows/sync-labels.ymlconfig798 B
.github/workflows/validate.ymlconfig1.3 KB
.gitignoreother169 B
CLAUDE.mdmarkdown1.6 KB
LICENSEother1.0 KB
README.mdmarkdown31.5 KB
README_EN.mdmarkdown33.9 KB
README_KO.mdmarkdown37.0 KB
SKILL.mdskill md22.4 KB
VERSIONother7 B
agents/openai.yamlconfig467 B
assets/banner-en.jpgbinary417.7 KB
assets/banner-ko.jpgbinary417.9 KB
assets/banner-zh.jpgbinary434.0 KB
assets/native-subtitle-quote-image-icon.pngbinary275.1 KB
docs/agent-workflow.mdmarkdown8.2 KB
examples/README.mdmarkdown6.0 KB
examples/gallery-manifest.jsonconfig7.6 KB
examples/gallery/en/darby-saxbe-shared-care.jpgbinary313.5 KB
examples/gallery/en/mikayla-johnson-define-outcome.jpgbinary294.4 KB
examples/gallery/en/rick-rubin-be-yourself.jpgbinary355.4 KB
examples/gallery/ko/codie-sanchez-321-speaking.jpgbinary331.9 KB
examples/gallery/ko/inaya-mcmillan-money-program.jpgbinary391.2 KB
examples/gallery/ko/masud-husain-starting-hill.jpgbinary266.2 KB
examples/gallery/zh/chen-shu-simple-life.jpgbinary328.2 KB
examples/gallery/zh/girls-on-the-bus-native.jpgbinary163.5 KB
examples/gallery/zh/rick-rubin-creative-clouds.jpgbinary339.9 KB
examples/scripts/en/darby-saxbe-shared-care.jsonconfig436 B
examples/scripts/en/mikayla-johnson-define-outcome.jsonconfig419 B
examples/scripts/en/rick-rubin-be-yourself.jsonconfig426 B
examples/scripts/ko/codie-sanchez-321-speaking.jsonconfig462 B
examples/scripts/ko/inaya-mcmillan-money-program.jsonconfig491 B
examples/scripts/ko/masud-husain-starting-hill.jsonconfig496 B
examples/scripts/zh/chen-shu-simple-life.jsonconfig747 B
examples/scripts/zh/girls-on-the-bus-native.jsonconfig1.0 KB
examples/scripts/zh/rick-rubin-creative-clouds.jsonconfig404 B
references/end-to-end-workflow.mdmarkdown17.2 KB
references/troubleshooting.mdmarkdown5.7 KB
references/visual-style.mdmarkdown10.2 KB
references/yt-dlp-and-transcripts.mdmarkdown14.0 KB
requirements.txtmanifest33 B
scripts/bump_version.pyscript2.7 KB
scripts/check_environment.pyscript8.9 KB
scripts/check_update.pyscript8.0 KB
scripts/native_subtitle_stitch.pyscript59.1 KB
scripts/render_banners.pyscript7.4 KB
scripts/submit_feedback.pyscript2.6 KB
scripts/validate_repo.pyscript9.0 KB
tests/test_agent_workflow.pyscript8.9 KB
tests/test_check_update.pyscript5.0 KB
tests/test_native_subtitle_stitch.pyscript63.2 KB
tests/test_render_banners.pyscript2.6 KB
tests/test_text_encoding.pyscript3.2 KB

scripts/check_environment.py

View on GitHub
#!/usr/bin/env python3
"""检查视频字幕拼图的原生、脚本与 URL 模式所需组件,不执行安装。"""

import argparse
import importlib
import importlib.util
import json
import locale
import shutil
import subprocess
import sys
from pathlib import Path


CJK_FONT_CANDIDATES = [
    "/System/Library/Fonts/PingFang.ttc",
    "/System/Library/Fonts/STHeiti Medium.ttc",
    "/System/Library/Fonts/Hiragino Sans GB.ttc",
    "C:/Windows/Fonts/msyh.ttc",
    "C:/Windows/Fonts/simhei.ttf",
    "/System/Library/Fonts/AppleSDGothicNeo.ttc",
    "C:/Windows/Fonts/malgun.ttf",
    "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
    "/usr/share/fonts/opentype/noto/NotoSansCJKsc-Regular.otf",
    "/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
]


def command_version(command, args=("--version",)):
    path = shutil.which(command)
    if not path:
        return None, None
    try:
        proc = subprocess.run(
            [path, *args],
            capture_output=True,
            encoding="utf-8",
            errors="replace",
            timeout=10,
            check=False,
        )
    except (OSError, subprocess.SubprocessError):
        return path, "无法读取版本"
    output = (proc.stdout or proc.stderr or "").strip().splitlines()
    return path, output[0] if output else "版本未知"


def module_version(name):
    if importlib.util.find_spec(name) is None:
        return None
    module = importlib.import_module(name)
    return getattr(module, "__version__", "已安装")


def add(rows, component, status, purpose, detail="", required="core"):
    rows.append(
        {
            "component": component,
            "status": status,
            "purpose": purpose,
            "detail": detail,
            "required": required,
        }
    )


def utf8_default():
    if sys.flags.utf8_mode:
        return True
    return locale.getpreferredencoding(False).lower().replace("-", "") == "utf8"


def inspect_environment():
    rows = []
    python_ok = sys.version_info >= (3, 10)
    add(
        rows,
        "Python 3.10+",
        "ok" if python_ok else "missing",
        "运行 Skill 脚本",
        sys.version.split()[0],
    )

    if not utf8_default():
        add(
            rows,
            "UTF-8 encoding",
            "optional",
            "文本读写:默认编码非 UTF-8 时中文路径与输出可能乱码",
            f"当前默认编码 {locale.getpreferredencoding(False)};"
            "建议设置 PYTHONUTF8=1(cmd: set PYTHONUTF8=1)",
            required="optional",
        )

    pillow = module_version("PIL")
    add(
        rows,
        "Pillow",
        "ok" if pillow else "missing",
        "裁图、拼图、导出 JPG",
        str(pillow or "未安装"),
    )

    ffmpeg_detail = ""
    imageio = module_version("imageio_ffmpeg")
    if imageio:
        try:
            imageio_module = importlib.import_module("imageio_ffmpeg")
            ffmpeg_detail = f"imageio-ffmpeg {imageio}: {imageio_module.get_ffmpeg_exe()}"
        except Exception as exc:  # pragma: no cover - platform-specific failure
            ffmpeg_detail = f"imageio-ffmpeg 已安装但不可用: {exc}"
            imageio = None
    system_ffmpeg, ffmpeg_version = command_version("ffmpeg", ("-version",))
    ffmpeg_ok = bool(imageio or system_ffmpeg)
    if system_ffmpeg:
        system_detail = f"system: {system_ffmpeg} ({ffmpeg_version})"
        ffmpeg_detail = f"{ffmpeg_detail}; {system_detail}" if ffmpeg_detail else system_detail
    add(
        rows,
        "FFmpeg provider",
        "ok" if ffmpeg_ok else "missing",
        "读取视频并精确取帧",
        ffmpeg_detail or "请安装 imageio-ffmpeg 或 FFmpeg 可执行文件",
    )

    cjk_font = next(
        (candidate for candidate in CJK_FONT_CANDIDATES if Path(candidate).is_file()),
        None,
    )
    add(
        rows,
        "CJK font",
        "ok" if cjk_font else "missing",
        "脚本字幕模式:绘制中文、日文或韩文台词",
        cjk_font or "未找到常见 CJK 字体;可安装 Noto Sans CJK 或用 --font 指定",
        required="script",
    )

    ytdlp_path, ytdlp_version = command_version("yt-dlp")
    add(
        rows,
        "yt-dlp",
        "ok" if ytdlp_path else "missing",
        "URL 模式:读取元数据、字幕轨和下载视频",
        f"{ytdlp_version} ({ytdlp_path})" if ytdlp_path else "本地视频模式不需要",
        required="url",
    )

    runtimes = []
    for label, command in (
        ("Deno", "deno"),
        ("Node.js", "node"),
        ("QuickJS", "qjs"),
        ("Bun (deprecated)", "bun"),
    ):
        path, version = command_version(command)
        if path:
            runtimes.append((label, command, path, version))
    if runtimes:
        label, command, path, version = runtimes[0]
        if command == "deno":
            detail = f"{label} {version} ({path});yt-dlp 默认启用"
        elif command == "bun":
            detail = (
                f"{label} {version} ({path});调用 yt-dlp 时添加 "
                "--js-runtimes bun;官方已将 Bun 支持标记为弃用"
            )
        else:
            detail = (
                f"{label} {version} ({path});调用 yt-dlp 时添加 "
                f"--js-runtimes {command}"
            )
        add(
            rows,
            "JavaScript runtime",
            "ok",
            "URL 模式:完整解析 YouTube",
            detail,
            required="url",
        )
    else:
        add(
            rows,
            "JavaScript runtime",
            "missing",
            "URL 模式:完整解析 YouTube",
            "推荐 Deno;也可使用 Node.js 或 QuickJS;Bun 支持已弃用",
            required="url",
        )

    whisper_cli, whisper_version = command_version("whisper")
    whisper_module = module_version("faster_whisper") or module_version("whisper")
    whisper_ok = bool(whisper_cli or whisper_module)
    whisper_detail = "未安装;只有来源没有可用时间轴时才需要"
    if whisper_cli:
        whisper_detail = f"CLI {whisper_version} ({whisper_cli})"
    elif whisper_module:
        whisper_detail = f"Python module {whisper_module}"
    add(
        rows,
        "Whisper / speech-to-text",
        "optional" if not whisper_ok else "ok",
        "可选:没有字幕轨时生成带时间戳文字稿",
        whisper_detail,
        required="optional",
    )
    return rows


def is_blocking(row, url_mode, script_mode):
    if row["status"] != "missing":
        return False
    return (
        row["required"] == "core"
        or (url_mode and row["required"] == "url")
        or (script_mode and row["required"] == "script")
    )


def print_human(rows, url_mode, script_mode):
    labels = {"ok": "可用", "missing": "缺失", "optional": "可选"}
    widths = (26, 8, 38)
    print(f"{'组件':<{widths[0]}} {'状态':<{widths[1]}} 用途")
    print("-" * 92)
    for row in rows:
        print(
            f"{row['component']:<{widths[0]}} "
            f"{labels[row['status']]:<{widths[1]}} "
            f"{row['purpose']}"
        )
        if row["detail"]:
            print(f"  {row['detail']}")

    blocking = [row for row in rows if is_blocking(row, url_mode, script_mode)]
    source = "URL" if url_mode else "本地视频"
    subtitle = "脚本字幕" if script_mode else "原生字幕"
    mode = f"{source} + {subtitle}模式"
    if blocking:
        print(f"\n{mode}尚不可用,缺少: " + ", ".join(row["component"] for row in blocking))
    else:
        print(f"\n{mode}环境检查通过。")
    if url_mode:
        print(
            "提示:若 YouTube 返回登录或机器人验证,不要退回本地模式;"
            "先取得用户授权,再在该 URL 的 yt-dlp 命令中添加 "
            "--cookies-from-browser chrome。"
        )


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        "--url-mode",
        action="store_true",
        help="把 yt-dlp 和 JavaScript runtime 也作为必需组件检查",
    )
    parser.add_argument(
        "--script-mode",
        action="store_true",
        help="把绘制中文台词所需的 CJK 字体也作为必需组件检查",
    )
    parser.add_argument("--json", action="store_true", help="输出机器可读 JSON")
    args = parser.parse_args()

    rows = inspect_environment()
    blocking = [
        row
        for row in rows
        if is_blocking(row, args.url_mode, args.script_mode)
    ]
    if args.json:
        print(
            json.dumps(
                {
                    "mode": "url" if args.url_mode else "local",
                    "script_mode": args.script_mode,
                    "ok": not blocking,
                    "components": rows,
                },
                ensure_ascii=False,
                indent=2,
            )
        )
    else:
        print_human(rows, args.url_mode, args.script_mode)
    raise SystemExit(1 if blocking else 0)


if __name__ == "__main__":
    main()
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall